Skip to content

Commit

Permalink
refactoring useExtensionProvider
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita-Polyakov committed Mar 1, 2024
1 parent 15130fc commit 2ed6131
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/ethers-util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,22 +104,22 @@ function createWeb3Instance(provider: any) {
}

async function useExtensionProvider(provider: Provider): Promise<string> {
const injectedWindow = window as any;

let ethereumProvider!: any;

switch (provider) {
case Provider.Metamask:
ethereumProvider = await detectEthereumProvider({ mustBeMetaMask: true, timeout: 0 });
break;
case Provider.SubWallet:
ethereumProvider = (window as any).SubWallet;
ethereumProvider = injectedWindow.SubWallet;
break;
case Provider.TrustWallet:
ethereumProvider = (window as any).trustwallet;
ethereumProvider = injectedWindow.trustwallet;
break;
case Provider.Fearless:
console.log((window as any).fearlessWallet);
console.log((window as any).fearlessWallet.provider);
ethereumProvider = (window as any).fearlessWallet;
ethereumProvider = injectedWindow.fearlessWallet;
break;
default:
throw new Error('Unknown provider');
Expand Down

0 comments on commit 2ed6131

Please sign in to comment.