accountSubscribe
All the specifications for accountSubscribe Websocket Method on Solana
Subscribe to an account to receive notifications when the lamports or data for a given account public key changes.
Parameters required for this RPC call
the account address (pubkey), as base-58 encoded string
configuration object: This contains the following parameters, all are optional fields.
commitment: The commitment describes how finalized a block is at that point in time. Commitment levels processed, confirmed and finalized are supported, defaults to finalized.
encoding: Encoding format for Account data
base58
is slow.jsonParsed
encoding attempts to use program-specific state parsers to return more human-readable and explicit account state dataIf
jsonParsed
is requested but a parser cannot be found, the field falls back to binary encoding, detectable when thedata
field is typestring
.Supports:
base58
,base64
,base64+zstd
,jsonParsed
{
"jsonrpc": "2.0",
"id": 1,
"method": "accountSubscribe",
"params": [
"CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",
{
"encoding": "jsonParsed",
"commitment": "finalized"
}
]
}
{
"jsonrpc": "2.0",
"method": "accountNotification",
"params": {
"result": {
"context": {
"slot": 5199307
},
"value": {
"data": [
"11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR",
"base58"
],
"executable": false,
"lamports": 33594,
"owner": "11111111111111111111111111111111",
"rentEpoch": 635,
"space": 80
}
},
"subscription": 23784
}
}
Last updated
Was this helpful?