Solana
accountSubscribe10 créditos
Subscribes to notifications when an account's lamports or data change (WebSocket).
Parâmetros
| Nome | Tipo | Descrição |
|---|---|---|
| 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). (opcional) |
Retorno
Tipo
integer
Subscription id (integer). Pass it to accountUnsubscribe; notifications arrive as accountNotification messages.
Exemplos de código
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"}]}