-
Ethers Version6.0.8 Search TermsNo response Describe the ProblemVersions: I'm trying to make a static call, but i'm get an error run the code. Code Snippetconst MAX_UINT128: BigNumber = BigNumber.from(2).pow(128).sub(1);
collect
.staticCall({
tokenId: PtokenId,
recipient: _addressAccount,
amount0Max: MAX_UINT128,
amount1Max: MAX_UINT128,
}) Contract ABI"inputs": [
{
"components": [
{
"internalType": "uint256",
"name": "tokenId",
"type": "uint256"
},
{
"internalType": "address",
"name": "recipient",
"type": "address"
},
{
"internalType": "uint128",
"name": "amount0Max",
"type": "uint128"
},
{
"internalType": "uint128",
"name": "amount1Max",
"type": "uint128"
}
],
"internalType": "struct INonfungiblePositionManager.CollectParams",
"name": "params",
"type": "tuple"
}
],
"name": "collect",
"outputs": [
{ "internalType": "uint256", "name": "amount0", "type": "uint256" },
{ "internalType": "uint256", "name": "amount1", "type": "uint256" }
],
"stateMutability": "payable",
"type": "function" ErrorsTypeError: invalid BigNumberish value (argument="value", value={ "hex": "0xffffffffffffffffffffffffffffffff", "type": "BigNumber" }, code=INVALID_ARGUMENT, version=6.0.8)
at makeError (errors.ts:656:1)
at assert (errors.ts:680:1)
at assertArgument (errors.ts:692:1)
at getBigInt (maths.ts:113:1)
at NumberCoder.encode (number.ts:36:1)
at array.ts:64:1
at Array.forEach (<anonymous>)
at pack (array.ts:47:1)
at TupleCoder.encode (tuple.ts:62:1)
at array.ts:64:1 EnvironmentBrowser (Chrome, Safari, etc) Environment (Other)React |
Beta Was this translation helpful? Give feedback.
Answered by
ricmoo
Mar 5, 2023
Replies: 1 comment 4 replies
-
You cannot mix-and-match v5 and v6; it is a major version change and they are incompatible. There is no longer a BigNumber class and you should be using ES2020 BigInt in v6: |
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
Cazs03
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You cannot mix-and-match v5 and v6; it is a major version change and they are incompatible. There is no longer a BigNumber class and you should be using ES2020 BigInt in v6:
MAX_UINT128 = (2n ** 128n) - 1n