Solana
Solana
Solana
Das Free-Tier deckt persönliche Projekte ab. Pay-as-you-go skaliert ohne Karte.
accountSubscribe opens a Solana PubSub subscription that pushes a notification every time a single account changes — either its SOL balance (held in lamports, where 1 SOL = 1,000,000,000 lamports) or the raw data the owning program stores in it. You give it a base-58 pubkey and the node streams the new account state to you over a WebSocket connection, so you never have to re-poll getAccountInfo. The matching JSON-RPC endpoint is https://solana.therpc.io/YOUR_API_KEY, and you cancel the stream by passing the returned subscription id to accountUnsubscribe.
getAccountInfo.| # | Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|---|
| 1 | pubkey | string | Ja | Base-58 account address to watch. |
| 2 | config | object | Nein | Options: commitment, encoding (base58|base64|base64+zstd|jsonParsed). |
| Typ | Beschreibung |
|---|---|
| integer | A numeric subscription id. Notifications (accountNotification) carry this id; the value mirrors getAccountInfo. |
| Code | Meldung | Ursache |
|---|---|---|
-32602 | Invalid params | A param is missing, of the wrong type, or malformed (e.g. a non-base58 pubkey or a bad config field). |
-32603 | Internal error | The node hit an internal error serving the request — retry, and reduce the requested range/encoding if it persists. |
wss PubSub connection to subscribe; you cannot call it as a one-shot HTTP request the way you would getAccountInfo.accountUnsubscribe when you are done, so the node frees the subscription slot.base58 encoding option fails for account data larger than 128 bytes — set encoding to base64 (or jsonParsed for readable token state) when watching larger accounts.