Error parsing a blank address returned from a contract call
See original GitHub issueThe following contract call:
import {ethers, providers } from 'ethers';
const provider = new providers.JsonRpcProvider("https://mainnet.infura.io/v3/<id>")
// const provider = ethers.providers.getDefaultProvider('mainnet');
var privateKey = '0x00000000000000000000000000000000000000000000000000000000000000d0';
var wallet = new ethers.Wallet(privateKey,provider);
const contract = new ethers.Contract(
'0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe',
[
{
constant: true,
inputs: [
{
internalType: 'uint256',
name: 'tokenId',
type: 'uint256',
},
],
name: 'resolverOf',
outputs: [
{
internalType: 'address',
name: '',
type: 'address',
},
],
payable: false,
stateMutability: 'view',
type: 'function',
},
],
wallet,
)
contract.functions.resolverOf(
'0x2ef86569f09a06f60ae081125c0731d971403c89fb8202f2ca17f1f83f91df1c'
).then(console.log, console.log)
Returns the error:
Error: call revert exception (method="resolverOf(uint256)", errorSignature=null, errorArgs=[null], reason=null, code=CALL_EXCEPTION, version=abi/5.0.1)
at Logger.makeError (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/logger/lib/index.js:188:20)
at Interface.decodeFunctionResult (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/abi/lib/interface.js:287:23)
at Object.<anonymous> (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:300:56)
at step (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:46:23)
at Object.next (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:27:53)
at fulfilled (/Users/bogdan/.nvm/versions/node/v14.5.0/lib/node_modules/ethers/node_modules/@ethersproject/contracts/lib/index.js:18:58)
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
reason: null,
code: 'CALL_EXCEPTION',
method: 'resolverOf(uint256)',
errorSignature: null,
errorArgs: [ null ],
address: '0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe',
args: [
'0x2ef86569f09a06f60ae081125c0731d971403c89fb8202f2ca17f1f83f91df1c'
],
transaction: {
data: '0xb3f9e4cb2ef86569f09a06f60ae081125c0731d971403c89fb8202f2ca17f1f83f91df1c',
to: '0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe',
from: '0x379ff6375F4A44f458683629ef05141d73fAe55A'
}
}
The returned response from the eth_call
RPC is { jsonrpc: '2.0', id: 1, result: '0x' }
.
I am not sure how a result like this is generated.
It seems like this is a mapping value of mapping (something => address)
from non-existent key when returned directly from a function call.
See line 1081 in https://etherscan.io/address/0xD1E5b0FF1287aA9f9A268759062E4Ab08b9Dacbe#code
Should 0x
be decoded just like 0x0000000000000000000000000000000000000000
in this case without an error?
Issue Analytics
- State:
- Created 3 years ago
- Comments:15 (4 by maintainers)
Top Results From Across the Web
Contract methods calls return empty array
In console.log() i can see the actual contract address and methods. Metamask is active and web3.eth.defaultAccount shows me my correct account ...
Read more >Contract_ABI returned from API call has JSON interface error
Here are what I tried so far: Wrapping the result of the api into a JSON.Parse(), but the error is the same if...
Read more >Function Call - NEAR Protocol Specification
LinkError is returned when wasmer runtime is unable to link the wasm module with provided imports. MethodResolveError occurs when the method in ...
Read more >Understanding and resolving MetaMask error codes
When trying to connect to the wallet, if a user clicks “Cancel” at any point on this interface and terminates the process, it...
Read more >Hack the Contract | CosmWasm Documentation
Note that we use the type Addr , which is a validated address wrapper with some ... If expired, we return a generic...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
That response is definitely an error with respect to the ABI. The response
0x
should not be interpreted as any sort of address, not even the zero address.I’m on my iPhone right now, so just looking at the contract source and can’t run it right now.
I’ll have to look more into the contract later, but I don’t see any implementation for the 'resolverOf` in the source. Maybe it is a proxy that isn’t configured?
@bogdan Error with a
CALL_EXCEPTION
code is thrown when aneth_call
fails (regardless of require with message or not). For invalid parameters, anINVALID_ARGUMENT
error code is thrown. Is there any specific code example that you want to share?Edit: oh, just noticed your comment is an year old lol (I got here from a recent gh notification).