File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,15 @@ import {
66import { config } from "./config" ;
77import { getWallet } from "./wallet" ;
88
9- let hasEmitted = false ;
9+ const emittedEnvironments = new Set < string > ( ) ;
1010
1111export const EIP6963Emitter = ( environmentId : string ) => {
12- // Ensure we only emit once per app lifetime
13- if ( hasEmitted ) {
12+ // Ensure we only emit once per environment
13+ if ( emittedEnvironments . has ( environmentId ) ) {
1414 return ;
1515 }
1616
17- hasEmitted = true ;
17+ emittedEnvironments . add ( environmentId ) ;
1818
1919 // Get wallet instance with the proper environment ID
2020 const wallet = getWallet ( environmentId ) ;
Original file line number Diff line number Diff line change 55
66import { DYNAMIC_ENVIRONMENT_IDS } from "../constants" ;
77
8- let walletInstance : GlobalWalletClient | null = null ;
8+ const walletInstances = new Map < string , GlobalWalletClient > ( ) ;
99
1010/**
1111 * Get the wallet URL based on the environment ID
@@ -23,13 +23,14 @@ const getWalletUrl = (environmentId: string): string => {
2323 * Get or create the GlobalWalletClient instance with the specified environment ID
2424 */
2525export const getWallet = ( environmentId : string ) : GlobalWalletClient => {
26- if ( ! walletInstance ) {
27- walletInstance = createGlobalWalletClient ( {
26+ if ( ! walletInstances . has ( environmentId ) ) {
27+ const walletInstance = createGlobalWalletClient ( {
2828 environmentId,
2929 popup : {
3030 url : getWalletUrl ( environmentId ) ,
3131 } ,
3232 } ) ;
33+ walletInstances . set ( environmentId , walletInstance ) ;
3334 }
34- return walletInstance ;
35+ return walletInstances . get ( environmentId ) ! ;
3536} ;
You can’t perform that action at this time.
0 commit comments