I'm trying to use curl
to query an ink contract's storage using the RPC of substrate. I've looked at the below question
How do I call the RPC method `contractInfoOf` using curl?
but it does not specify how exactly to do this. I've got as far as
curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"state_getKeys", "id":2 }' localhost:9944
but this yields {"jsonrpc":"2.0","error":{"code":-32602,"message":"No more params"},"id":2}
. I know I need to supply further parameters to specify the contract address, but it is unclear how to do that.
Here's the contract storage in ink
#[derive(Default)]
#[ink(storage)]
pub struct MyContract<KEY: StorageKey = ManualKey<0xABCDEF01>> {
a: u8,
b: u8,
c: u8,
}
I've tried giving the contract storage a set key using curl -H 'Content-Type: application/json' --data '{ "jsonrpc":"2.0", "method":"state_getKeys", "id":2, "key":"0xABCDEF01" }' localhost:9944
with no avail, same error message.
The contract's address is 5F4N6ctYoDk1yqD4bSRh6eFottkfPWrxSPAcpq2m78sMoarJ
in my substrate-contracts-node instance, I assume I need that somewhere in the command to specify the contract.
Any ideas?