diff --git a/packages/snap/snap.manifest.json b/packages/snap/snap.manifest.json index 1d17d50..f5605a9 100644 --- a/packages/snap/snap.manifest.json +++ b/packages/snap/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/tenderly/tenderly-snap.git" }, "source": { - "shasum": "JNLIjh3TKVEi5tyOrY975mbE9GYvtA6ruLcmilpZvPc=", + "shasum": "kb5428TsWWeG9ZBWltgh9MEESOZFmNKzhi0GHDsKNAo=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snap/src/tenderly/utils.ts b/packages/snap/src/tenderly/utils.ts index fe09474..7e16bb3 100644 --- a/packages/snap/src/tenderly/utils.ts +++ b/packages/snap/src/tenderly/utils.ts @@ -120,16 +120,15 @@ export const isTenderlyDomain = (origin: string) => { * @throws {Error} If the input format is invalid, or processing fails. * @example * parseChainId("eip155:1") // returns "0x1" - * parseChainId("eip155:a86a") // returns "0xa86a" - * parseChainId("eip155:76adf1") // returns "0x76adf1" + * parseChainId("eip155:11155111") // returns "0xaa36a7" */ export const parseChainId = (chainId: string): string => { try { // Split the chainId string const [, reference] = chainId.split(':'); - // Append '0x' to the reference and return - return `0x${reference}`; + // Convert the reference from base 10 to hexadecimal and prefix with '0x' + return `0x${parseInt(reference, 10).toString(16)}`; } catch (error) { throw new Error( `An unexpected error occurred while parsing CAIP-2 chainId (${chainId}): ${error.message}`,