Solana
accountSubscribe10 额度
Subscribes to notifications when an account's lamports or data change (WebSocket).
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| pubkey | string | Account public key (base-58). |
| config | Object | Optional configuration object. commitment: processed | confirmed | finalized (default finalized); encoding: base58 | base64 | base64+zstd | binary | jsonParsed (default binary); dataSlice: { offset, length } (not with jsonParsed). (可选) |
返回值
类型
integer
Subscription id (integer). Pass it to accountUnsubscribe; notifications arrive as accountNotification messages.
代码示例
wscat -c wss://holy-burned-sky-solana-mainnet.rpcnode.dev/7c9e6679-7425-40de-944b-e07fc1f90ae7
> {"jsonrpc":"2.0","id":1,"method":"accountSubscribe","params":["CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12",{"encoding":"jsonParsed","commitment":"finalized"}]}