Skip to content

Commit

Permalink
chore: duplicate open connect window (#10536)
Browse files Browse the repository at this point in the history
  • Loading branch information
nuanyang233 committed Aug 21, 2023
1 parent 3eabdc2 commit 020a49e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/web3-providers/src/Web3/EVM/providers/MaskWallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { BaseContractWalletProvider } from './BaseContractWallet.js'
import { RequestReadonlyAPI } from '../apis/RequestReadonlyAPI.js'
import { SmartPayOwnerAPI } from '../../../SmartPay/apis/OwnerAPI.js'
import type { WalletAPI } from '../../../entry-types.js'
import { env } from '@masknet/flags'

export class MaskWalletProvider
extends BaseContractWalletProvider
Expand All @@ -36,6 +37,15 @@ export class MaskWalletProvider

private ref = new ValueRef<Wallet[]>(EMPTY_LIST)

private openPopupWindow: (route?: PopupRoutes, params?: Record<string, any>) => Promise<void> = async (...args) => {
await this.context?.openPopupWindow(...args)
}

private openSelectWalletWindow =
env.channel === 'stable' && process.env.NODE_ENV === 'production'
? this.openPopupWindow
: debounce(this.openPopupWindow, 1000)

constructor() {
super(ProviderType.MaskWallet)
}
Expand Down Expand Up @@ -184,7 +194,7 @@ export class MaskWalletProvider
}
}

await this.context?.openPopupWindow(this.wallets.length ? PopupRoutes.SelectWallet : PopupRoutes.Wallet, {
await this.openSelectWalletWindow?.(this.wallets.length ? PopupRoutes.SelectWallet : PopupRoutes.Wallet, {
chainId,
})

Expand Down

0 comments on commit 020a49e

Please sign in to comment.