Subscribe to notifications when an account's lamports or data change.
Source
$ curl https://api.devnet.solana.com -s -X \> POST -H "Content-Type: application/json" -d '> {> "jsonrpc": "2.0",> "id": 1,> "method": "accountSubscribe",> "params": [> "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",> {> "encoding": "jsonParsed",> "commitment": "finalized"> }> ]> }> '
params
string !requiredoptional
Account Pubkey, as base-58 encoded string
objectoptional
Optional configuration object.
result
Response
{"jsonrpc": "2.0","result": 23784,"id": 1}
number
Subscription id. Pass this to accountUnsubscribe.
Notification format
Notifications are delivered as accountNotification.
{"jsonrpc": "2.0","method": "accountNotification","params": {"result": {"context": {"slot": 559},"value": {"lamports": 1169280,"data": {"program": "sysvar","parsed": {"info": {"epoch": 0,"epochStartTimestamp": 1774643544,"leaderScheduleEpoch": 1,"slot": 559,"unixTimestamp": 1774643807},"type": "clock"},"space": 40},"owner": "Sysvar1111111111111111111111111111111111111","executable": false,"rentEpoch": 0,"space": 40}},"subscription": 10}}
jsonrpc
string
Always "2.0".
method
string
Always "accountNotification".
params
object
Notification wrapper with the updated account payload and the subscription id.
Is this page helpful?