Skip to main content

View State

view_state request type

This endpoint allows you to view the key-value state of a smart contract on the NEAR blockchain.

Network
Include ProofRequest body field
FastNear API keyNo saved key
Get API key
Endpointhttps://rpc.mainnet.fastnear.com
Finality

The latest block with full finality. Highest confidence, with the most confirmation lag.

Authnone detected
Live Response

Responses from the selected endpoint appear here after you run a request.

Live response output will appear here after you run a request.

Request reference

application/json

This operation accepts a JSON-RPC body over POST to /.

Required request inputs: yes

{
  "jsonrpc": "2.0",
  "id": "fastnear",
  "method": "query",
  "params": {
    "request_type": "view_state",
    "finality": "final",
    "account_id": "lockup.near",
    "prefix_base64": "U1RBVEU="
  }
}

Request schema

object
requires jsonrpc, id, method, params
jsonrpc *string
2.0
id *string

Example: fastnear

method *string
query
params *object
requires request_type, account_id, prefix_base64, finality
account_id *string

NEAR account ID

include_proofboolean
prefix_base64 *string

Base64-encoded storage key

request_type *string
view_state
finality *string

Block finality

finalnear-finaloptimistic

Response reference

200 application/json

Successful response

Response schema

objectJsonRpcResponse
requires jsonrpc, id
jsonrpc *string
2.0
id *one of
stringnumber
resultobject
requires values

Resulting state values for a view state query request

proofarray
itemsstring
values *array
itemsobject

Item of the state, key and value are serialized in base64 and proof for inclusion of given state item.

errorobject
codeinteger
messagestring
dataobject