state_subscribeStorage

Subscribes to storage changes for the provided keys

Example Request and Result for state_subscribeStorage method

In this section, we provide an illustrative example of a request made to retrieve details contents using the state_subscribeStorage method. Additionally, we present the resulting response containing information about subscribing to storage updates using WS subscription.

Parameters

FieldsTypeDescription

keys

array<string>

An array representing the key or keys for which you want to retrieve storage entries

The example in this section uses a non-existing project id.

Make sure you replace it with your Vara Mainnet endpoint when issuing the API calls.

Don't have a project id? Here's a straightforward guide on how to obtain one!

Subscribes to storage changes for the provided keys

POST wss://vara-mainnet.blastapi.io/<project-id>

Request Body

NameTypeDescription

keys

string

0x06de3d8a54d27e44a9d5ce189618f22d4e7b9012096b41c4eb3aaf947f6ea429

{
  "jsonrpc": "2.0",
  "method": "state_storage",
  "params": {
    "subscription": "vqYPtVpBCNCYcBfW",
    "result": {
      "block": "0xf9abde7611f53cbed95775b9561fc354597a897ed4efa6d2841787199c4bd974",
      "changes": [
        [
          "0x06de3d8a54d27e44a9d5ce189618f22d4e7b9012096b41c4eb3aaf947f6ea429",
          null
        ]
      ]
    }
  }
}

Curl Request example

wscat -c 'wss://vara-mainnet.blastapi.io/<project-id>' 
# wait for connection
messasge:
{
    "id": 1,
    "jsonrpc": "2.0",
    "method": "state_subscribeStorage",
    "params": {
        "keys":["0x06de3d8a54d27e44a9d5ce189618f22d4e7b9012096b41c4eb3aaf947f6ea429"]
    }
}

Last updated