Skip to content

Commit

Permalink
Announce the alephium provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Nov 18, 2024
1 parent 23a0e8e commit a8bb95d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ProviderSolana, registerSolanaWallet, WalletIcon } from '@onekeyfe/onek
// import { ProviderStarcoin } from '@onekeyfe/onekey-starcoin-provider';
import { ProviderAptos, ProviderAptosMartian } from '@onekeyfe/onekey-aptos-provider';
import { ProviderConflux } from '@onekeyfe/onekey-conflux-provider';
import { ProviderAlph } from '@onekeyfe/onekey-alph-provider';
import { ProviderAlph, registerAlephiumProvider } from '@onekeyfe/onekey-alph-provider';
import { ProviderTron } from '@onekeyfe/onekey-tron-provider';
import { ProviderCardano, defineWindowCardanoProperty } from '@onekeyfe/onekey-cardano-provider';
// import { ProviderPrivateExternalAccount } from '@onekeyfe/onekey-private-external-account-provider';
Expand Down Expand Up @@ -205,6 +205,7 @@ function injectWeb3Provider(): unknown {
defineWindowProperty('alephiumProviders', {
alephium,
});
registerAlephiumProvider(alephium);
defineWindowProperty('tronLink', tron);
defineWindowProperty('suiWallet', sui);
defineWindowProperty('onekeyTonWallet', {
Expand Down
1 change: 1 addition & 0 deletions packages/providers/onekey-alph-provider/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './OnekeyAlphProvider';
export * from './ProviderAlphBase';
export * from './registerAlephiumProvider'
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { ProviderAlph } from './OnekeyAlphProvider';

export function registerAlephiumProvider(provider: ProviderAlph) {
function announceProvider() {
window.dispatchEvent(
new CustomEvent('announceAlephiumProvider', {
detail: Object.freeze({ provider }),
}),
);
}
window.addEventListener('requestAlephiumProvider', announceProvider);
announceProvider();
}

0 comments on commit a8bb95d

Please sign in to comment.