Rootstock checksum is applied to all chains (#2616)

Fixes #2613
This commit is contained in:
tom goriunov
2025-03-11 19:47:51 +01:00
committed by GitHub
parent 479ab452b1
commit 89faf3b449
+8 -2
View File
@@ -2,12 +2,18 @@ import { getAddress } from 'viem';
import config from 'configs/app';
const ERC1191_CHAIN_IDS = [
'30', // RSK Mainnet
'31', // RSK Testnet
];
export default function getCheckedSummedAddress(address: string): string {
try {
return getAddress(
address,
// We need to pass chainId to getAddress to make it work correctly for some chains, e.g. Rootstock
config.chain.id ? Number(config.chain.id) : undefined,
// We need to pass chainId to getAddress to make it work correctly for chains that support ERC-1191
// https://eips.ethereum.org/EIPS/eip-1191#usage--table
ERC1191_CHAIN_IDS.includes(config.chain.id ?? '') ? Number(config.chain.id) : undefined,
);
} catch (error) {
return address;