Skip to content

Commit

Permalink
Merge pull request #45 from Web3Auth/fix/chain-methods
Browse files Browse the repository at this point in the history
fix init condition for sfa methods
  • Loading branch information
chaitanyapotti authored May 23, 2024
2 parents de10749 + 6c4d87b commit e5a3d0d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/react-app/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function shouldSupportPasskey(): { isBrowserSupported: boolean; isOsSuppo
firefox: ">=122",
},
Android: {
chrome: ">=121",
chrome: ">=108",
},
Windows: {
edge: ">=108",
Expand Down
6 changes: 3 additions & 3 deletions src/Web3Auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,17 +205,17 @@ class Web3Auth extends SafeEventEmitter implements IWeb3Auth {
}

async addChain(chainConfig: CustomChainConfig): Promise<void> {
if (this.status !== ADAPTER_STATUS.READY) throw WalletInitializationError.notReady("Please call init first.");
if (this.status === ADAPTER_STATUS.NOT_READY) throw WalletInitializationError.notReady("Please call init first.");
return this.privKeyProvider.addChain(chainConfig);
}

switchChain(params: { chainId: string }): Promise<void> {
if (this.status !== ADAPTER_STATUS.READY) throw WalletInitializationError.notReady("Please call init first.");
if (this.status === ADAPTER_STATUS.NOT_READY) throw WalletInitializationError.notReady("Please call init first.");
return this.privKeyProvider.switchChain(params);
}

async getPostboxKey(loginParams: LoginParams): Promise<string> {
if (this.status !== ADAPTER_STATUS.READY) throw WalletInitializationError.notReady("Please call init first.");
if (this.status === ADAPTER_STATUS.NOT_READY) throw WalletInitializationError.notReady("Please call init first.");
return this.getTorusKey(loginParams);
}

Expand Down

0 comments on commit e5a3d0d

Please sign in to comment.