Skip to content

Commit 8ff9427

Browse files
authored
feat(snaps-rpc-methods): Use BigInt to parse chain ids (#2781)
There are no size limits on Ethereum chain ids, so we should use BigInt to parse them.
1 parent 824fd4f commit 8ff9427

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/snaps-rpc-methods/src/permitted/experimentalProviderRequest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
type,
1717
} from '@metamask/superstruct';
1818
import {
19-
numberToHex,
19+
bigIntToHex,
2020
parseCaipChainId,
2121
type PendingJsonRpcResponse,
2222
type Json,
@@ -175,10 +175,10 @@ async function providerRequestImplementation(
175175
);
176176
}
177177

178-
const numericalChainId = parseInt(parsedChainId.reference, 10);
178+
const numericalChainId = BigInt(parsedChainId.reference);
179179

180180
const networkConfiguration = getNetworkConfigurationByChainId(
181-
numberToHex(numericalChainId),
181+
bigIntToHex(numericalChainId),
182182
);
183183

184184
if (!networkConfiguration) {

0 commit comments

Comments
 (0)