Skip to content

Commit

Permalink
fix: chainId
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1707 committed Jun 17, 2024
1 parent 431c1c4 commit 074ba34
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/background/controller/provider/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@ class ProviderController extends BaseController {
if (typeof chainId === 'number') {
chainId = intToHex(chainId).toLowerCase();
} else {
chainId = chainId.toLowerCase();
chainId = `0x${new BigNumber(chainId).toString(16).toLowerCase()}`;
}

const chain = findChain({
Expand Down Expand Up @@ -1127,13 +1127,16 @@ class ProviderController extends BaseController {
if (typeof chainId === 'number') {
chainId = intToHex(chainId).toLowerCase();
} else {
chainId = chainId.toLowerCase();
chainId = `0x${new BigNumber(chainId).toString(16).toLowerCase()}`;
}

const chain = findChain({ hex: chainId });

if (!chain) {
throw new Error('This chain is not supported by Rabby yet.');
throw ethErrors.provider.custom({
code: 4902,
message: `Unrecognized chain ID "${chainId}". Try adding the chain using wallet_switchEthereumChain first.`,
});
}

permissionService.updateConnectSite(
Expand Down

0 comments on commit 074ba34

Please sign in to comment.