Skip to content

Commit

Permalink
only register once
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaaash committed Oct 10, 2023
1 parent db62745 commit ae3cc26
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/wallets/solflare/src/metamask/detect.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { registerWallet } from '@wallet-standard/wallet';
import { SolflareMetaMaskWallet } from './wallet.js';

let registered = false;

function register() {
if (registered) return;
registerWallet(new SolflareMetaMaskWallet());
registered = true;
}

/** @internal */
export async function detectAndRegisterSolflareMetaMaskWallet(): Promise<void> {
const id = 'solflare-detect-metamask';
Expand Down Expand Up @@ -29,7 +37,7 @@ export async function detectAndRegisterSolflareMetaMaskWallet(): Promise<void> {
window.removeEventListener('message', onMessage);

if (!message.data.data.error) {
registerWallet(new SolflareMetaMaskWallet());
register();
}
} else {
postMessage();
Expand Down

0 comments on commit ae3cc26

Please sign in to comment.