I have some code that interacts with the Crypto Kitties smart contract. When it runs it gets the tokenID of a particular kitty. There’s a method in the smart contract called getKitty
that takes this tokenID and returns information about the token that I want. How would make this call with Infura?
Hello,
We have a topic like that on our blog https://blog.infura.io/ethereum-rpcs-methods/ (particularly Using eth_call section ). Additionally you can also check here the JSON-RPC method https://infura.io/docs/ethereum/json-rpc/eth-call
The payload would look like :
{“jsonrpc”:“2.0”,“id”:1,“method”:“eth_call”,“params”:[{“from”:“0x0000000000000000000000000000000000000000”,“data”:“0xe98b7f4d0000000000000000000000000000000000000000000000000000000000001a43”,“to”:“0x06012c8cf97bead5deae237070f9587f8e7a266d”},“latest”]}
instead of from you should use your address/smart contract and also make sure you use the projectID provided by infura …e.g: https://mainnet.infura.io/v3/YOUR-PROJECT-ID before the JSON payload.
Cheers!
1 Like