From 9d8915b390d5de094aaf6997cb22a14b433d8801 Mon Sep 17 00:00:00 2001 From: Frederik Bolding Date: Mon, 9 Dec 2024 14:03:00 +0100 Subject: [PATCH] fix: Use BigInt for insight chain IDs (#2935) Use `BigInt` for insight chain IDs since Ethereum chain IDs have no sizing limits. --- .../snaps-controllers/src/insights/SnapInsightsController.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/snaps-controllers/src/insights/SnapInsightsController.ts b/packages/snaps-controllers/src/insights/SnapInsightsController.ts index 0354c95047..55b2f471c8 100644 --- a/packages/snaps-controllers/src/insights/SnapInsightsController.ts +++ b/packages/snaps-controllers/src/insights/SnapInsightsController.ts @@ -16,7 +16,7 @@ import { } from '@metamask/snaps-rpc-methods'; import type { Json, SnapId } from '@metamask/snaps-sdk'; import { HandlerType } from '@metamask/snaps-utils'; -import { hasProperty } from '@metamask/utils'; +import { hasProperty, hexToBigInt } from '@metamask/utils'; import type { DeleteInterface } from '../interface'; import type { GetAllSnaps, HandleSnapRequest } from '../snaps'; @@ -170,7 +170,7 @@ export class SnapInsightsController extends BaseController< const { id, txParams, chainId, origin } = transaction; // This assumes that the transactions are EVM-compatible for now. - const caipChainId = `eip155:${parseInt(chainId, 16)}`; + const caipChainId = `eip155:${hexToBigInt(chainId).toString(10)}`; const snaps = this.#getSnapsWithPermission( SnapEndowments.TransactionInsight,