Skip to content

Commit

Permalink
we can't check if metamask or coinbase has chain added already. So, w…
Browse files Browse the repository at this point in the history
…e always add chain first
  • Loading branch information
chaitanyapotti committed Mar 24, 2023
1 parent 35f4fb9 commit 12d4af2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/adapters/coinbase-adapter/src/coinbaseAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class CoinbaseAdapter extends BaseEvmAdapter<void> {
await this.coinbaseProvider.request({ method: "eth_requestAccounts" });
const { chainId } = this.coinbaseProvider;
if (chainId !== (this.chainConfig as CustomChainConfig).chainId) {
if (!this.getChainConfig(this.chainConfig.chainId)) await this.addChain(this.chainConfig as CustomChainConfig);
await this.addChain(this.chainConfig as CustomChainConfig);
await this.switchChain(this.chainConfig as CustomChainConfig, true);
}
this.status = ADAPTER_STATUS.CONNECTED;
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/metamask-adapter/src/metamaskAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class MetamaskAdapter extends BaseEvmAdapter<void> {
await this.metamaskProvider.request({ method: "eth_requestAccounts" });
const { chainId } = this.metamaskProvider;
if (chainId !== (this.chainConfig as CustomChainConfig).chainId) {
if (!this.getChainConfig((this.chainConfig as CustomChainConfig).chainId)) await this.addChain(this.chainConfig as CustomChainConfig, true);
await this.addChain(this.chainConfig as CustomChainConfig, true);
await this.switchChain(this.chainConfig as CustomChainConfig, true);
}
this.status = ADAPTER_STATUS.CONNECTED;
Expand Down

0 comments on commit 12d4af2

Please sign in to comment.