Skip to content

Commit

Permalink
chore(release): 2.13.1 [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
toolsvenus authored and therealemjy committed Sep 1, 2023
1 parent 9c6bf63 commit 062b864
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/clients/web3/Web3Wrapper/binanceWalletConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const mappingNetwork: Record<number, string> = {
97: 'bsc-testnet',
};

// eslint-disable-next-line
const _binanceChainListener = async () =>
const binanceChainListener = async () =>
new Promise<void>(resolve =>
Object.defineProperty(window, 'BinanceChain', {
get() {
Expand Down Expand Up @@ -95,16 +94,17 @@ export class BinanceWalletConnector extends InjectedConnector {
}

async getProvider() {
if (typeof window === 'undefined') {
return this.provider;
}

if (window.BinanceChain) {
this.provider = window.BinanceChain;
} else {
await _binanceChainListener();
this.provider = window.BinanceChain;
if (typeof window !== 'undefined') {
// TODO: Fallback to `ethereum#initialized` event for async injection
// https://github.com/MetaMask/detect-provider#synchronous-and-asynchronous-injection=
if (window.BinanceChain) {
this.provider = window.BinanceChain;
} else {
await binanceChainListener();
this.provider = window.BinanceChain;
}
}
return this.provider;
}

async switchChain(chainId: number): Promise<Chain> {
Expand Down

0 comments on commit 062b864

Please sign in to comment.