Returns the state (key value pairs) of a contract based on the key prefix (base64 encoded). Pass an empty string for prefix_base64 if you would like to return the entire state. Please note that the returned state will be base64 encoded as well.
prefix_base64
method: query
query
params:
request_type: view_state
request_type
view_state
finality OR block_id
finality
block_id
account_id: "guest-book.testnet",
account_id
"guest-book.testnet"
prefix_base64: ""
""
// Request curl https://near.blockpi.network/v1/rpc/your-rpc-key -X POST -H "Content-Type: application/json" --data '{ "jsonrpc": "2.0", "id": "dontcare", "method": "query", "params": { "request_type": "view_state", "finality": "final", "account_id": "guest-book.testnet", "prefix_base64": "" } }' // Result { "jsonrpc": "2.0", "result": { "values": [ { "key": "bTo6MA==", "value": "eyJwcmVtaXVtIjp0cnVlLCJzZW5kZXIiOiJqb3NoZm9yZC50ZXN0bmV0IiwidGV4dCI6ImhlbGxvIn0=", "proof": [] }, { "key": "bTo6MQ==", "value": "eyJwcmVtaXVtIjpmYWxzZSwic2VuZGVyIjoiY2hhZG9oIiwidGV4dCI6ImhlbGxvIGVyeWJvZHkifQ==", "proof": [] }, ......
Last updated 4 months ago