const domainSeparator = {
chainId: 5
};
const TestInfo = [
{ name: 'contractAddress', type: 'address' },
{ name: 'fee', type: 'uint256' }
];
const data = {
contractAddress: '.....',
airdropFee: 52009946125155410 // wei value
};
const signature = await signer._signTypedData(domainSeparator, { TestInfo }, data);原因:‘溢出’,代码:‘数字_故障’,错误:‘溢出’,操作:'BigNumber.from',值: 52009946125155410
solidity将weth的uint256魏值作为参数,因此我将发送该数字,但会得到溢出错误。我该怎么解决这个问题?
发布于 2022-04-30 08:59:31
您的值52009946125155410高于JavaScript:9007199254740991中安全表示为Number类型的最大整数,因此ethers.js抛出一个错误。
只需将其作为字符串传递:
airdropFee: "52009946125155410" // wei value应该没问题的。
https://ethereum.stackexchange.com/questions/127222
复制相似问题