From 5e9f064a82a394be6afbba3719d94260a3987dfe Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:38:30 -0500 Subject: [PATCH 01/28] feat: added api page --- docs/src/pages/api.js | 82 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 docs/src/pages/api.js diff --git a/docs/src/pages/api.js b/docs/src/pages/api.js new file mode 100644 index 00000000000000..6252d21df5027e --- /dev/null +++ b/docs/src/pages/api.js @@ -0,0 +1,82 @@ +import React from "react"; +import Link from "@docusaurus/Link"; +import styles from "./styles.module.css"; +import Card from "../../components/Card"; +import CardLayout from "../../layouts/CardLayout"; + +function APIPage() { + return ( + +
+
+
+

JSON RPC API

+ +
+

+ Interact with Solana nodes directly with the JSON RPC API via + the HTTP and Websocket methods. +

+ + + Explore the API + +
+
+ +
+

Explore the JSON RPC Methods

+ +
+ + + + + +
+
+
+
+
+ ); +} + +export default APIPage; From 5814b5338f69d1805bba7820e9e96e9ab55627ce Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:39:03 -0500 Subject: [PATCH 02/28] fix: api redirects --- docs/publish-docs.sh | 3 ++- docs/src/pages/developers.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/publish-docs.sh b/docs/publish-docs.sh index 898fd415f59f86..366673467b5be1 100755 --- a/docs/publish-docs.sh +++ b/docs/publish-docs.sh @@ -38,7 +38,8 @@ cat > "$CONFIG_FILE" < Date: Wed, 18 Jan 2023 18:41:16 -0500 Subject: [PATCH 03/28] feat: websocket page and partials --- docs/src/api/websocket.md | 91 +++++ docs/src/api/websocket/_accountSubscribe.mdx | 159 ++++++++ .../src/api/websocket/_accountUnsubscribe.mdx | 53 +++ docs/src/api/websocket/_blockSubscribe.mdx | 340 ++++++++++++++++++ docs/src/api/websocket/_blockUnsubscribe.mdx | 53 +++ docs/src/api/websocket/_logsSubscribe.mdx | 129 +++++++ docs/src/api/websocket/_logsUnsubscribe.mdx | 53 +++ docs/src/api/websocket/_programSubscribe.mdx | 201 +++++++++++ .../src/api/websocket/_programUnsubscribe.mdx | 53 +++ docs/src/api/websocket/_rootSubscribe.mdx | 62 ++++ docs/src/api/websocket/_rootUnsubscribe.mdx | 53 +++ .../src/api/websocket/_signatureSubscribe.mdx | 97 +++++ .../api/websocket/_signatureUnsubscribe.mdx | 53 +++ docs/src/api/websocket/_slotSubscribe.mdx | 72 ++++ docs/src/api/websocket/_slotUnsubscribe.mdx | 53 +++ .../api/websocket/_slotsUpdatesSubscribe.mdx | 86 +++++ .../websocket/_slotsUpdatesUnsubscribe.mdx | 53 +++ docs/src/api/websocket/_voteSubscribe.mdx | 79 ++++ docs/src/api/websocket/_voteUnsubscribe.mdx | 53 +++ 19 files changed, 1793 insertions(+) create mode 100644 docs/src/api/websocket.md create mode 100644 docs/src/api/websocket/_accountSubscribe.mdx create mode 100644 docs/src/api/websocket/_accountUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_blockSubscribe.mdx create mode 100644 docs/src/api/websocket/_blockUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_logsSubscribe.mdx create mode 100644 docs/src/api/websocket/_logsUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_programSubscribe.mdx create mode 100644 docs/src/api/websocket/_programUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_rootSubscribe.mdx create mode 100644 docs/src/api/websocket/_rootUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_signatureSubscribe.mdx create mode 100644 docs/src/api/websocket/_signatureUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_slotSubscribe.mdx create mode 100644 docs/src/api/websocket/_slotUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_slotsUpdatesSubscribe.mdx create mode 100644 docs/src/api/websocket/_slotsUpdatesUnsubscribe.mdx create mode 100644 docs/src/api/websocket/_voteSubscribe.mdx create mode 100644 docs/src/api/websocket/_voteUnsubscribe.mdx diff --git a/docs/src/api/websocket.md b/docs/src/api/websocket.md new file mode 100644 index 00000000000000..06b51d051ce9d1 --- /dev/null +++ b/docs/src/api/websocket.md @@ -0,0 +1,91 @@ +--- +title: RPC Websocket API +displayed_sidebar: apiWebsocketMethodsSidebar +hide_table_of_contents: true +--- + +After connecting to the RPC PubSub websocket at `ws://
/`: + +- Submit subscription requests to the websocket using the methods below +- Multiple subscriptions may be active at once +- Many subscriptions take the optional [`commitment` parameter](/api#configuring-state-commitment), defining how finalized a change should be to trigger a notification. For subscriptions, if commitment is unspecified, the default value is `finalized`. + +## RPC PubSub WebSocket Endpoint + +**Default port:** 8900 e.g. ws://localhost:8900, [http://192.168.1.88:8900](http://192.168.1.88:8900) + +## Methods + +The following methods are supported in the RPC Websocket API: + +import AccountSubscribe from "./websocket/\_accountSubscribe.mdx" + + + +import AccountUnsubscribe from "./websocket/\_accountUnsubscribe.mdx" + + + +import BlockSubscribe from "./websocket/\_blockSubscribe.mdx" + + + +import BlockUnsubscribe from "./websocket/\_blockUnsubscribe.mdx" + + + +import LogsSubscribe from "./websocket/\_logsSubscribe.mdx" + + + +import LogsUnsubscribe from "./websocket/\_logsUnsubscribe.mdx" + + + +import ProgramSubscribe from "./websocket/\_programSubscribe.mdx" + + + +import ProgramUnsubscribe from "./websocket/\_programUnsubscribe.mdx" + + + +import SignatureSubscribe from "./websocket/\_signatureSubscribe.mdx" + + + +import SignatureUnsubscribe from "./websocket/\_signatureUnsubscribe.mdx" + + + +import SlotSubscribe from "./websocket/\_slotSubscribe.mdx" + + + +import SlotUnsubscribe from "./websocket/\_slotUnsubscribe.mdx" + + + +import SlotsUpdatesSubscribe from "./websocket/\_slotsUpdatesSubscribe.mdx" + + + +import SlotsUpdatesUnsubscribe from "./websocket/\_slotsUpdatesUnsubscribe.mdx" + + + +import RootSubscribe from "./websocket/\_rootSubscribe.mdx" + + + +import RootUnsubscribe from "./websocket/\_rootUnsubscribe.mdx" + + + +import VoteSubscribe from "./websocket/\_voteSubscribe.mdx" + + + +import VoteUnsubscribe from "./websocket/\_voteUnsubscribe.mdx" + + diff --git a/docs/src/api/websocket/_accountSubscribe.mdx b/docs/src/api/websocket/_accountSubscribe.mdx new file mode 100644 index 00000000000000..b26d432bf490e0 --- /dev/null +++ b/docs/src/api/websocket/_accountSubscribe.mdx @@ -0,0 +1,159 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## accountSubscribe + +Subscribe to an account to receive notifications when the lamports or data for a given account public key changes + + + + +### Parameters: + + + Account Pubkey, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +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 data +- If `jsonParsed` is requested but a parser cannot be found, the field falls back to + binary encoding, detectable when the `data`field is type`string`. + +
+ +
+ +
+ +### Result: + +`` - Subscription id \(needed to unsubscribe\) + +
+ + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "accountSubscribe", + "params": [ + "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12", + { + "encoding": "jsonParsed", + "commitment": "finalized" + } + ] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 23784, "id": 1 } +``` + + +
+ +#### Notification Format: + +The notification format is the same as seen in the [getAccountInfo](#getAccountInfo) RPC HTTP method. + +Base58 encoding: + +```json +{ + "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 + } +} +``` + +Parsed-JSON encoding: + +```json +{ + "jsonrpc": "2.0", + "method": "accountNotification", + "params": { + "result": { + "context": { + "slot": 5199307 + }, + "value": { + "data": { + "program": "nonce", + "parsed": { + "type": "initialized", + "info": { + "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX", + "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k", + "feeCalculator": { + "lamportsPerSignature": 5000 + } + } + } + }, + "executable": false, + "lamports": 33594, + "owner": "11111111111111111111111111111111", + "rentEpoch": 635, + "space": 80 + } + }, + "subscription": 23784 + } +} +``` + +
diff --git a/docs/src/api/websocket/_accountUnsubscribe.mdx b/docs/src/api/websocket/_accountUnsubscribe.mdx new file mode 100644 index 00000000000000..d3a90de9ab9132 --- /dev/null +++ b/docs/src/api/websocket/_accountUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## accountUnsubscribe + +Unsubscribe from account change notifications + + + + +### Parameters: + + + id of the account Subscription to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "accountUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_blockSubscribe.mdx b/docs/src/api/websocket/_blockSubscribe.mdx new file mode 100644 index 00000000000000..fb5a89ce78ea61 --- /dev/null +++ b/docs/src/api/websocket/_blockSubscribe.mdx @@ -0,0 +1,340 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## blockSubscribe + +Subscribe to receive notification anytime a new block is Confirmed or Finalized. + +:::caution +This subscription is **unstable** and only available if the validator was started +with the `--rpc-pubsub-enable-block-subscription` flag. + +**NOTE: The format of this subscription may change in the future** +::: + + + + +### Parameters: + + +filter criteria for the logs to receive results by account type; currently supported: + + + all - include all transactions in block + + + + +A JSON object with the following field: + +- `mentionsAccountOrProgram: ` - return only transactions that mention the provided public key (as base-58 encoded string). If no mentions in a given block, then no notification will be sent. + + + + + + +Configuration object containing the following fields: + + + + + level of transaction detail to return, either "full", "signatures", or "none". + + + + whether to populate the `rewards` array. + + + + +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 data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls back + to `base64` encoding, detectable when the `data` field is type `string`. + +
+ +
+ +
+ +### Result: + +`integer` - subscription id \(needed to unsubscribe\) + +
+ + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": "1", + "method": "blockSubscribe", + "params": ["all"] +} +``` + +```json +{ + "jsonrpc": "2.0", + "id": "1", + "method": "blockSubscribe", + "params": [ + { + "mentionsAccountOrProgram": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op" + }, + { + "commitment": "confirmed", + "encoding": "base64", + "showRewards": true, + "transactionDetails": "full" + } + ] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 0, "id": 1 } +``` + + +
+ +#### Notification Format: + +The notification will be an object with the following fields: + +- `slot: ` - The corresponding slot. +- `err: ` - Error if something went wrong publishing the notification otherwise null. +- `block: ` - A block object as seen in the [getBlock](/api#getblock) RPC HTTP method. + +```json +{ + "jsonrpc": "2.0", + "method": "blockNotification", + "params": { + "result": { + "context": { + "slot": 112301554 + }, + "value": { + "slot": 112301554, + "block": { + "previousBlockhash": "GJp125YAN4ufCSUvZJVdCyWQJ7RPWMmwxoyUQySydZA", + "blockhash": "6ojMHjctdqfB55JDpEpqfHnP96fiaHEcvzEQ2NNcxzHP", + "parentSlot": 112301553, + "transactions": [ + { + "transaction": [ + "OpltwoUvWxYi1P2U8vbIdE/aPntjYo5Aa0VQ2JJyeJE2g9Vvxk8dDGgFMruYfDu8/IfUWb0REppTe7IpAuuLRgIBAAkWnj4KHRpEWWW7gvO1c0BHy06wZi2g7/DLqpEtkRsThAXIdBbhXCLvltw50ZnjDx2hzw74NVn49kmpYj2VZHQJoeJoYJqaKcvuxCi/2i4yywedcVNDWkM84Iuw+cEn9/ROCrXY4qBFI9dveEERQ1c4kdU46xjxj9Vi+QXkb2Kx45QFVkG4Y7HHsoS6WNUiw2m4ffnMNnOVdF9tJht7oeuEfDMuUEaO7l9JeUxppCvrGk3CP45saO51gkwVYEgKzhpKjCx3rgsYxNR81fY4hnUQXSbbc2Y55FkwgRBpVvQK7/+clR4Gjhd3L4y+OtPl7QF93Akg1LaU9wRMs5nvfDFlggqI9PqJl+IvVWrNRdBbPS8LIIhcwbRTkSbqlJQWxYg3Bo2CTVbw7rt1ZubuHWWp0mD/UJpLXGm2JprWTePNULzHu67sfqaWF99LwmwjTyYEkqkRt1T0Je5VzHgJs0N5jY4iIU9K3lMqvrKOIn/2zEMZ+ol2gdgjshx+sphIyhw65F3J/Dbzk04LLkK+CULmN571Y+hFlXF2ke0BIuUG6AUF+4214Cu7FXnqo3rkxEHDZAk0lRrAJ8X/Z+iwuwI5cgbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpDLAp8axcEkaQkLDKRoWxqp8XLNZSKial7Rk+ELAVVKWoWLRXRZ+OIggu0OzMExvVLE5VHqy71FNHq4gGitkiKYNFWSLIE4qGfdFLZXy/6hwS+wq9ewjikCpd//C9BcCL7Wl0iQdUslxNVCBZHnCoPYih9JXvGefOb9WWnjGy14sG9j70+RSVx6BlkFELWwFvIlWR/tHn3EhHAuL0inS2pwX7ZQTAU6gDVaoqbR2EiJ47cKoPycBNvHLoKxoY9AZaBjPl6q8SKQJSFyFd9n44opAgI6zMTjYF/8Ok4VpXEESp3QaoUyTI9sOJ6oFP6f4dwnvQelgXS+AEfAsHsKXxGAIUDQENAgMEBQAGBwgIDg8IBJCER3QXl1AVDBADCQoOAAQLERITDAjb7ugh3gOuTy==", + "base64" + ], + "meta": { + "err": null, + "status": { + "Ok": null + }, + "fee": 5000, + "preBalances": [ + 1758510880, 2067120, 1566000, 1461600, 2039280, 2039280, + 1900080, 1865280, 0, 3680844220, 2039280 + ], + "postBalances": [ + 1758505880, 2067120, 1566000, 1461600, 2039280, 2039280, + 1900080, 1865280, 0, 3680844220, 2039280 + ], + "innerInstructions": [ + { + "index": 0, + "instructions": [ + { + "programIdIndex": 13, + "accounts": [1, 15, 3, 4, 2, 14], + "data": "21TeLgZXNbtHXVBzCaiRmH" + }, + { + "programIdIndex": 14, + "accounts": [3, 4, 1], + "data": "6qfC8ic7Aq99" + }, + { + "programIdIndex": 13, + "accounts": [1, 15, 3, 5, 2, 14], + "data": "21TeLgZXNbsn4QEpaSEr3q" + }, + { + "programIdIndex": 14, + "accounts": [3, 5, 1], + "data": "6LC7BYyxhFRh" + } + ] + }, + { + "index": 1, + "instructions": [ + { + "programIdIndex": 14, + "accounts": [4, 3, 0], + "data": "7aUiLHFjSVdZ" + }, + { + "programIdIndex": 19, + "accounts": [17, 18, 16, 9, 11, 12, 14], + "data": "8kvZyjATKQWYxaKR1qD53V" + }, + { + "programIdIndex": 14, + "accounts": [9, 11, 18], + "data": "6qfC8ic7Aq99" + } + ] + } + ], + "logMessages": [ + "Program QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB invoke [1]", + "Program QMWoBmAyJLAsA1Lh9ugMTw2gciTihncciphzdNzdZYV invoke [2]" + ], + "preTokenBalances": [ + { + "accountIndex": 4, + "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", + "uiTokenAmount": { + "uiAmount": null, + "decimals": 6, + "amount": "0", + "uiAmountString": "0" + }, + "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "accountIndex": 5, + "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", + "uiTokenAmount": { + "uiAmount": 11513.0679, + "decimals": 6, + "amount": "11513067900", + "uiAmountString": "11513.0679" + }, + "owner": "rXhAofQCT7NN9TUqigyEAUzV1uLL4boeD8CRkNBSkYk", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "accountIndex": 10, + "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", + "uiTokenAmount": { + "uiAmount": null, + "decimals": 6, + "amount": "0", + "uiAmountString": "0" + }, + "owner": "CL9wkGFT3SZRRNa9dgaovuRV7jrVVigBUZ6DjcgySsCU", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "accountIndex": 11, + "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", + "uiTokenAmount": { + "uiAmount": 15138.514093, + "decimals": 6, + "amount": "15138514093", + "uiAmountString": "15138.514093" + }, + "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + } + ], + "postTokenBalances": [ + { + "accountIndex": 4, + "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", + "uiTokenAmount": { + "uiAmount": null, + "decimals": 6, + "amount": "0", + "uiAmountString": "0" + }, + "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "accountIndex": 5, + "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", + "uiTokenAmount": { + "uiAmount": 11513.103028, + "decimals": 6, + "amount": "11513103028", + "uiAmountString": "11513.103028" + }, + "owner": "rXhAofQCT7NN9TUqigyEAUzV1uLL4boeD8CRkNBSkYk", + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "accountIndex": 10, + "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", + "uiTokenAmount": { + "uiAmount": null, + "decimals": 6, + "amount": "0", + "uiAmountString": "0" + }, + "owner": "CL9wkGFT3SZRRNa9dgaovuRV7jrVVigBUZ6DjcgySsCU", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + }, + { + "accountIndex": 11, + "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", + "uiTokenAmount": { + "uiAmount": 15489.767829, + "decimals": 6, + "amount": "15489767829", + "uiAmountString": "15489.767829" + }, + "owner": "BeiHVPRE8XeX3Y2xVNrSsTpAScH94nYySBVQ4HqgN9at", + "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" + } + ], + "rewards": [] + } + } + ], + "blockTime": 1639926816, + "blockHeight": 101210751 + }, + "err": null + } + }, + "subscription": 14 + } +} +``` + +
diff --git a/docs/src/api/websocket/_blockUnsubscribe.mdx b/docs/src/api/websocket/_blockUnsubscribe.mdx new file mode 100644 index 00000000000000..a16b73ca639aa4 --- /dev/null +++ b/docs/src/api/websocket/_blockUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## blockUnsubscribe + +Unsubscribe from block notifications + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "blockUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_logsSubscribe.mdx b/docs/src/api/websocket/_logsSubscribe.mdx new file mode 100644 index 00000000000000..2a285ced9a59a2 --- /dev/null +++ b/docs/src/api/websocket/_logsSubscribe.mdx @@ -0,0 +1,129 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## logsSubscribe + +Subscribe to transaction logging + + + + +### Parameters: + + + filter criteria for the logs to receive results by account type. The following filters types are currently supported: + + + +A string with one of the following values: + +- `all` - subscribe to all transactions except for simple vote transactions +- `allWithVotes` - subscribe to all transactions including simple vote transactions + + + + + +An object with the following field: + +- `mentions: [ ]` - array of Pubkeys (as base-58 encoded strings) to listen for being mentioned in any transaction + + + + + + +Configuration object containing the following fields: + + + + + +### Result: + +`` - Subscription id \(needed to unsubscribe\) + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "logsSubscribe", + "params": [ + { + "mentions": [ "11111111111111111111111111111111" ] + }, + { + "commitment": "finalized" + } + ] +} +{ + "jsonrpc": "2.0", + "id": 1, + "method": "logsSubscribe", + "params": [ "all" ] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 24040, "id": 1 } +``` + + + + +#### Notification Format: + +The notification will be an RpcResponse JSON object with value equal to: + +- `signature: ` - The transaction signature base58 encoded. +- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) +- `logs: ` - Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure) + +Example: + +```json +{ + "jsonrpc": "2.0", + "method": "logsNotification", + "params": { + "result": { + "context": { + "slot": 5208469 + }, + "value": { + "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", + "err": null, + "logs": [ + "SBF program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success" + ] + } + }, + "subscription": 24040 + } +} +``` + + diff --git a/docs/src/api/websocket/_logsUnsubscribe.mdx b/docs/src/api/websocket/_logsUnsubscribe.mdx new file mode 100644 index 00000000000000..6a75606eb02b06 --- /dev/null +++ b/docs/src/api/websocket/_logsUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## logsUnsubscribe + +Unsubscribe from transaction logging + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "logsUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_programSubscribe.mdx b/docs/src/api/websocket/_programSubscribe.mdx new file mode 100644 index 00000000000000..b79b7f979ce5f9 --- /dev/null +++ b/docs/src/api/websocket/_programSubscribe.mdx @@ -0,0 +1,201 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## programSubscribe + +Subscribe to a program to receive notifications when the lamports or data for an account owned by the given program changes + + + + +### Parameters: + + + +Pubkey of the `program_id`, as base-58 encoded string + + + + +Configuration object containing the following fields: + + + + + +filter results using various [filter objects](#filters); account must meet all +filter criteria to be included in results + + + + + +Encoding format for Account data + + + +
+ +- `base58` is slow. +- [`jsonParsed`](/api#parsed-responses">) encoding attempts to use program-specific + state parsers to return more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls + back to `base64` encoding, detectable when the `data` field is type `string`. + +
+ +
+ +
+ +### Result: + +`` - Subscription id \(needed to unsubscribe\) + +
+ + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "programSubscribe", + "params": [ + "11111111111111111111111111111111", + { + "encoding": "base64", + "commitment": "finalized" + } + ] +} +{ + "jsonrpc": "2.0", + "id": 1, + "method": "programSubscribe", + "params": [ + "11111111111111111111111111111111", + { + "encoding": "jsonParsed" + } + ] +} +{ + "jsonrpc": "2.0", + "id": 1, + "method": "programSubscribe", + "params": [ + "11111111111111111111111111111111", + { + "encoding": "base64", + "filters": [ + { + "dataSize": 80 + } + ] + } + ] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 24040, "id": 1 } +``` + + +
+ +#### Notification format + +The notification format is a single program account object as seen in the [getProgramAccounts](/api#getProgramAccounts) RPC HTTP method. + +Base58 encoding: + +```json +{ + "jsonrpc": "2.0", + "method": "programNotification", + "params": { + "result": { + "context": { + "slot": 5208469 + }, + "value": { + "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq", + "account": { + "data": [ + "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR", + "base58" + ], + "executable": false, + "lamports": 33594, + "owner": "11111111111111111111111111111111", + "rentEpoch": 636, + "space": 80 + } + } + }, + "subscription": 24040 + } +} +``` + +Parsed-JSON encoding: + +```json +{ + "jsonrpc": "2.0", + "method": "programNotification", + "params": { + "result": { + "context": { + "slot": 5208469 + }, + "value": { + "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq", + "account": { + "data": { + "program": "nonce", + "parsed": { + "type": "initialized", + "info": { + "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX", + "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k", + "feeCalculator": { + "lamportsPerSignature": 5000 + } + } + } + }, + "executable": false, + "lamports": 33594, + "owner": "11111111111111111111111111111111", + "rentEpoch": 636, + "space": 80 + } + } + }, + "subscription": 24040 + } +} +``` + +
diff --git a/docs/src/api/websocket/_programUnsubscribe.mdx b/docs/src/api/websocket/_programUnsubscribe.mdx new file mode 100644 index 00000000000000..b3decdcb9a50fe --- /dev/null +++ b/docs/src/api/websocket/_programUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## programUnsubscribe + +Unsubscribe from program-owned account change notifications + + + + +### Parameters: + + + id of account Subscription to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "programUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_rootSubscribe.mdx b/docs/src/api/websocket/_rootSubscribe.mdx new file mode 100644 index 00000000000000..98fd59407f023b --- /dev/null +++ b/docs/src/api/websocket/_rootSubscribe.mdx @@ -0,0 +1,62 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## rootSubscribe + +Subscribe to receive notification anytime a new root is set by the validator. + + + + +### Parameters: + +**None** + +### Result: + +`integer` - subscription id \(needed to unsubscribe\) + + + + + +### Code sample: + +```json +{ "jsonrpc": "2.0", "id": 1, "method": "rootSubscribe" } +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 0, "id": 1 } +``` + + + + +#### Notification Format: + +The result is the latest root slot number. + +```json +{ + "jsonrpc": "2.0", + "method": "rootNotification", + "params": { + "result": 42, + "subscription": 0 + } +} +``` + + diff --git a/docs/src/api/websocket/_rootUnsubscribe.mdx b/docs/src/api/websocket/_rootUnsubscribe.mdx new file mode 100644 index 00000000000000..8d4085f183678f --- /dev/null +++ b/docs/src/api/websocket/_rootUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## rootUnsubscribe + +Unsubscribe from root notifications + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "rootUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_signatureSubscribe.mdx b/docs/src/api/websocket/_signatureSubscribe.mdx new file mode 100644 index 00000000000000..8fe3117a8d327c --- /dev/null +++ b/docs/src/api/websocket/_signatureSubscribe.mdx @@ -0,0 +1,97 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## signatureSubscribe + +Subscribe to a transaction signature to receive notification when a given transaction is committed. On `signatureNotification` - the subscription is automatically cancelled. + + + + +### Parameters: + + + Transaction Signature, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +### Result: + +`` - subscription id (needed to unsubscribe) + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "signatureSubscribe", + "params": [ + "2EBVM6cB8vAAD93Ktr6Vd8p67XPbQzCJX47MpReuiCXJAtcjaxpvWpcg9Ege1Nr5Tk3a2GFrByT7WPBjdsTycY9b", + { + "commitment": "finalized" + } + ] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 0, "id": 1 } +``` + + + + +#### Notification Format: + +The notification will be an RpcResponse JSON object with value containing an object with: + +- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) + +Example: + +```json +{ + "jsonrpc": "2.0", + "method": "signatureNotification", + "params": { + "result": { + "context": { + "slot": 5207624 + }, + "value": { + "err": null + } + }, + "subscription": 24006 + } +} +``` + + diff --git a/docs/src/api/websocket/_signatureUnsubscribe.mdx b/docs/src/api/websocket/_signatureUnsubscribe.mdx new file mode 100644 index 00000000000000..880efed7c49fe7 --- /dev/null +++ b/docs/src/api/websocket/_signatureUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## signatureUnsubscribe + +Unsubscribe from signature confirmation notification + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "signatureUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_slotSubscribe.mdx b/docs/src/api/websocket/_slotSubscribe.mdx new file mode 100644 index 00000000000000..c746ff060e5b22 --- /dev/null +++ b/docs/src/api/websocket/_slotSubscribe.mdx @@ -0,0 +1,72 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## slotSubscribe + +Subscribe to receive notification anytime a slot is processed by the validator + + + + +### Parameters: + +**None** + +### Result: + +`` - Subscription id \(needed to unsubscribe\) + + + + + +### Code sample: + +```json +{ "jsonrpc": "2.0", "id": 1, "method": "slotSubscribe" } +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 0, "id": 1 } +``` + + + + +#### Notification Format: + +The notification will be an object with the following fields: + +- `parent: ` - The parent slot +- `root: ` - The current root slot +- `slot: ` - The newly set slot value + +Example: + +```json +{ + "jsonrpc": "2.0", + "method": "slotNotification", + "params": { + "result": { + "parent": 75, + "root": 44, + "slot": 76 + }, + "subscription": 0 + } +} +``` + + diff --git a/docs/src/api/websocket/_slotUnsubscribe.mdx b/docs/src/api/websocket/_slotUnsubscribe.mdx new file mode 100644 index 00000000000000..0ce506163c87ca --- /dev/null +++ b/docs/src/api/websocket/_slotUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## slotUnsubscribe + +Unsubscribe from slot notifications + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "slotUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_slotsUpdatesSubscribe.mdx b/docs/src/api/websocket/_slotsUpdatesSubscribe.mdx new file mode 100644 index 00000000000000..efb639b2034958 --- /dev/null +++ b/docs/src/api/websocket/_slotsUpdatesSubscribe.mdx @@ -0,0 +1,86 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## slotsUpdatesSubscribe + +Subscribe to receive a notification from the validator on a variety of updates +on every slot + +:::caution +This subscription is unstable + +**NOTE: the format of this subscription may change in the future and it may not always be supported** +::: + + + + +### Parameters: + +**None** + +### Result: + +`` - Subscription id (needed to unsubscribe) + + + + + +### Code sample: + +```json +{ "jsonrpc": "2.0", "id": 1, "method": "slotsUpdatesSubscribe" } +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 0, "id": 1 } +``` + + + + +#### Notification Format: + +The notification will be an object with the following fields: + +- `parent: ` - The parent slot +- `slot: ` - The newly updated slot +- `timestamp: ` - The Unix timestamp of the update +- `type: ` - The update type, one of: + - "firstShredReceived" + - "completed" + - "createdBank" + - "frozen" + - "dead" + - "optimisticConfirmation" + - "root" + +```bash +{ + "jsonrpc": "2.0", + "method": "slotsUpdatesNotification", + "params": { + "result": { + "parent": 75, + "slot": 76, + "timestamp": 1625081266243, + "type": "optimisticConfirmation" + }, + "subscription": 0 + } +} +``` + + diff --git a/docs/src/api/websocket/_slotsUpdatesUnsubscribe.mdx b/docs/src/api/websocket/_slotsUpdatesUnsubscribe.mdx new file mode 100644 index 00000000000000..8169e52118781b --- /dev/null +++ b/docs/src/api/websocket/_slotsUpdatesUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## slotsUpdatesUnsubscribe + +Unsubscribe from slot-update notifications + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "slotsUpdatesUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + diff --git a/docs/src/api/websocket/_voteSubscribe.mdx b/docs/src/api/websocket/_voteSubscribe.mdx new file mode 100644 index 00000000000000..4f6f9cc87be982 --- /dev/null +++ b/docs/src/api/websocket/_voteSubscribe.mdx @@ -0,0 +1,79 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## voteSubscribe + +Subscribe to receive notification anytime a new vote is observed in gossip. +These votes are pre-consensus therefore there is no guarantee these votes will +enter the ledger. + +:::caution +This subscription is unstable and only available if the validator was started +with the `--rpc-pubsub-enable-vote-subscription` flag. The format of this +subscription may change in the future +::: + + + + +### Parameters: + +**None** + +### Result: + +`` - subscription id (needed to unsubscribe) + + + + + +### Code sample: + +```json +{ "jsonrpc": "2.0", "id": 1, "method": "voteSubscribe" } +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 0, "id": 1 } +``` + + + + +#### Notification Format: + +The notification will be an object with the following fields: + +- `hash: ` - The vote hash +- `slots: ` - The slots covered by the vote, as an array of u64 integers +- `timestamp: ` - The timestamp of the vote +- `signature: ` - The signature of the transaction that contained this vote + +```json +{ + "jsonrpc": "2.0", + "method": "voteNotification", + "params": { + "result": { + "hash": "8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM", + "slots": [1, 2], + "timestamp": null + }, + "subscription": 0 + } +} +``` + + diff --git a/docs/src/api/websocket/_voteUnsubscribe.mdx b/docs/src/api/websocket/_voteUnsubscribe.mdx new file mode 100644 index 00000000000000..db37b4205479a1 --- /dev/null +++ b/docs/src/api/websocket/_voteUnsubscribe.mdx @@ -0,0 +1,53 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## voteUnsubscribe + +Unsubscribe from vote notifications + + + + +### Parameters: + + + subscription id to cancel + + +### Result: + +`` - unsubscribe success message + + + + + +### Code sample: + +```json +{ + "jsonrpc": "2.0", + "id": 1, + "method": "voteUnsubscribe", + "params": [0] +} +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": true, "id": 1 } +``` + + + + From edba51ee65744526f71a368c72e4c8b9aa020edf Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:41:50 -0500 Subject: [PATCH 04/28] feat: deprectated partials --- .../api/deprecated/_getConfirmedBlocks.mdx | 70 ++++++++++ .../_getConfirmedBlocksWithLimit.mdx | 77 ++++++++++ .../_getConfirmedSignaturesForAddress2.mdx | 114 +++++++++++++++ .../deprecated/_getConfirmedTransaction.mdx | 132 ++++++++++++++++++ .../_getFeeCalculatorForBlockhash.mdx | 96 +++++++++++++ .../api/deprecated/_getFeeRateGovernor.mdx | 76 ++++++++++ docs/src/api/deprecated/_getFees.mdx | 91 ++++++++++++ docs/src/api/deprecated/_getSnapshotSlot.mdx | 64 +++++++++ 8 files changed, 720 insertions(+) create mode 100644 docs/src/api/deprecated/_getConfirmedBlocks.mdx create mode 100644 docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx create mode 100644 docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx create mode 100644 docs/src/api/deprecated/_getConfirmedTransaction.mdx create mode 100644 docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx create mode 100644 docs/src/api/deprecated/_getFeeRateGovernor.mdx create mode 100644 docs/src/api/deprecated/_getFees.mdx create mode 100644 docs/src/api/deprecated/_getSnapshotSlot.mdx diff --git a/docs/src/api/deprecated/_getConfirmedBlocks.mdx b/docs/src/api/deprecated/_getConfirmedBlocks.mdx new file mode 100644 index 00000000000000..272eff69c7a48c --- /dev/null +++ b/docs/src/api/deprecated/_getConfirmedBlocks.mdx @@ -0,0 +1,70 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getConfirmedBlocks + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getBlocks](#getblocks) instead** +::: + +Returns a list of confirmed blocks between two slots + + + + + +### Parameters: + + + start_slot, as u64 integer + + + +Configuration object containing the following fields: + + + + + +### Result: + +The result field will be an array of u64 integers listing confirmed blocks +between `start_slot` and either `end_slot` - if provided, or latest confirmed block, +inclusive. Max range allowed is 500,000 slots. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc": "2.0","id":1,"method":"getConfirmedBlocks","params":[5, 10]} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": [5, 6, 7, 8, 9, 10], "id": 1 } +``` + + + + diff --git a/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx b/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx new file mode 100644 index 00000000000000..f05b472ce1f18f --- /dev/null +++ b/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx @@ -0,0 +1,77 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getConfirmedBlocksWithLimit + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getBlocksWithLimit](#getblockswithlimit) instead** +::: + +Returns a list of confirmed blocks starting at the given slot + + + + + +### Parameters: + + + start_slot, as u64 integer + + + + limit, as u64 integer + + + +Configuration object containing the following fields: + + + + + +### Result: + +The result field will be an array of u64 integers listing confirmed blocks +starting at `start_slot` for up to `limit` blocks, inclusive. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getConfirmedBlocksWithLimit", + "params": [5, 3] + } +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": [5, 6, 7], "id": 1 } +``` + + + + diff --git a/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx b/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx new file mode 100644 index 00000000000000..2b80610be41a39 --- /dev/null +++ b/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx @@ -0,0 +1,114 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getConfirmedSignaturesForAddress2 + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getSignaturesForAddress](#getsignaturesforaddress) instead** +::: + +Returns signatures for confirmed transactions that include the given address in +their `accountKeys` list. Returns signatures backwards in time from the +provided signature or most recent confirmed block + + + + + +### Parameters: + + + account address, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + maximum transaction signatures to return (between 1 and 1,000, default: + 1,000). + + + + start searching backwards from this transaction signature. (If not provided + the search starts from the top of the highest max confirmed block.) + + + + search until this transaction signature, if found before limit reached. + + + + +### Result: + +The result field will be an array of ``, ordered +from newest to oldest transaction, containing transaction signature information with the following fields: + +- `signature: ` - transaction signature as base-58 encoded string +- `slot: ` - The slot that contains the block with the transaction +- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) +- `memo: ` - Memo associated with the transaction, null if no memo is present +- `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getConfirmedSignaturesForAddress2", + "params": [ + "Vote111111111111111111111111111111111111111", + { + "limit": 1 + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "err": null, + "memo": null, + "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", + "slot": 114, + "blockTime": null + } + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/deprecated/_getConfirmedTransaction.mdx b/docs/src/api/deprecated/_getConfirmedTransaction.mdx new file mode 100644 index 00000000000000..62f79f12c7ec35 --- /dev/null +++ b/docs/src/api/deprecated/_getConfirmedTransaction.mdx @@ -0,0 +1,132 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getConfirmedTransaction + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getTransaction](#gettransaction) instead** +::: + +Returns transaction details for a confirmed transaction + + + + + +### Parameters: + + + transaction signature, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +Encoding format for Account data + + + +
+ +- `base58` is slow and limited to less than 129 bytes of Account data. +- `jsonParsed` encoding attempts to use program-specific instruction parsers + to return more human-readable and explicit data in the `transaction.message.instructions` list. +- If `jsonParsed` is requested but a parser cannot be found, the instruction + falls back to regular `json` encoding (`accounts`, `data`, and `programIdIndex` fields). + +
+ +
+ +
+ +### Result: + +- `` - if transaction is not found or not confirmed +- `` - if transaction is confirmed, an object with the following fields: + - `slot: ` - the slot this transaction was processed in + - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter + - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available + - `meta: ` - transaction status metadata object: + - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/transaction/enum.TransactionError.html) + - `fee: ` - fee this transaction was charged, as u64 integer + - `preBalances: ` - array of u64 account balances from before the transaction was processed + - `postBalances: ` - array of u64 account balances after the transaction was processed + - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction + - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction + - DEPRECATED: `status: ` - Transaction status + - `"Ok": ` - Transaction was successful + - `"Err": ` - Transaction failed with TransactionError + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getConfirmedTransaction", + "params": [ + "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv", + "base64" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "meta": { + "err": null, + "fee": 5000, + "innerInstructions": [], + "postBalances": [499998932500, 26858640, 1, 1, 1], + "postTokenBalances": [], + "preBalances": [499998937500, 26858640, 1, 1, 1], + "preTokenBalances": [], + "status": { + "Ok": null + } + }, + "slot": 430, + "transaction": [ + "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==", + "base64" + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx b/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx new file mode 100644 index 00000000000000..6f95a133475a51 --- /dev/null +++ b/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx @@ -0,0 +1,96 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getFeeCalculatorForBlockhash + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [isBlockhashValid](#isblockhashvalid) or [getFeeForMessage](#getfeeformessage) instead** +::: + +Returns the fee calculator associated with the query blockhash, or `null` if the blockhash has expired + + + + + +### Parameters: + + + query blockhash, as a base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to: + +- `` - if the query blockhash has expired; or +- `` - otherwise, a JSON object containing: + - `feeCalculator: ` - `FeeCalculator` object describing the cluster fee rate at the queried blockhash + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getFeeCalculatorForBlockhash", + "params": [ + "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 221 + }, + "value": { + "feeCalculator": { + "lamportsPerSignature": 5000 + } + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/deprecated/_getFeeRateGovernor.mdx b/docs/src/api/deprecated/_getFeeRateGovernor.mdx new file mode 100644 index 00000000000000..e7b87cda19b981 --- /dev/null +++ b/docs/src/api/deprecated/_getFeeRateGovernor.mdx @@ -0,0 +1,76 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getFeeRateGovernor + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +::: + +Returns the fee rate governor information from the root bank + + + + + +### Parameters: + +**None** + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to an `object` with the following fields: + +- `burnPercent: ` - Percentage of fees collected to be destroyed +- `maxLamportsPerSignature: ` - Largest value `lamportsPerSignature` can attain for the next slot +- `minLamportsPerSignature: ` - Smallest value `lamportsPerSignature` can attain for the next slot +- `targetLamportsPerSignature: ` - Desired fee rate for the cluster +- `targetSignaturesPerSlot: ` - Desired signature rate for the cluster + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getFeeRateGovernor"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 54 + }, + "value": { + "feeRateGovernor": { + "burnPercent": 50, + "maxLamportsPerSignature": 100000, + "minLamportsPerSignature": 5000, + "targetLamportsPerSignature": 10000, + "targetSignaturesPerSlot": 20000 + } + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/deprecated/_getFees.mdx b/docs/src/api/deprecated/_getFees.mdx new file mode 100644 index 00000000000000..1d2fcffc2259dc --- /dev/null +++ b/docs/src/api/deprecated/_getFees.mdx @@ -0,0 +1,91 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getFees + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getFeeForMessage](#getfeeformessage) instead** +::: + +Returns a recent block hash from the ledger, a fee schedule that can be used to +compute the cost of submitting a transaction using it, and the last slot in +which the blockhash will be valid. + + + + + +### Parameters: + + + Pubkey of account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` set to a JSON object with the following fields: + +- `blockhash: ` - a Hash as base-58 encoded string +- `feeCalculator: ` - FeeCalculator object, the fee schedule for this block hash +- `lastValidSlot: ` - DEPRECATED - this value is inaccurate and should not be relied upon +- `lastValidBlockHeight: ` - last [block height](../../terminology.md#block-height) at which the blockhash will be valid + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { "jsonrpc":"2.0", "id": 1, "method":"getFees"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1 + }, + "value": { + "blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", + "feeCalculator": { + "lamportsPerSignature": 5000 + }, + "lastValidSlot": 297, + "lastValidBlockHeight": 296 + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/deprecated/_getSnapshotSlot.mdx b/docs/src/api/deprecated/_getSnapshotSlot.mdx new file mode 100644 index 00000000000000..42ee186d5c3325 --- /dev/null +++ b/docs/src/api/deprecated/_getSnapshotSlot.mdx @@ -0,0 +1,64 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSnapshotSlot + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getHighestSnapshotSlot](#gethighestsnapshotslot) instead** +::: + +Returns the highest slot that the node has a snapshot for + + + + + +### Parameters: + +**None** + +### Result: + +`` - Snapshot slot + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getSnapshotSlot"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 100, "id": 1 } +``` + +Result when the node has no snapshot: + +```json +{ + "jsonrpc": "2.0", + "error": { "code": -32008, "message": "No snapshot" }, + "id": 1 +} +``` + + + + From 4f1b1a2ae5a5ae54da652bea94493ae69a40d2b4 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:43:03 -0500 Subject: [PATCH 05/28] feat: http method partials --- docs/src/api/methods/_getAccountInfo.mdx | 135 ++++++++ docs/src/api/methods/_getBalance.mdx | 77 +++++ docs/src/api/methods/_getBlock.mdx | 287 ++++++++++++++++++ docs/src/api/methods/_getBlockCommitment.mdx | 70 +++++ docs/src/api/methods/_getBlockHeight.mdx | 72 +++++ docs/src/api/methods/_getBlockProduction.mdx | 96 ++++++ docs/src/api/methods/_getBlockTime.mdx | 67 ++++ docs/src/api/methods/_getBlocks.mdx | 85 ++++++ docs/src/api/methods/_getBlocksWithLimit.mdx | 83 +++++ docs/src/api/methods/_getClusterNodes.mdx | 71 +++++ docs/src/api/methods/_getEpochInfo.mdx | 84 +++++ docs/src/api/methods/_getEpochSchedule.mdx | 67 ++++ docs/src/api/methods/_getFeeForMessage.mdx | 85 ++++++ .../api/methods/_getFirstAvailableBlock.mdx | 50 +++ docs/src/api/methods/_getGenesisHash.mdx | 51 ++++ docs/src/api/methods/_getHealth.mdx | 88 ++++++ .../api/methods/_getHighestSnapshotSlot.mdx | 78 +++++ docs/src/api/methods/_getIdentity.mdx | 55 ++++ .../src/api/methods/_getInflationGovernor.mdx | 74 +++++ docs/src/api/methods/_getInflationRate.mdx | 62 ++++ docs/src/api/methods/_getInflationReward.mdx | 100 ++++++ docs/src/api/methods/_getLargestAccounts.mdx | 149 +++++++++ docs/src/api/methods/_getLatestBlockhash.mdx | 91 ++++++ docs/src/api/methods/_getLeaderSchedule.mdx | 95 ++++++ .../src/api/methods/_getMaxRetransmitSlot.mdx | 48 +++ .../api/methods/_getMaxShredInsertSlot.mdx | 48 +++ .../_getMinimumBalanceForRentExemption.mdx | 66 ++++ docs/src/api/methods/_getMultipleAccounts.mdx | 143 +++++++++ docs/src/api/methods/_getProgramAccounts.mdx | 168 ++++++++++ .../methods/_getRecentPerformanceSamples.mdx | 89 ++++++ .../methods/_getRecentPrioritizationFees.mdx | 94 ++++++ .../src/api/methods/_getSignatureStatuses.mdx | 113 +++++++ .../api/methods/_getSignaturesForAddress.mdx | 116 +++++++ docs/src/api/methods/_getSlot.mdx | 62 ++++ docs/src/api/methods/_getSlotLeader.mdx | 66 ++++ docs/src/api/methods/_getSlotLeaders.mdx | 77 +++++ docs/src/api/methods/_getStakeActivation.mdx | 94 ++++++ .../methods/_getStakeMinimumDelegation.mdx | 72 +++++ docs/src/api/methods/_getSupply.mdx | 86 ++++++ .../api/methods/_getTokenAccountBalance.mdx | 90 ++++++ .../methods/_getTokenAccountsByDelegate.mdx | 176 +++++++++++ .../api/methods/_getTokenAccountsByOwner.mdx | 175 +++++++++++ .../api/methods/_getTokenLargestAccounts.mdx | 98 ++++++ docs/src/api/methods/_getTokenSupply.mdx | 87 ++++++ docs/src/api/methods/_getTransaction.mdx | 171 +++++++++++ docs/src/api/methods/_getTransactionCount.mdx | 62 ++++ docs/src/api/methods/_getVersion.mdx | 51 ++++ docs/src/api/methods/_getVoteAccounts.mdx | 113 +++++++ docs/src/api/methods/_isBlockhashValid.mdx | 88 ++++++ docs/src/api/methods/_minimumLedgerSlot.mdx | 52 ++++ docs/src/api/methods/_requestAirdrop.mdx | 77 +++++ docs/src/api/methods/_sendTransaction.mdx | 123 ++++++++ docs/src/api/methods/_simulateTransaction.mdx | 172 +++++++++++ 53 files changed, 5049 insertions(+) create mode 100644 docs/src/api/methods/_getAccountInfo.mdx create mode 100644 docs/src/api/methods/_getBalance.mdx create mode 100644 docs/src/api/methods/_getBlock.mdx create mode 100644 docs/src/api/methods/_getBlockCommitment.mdx create mode 100644 docs/src/api/methods/_getBlockHeight.mdx create mode 100644 docs/src/api/methods/_getBlockProduction.mdx create mode 100644 docs/src/api/methods/_getBlockTime.mdx create mode 100644 docs/src/api/methods/_getBlocks.mdx create mode 100644 docs/src/api/methods/_getBlocksWithLimit.mdx create mode 100644 docs/src/api/methods/_getClusterNodes.mdx create mode 100644 docs/src/api/methods/_getEpochInfo.mdx create mode 100644 docs/src/api/methods/_getEpochSchedule.mdx create mode 100644 docs/src/api/methods/_getFeeForMessage.mdx create mode 100644 docs/src/api/methods/_getFirstAvailableBlock.mdx create mode 100644 docs/src/api/methods/_getGenesisHash.mdx create mode 100644 docs/src/api/methods/_getHealth.mdx create mode 100644 docs/src/api/methods/_getHighestSnapshotSlot.mdx create mode 100644 docs/src/api/methods/_getIdentity.mdx create mode 100644 docs/src/api/methods/_getInflationGovernor.mdx create mode 100644 docs/src/api/methods/_getInflationRate.mdx create mode 100644 docs/src/api/methods/_getInflationReward.mdx create mode 100644 docs/src/api/methods/_getLargestAccounts.mdx create mode 100644 docs/src/api/methods/_getLatestBlockhash.mdx create mode 100644 docs/src/api/methods/_getLeaderSchedule.mdx create mode 100644 docs/src/api/methods/_getMaxRetransmitSlot.mdx create mode 100644 docs/src/api/methods/_getMaxShredInsertSlot.mdx create mode 100644 docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx create mode 100644 docs/src/api/methods/_getMultipleAccounts.mdx create mode 100644 docs/src/api/methods/_getProgramAccounts.mdx create mode 100644 docs/src/api/methods/_getRecentPerformanceSamples.mdx create mode 100644 docs/src/api/methods/_getRecentPrioritizationFees.mdx create mode 100644 docs/src/api/methods/_getSignatureStatuses.mdx create mode 100644 docs/src/api/methods/_getSignaturesForAddress.mdx create mode 100644 docs/src/api/methods/_getSlot.mdx create mode 100644 docs/src/api/methods/_getSlotLeader.mdx create mode 100644 docs/src/api/methods/_getSlotLeaders.mdx create mode 100644 docs/src/api/methods/_getStakeActivation.mdx create mode 100644 docs/src/api/methods/_getStakeMinimumDelegation.mdx create mode 100644 docs/src/api/methods/_getSupply.mdx create mode 100644 docs/src/api/methods/_getTokenAccountBalance.mdx create mode 100644 docs/src/api/methods/_getTokenAccountsByDelegate.mdx create mode 100644 docs/src/api/methods/_getTokenAccountsByOwner.mdx create mode 100644 docs/src/api/methods/_getTokenLargestAccounts.mdx create mode 100644 docs/src/api/methods/_getTokenSupply.mdx create mode 100644 docs/src/api/methods/_getTransaction.mdx create mode 100644 docs/src/api/methods/_getTransactionCount.mdx create mode 100644 docs/src/api/methods/_getVersion.mdx create mode 100644 docs/src/api/methods/_getVoteAccounts.mdx create mode 100644 docs/src/api/methods/_isBlockhashValid.mdx create mode 100644 docs/src/api/methods/_minimumLedgerSlot.mdx create mode 100644 docs/src/api/methods/_requestAirdrop.mdx create mode 100644 docs/src/api/methods/_sendTransaction.mdx create mode 100644 docs/src/api/methods/_simulateTransaction.mdx diff --git a/docs/src/api/methods/_getAccountInfo.mdx b/docs/src/api/methods/_getAccountInfo.mdx new file mode 100644 index 00000000000000..15ad5eebd9d11e --- /dev/null +++ b/docs/src/api/methods/_getAccountInfo.mdx @@ -0,0 +1,135 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getAccountInfo + +Returns all information associated with the account of provided Pubkey + + + + + +### Parameters: + + + Pubkey of account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +Encoding format for Account data + + + +
+ +- `base58` is slow and limited to less than 129 bytes of Account data. +- `base64` will return base64 encoded data for Account data of any size. +- `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) + and base64-encodes the result. +- `jsonParsed` encoding attempts to use program-specific state parsers to return + more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls + back to `base64` encoding, detectable when the `data` field is type `string`. + +
+ +
+ + + limit the returned account data using the provided "offset: <usize>" and + "length: <usize>" fields +
  • + only available for base58, base64 or{" "} + base64+zstd encodings. +
  • +
    + + + The minimum slot that the request can be evaluated at + + +
    + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to: + +- `` - if the requested account doesn't exist +- `` - otherwise, a JSON object containing: + - `lamports: ` - number of lamports assigned to this account, as a u64 + - `owner: ` - base-58 encoded Pubkey of the program this account has been assigned to + - `data: <[string, encoding]|object>` - data associated with the account, either as encoded binary data or JSON format `{: }` - depending on encoding parameter + - `executable: ` - boolean indicating if the account contains a program \(and is strictly read-only\) + - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 + - `size: ` - the data size of the account + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getAccountInfo", + "params": [ + "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", + { + "encoding": "base58" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1 + }, + "value": { + "data": [ + "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHRTPuR3oZ1EioKtYGiYxpxMG5vpbZLsbcBYBEmZZcMKaSoGx9JZeAuWf", + "base58" + ], + "executable": false, + "lamports": 1000000000, + "owner": "11111111111111111111111111111111", + "rentEpoch": 2, + "space": 80 + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBalance.mdx b/docs/src/api/methods/_getBalance.mdx new file mode 100644 index 00000000000000..e91e181d4fa0f7 --- /dev/null +++ b/docs/src/api/methods/_getBalance.mdx @@ -0,0 +1,77 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBalance + +Returns the balance of the account of provided Pubkey + + + + + +### Parameters: + + + Pubkey of account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +`RpcResponse` - RpcResponse JSON object with `value` field set to the balance + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getBalance", + "params": [ + "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { "context": { "slot": 1 }, "value": 0 }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBlock.mdx b/docs/src/api/methods/_getBlock.mdx new file mode 100644 index 00000000000000..0a46c15d043f09 --- /dev/null +++ b/docs/src/api/methods/_getBlock.mdx @@ -0,0 +1,287 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlock + +Returns identity and transaction information about a confirmed block in the ledger + + + + + +### Parameters: + + + slot number, as u64 integer + + + +Configuration object containing the following fields: + + +
  • + the default is finalized +
  • +
  • + processed is not supported. +
  • +
    + + + +encoding format for each returned Transaction + + + +
    + +- `jsonParsed` attempts to use program-specific instruction parsers to return + more human-readable and explicit data in the `transaction.message.instructions` list. +- If `jsonParsed` is requested but a parser cannot be found, the instruction + falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). + +
    + +
    + + + +level of transaction detail to return + + + +
    + +- If `accounts` are requested, transaction details only include signatures and + an annotated list of accounts in each transaction. +- Transaction metadata is limited to only: fee, err, pre_balances, + post_balances, pre_token_balances, and post_token_balances. + +
    + +
    + + + +the max transaction version to return in responses. + +
    + +- If the requested block contains a transaction with a higher version, an + error will be returned. +- If this parameter is omitted, only legacy transactions will be returned, and + a block containing any versioned transaction will prompt the error. + +
    + +
    + + + whether to populate the `rewards` array. If parameter not provided, the + default includes rewards. + + +
    + +### Result: + +The result field will be an object with the following fields: + +- `` - if specified block is not confirmed +- `` - if block is confirmed, an object with the following fields: + - `blockhash: ` - the blockhash of this block, as base-58 encoded string + - `previousBlockhash: ` - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111" + - `parentSlot: ` - the slot index of this block's parent + - `transactions: ` - present if "full" transaction details are requested; an array of JSON objects containing: + - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter + - `meta: ` - transaction status metadata object, containing `null` or: + - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) + - `fee: ` - fee this transaction was charged, as u64 integer + - `preBalances: ` - array of u64 account balances from before the transaction was processed + - `postBalances: ` - array of u64 account balances after the transaction was processed + - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction + - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction + - `rewards: ` - transaction-level rewards, populated if rewards are requested; an array of JSON objects containing: + - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward + - `lamports: `- number of reward lamports credited or debited by the account, as a i64 + - `postBalance: ` - account balance in lamports after the reward was applied + - `rewardType: ` - type of reward: "fee", "rent", "voting", "staking" + - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards + - DEPRECATED: `status: ` - Transaction status + - `"Ok": ` - Transaction was successful + - `"Err": ` - Transaction failed with TransactionError + - `loadedAddresses: ` - Transaction addresses loaded from address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set in request params. + - `writable: ` - Ordered list of base-58 encoded addresses for writable loaded accounts + - `readonly: ` - Ordered list of base-58 encoded addresses for readonly loaded accounts + - `returnData: ` - the most-recent return data generated by an instruction in the transaction, with the following fields: + - `programId: ` - the program that generated the return data, as base-58 encoded Pubkey + - `data: <[string, encoding]>` - the return data itself, as base-64 encoded binary data + - `computeUnitsConsumed: ` - number of [compute units](developing/programming-model/runtime.md#compute-budget) consumed by the transaction + - `version: <"legacy"|number|undefined>` - Transaction version. Undefined if `maxSupportedTransactionVersion` is not set in request params. + - `signatures: ` - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block + - `rewards: ` - block-level rewards, present if rewards are requested; an array of JSON objects containing: + - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward + - `lamports: `- number of reward lamports credited or debited by the account, as a i64 + - `postBalance: ` - account balance in lamports after the reward was applied + - `rewardType: ` - type of reward: "fee", "rent", "voting", "staking" + - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards + - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available + - `blockHeight: ` - the number of blocks beneath this block + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0","id":1, + "method":"getBlock", + "params": [ + 430, + { + "encoding": "json", + "maxSupportedTransactionVersion":0, + "transactionDetails":"full", + "rewards":false + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "blockHeight": 428, + "blockTime": null, + "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", + "parentSlot": 429, + "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", + "transactions": [ + { + "meta": { + "err": null, + "fee": 5000, + "innerInstructions": [], + "logMessages": [], + "postBalances": [499998932500, 26858640, 1, 1, 1], + "postTokenBalances": [], + "preBalances": [499998937500, 26858640, 1, 1, 1], + "preTokenBalances": [], + "rewards": null, + "status": { + "Ok": null + } + }, + "transaction": { + "message": { + "accountKeys": [ + "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", + "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", + "SysvarS1otHashes111111111111111111111111111", + "SysvarC1ock11111111111111111111111111111111", + "Vote111111111111111111111111111111111111111" + ], + "header": { + "numReadonlySignedAccounts": 0, + "numReadonlyUnsignedAccounts": 3, + "numRequiredSignatures": 1 + }, + "instructions": [ + { + "accounts": [1, 2, 3, 0], + "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", + "programIdIndex": 4 + } + ], + "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" + }, + "signatures": [ + "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" + ] + } + } + ] + }, + "id": 1 +} +``` + + + + +--- + +#### Transaction Structure + +Transactions are quite different from those on other blockchains. Be sure to review [Anatomy of a Transaction](developing/programming-model/transactions.md) to learn about transactions on Solana. + +The JSON structure of a transaction is defined as follows: + +- `signatures: ` - A list of base-58 encoded signatures applied to the transaction. The list is always of length `message.header.numRequiredSignatures` and not empty. The signature at index `i` corresponds to the public key at index `i` in `message.accountKeys`. The first one is used as the [transaction id](../../terminology.md#transaction-id). +- `message: ` - Defines the content of the transaction. + - `accountKeys: ` - List of base-58 encoded public keys used by the transaction, including by the instructions and for signatures. The first `message.header.numRequiredSignatures` public keys must sign the transaction. + - `header: ` - Details the account types and signatures required by the transaction. + - `numRequiredSignatures: ` - The total number of signatures required to make the transaction valid. The signatures must match the first `numRequiredSignatures` of `message.accountKeys`. + - `numReadonlySignedAccounts: ` - The last `numReadonlySignedAccounts` of the signed keys are read-only accounts. Programs may process multiple transactions that load read-only accounts within a single PoH entry, but are not permitted to credit or debit lamports or modify account data. Transactions targeting the same read-write account are evaluated sequentially. + - `numReadonlyUnsignedAccounts: ` - The last `numReadonlyUnsignedAccounts` of the unsigned keys are read-only accounts. + - `recentBlockhash: ` - A base-58 encoded hash of a recent block in the ledger used to prevent transaction duplication and to give transactions lifetimes. + - `instructions: ` - List of program instructions that will be executed in sequence and committed in one atomic transaction if all succeed. + - `programIdIndex: ` - Index into the `message.accountKeys` array indicating the program account that executes this instruction. + - `accounts: ` - List of ordered indices into the `message.accountKeys` array indicating which accounts to pass to the program. + - `data: ` - The program input data encoded in a base-58 string. + - `addressTableLookups: ` - List of address table lookups used by a transaction to dynamically load addresses from on-chain address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set. + - `accountKey: ` - base-58 encoded public key for an address lookup table account. + - `writableIndexes: ` - List of indices used to load addresses of writable accounts from a lookup table. + - `readonlyIndexes: ` - List of indices used to load addresses of readonly accounts from a lookup table. + +#### Inner Instructions Structure + +The Solana runtime records the cross-program instructions that are invoked during transaction processing and makes these available for greater transparency of what was executed on-chain per transaction instruction. Invoked instructions are grouped by the originating transaction instruction and are listed in order of processing. + +The JSON structure of inner instructions is defined as a list of objects in the following structure: + +- `index: number` - Index of the transaction instruction from which the inner instruction(s) originated +- `instructions: ` - Ordered list of inner program instructions that were invoked during a single transaction instruction. + - `programIdIndex: ` - Index into the `message.accountKeys` array indicating the program account that executes this instruction. + - `accounts: ` - List of ordered indices into the `message.accountKeys` array indicating which accounts to pass to the program. + - `data: ` - The program input data encoded in a base-58 string. + +#### Token Balances Structure + +The JSON structure of token balances is defined as a list of objects in the following structure: + +- `accountIndex: ` - Index of the account in which the token balance is provided for. +- `mint: ` - Pubkey of the token's mint. +- `owner: ` - Pubkey of token balance's owner. +- `programId: ` - Pubkey of the Token program that owns the account. +- `uiTokenAmount: ` - + - `amount: ` - Raw amount of tokens as a string, ignoring decimals. + - `decimals: ` - Number of decimals configured for token's mint. + - `uiAmount: ` - Token amount as a float, accounting for decimals. **DEPRECATED** + - `uiAmountString: ` - Token amount as a string, accounting for decimals. + + diff --git a/docs/src/api/methods/_getBlockCommitment.mdx b/docs/src/api/methods/_getBlockCommitment.mdx new file mode 100644 index 00000000000000..c12fc186cfca4b --- /dev/null +++ b/docs/src/api/methods/_getBlockCommitment.mdx @@ -0,0 +1,70 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlockCommitment + +Returns commitment for particular block + + + + + +### Parameters: + + + block number, identified by Slot + + +### Result: + +The result field will be a JSON object containing: + +- `commitment` - commitment, comprising either: + - `` - Unknown block + - `` - commitment, array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY` + 1 +- `totalStake` - total active stake, in lamports, of the current epoch + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getBlockCommitment", + "params":[5] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "commitment": [ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 10, 32 + ], + "totalStake": 42 + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBlockHeight.mdx b/docs/src/api/methods/_getBlockHeight.mdx new file mode 100644 index 00000000000000..d8b3ff0bb263e9 --- /dev/null +++ b/docs/src/api/methods/_getBlockHeight.mdx @@ -0,0 +1,72 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlockHeight + +Returns the current block height of the node + + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +- `` - Current block height + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0","id":1, + "method":"getBlockHeight" + } +' +``` + +Result: + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": 1233, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBlockProduction.mdx b/docs/src/api/methods/_getBlockProduction.mdx new file mode 100644 index 00000000000000..d0d65d1e53f8fd --- /dev/null +++ b/docs/src/api/methods/_getBlockProduction.mdx @@ -0,0 +1,96 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlockProduction + +Returns recent block production information from the current or previous epoch. + + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + Only return results for this validator identity (base-58 encoded) + + + +Slot range to return block production for. If parameter not provided, defaults to current epoch. + +- `firstSlot: ` - first slot to return block production information for (inclusive) +- (optional) `lastSlot: ` - last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to: + +- `` + - `byIdentity: ` - a dictionary of validator identities, + as base-58 encoded strings. Value is a two element array containing the + number of leader slots and the number of blocks produced. + - `range: ` - Block production slot range + - `firstSlot: ` - first slot of the block production information (inclusive) + - `lastSlot: ` - last slot of block production information (inclusive) + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getBlockProduction"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 9887 + }, + "value": { + "byIdentity": { + "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [9888, 9886] + }, + "range": { + "firstSlot": 0, + "lastSlot": 9887 + } + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBlockTime.mdx b/docs/src/api/methods/_getBlockTime.mdx new file mode 100644 index 00000000000000..50ef1de6fb4699 --- /dev/null +++ b/docs/src/api/methods/_getBlockTime.mdx @@ -0,0 +1,67 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlockTime + +Returns the estimated production time of a block. + +:::info +Each validator reports their UTC time to the ledger on a regular interval by +intermittently adding a timestamp to a Vote for a particular block. A requested +block's time is calculated from the stake-weighted mean of the Vote timestamps +in a set of recent blocks recorded on the ledger. +::: + + + + + +### Parameters: + + + block number, identified by Slot + + +### Result: + +- `` - estimated production time, as Unix timestamp (seconds since the Unix epoch) +- `` - timestamp is not available for this block + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0", "id":1, + "method": "getBlockTime", + "params":[5] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": 1574721591, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBlocks.mdx b/docs/src/api/methods/_getBlocks.mdx new file mode 100644 index 00000000000000..2648d3302ec717 --- /dev/null +++ b/docs/src/api/methods/_getBlocks.mdx @@ -0,0 +1,85 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlocks + +Returns a list of confirmed blocks between two slots + + + + + +### Parameters: + + + end_slot, as u64 integer + + + + start_slot, as u64 integer (must be no more than 500,000 blocks + higher than the `start_slot`) + + + +Configuration object containing the following fields: + + + +- "processed" is not supported + + + + + +### Result: + +The result field will be an array of u64 integers listing confirmed blocks +between `start_slot` and either `end_slot` - if provided, or latest confirmed block, +inclusive. Max range allowed is 500,000 slots. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getBlocks", + "params": [ + 5, 10 + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [5, 6, 7, 8, 9, 10], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getBlocksWithLimit.mdx b/docs/src/api/methods/_getBlocksWithLimit.mdx new file mode 100644 index 00000000000000..ab7fe4eab943fa --- /dev/null +++ b/docs/src/api/methods/_getBlocksWithLimit.mdx @@ -0,0 +1,83 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getBlocksWithLimit + +Returns a list of confirmed blocks starting at the given slot + + + + + +### Parameters: + + + start_slot, as u64 integer + + + + limit, as u64 integer (must be no more than 500,000 blocks higher + than the start_slot) + + + +Configuration object containing the following field: + + + +- "processed" is not supported + + + + + +### Result: + +The result field will be an array of u64 integers listing confirmed blocks +starting at `start_slot` for up to `limit` blocks, inclusive. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id":1, + "method":"getBlocksWithLimit", + "params":[5, 3] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [5, 6, 7], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getClusterNodes.mdx b/docs/src/api/methods/_getClusterNodes.mdx new file mode 100644 index 00000000000000..735e3aff27fc8e --- /dev/null +++ b/docs/src/api/methods/_getClusterNodes.mdx @@ -0,0 +1,71 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getClusterNodes + +Returns information about all the nodes participating in the cluster + + + + +### Parameters: + +**None** + +### Result: + +The result field will be an array of JSON objects, each with the following sub fields: + +- `pubkey: ` - Node public key, as base-58 encoded string +- `gossip: ` - Gossip network address for the node +- `tpu: ` - TPU network address for the node +- `rpc: ` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled +- `version: ` - The software version of the node, or `null` if the version information is not available +- `featureSet: ` - The unique identifier of the node's feature set +- `shredVersion: ` - The shred version the node has been configured to use + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getClusterNodes" + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "gossip": "10.239.6.48:8001", + "pubkey": "9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ", + "rpc": "10.239.6.48:8899", + "tpu": "10.239.6.48:8856", + "version": "1.0.0 c375ce1f" + } + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getEpochInfo.mdx b/docs/src/api/methods/_getEpochInfo.mdx new file mode 100644 index 00000000000000..2a9b3fe2c67b0c --- /dev/null +++ b/docs/src/api/methods/_getEpochInfo.mdx @@ -0,0 +1,84 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getEpochInfo + +Returns information about the current epoch + + + + + +### Parameters: + + + Pubkey of account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +The result field will be an object with the following fields: + +- `absoluteSlot: ` - the current slot +- `blockHeight: ` - the current block height +- `epoch: ` - the current epoch +- `slotIndex: ` - the current slot relative to the start of the current epoch +- `slotsInEpoch: ` - the number of slots in this epoch +- `transactionCount: ` - total number of transactions processed without error since genesis + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getEpochInfo"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "absoluteSlot": 166598, + "blockHeight": 166500, + "epoch": 27, + "slotIndex": 2790, + "slotsInEpoch": 8192, + "transactionCount": 22661093 + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getEpochSchedule.mdx b/docs/src/api/methods/_getEpochSchedule.mdx new file mode 100644 index 00000000000000..2e11e8a4be0d93 --- /dev/null +++ b/docs/src/api/methods/_getEpochSchedule.mdx @@ -0,0 +1,67 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getEpochSchedule + +Returns the epoch schedule information from this cluster's genesis config + + + + +### Parameters: + +**None** + +### Result: + +The result field will be an object with the following fields: + +- `slotsPerEpoch: ` - the maximum number of slots in each epoch +- `leaderScheduleSlotOffset: ` - the number of slots before beginning of an epoch to calculate a leader schedule for that epoch +- `warmup: ` - whether epochs start short and grow +- `firstNormalEpoch: ` - first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH) +- `firstNormalSlot: ` - MINIMUM_SLOTS_PER_EPOCH \* (2.pow(firstNormalEpoch) - 1) + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0","id":1, + "method":"getEpochSchedule" + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "firstNormalEpoch": 8, + "firstNormalSlot": 8160, + "leaderScheduleSlotOffset": 8192, + "slotsPerEpoch": 8192, + "warmup": true + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getFeeForMessage.mdx b/docs/src/api/methods/_getFeeForMessage.mdx new file mode 100644 index 00000000000000..adac11e5402678 --- /dev/null +++ b/docs/src/api/methods/_getFeeForMessage.mdx @@ -0,0 +1,85 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getFeeForMessage + +Get the fee the network will charge for a particular Message + +:::caution +**NEW: This method is only available in solana-core v1.9 or newer. Please use +[getFees](#getFees) for solana-core v1.8** +::: + + + + +### Parameters: + + + Base-64 encoded Message + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +- `` - Fee corresponding to the message at the specified blockhash + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' +{ + "id":1, + "jsonrpc":"2.0", + "method":"getFeeForMessage", + "params":[ + "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA", + { + "commitment":"processed" + } + ] +} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { "context": { "slot": 5068 }, "value": 5000 }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getFirstAvailableBlock.mdx b/docs/src/api/methods/_getFirstAvailableBlock.mdx new file mode 100644 index 00000000000000..97139e17b5bf60 --- /dev/null +++ b/docs/src/api/methods/_getFirstAvailableBlock.mdx @@ -0,0 +1,50 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getFirstAvailableBlock + +Returns the slot of the lowest confirmed block that has not been purged from the ledger + + + + +### Parameters: + +**None** + +### Result: + +- `` - Slot + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0","id":1, + "method":"getFirstAvailableBlock" + } +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 250000, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getGenesisHash.mdx b/docs/src/api/methods/_getGenesisHash.mdx new file mode 100644 index 00000000000000..4a7802d8b1b266 --- /dev/null +++ b/docs/src/api/methods/_getGenesisHash.mdx @@ -0,0 +1,51 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getGenesisHash + +Returns the genesis hash + + + + +### Parameters: + +**None** + +### Result: + +- `` - a Hash as base-58 encoded string + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getGenesisHash"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": "GH7ome3EiwEr7tu9JuTh2dpYWBJK3z69Xm1ZE3MEE6JC", + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getHealth.mdx b/docs/src/api/methods/_getHealth.mdx new file mode 100644 index 00000000000000..482a2ff62a076e --- /dev/null +++ b/docs/src/api/methods/_getHealth.mdx @@ -0,0 +1,88 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getHealth + +Returns the current health of the node. + +:::caution +If one or more `--known-validator` arguments are provided to `solana-validator` - "ok" is returned +when the node has within `HEALTH_CHECK_SLOT_DISTANCE` slots of the highest known validator, +otherwise an error is returned. "ok" is always returned if no known validators are provided. +::: + + + + +### Parameters: + +**None** + +### Result: + +If the node is healthy: "ok" + +If the node is unhealthy, a JSON RPC error response is returned. The specifics of the error response are **UNSTABLE** and may change in the future + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getHealth"} +' +``` + +### Response: + +Healthy Result: + +```json +{ "jsonrpc": "2.0", "result": "ok", "id": 1 } +``` + +Unhealthy Result (generic): + +```json +{ + "jsonrpc": "2.0", + "error": { + "code": -32005, + "message": "Node is unhealthy", + "data": {} + }, + "id": 1 +} +``` + +Unhealthy Result (if additional information is available) + +```json +{ + "jsonrpc": "2.0", + "error": { + "code": -32005, + "message": "Node is behind by 42 slots", + "data": { + "numSlotsBehind": 42 + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getHighestSnapshotSlot.mdx b/docs/src/api/methods/_getHighestSnapshotSlot.mdx new file mode 100644 index 00000000000000..b4a284b8a99d9e --- /dev/null +++ b/docs/src/api/methods/_getHighestSnapshotSlot.mdx @@ -0,0 +1,78 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getHighestSnapshotSlot + +Returns the highest slot information that the node has snapshots for. + +This will find the highest full snapshot slot, and the highest incremental +snapshot slot _based on_ the full snapshot slot, if there is one. + +:::caution +NEW: This method is only available in solana-core v1.9 or newer. Please use +[getSnapshotSlot](/api#getsnapshotslot) for solana-core v1.8 +::: + + + + +### Parameters: + +**None** + +### Result: + +When the node has a snapshot, this returns a JSON object with the following fields: + +- `full: ` - Highest full snapshot slot +- `incremental: ` - Highest incremental snapshot slot _based on_ `full` + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1,"method":"getHighestSnapshotSlot"} +' +``` + +### Response: + +Result when the node has a snapshot: + +```json +{ + "jsonrpc": "2.0", + "result": { + "full": 100, + "incremental": 110 + }, + "id": 1 +} +``` + +Result when the node has no snapshot: + +```json +{ + "jsonrpc": "2.0", + "error": { "code": -32008, "message": "No snapshot" }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getIdentity.mdx b/docs/src/api/methods/_getIdentity.mdx new file mode 100644 index 00000000000000..263ebb28d7f824 --- /dev/null +++ b/docs/src/api/methods/_getIdentity.mdx @@ -0,0 +1,55 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getIdentity + +Returns the identity pubkey for the current node + + + + +### Parameters: + +**None** + +### Result: + +The result field will be a JSON object with the following fields: + +- `identity` - the identity pubkey of the current node \(as a base-58 encoded string\) + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getIdentity"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "identity": "2r1F4iWqVcb8M1DbAjQuFpebkQHY9hcVU4WuW2DJBppN" + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getInflationGovernor.mdx b/docs/src/api/methods/_getInflationGovernor.mdx new file mode 100644 index 00000000000000..60d859b9adcb2f --- /dev/null +++ b/docs/src/api/methods/_getInflationGovernor.mdx @@ -0,0 +1,74 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getInflationGovernor + +Returns the current inflation governor + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + +### Result: + +The result field will be a JSON object with the following fields: + +- `initial: ` - the initial inflation percentage from time 0 +- `terminal: ` - terminal inflation percentage +- `taper: ` - rate per year at which inflation is lowered. (Rate reduction is derived using the target slot time in genesis config) +- `foundation: ` - percentage of total inflation allocated to the foundation +- `foundationTerm: ` - duration of foundation pool inflation in years + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getInflationGovernor"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "foundation": 0.05, + "foundationTerm": 7, + "initial": 0.15, + "taper": 0.15, + "terminal": 0.015 + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getInflationRate.mdx b/docs/src/api/methods/_getInflationRate.mdx new file mode 100644 index 00000000000000..1cc987aab13c1c --- /dev/null +++ b/docs/src/api/methods/_getInflationRate.mdx @@ -0,0 +1,62 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getInflationRate + +Returns the specific inflation values for the current epoch + + + + +### Parameters: + +**None** + +### Result: + +The result field will be a JSON object with the following fields: + +- `total: ` - total inflation +- `validator: ` -inflation allocated to validators +- `foundation: ` - inflation allocated to the foundation +- `epoch: ` - epoch for which these values are valid + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getInflationRate"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "epoch": 100, + "foundation": 0.001, + "total": 0.149, + "validator": 0.148 + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getInflationReward.mdx b/docs/src/api/methods/_getInflationReward.mdx new file mode 100644 index 00000000000000..ec94c43acc576f --- /dev/null +++ b/docs/src/api/methods/_getInflationReward.mdx @@ -0,0 +1,100 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getInflationReward + +Returns the inflation / staking reward for a list of addresses for an epoch + + + + +### Parameters: + + + An array of addresses to query, as base-58 encoded strings + + + +Configuration object containing the following fields: + + + + + An epoch for which the reward occurs. If omitted, the previous epoch will be + used + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +The result field will be a JSON array with the following fields: + +- `epoch: ` - epoch for which reward occured +- `effectiveSlot: ` - the slot in which the rewards are effective +- `amount: ` - reward amount in lamports +- `postBalance: ` - post balance of the account in lamports +- `commission: ` - vote account commission when the reward was credited + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getInflationReward", + "params": [ + [ + "6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu", + "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2" + ], + {"epoch": 2} + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "amount": 2500, + "effectiveSlot": 224, + "epoch": 2, + "postBalance": 499999442500 + }, + null + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getLargestAccounts.mdx b/docs/src/api/methods/_getLargestAccounts.mdx new file mode 100644 index 00000000000000..e4b9c56729ad2a --- /dev/null +++ b/docs/src/api/methods/_getLargestAccounts.mdx @@ -0,0 +1,149 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getLargestAccounts + +Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours) + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + filter results by account type + + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to an array of `` containing: + +- `address: ` - base-58 encoded address of the account +- `lamports: ` - number of lamports in the account, as a u64 + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getLargestAccounts"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 54 + }, + "value": [ + { + "lamports": 999974, + "address": "99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ" + }, + { + "lamports": 42, + "address": "uPwWLo16MVehpyWqsLkK3Ka8nLowWvAHbBChqv2FZeL" + }, + { + "lamports": 42, + "address": "aYJCgU7REfu3XF8b3QhkqgqQvLizx8zxuLBHA25PzDS" + }, + { + "lamports": 42, + "address": "CTvHVtQ4gd4gUcw3bdVgZJJqApXE9nCbbbP4VTS5wE1D" + }, + { + "lamports": 20, + "address": "4fq3xJ6kfrh9RkJQsmVd5gNMvJbuSHfErywvEjNQDPxu" + }, + { + "lamports": 4, + "address": "AXJADheGVp9cruP8WYu46oNkRbeASngN5fPCMVGQqNHa" + }, + { + "lamports": 2, + "address": "8NT8yS6LiwNprgW4yM1jPPow7CwRUotddBVkrkWgYp24" + }, + { + "lamports": 1, + "address": "SysvarEpochSchedu1e111111111111111111111111" + }, + { + "lamports": 1, + "address": "11111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "Stake11111111111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "SysvarC1ock11111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "StakeConfig11111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "SysvarRent111111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "Config1111111111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "SysvarStakeHistory1111111111111111111111111" + }, + { + "lamports": 1, + "address": "SysvarRecentB1ockHashes11111111111111111111" + }, + { + "lamports": 1, + "address": "SysvarFees111111111111111111111111111111111" + }, + { + "lamports": 1, + "address": "Vote111111111111111111111111111111111111111" + } + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getLatestBlockhash.mdx b/docs/src/api/methods/_getLatestBlockhash.mdx new file mode 100644 index 00000000000000..e2bf514c88ed56 --- /dev/null +++ b/docs/src/api/methods/_getLatestBlockhash.mdx @@ -0,0 +1,91 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getLatestBlockhash + +Returns the latest blockhash + +:::caution +NEW: This method is only available in solana-core v1.9 or newer. Please use +[getRecentBlockhash](#getrecentblockhash) for solana-core v1.8 +::: + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +`RpcResponse` - RpcResponse JSON object with `value` field set to a JSON object including: + +- `blockhash: ` - a Hash as base-58 encoded string +- `lastValidBlockHeight: ` - last [block height](../../terminology.md#block-height) at which the blockhash will be valid + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "id":1, + "jsonrpc":"2.0", + "method":"getLatestBlockhash", + "params":[ + { + "commitment":"processed" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 2792 + }, + "value": { + "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N", + "lastValidBlockHeight": 3090 + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getLeaderSchedule.mdx b/docs/src/api/methods/_getLeaderSchedule.mdx new file mode 100644 index 00000000000000..148d166f137800 --- /dev/null +++ b/docs/src/api/methods/_getLeaderSchedule.mdx @@ -0,0 +1,95 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getLeaderSchedule + +Returns the leader schedule for an epoch + + + + +### Parameters: + + +Fetch the leader schedule for the epoch that corresponds to the provided slot. + +
  • If unspecified, the leader schedule for the current epoch is fetched
  • + +
    + + +Configuration object containing the following fields: + + + + + Only return results for this validator identity (base-58 encoded) + + + + +### Result: + +Returns a result with one of the two following values: + +- `` - if requested epoch is not found, or +- `` - the result field will be a dictionary of validator identities, + as base-58 encoded strings, and their corresponding leader slot indices as values + (indices are relative to the first slot in the requested epoch) + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getLeaderSchedule", + "params": [ + null, + { + "identity": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [ + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, + 57, 58, 59, 60, 61, 62, 63 + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getMaxRetransmitSlot.mdx b/docs/src/api/methods/_getMaxRetransmitSlot.mdx new file mode 100644 index 00000000000000..17a104750e5cd6 --- /dev/null +++ b/docs/src/api/methods/_getMaxRetransmitSlot.mdx @@ -0,0 +1,48 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getMaxRetransmitSlot + +Get the max slot seen from retransmit stage. + + + + +### Parameters: + +**None** + +### Result: + +`` - Slot number + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getMaxRetransmitSlot"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 1234, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getMaxShredInsertSlot.mdx b/docs/src/api/methods/_getMaxShredInsertSlot.mdx new file mode 100644 index 00000000000000..d776870ed9cc2c --- /dev/null +++ b/docs/src/api/methods/_getMaxShredInsertSlot.mdx @@ -0,0 +1,48 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getMaxShredInsertSlot + +Get the max slot seen from after shred insert. + + + + +### Parameters: + +**None** + +### Result: + +`` - Slot number + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getMaxShredInsertSlot"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 1234, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx b/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx new file mode 100644 index 00000000000000..36849899effa0d --- /dev/null +++ b/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx @@ -0,0 +1,66 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getMinimumBalanceForRentExemption + +Returns minimum balance required to make account rent exempt. + + + + +### Parameters: + + + the Account's data length + + + +Configuration object containing the following fields: + + + + + +### Result: + +`` - minimum lamports required in the Account to remain rent free + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getMinimumBalanceForRentExemption", + "params": [50] + } +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 500, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getMultipleAccounts.mdx b/docs/src/api/methods/_getMultipleAccounts.mdx new file mode 100644 index 00000000000000..2e4e314179db79 --- /dev/null +++ b/docs/src/api/methods/_getMultipleAccounts.mdx @@ -0,0 +1,143 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getMultipleAccounts + +Returns the account information for a list of Pubkeys. + + + + +### Parameters: + + + An array of Pubkeys to query, as base-58 encoded strings (up to a maximum of + 100) + + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +limit the returned account data using the provided `offset: ` and `length: ` fields; only available for "base58", "base64" or "base64+zstd" encodings. + + + + + +encoding format for the returned Account data + + + +
    + +- `base58` is slow and limited to less than 129 bytes of Account data. +- `base64` will return base64 encoded data for Account data of any size. +- `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) + and base64-encodes the result. +- [`jsonParsed` encoding](/api#parsed-responses) attempts to use program-specific state parsers to + return more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64` + encoding, detectable when the `data` field is type ``. + +
    + +
    + +
    + +### Result: + +The result will be a JSON object with `value` equal to an array of: + +- `` - if the account at that Pubkey doesn't exist, or +- `` - a JSON object containing: + - `lamports: ` - number of lamports assigned to this account, as a u64 + - `owner: ` - base-58 encoded Pubkey of the program this account has been assigned to + - `data: <[string, encoding]|object>` - data associated with the account, either as encoded binary data or JSON format `{: }` - depending on encoding parameter + - `executable: ` - boolean indicating if the account contains a program \(and is strictly read-only\) + - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 + - `size: ` - the data size of the account + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getMultipleAccounts", + "params": [ + [ + "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", + "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" + ], + { + "encoding": "base58" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1 + }, + "value": [ + { + "data": ["", "base64"], + "executable": false, + "lamports": 1000000000, + "owner": "11111111111111111111111111111111", + "rentEpoch": 2, + "space": 16 + }, + { + "data": ["", "base64"], + "executable": false, + "lamports": 5000000000, + "owner": "11111111111111111111111111111111", + "rentEpoch": 2, + "space": 0 + } + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getProgramAccounts.mdx b/docs/src/api/methods/_getProgramAccounts.mdx new file mode 100644 index 00000000000000..9af709d546af56 --- /dev/null +++ b/docs/src/api/methods/_getProgramAccounts.mdx @@ -0,0 +1,168 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getProgramAccounts + +Returns all accounts owned by the provided program Pubkey + + + + +### Parameters: + + + Pubkey of program, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + wrap the result in an RpcResponse JSON object + + + + +encoding format for the returned Account data + + + +
    + +- `base58` is slow and limited to less than 129 bytes of Account data. +- `base64` will return base64 encoded data for Account data of any size. +- `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and + base64-encodes the result. +- [`jsonParsed` encoding](/api#parsed-responses) attempts to use program-specific state + parsers to return more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls back + to `base64` encoding, detectable when the `data` field is type ``. + +
    + +
    + + +limit the returned account data using the provided `offset: usize` and `length: usize` fields; + +- only available for "base58", "base64" or "base64+zstd" encodings. + + + + + +filter results using up to 4 filter objects listed below: + +- `memcmp: object` - compares a provided series of bytes with program account data at a particular offset. Fields: + + - `offset: usize` - offset into program account data to start comparison + - `bytes: string` - data to match, as encoded string + - `encoding: string` - encoding for filter `bytes` data, either "base58" or "base64". Data is limited in size to 128 or fewer decoded bytes. + **NEW: This field, and base64 support generally, is only available in solana-core v1.11.2 or newer. Please omit when querying nodes on earlier versions** + +- `dataSize: u64` - compares the program account data length with the provided data size + +:::info +The resultant account(s) must meet **ALL** filter criteria to be included in the returned results +::: + + + +
    + +### Result: + +By default, the result field will be an array of JSON objects. + +:::info +If `withContext` flag is set the array will be wrapped in an RpcResponse JSON object. +::: + +The resultant response array will contain: + +- `pubkey: ` - the account Pubkey as base-58 encoded string +- `account: ` - a JSON object, with the following sub fields: + - `lamports: ` - number of lamports assigned to this account, as a u64 + - `owner: ` - base-58 encoded Pubkey of the program this account has been assigned to + - `data: <[string,encoding]|object>` - data associated with the account, either as encoded binary data or JSON format `{: }` - depending on encoding parameter + - `executable: ` - boolean indicating if the account contains a program \(and is strictly read-only\) + - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 + - `size: ` - the data size of the account + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getProgramAccounts", + "params": [ + "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + { + "filters": [ + { + "dataSize": 17 + }, + { + "memcmp": { + "offset": 4, + "bytes": "3Mc6vR" + } + } + ] + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "account": { + "data": "2R9jLfiAQ9bgdcw6h8s44439", + "executable": false, + "lamports": 15298080, + "owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "rentEpoch": 28, + "space": 42 + }, + "pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY" + } + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getRecentPerformanceSamples.mdx b/docs/src/api/methods/_getRecentPerformanceSamples.mdx new file mode 100644 index 00000000000000..ce071ddea259b8 --- /dev/null +++ b/docs/src/api/methods/_getRecentPerformanceSamples.mdx @@ -0,0 +1,89 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getRecentPerformanceSamples + +Returns a list of recent performance samples, in reverse slot order. Performance samples are taken every 60 seconds and +include the number of transactions and slots that occur in a given time window. + + + + +### Parameters: + + +number of samples to return (maximum 720) + + + +### Result: + +An array of `RpcPerfSample` with the following fields: + +- `slot: ` - Slot in which sample was taken at +- `numTransactions: ` - Number of transactions in sample +- `numSlots: ` - Number of slots in sample +- `samplePeriodSecs: ` - Number of seconds in a sample window + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0", "id":1, + "method": "getRecentPerformanceSamples", + "params": [4]} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "numSlots": 126, + "numTransactions": 126, + "samplePeriodSecs": 60, + "slot": 348125 + }, + { + "numSlots": 126, + "numTransactions": 126, + "samplePeriodSecs": 60, + "slot": 347999 + }, + { + "numSlots": 125, + "numTransactions": 125, + "samplePeriodSecs": 60, + "slot": 347873 + }, + { + "numSlots": 125, + "numTransactions": 125, + "samplePeriodSecs": 60, + "slot": 347748 + } + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getRecentPrioritizationFees.mdx b/docs/src/api/methods/_getRecentPrioritizationFees.mdx new file mode 100644 index 00000000000000..8c6759bd3ea683 --- /dev/null +++ b/docs/src/api/methods/_getRecentPrioritizationFees.mdx @@ -0,0 +1,94 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getRecentPrioritizationFees + +Returns a list of minimum prioritization fees from recent blocks. + +:::info +Currently, a node's prioritization-fee cache stores data from up to 150 blocks. +::: + + + + +### Parameters: + + + +An array of Account addresses, as base-58 encoded strings + +:::note +If this parameter is provided, the response will reflect the minimum prioritization fee to land a transaction locking all of the provided accounts as writable. +::: + + + +### Result: + +An array of `RpcPrioritizationFee` with the following fields: + +- `slot: ` - Slot in which minimum fee was observed +- `prioritizationFee: ` - Minimum fee paid for a successfully landed transaction + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0", "id":1, + "method": "getRecentPrioritizationFees", + "params": [ + ["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"] + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "slot": 348125, + "prioritizationFee": 0 + }, + { + "slot": 348126, + "prioritizationFee": 1000 + }, + { + "slot": 348127, + "prioritizationFee": 500 + }, + { + "slot": 348128, + "prioritizationFee": 0 + }, + { + "slot": 348129, + "prioritizationFee": 1234 + } + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getSignatureStatuses.mdx b/docs/src/api/methods/_getSignatureStatuses.mdx new file mode 100644 index 00000000000000..61768de62f4c09 --- /dev/null +++ b/docs/src/api/methods/_getSignatureStatuses.mdx @@ -0,0 +1,113 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSignatureStatuses + +Returns the statuses of a list of signatures. + +:::info +Unless the `searchTransactionHistory` configuration parameter is included, +this method only searches the recent status cache of signatures, which +retains statuses for all active slots plus `MAX_RECENT_BLOCKHASHES` rooted slots. +::: + + + + +### Parameters: + + + An array of transaction signatures to confirm, as base-58 encoded strings (up + to a maximum of 256) + + + +Configuration object containing the following fields: + + + +if `true` - a Solana node will search its ledger cache for any signatures not +found in the recent status cache + + + + + +### Result: + +An array of `RpcResponse` consisting of either: + +- `` - Unknown transaction, or +- `` + - `slot: ` - The slot the transaction was processed + - `confirmations: ` - Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster + - `err: ` - Error if transaction failed, null if transaction succeeded. + See [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) + - `confirmationStatus: ` - The transaction's cluster confirmation status; + Either `processed`, `confirmed`, or `finalized`. See [Commitment](/api#configuring-state-commitment) for more on optimistic confirmation. + - DEPRECATED: `status: ` - Transaction status + - `"Ok": ` - Transaction was successful + - `"Err": ` - Transaction failed with TransactionError + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getSignatureStatuses", + "params": [ + [ + "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW" + ], + { + "searchTransactionHistory": true + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 82 + }, + "value": [ + { + "slot": 48, + "confirmations": null, + "err": null, + "status": { + "Ok": null + }, + "confirmationStatus": "finalized" + }, + null + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getSignaturesForAddress.mdx b/docs/src/api/methods/_getSignaturesForAddress.mdx new file mode 100644 index 00000000000000..dcf86d2673200e --- /dev/null +++ b/docs/src/api/methods/_getSignaturesForAddress.mdx @@ -0,0 +1,116 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSignaturesForAddress + +Returns signatures for confirmed transactions that include the given address in +their `accountKeys` list. Returns signatures backwards in time from the +provided signature or most recent confirmed block + + + + +### Parameters: + + + Account address as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + maximum transaction signatures to return (between 1 and 1,000). + + + + start searching backwards from this transaction signature. If not provided the + search starts from the top of the highest max confirmed block. + + + + search until this transaction signature, if found before limit reached + + + + +### Result: + +An array of ``, ordered from **newest** to **oldest** transaction, containing transaction +signature information with the following fields: + +- `signature: ` - transaction signature as base-58 encoded string +- `slot: ` - The slot that contains the block with the transaction +- `err: ` - Error if transaction failed, null if transaction succeeded. + See [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) + for more info. +- `memo: ` - Memo associated with the transaction, null if no memo is present +- `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) + of when transaction was processed. null if not available. +- `confirmationStatus: ` - The transaction's cluster confirmation status; + Either `processed`, `confirmed`, or `finalized`. See [Commitment](/api#configuring-state-commitment) + for more on optimistic confirmation. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getSignaturesForAddress", + "params": [ + "Vote111111111111111111111111111111111111111", + { + "limit": 1 + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": [ + { + "err": null, + "memo": null, + "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", + "slot": 114, + "blockTime": null + } + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getSlot.mdx b/docs/src/api/methods/_getSlot.mdx new file mode 100644 index 00000000000000..d653febb68e00b --- /dev/null +++ b/docs/src/api/methods/_getSlot.mdx @@ -0,0 +1,62 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSlot + +Returns the slot that has reached the [given or default commitment level](/api#configuring-state-commitment) + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +`` - Current slot + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getSlot"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 1234, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getSlotLeader.mdx b/docs/src/api/methods/_getSlotLeader.mdx new file mode 100644 index 00000000000000..6410973d59a448 --- /dev/null +++ b/docs/src/api/methods/_getSlotLeader.mdx @@ -0,0 +1,66 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSlotLeader + +Returns the current slot leader + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +`` - Node identity Pubkey as base-58 encoded string + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getSlotLeader"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": "ENvAW7JScgYq6o4zKZwewtkzzJgDzuJAFxYasvmEQdpS", + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getSlotLeaders.mdx b/docs/src/api/methods/_getSlotLeaders.mdx new file mode 100644 index 00000000000000..386a74fb44de94 --- /dev/null +++ b/docs/src/api/methods/_getSlotLeaders.mdx @@ -0,0 +1,77 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSlotLeaders + +Returns the slot leaders for a given slot range + + + + +### Parameters: + + + Start slot, as u64 integer + + + + Limit, as u64 integer (between 1 and 5,000) + + +### Result: + +`` - array of Node identity public keys as base-58 encoded strings + + + + + +### Code sample: + +If the current slot is `#99` - query the next `10` leaders with the following request: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0", "id": 1, + "method": "getSlotLeaders", + "params": [100, 10] + } +' +``` + +### Response: + +The first leader returned is the leader for slot `#100`: + +```json +{ + "jsonrpc": "2.0", + "result": [ + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", + "DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP", + "DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP" + ], + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getStakeActivation.mdx b/docs/src/api/methods/_getStakeActivation.mdx new file mode 100644 index 00000000000000..0e0527bc430a97 --- /dev/null +++ b/docs/src/api/methods/_getStakeActivation.mdx @@ -0,0 +1,94 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getStakeActivation + +Returns epoch activation information for a stake account + + + + +### Parameters: + + + Pubkey of stake Account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + epoch for which to calculate activation details. If parameter not provided, + defaults to current epoch. + + + + +### Result: + +The result will be a JSON object with the following fields: + +- `state: ` - the stake account's activation state, + either: `active`, `inactive`, `activating`, or `deactivating` +- `active: ` - stake active during the epoch +- `inactive: ` - stake inactive during the epoch + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getStakeActivation", + "params": [ + "CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT", + { + "epoch": 4 + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "active": 124429280, + "inactive": 73287840, + "state": "activating" + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getStakeMinimumDelegation.mdx b/docs/src/api/methods/_getStakeMinimumDelegation.mdx new file mode 100644 index 00000000000000..d093f91f7ae4b8 --- /dev/null +++ b/docs/src/api/methods/_getStakeMinimumDelegation.mdx @@ -0,0 +1,72 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getStakeMinimumDelegation + +Returns the stake minimum delegation, in lamports. + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to: + +- `` - The stake minimum delegation, in lamports + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc":"2.0", "id":1, + "method": "getStakeMinimumDelegation" + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 501 + }, + "value": 1000000000 + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getSupply.mdx b/docs/src/api/methods/_getSupply.mdx new file mode 100644 index 00000000000000..9cb98f03d3ebe6 --- /dev/null +++ b/docs/src/api/methods/_getSupply.mdx @@ -0,0 +1,86 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getSupply + +Returns information about the current supply. + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + exclude non circulating accounts list from response + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: + +- `total: ` - Total supply in lamports +- `circulating: ` - Circulating supply in lamports +- `nonCirculating: ` - Non-circulating supply in lamports +- `nonCirculatingAccounts: ` - an array of account addresses of non-circulating accounts, as strings. If `excludeNonCirculatingAccountsList` is enabled, the returned array will be empty. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0", "id":1, "method":"getSupply"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": { + "circulating": 16000, + "nonCirculating": 1000000, + "nonCirculatingAccounts": [ + "FEy8pTbP5fEoqMV1GdTz83byuA8EKByqYat1PKDgVAq5", + "9huDUZfxoJ7wGMTffUE7vh1xePqef7gyrLJu9NApncqA", + "3mi1GmwEE3zo2jmfDuzvjSX9ovRXsDUKHvsntpkhuLJ9", + "BYxEJTDerkaRWBem3XgnVcdhppktBXa2HbkHPKj2Ui4Z" + ], + "total": 1016000 + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getTokenAccountBalance.mdx b/docs/src/api/methods/_getTokenAccountBalance.mdx new file mode 100644 index 00000000000000..2d1b75c9ccefdb --- /dev/null +++ b/docs/src/api/methods/_getTokenAccountBalance.mdx @@ -0,0 +1,90 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTokenAccountBalance + +Returns the token balance of an SPL Token account. + + + + +### Parameters: + + + Pubkey of Token account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: + +- `amount: ` - the raw balance without decimals, a string representation of u64 +- `decimals: ` - number of base 10 digits to the right of the decimal place +- `uiAmount: ` - the balance, using mint-prescribed decimals **DEPRECATED** +- `uiAmountString: ` - the balance as a string, using mint-prescribed decimals + +For more details on returned data, the [Token Balances Structure](#token-balances-structure) +response from [getBlock](#getblock) follows a similar structure. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getTokenAccountBalance", + "params": [ + "7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": { + "amount": "9864", + "decimals": 2, + "uiAmount": 98.64, + "uiAmountString": "98.64" + }, + "id": 1 + } +} +``` + + + + diff --git a/docs/src/api/methods/_getTokenAccountsByDelegate.mdx b/docs/src/api/methods/_getTokenAccountsByDelegate.mdx new file mode 100644 index 00000000000000..75e786e9196bd3 --- /dev/null +++ b/docs/src/api/methods/_getTokenAccountsByDelegate.mdx @@ -0,0 +1,176 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTokenAccountsByDelegate + +Returns all SPL Token accounts by approved Delegate. + + + + +### Parameters: + + + Pubkey of account delegate to query, as base-58 encoded string + + + + +A JSON object with one of the following fields: + +- `mint: ` - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or +- `programId: ` - Pubkey of the Token program that owns the accounts, as base-58 encoded string + + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +limit the returned account data using the provided `offset: ` +and `length: ` fields; only available for `base58`, +`base64` or `base64+zstd` encodings. + + + + + +Encoding format for Account data + + + +
    + +- `base58` is slow and limited to less than 129 bytes of Account data. +- `base64` will return base64 encoded data for Account data of any size. +- `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) + and base64-encodes the result. +- `jsonParsed` encoding attempts to use program-specific state parsers to return + more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls + back to `base64` encoding, detectable when the `data` field is type `string`. + +
    + +
    + +
    + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain: + +- `pubkey: ` - the account Pubkey as base-58 encoded string +- `account: ` - a JSON object, with the following sub fields: + - `lamports: ` - number of lamports assigned to this account, as a u64 + - `owner: ` - base-58 encoded Pubkey of the program this account has been assigned to + - `data: ` - Token state data associated with the account, either as encoded binary data or in JSON format `{: }` + - `executable: ` - boolean indicating if the account contains a program (and is strictly read-only\) + - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 + - `size: ` - the data size of the account + +When the data is requested with the `jsonParsed` encoding a format similar to that of the +[Token Balances Structure](#token-balances-structure) can be expected inside the structure, +both for the `tokenAmount` and the `delegatedAmount` - with the latter being an optional object. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccountsByDelegate", + "params": [ + "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + { + "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" + }, + { + "encoding": "jsonParsed" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": [ + { + "account": { + "data": { + "program": "spl-token", + "parsed": { + "info": { + "tokenAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "delegatedAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "state": "initialized", + "isNative": false, + "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", + "owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD" + }, + "type": "account" + }, + "space": 165 + }, + "executable": false, + "lamports": 1726080, + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "rentEpoch": 4, + "space": 165 + }, + "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp" + } + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getTokenAccountsByOwner.mdx b/docs/src/api/methods/_getTokenAccountsByOwner.mdx new file mode 100644 index 00000000000000..f7fff459df8fa9 --- /dev/null +++ b/docs/src/api/methods/_getTokenAccountsByOwner.mdx @@ -0,0 +1,175 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTokenAccountsByOwner + +Returns all SPL Token accounts by token owner. + + + + +### Parameters: + + + Pubkey of account delegate to query, as base-58 encoded string + + + + +A JSON object with one of the following fields: + +- `mint: ` - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or +- `programId: ` - Pubkey of the Token program that owns the accounts, as base-58 encoded string + + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +limit the returned account data using the provided `offset: ` +and `length: ` fields; only available for +`base58`, `base64`, or `base64+zstd` encodings. + + + + + +Encoding format for Account data + + + +
    + +- `base58` is slow and limited to less than 129 bytes of Account data. +- `base64` will return base64 encoded data for Account data of any size. +- `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) + and base64-encodes the result. +- `jsonParsed` encoding attempts to use program-specific state parsers to return + more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls + back to `base64` encoding, detectable when the `data` field is type `string`. + +
    + +
    + +
    + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain: + +- `pubkey: ` - the account Pubkey as base-58 encoded string +- `account: ` - a JSON object, with the following sub fields: + - `lamports: ` - number of lamports assigned to this account, as a u64 + - `owner: ` - base-58 encoded Pubkey of the program this account has been assigned to + - `data: ` - Token state data associated with the account, either as encoded binary data or in JSON format `{: }` + - `executable: ` - boolean indicating if the account contains a program \(and is strictly read-only\) + - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 + - `size: ` - the data size of the account + +When the data is requested with the `jsonParsed` encoding a format similar to that of the [Token Balances Structure](/api#token-balances-structure) can be expected inside the structure, both for the `tokenAmount` and the `delegatedAmount` - with the latter being an optional object. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getTokenAccountsByOwner", + "params": [ + "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F", + { + "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" + }, + { + "encoding": "jsonParsed" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": [ + { + "account": { + "data": { + "program": "spl-token", + "parsed": { + "accountType": "account", + "info": { + "tokenAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", + "delegatedAmount": { + "amount": "1", + "decimals": 1, + "uiAmount": 0.1, + "uiAmountString": "0.1" + }, + "state": "initialized", + "isNative": false, + "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", + "owner": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F" + }, + "type": "account" + }, + "space": 165 + }, + "executable": false, + "lamports": 1726080, + "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", + "rentEpoch": 4, + "space": 165 + }, + "pubkey": "C2gJg6tKpQs41PRS1nC8aw3ZKNZK3HQQZGVrDFDup5nx" + } + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getTokenLargestAccounts.mdx b/docs/src/api/methods/_getTokenLargestAccounts.mdx new file mode 100644 index 00000000000000..45452cd829b16a --- /dev/null +++ b/docs/src/api/methods/_getTokenLargestAccounts.mdx @@ -0,0 +1,98 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTokenLargestAccounts + +Returns the 20 largest accounts of a particular SPL Token type. + + + + +### Parameters: + + + Pubkey of the token Mint to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects containing: + +- `address: ` - the address of the token account +- `amount: ` - the raw token account balance without decimals, a string representation of u64 +- `decimals: ` - number of base 10 digits to the right of the decimal place +- `uiAmount: ` - the token account balance, using mint-prescribed decimals **DEPRECATED** +- `uiAmountString: ` - the token account balance as a string, using mint-prescribed decimals + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getTokenLargestAccounts", + "params": [ + "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": [ + { + "address": "FYjHNoFtSQ5uijKrZFyYAxvEr87hsKXkXcxkcmkBAf4r", + "amount": "771", + "decimals": 2, + "uiAmount": 7.71, + "uiAmountString": "7.71" + }, + { + "address": "BnsywxTcaYeNUtzrPxQUvzAWxfzZe3ZLUJ4wMMuLESnu", + "amount": "229", + "decimals": 2, + "uiAmount": 2.29, + "uiAmountString": "2.29" + } + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getTokenSupply.mdx b/docs/src/api/methods/_getTokenSupply.mdx new file mode 100644 index 00000000000000..61c05be2afce67 --- /dev/null +++ b/docs/src/api/methods/_getTokenSupply.mdx @@ -0,0 +1,87 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTokenSupply + +Returns the total supply of an SPL Token type. + + + + +### Parameters: + + + Pubkey of the token Mint to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +### Result: + +The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: + +- `amount: ` - the raw total token supply without decimals, a string representation of u64 +- `decimals: ` - number of base 10 digits to the right of the decimal place +- `uiAmount: ` - the total token supply, using mint-prescribed decimals **DEPRECATED** +- `uiAmountString: ` - the total token supply as a string, using mint-prescribed decimals + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getTokenSupply", + "params": [ + "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1114 + }, + "value": { + "amount": "100000", + "decimals": 2, + "uiAmount": 1000, + "uiAmountString": "1000" + } + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getTransaction.mdx b/docs/src/api/methods/_getTransaction.mdx new file mode 100644 index 00000000000000..0b8ee163ed01fa --- /dev/null +++ b/docs/src/api/methods/_getTransaction.mdx @@ -0,0 +1,171 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTransaction + +Returns transaction details for a confirmed transaction + + + + +### Parameters: + + + Transaction signature, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + Set the max transaction version to return in responses. If the requested + transaction is a higher version, an error will be returned. If this parameter + is omitted, only legacy transactions will be returned, and any versioned + transaction will prompt the error. + + + + +Encoding for the returned Transaction + + + +
    + +- `jsonParsed` encoding attempts to use program-specific state parsers to return + more human-readable and explicit data in the `transaction.message.instructions` list. +- If `jsonParsed` is requested but a parser cannot be found, the instruction + falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). + +
    + +
    + +
    + +### Result: + +- `` - if transaction is not found or not confirmed +- `` - if transaction is confirmed, an object with the following fields: + - `slot: ` - the slot this transaction was processed in + - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter + - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available + - `meta: ` - transaction status metadata object: + - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/transaction/enum.TransactionError.html) + - `fee: ` - fee this transaction was charged, as u64 integer + - `preBalances: ` - array of u64 account balances from before the transaction was processed + - `postBalances: ` - array of u64 account balances after the transaction was processed + - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction + - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction + - DEPRECATED: `status: ` - Transaction status + - `"Ok": ` - Transaction was successful + - `"Err": ` - Transaction failed with TransactionError + - `rewards: ` - transaction-level rewards, populated if rewards are requested; an array of JSON objects containing: + - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward + - `lamports: `- number of reward lamports credited or debited by the account, as a i64 + - `postBalance: ` - account balance in lamports after the reward was applied + - `rewardType: ` - type of reward: currently only "rent", other types may be added in the future + - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards + - `loadedAddresses: ` - Transaction addresses loaded from address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set in request params. + - `writable: ` - Ordered list of base-58 encoded addresses for writable loaded accounts + - `readonly: ` - Ordered list of base-58 encoded addresses for readonly loaded accounts + - `returnData: ` - the most-recent return data generated by an instruction in the transaction, with the following fields: + - `programId: ` - the program that generated the return data, as base-58 encoded Pubkey + - `data: <[string, encoding]>` - the return data itself, as base-64 encoded binary data + - `computeUnitsConsumed: ` - number of [compute units](developing/programming-model/runtime.md#compute-budget) consumed by the transaction + - `version: <"legacy"|number|undefined>` - Transaction version. Undefined if `maxSupportedTransactionVersion` is not set in request params. + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getTransaction", + "params": [ + "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv", + "json" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "meta": { + "err": null, + "fee": 5000, + "innerInstructions": [], + "postBalances": [499998932500, 26858640, 1, 1, 1], + "postTokenBalances": [], + "preBalances": [499998937500, 26858640, 1, 1, 1], + "preTokenBalances": [], + "rewards": [], + "status": { + "Ok": null + } + }, + "slot": 430, + "transaction": { + "message": { + "accountKeys": [ + "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", + "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", + "SysvarS1otHashes111111111111111111111111111", + "SysvarC1ock11111111111111111111111111111111", + "Vote111111111111111111111111111111111111111" + ], + "header": { + "numReadonlySignedAccounts": 0, + "numReadonlyUnsignedAccounts": 3, + "numRequiredSignatures": 1 + }, + "instructions": [ + { + "accounts": [1, 2, 3, 0], + "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", + "programIdIndex": 4 + } + ], + "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" + }, + "signatures": [ + "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" + ] + } + }, + "blockTime": null, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_getTransactionCount.mdx b/docs/src/api/methods/_getTransactionCount.mdx new file mode 100644 index 00000000000000..cbb2a04b9c972c --- /dev/null +++ b/docs/src/api/methods/_getTransactionCount.mdx @@ -0,0 +1,62 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getTransactionCount + +Returns the current Transaction count from the ledger + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +`` - the current Transaction count from the ledger + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getTransactionCount"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 268, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getVersion.mdx b/docs/src/api/methods/_getVersion.mdx new file mode 100644 index 00000000000000..0ed4d94020fd2a --- /dev/null +++ b/docs/src/api/methods/_getVersion.mdx @@ -0,0 +1,51 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getVersion + +Returns the current Solana version running on the node + + + + +### Parameters: + +**None** + +### Result: + +The result field will be a JSON object with the following fields: + +- `solana-core` - software version of solana-core +- `feature-set` - unique identifier of the current software's feature set + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getVersion"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": { "solana-core": "1.15.0" }, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_getVoteAccounts.mdx b/docs/src/api/methods/_getVoteAccounts.mdx new file mode 100644 index 00000000000000..76b227430657d0 --- /dev/null +++ b/docs/src/api/methods/_getVoteAccounts.mdx @@ -0,0 +1,113 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getVoteAccounts + +Returns the account info and associated stake for all the voting accounts in the current bank. + + + + +### Parameters: + + +Configuration object containing the following fields: + + + + + Only return results for this validator vote address (base-58 encoded) + + + + Do not filter out delinquent validators with no stake + + + + Specify the number of slots behind the tip that a validator must fall to be + considered delinquent. **NOTE:** For the sake of consistency between ecosystem + products, _it is **not** recommended that this argument be specified._ + + + + +### Result: + +The result field will be a JSON object of `current` and `delinquent` accounts, +each containing an array of JSON objects with the following sub fields: + +- `votePubkey: ` - Vote account address, as base-58 encoded string +- `nodePubkey: ` - Validator identity, as base-58 encoded string +- `activatedStake: ` - the stake, in lamports, delegated to this vote account and active in this epoch +- `epochVoteAccount: ` - bool, whether the vote account is staked for this epoch +- `commission: ` - percentage (0-100) of rewards payout owed to the vote account +- `lastVote: ` - Most recent slot voted on by this vote account +- `epochCredits: ` - Latest history of earned credits for up to five epochs, as an array of arrays containing: `[epoch, credits, previousCredits]`. +- `rootSlot: ` - Current root slot for this vote account + + + + + +### Code sample: + +Restrict results to a single validator vote account: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getVoteAccounts", + "params": [ + { + "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "current": [ + { + "commission": 0, + "epochVoteAccount": true, + "epochCredits": [ + [1, 64, 0], + [2, 192, 64] + ], + "nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD", + "lastVote": 147, + "activatedStake": 42, + "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" + } + ], + "delinquent": [] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_isBlockhashValid.mdx b/docs/src/api/methods/_isBlockhashValid.mdx new file mode 100644 index 00000000000000..e13cff1ba47b4c --- /dev/null +++ b/docs/src/api/methods/_isBlockhashValid.mdx @@ -0,0 +1,88 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## isBlockhashValid + +Returns whether a blockhash is still valid or not + +:::caution +NEW: This method is only available in solana-core v1.9 or newer. Please use +[getFeeCalculatorForBlockhash](#getfeecalculatorforblockhash) for solana-core v1.8 +::: + + + + +### Parameters: + + + the blockhash of the block to evauluate, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + The minimum slot that the request can be evaluated at + + + + +### Result: + +`` - `true` if the blockhash is still valid + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "id":45, + "jsonrpc":"2.0", + "method":"isBlockhashValid", + "params":[ + "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW", + {"commitment":"processed"} + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 2483 + }, + "value": false + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_minimumLedgerSlot.mdx b/docs/src/api/methods/_minimumLedgerSlot.mdx new file mode 100644 index 00000000000000..1ac63315d972ed --- /dev/null +++ b/docs/src/api/methods/_minimumLedgerSlot.mdx @@ -0,0 +1,52 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## minimumLedgerSlot + +Returns the lowest slot that the node has information about in its ledger. + +:::info +This value may increase over time if the node is configured to purge older ledger data +::: + + + + +### Parameters: + +**None** + +### Result: + +`u64` - Minimum ledger slot number + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"minimumLedgerSlot"} +' +``` + +### Response: + +```json +{ "jsonrpc": "2.0", "result": 1234, "id": 1 } +``` + + + + diff --git a/docs/src/api/methods/_requestAirdrop.mdx b/docs/src/api/methods/_requestAirdrop.mdx new file mode 100644 index 00000000000000..ffe7be2b8dbb41 --- /dev/null +++ b/docs/src/api/methods/_requestAirdrop.mdx @@ -0,0 +1,77 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## requestAirdrop + +Requests an airdrop of lamports to a Pubkey + + + + +### Parameters: + + + Pubkey of account to receive lamports, as a base-58 encoded string + + + + lamports to airdrop, as a "u64" + + + +Configuration object containing the following fields: + + + + + +### Result: + +`` - Transaction Signature of the airdrop, as a base-58 encoded string + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "requestAirdrop", + "params": [ + "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", + 1000000000 + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW", + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_sendTransaction.mdx b/docs/src/api/methods/_sendTransaction.mdx new file mode 100644 index 00000000000000..ab725ff5f99a96 --- /dev/null +++ b/docs/src/api/methods/_sendTransaction.mdx @@ -0,0 +1,123 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## sendTransaction + +Submits a signed transaction to the cluster for processing. + +This method does not alter the transaction in any way; it relays the +transaction created by clients to the node as-is. + +If the node's rpc service receives the transaction, this method immediately +succeeds, without waiting for any confirmations. A successful response from +this method does not guarantee the transaction is processed or confirmed by the +cluster. + +While the rpc service will reasonably retry to submit it, the transaction +could be rejected if transaction's `recent_blockhash` expires before it lands. + +Use [`getSignatureStatuses`](#getsignaturestatuses) to ensure a transaction is processed and confirmed. + +Before submitting, the following preflight checks are performed: + +1. The transaction signatures are verified +2. The transaction is simulated against the bank slot specified by the preflight + commitment. On failure an error will be returned. Preflight checks may be + disabled if desired. It is recommended to specify the same commitment and + preflight commitment to avoid confusing behavior. + +The returned signature is the first signature in the transaction, which +is used to identify the transaction ([transaction id](../../terminology.md#transaction-id)). +This identifier can be easily extracted from the transaction data before +submission. + + + + +### Parameters: + + + Fully-signed Transaction, as encoded string. + + + +Configuration object containing the following optional fields: + + + +Encoding used for the transaction data. + +Values: `base58` (_slow_, **DEPRECATED**), or `base64`. + + + + + if "true", skip the preflight transaction checks + + + + Commitment level to use for preflight. + + + + Maximum number of times for the RPC node to retry sending the transaction to + the leader. If this parameter not provided, the RPC node will retry the + transaction until it is finalized or until the blockhash expires. + + + + set the minimum slot at which to perform preflight transaction checks + + + + +### Result: + +`` - First Transaction Signature embedded in the transaction, as base-58 encoded string ([transaction id](../../terminology.md#transaction-id)) + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "sendTransaction", + "params": [ + "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT" + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb", + "id": 1 +} +``` + + + + diff --git a/docs/src/api/methods/_simulateTransaction.mdx b/docs/src/api/methods/_simulateTransaction.mdx new file mode 100644 index 00000000000000..564ee66f36e836 --- /dev/null +++ b/docs/src/api/methods/_simulateTransaction.mdx @@ -0,0 +1,172 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## simulateTransaction + +Simulate sending a transaction + + + + +### Parameters: + + + +Transaction, as an encoded string. + +:::note +The transaction must have a valid blockhash, but is not required to be signed. +::: + + + + +Configuration object containing the following fields: + + + Commitment level to simulate the transaction at + + + + if `true` the transaction signatures will be verified (conflicts with + `replaceRecentBlockhash`) + + + + if `true` the transaction recent blockhash will be replaced with the most + recent blockhash. (conflicts with `sigVerify`) + + + + the minimum slot that the request can be evaluated at + + + + +Encoding used for the transaction data. + +Values: `base58` (_slow_, **DEPRECATED**), or `base64`. + + + + +Accounts configuration object containing the following fields: + + + An `array` of accounts to return, as base-58 encoded strings + + + + +encoding for returned Account data + + + +
    + +- `jsonParsed` encoding attempts to use program-specific state + parsers to return more human-readable and explicit account state data. +- If `jsonParsed` is requested but a parser cannot be found, the field falls + back to binary encoding, detectable when the `data` field is type `string`. + +
    + +
    + +
    + +
    + +### Result: + +The result will be an RpcResponse JSON object with `value` set to a JSON object with the following fields: + +- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) +- `logs: ` - Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure) +- `accounts: ` - array of accounts with the same length as the `accounts.addresses` array in the request + - `` - if the account doesn't exist or if `err` is not null + - `` - otherwise, a JSON object containing: + - `lamports: ` - number of lamports assigned to this account, as a u64 + - `owner: ` - base-58 encoded Pubkey of the program this account has been assigned to + - `data: <[string, encoding]|object>` - data associated with the account, either as encoded binary data or JSON format `{: }` - depending on encoding parameter + - `executable: ` - boolean indicating if the account contains a program \(and is strictly read-only\) + - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 +- `unitsConsumed: ` - The number of compute budget units consumed during the processing of this transaction +- `returnData: ` - the most-recent return data generated by an instruction in the transaction, with the following fields: + - `programId: ` - the program that generated the return data, as base-58 encoded Pubkey + - `data: <[string, encoding]>` - the return data itself, as base-64 encoded binary data + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "simulateTransaction", + "params": [ + "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=", + { + "encoding":"base64", + } + ] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 218 + }, + "value": { + "err": null, + "accounts": null, + "logs": [ + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri invoke [1]", + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri consumed 2366 of 1400000 compute units", + "Program return: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri KgAAAAAAAAA=", + "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success" + ], + "returnData": { + "data": ["Kg==", "base64"], + "programId": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" + }, + "unitsConsumed": 2366 + } + }, + "id": 1 +} +``` + + + + From 51855f3bb2dcdc90e7c84d5b77a7395ca6ce2589 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:43:32 -0500 Subject: [PATCH 06/28] fix: more deprecated partials --- .../src/api/deprecated/_getConfirmedBlock.mdx | 168 ++++++++++++++++++ .../api/deprecated/_getRecentBlockhash.mdx | 86 +++++++++ 2 files changed, 254 insertions(+) create mode 100644 docs/src/api/deprecated/_getConfirmedBlock.mdx create mode 100644 docs/src/api/deprecated/_getRecentBlockhash.mdx diff --git a/docs/src/api/deprecated/_getConfirmedBlock.mdx b/docs/src/api/deprecated/_getConfirmedBlock.mdx new file mode 100644 index 00000000000000..5e482fab91ba1b --- /dev/null +++ b/docs/src/api/deprecated/_getConfirmedBlock.mdx @@ -0,0 +1,168 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getConfirmedBlock + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0. +**Please use [getBlock](#getblock) instead** +::: + +Returns identity and transaction information about a confirmed block in the ledger + + + + + +### Parameters: + + + slot number, as u64 integer + + + +Configuration object containing the following fields: + + + + + level of transaction detail to return, either "full", "signatures", or "none" + + + + whether to populate the `rewards` array. + + + + +Encoding format for Account data + + + +
    + +- `jsonParsed` encoding attempts to use program-specific instruction parsers to return + more human-readable and explicit data in the `transaction.message.instructions` list. +- If `jsonParsed` is requested but a parser cannot be found, the instruction + falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). + +
    + +
    + +
    + +### Result: + +The result field will be an object with the following fields: + +- `` - if specified block is not confirmed +- `` - if block is confirmed, an object with the following fields: + - `blockhash: ` - the blockhash of this block, as base-58 encoded string + - `previousBlockhash: ` - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111" + - `parentSlot: ` - the slot index of this block's parent + - `transactions: ` - present if "full" transaction details are requested; an array of JSON objects containing: + - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter + - `meta: ` - transaction status metadata object, containing `null` or: + - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) + - `fee: ` - fee this transaction was charged, as u64 integer + - `preBalances: ` - array of u64 account balances from before the transaction was processed + - `postBalances: ` - array of u64 account balances after the transaction was processed + - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction + - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction + - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction + - DEPRECATED: `status: ` - Transaction status + - `"Ok": ` - Transaction was successful + - `"Err": ` - Transaction failed with TransactionError + - `signatures: ` - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block + - `rewards: ` - present if rewards are requested; an array of JSON objects containing: + - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward + - `lamports: `- number of reward lamports credited or debited by the account, as a i64 + - `postBalance: ` - account balance in lamports after the reward was applied + - `rewardType: ` - type of reward: "fee", "rent", "voting", "staking" + - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards + - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available + +#### For more details on returned data: + +- [Transaction Structure](#transaction-structure) +- [Inner Instructions Structure](#inner-instructions-structure) +- [Token Balances Structure](#token-balances-structure) + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", "id": 1, + "method": "getConfirmedBlock", + "params": [430, "base64"] + } +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "blockTime": null, + "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", + "parentSlot": 429, + "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", + "rewards": [], + "transactions": [ + { + "meta": { + "err": null, + "fee": 5000, + "innerInstructions": [], + "logMessages": [], + "postBalances": [499998932500, 26858640, 1, 1, 1], + "postTokenBalances": [], + "preBalances": [499998937500, 26858640, 1, 1, 1], + "preTokenBalances": [], + "status": { + "Ok": null + } + }, + "transaction": [ + "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==", + "base64" + ] + } + ] + }, + "id": 1 +} +``` + + + + diff --git a/docs/src/api/deprecated/_getRecentBlockhash.mdx b/docs/src/api/deprecated/_getRecentBlockhash.mdx new file mode 100644 index 00000000000000..f2e9a023e17be8 --- /dev/null +++ b/docs/src/api/deprecated/_getRecentBlockhash.mdx @@ -0,0 +1,86 @@ +import { + DocBlock, + DocSideBySide, + CodeParams, + Parameter, + Field, + Values, + CodeSnippets, +} from "../../../components/CodeDocBlock"; + + + +## getRecentBlockhash + +:::warning DEPRECATED +This method is expected to be removed in solana-core v2.0 +**Please use [getLatestBlockhash](#getlatestblockhash) instead** +::: + +Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it. + + + + + +### Parameters: + + + Pubkey of account to query, as base-58 encoded string + + + +Configuration object containing the following fields: + + + + + +### Result: + +An RpcResponse containing a JSON object consisting of a string blockhash and FeeCalculator JSON object. + +- `RpcResponse` - RpcResponse JSON object with `value` field set to a JSON object including: +- `blockhash: ` - a Hash as base-58 encoded string +- `feeCalculator: ` - FeeCalculator object, the fee schedule for this block hash + + + + + +### Code sample: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + {"jsonrpc":"2.0","id":1, "method":"getRecentBlockhash"} +' +``` + +### Response: + +```json +{ + "jsonrpc": "2.0", + "result": { + "context": { + "slot": 1 + }, + "value": { + "blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", + "feeCalculator": { + "lamportsPerSignature": 5000 + } + } + }, + "id": 1 +} +``` + + + + From 1e4d6133fc7cb549c4cd0dcdd95afa4ead00a59c Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:44:07 -0500 Subject: [PATCH 07/28] feat: codeblock component and styles --- docs/components/CodeDocBlock.jsx | 161 +++++++++++++++++++++++++ docs/src/pages/CodeDocBlock.module.css | 80 ++++++++++++ 2 files changed, 241 insertions(+) create mode 100644 docs/components/CodeDocBlock.jsx create mode 100644 docs/src/pages/CodeDocBlock.module.css diff --git a/docs/components/CodeDocBlock.jsx b/docs/components/CodeDocBlock.jsx new file mode 100644 index 00000000000000..8e2212938bb2ca --- /dev/null +++ b/docs/components/CodeDocBlock.jsx @@ -0,0 +1,161 @@ +import React from "react"; +import Link from "@docusaurus/Link"; +// import clsx from "clsx"; +import styles from "../src/pages/CodeDocBlock.module.css"; + +export function DocBlock({ children }) { + return
    {children}
    ; +} + +export function DocSideBySide({ children }) { + return
    {children}
    ; +} + +export function CodeParams({ children }) { + return
    {children}
    ; +} + +export function CodeSnippets({ children }) { + return ( +
    + {/*

    Code Sample:

    */} + + {children} +
    + ); +} + +/* + Display a single Parameter +*/ +export function Parameter(props) { + const { + name = null, + type = null, + required = null, + optional = null, + children, + } = computeHeader(props); + + return ( +
    +

    + {name && name} {type && type} {required && required}{" "} + {optional && optional} +

    + + {children} +
    + ); +} + +/* + Display a single Parameter's field data +*/ +export function Field(props) { + const { + name = null, + type = null, + values = null, + required = null, + defaultValue = null, + optional = null, + children, + } = computeHeader(props); + + return ( +
    +

    + {name && name} {type && type} {required && required}{" "} + {optional && optional} + {defaultValue && defaultValue} +

    + +
    + {values && values} + + {children} +
    +
    + ); +} + +/* + Parse an array of string values to display +*/ +export function Values({ values = null }) { + // format the Parameter's values + if (values && Array.isArray(values) && values?.length) { + values = values.map((value) => ( + + {value} + + )); + } + + return ( +

    + Values: {values} +

    + ); +} + +/* + Compute the formatted Parameter and Field component's header meta data +*/ +function computeHeader({ + name = null, + type = null, + href = null, + values = null, + required = null, + defaultValue = null, + optional = null, + children, +}) { + // format the Parameter's name + if (name) { + name = {name}; + + if (href) name = {name}; + } + + // format the Parameter's type + if (type) type = {type}; + + // format the Parameter's values + if (values && Array.isArray(values)) { + values = values.map((value) => ( + {value} + )); + } + + // format the `defaultValue` flag + if (defaultValue) { + defaultValue = ( + + Default: {defaultValue.toString()} + + ); + } + + // format the `required` flag + if (required) { + required = required; + } + // format the `optional` flag + else if (optional) { + optional = optional; + } + + return { + name, + type, + href, + values, + required, + defaultValue, + optional, + children, + }; +} diff --git a/docs/src/pages/CodeDocBlock.module.css b/docs/src/pages/CodeDocBlock.module.css new file mode 100644 index 00000000000000..7cffc5625bd7a0 --- /dev/null +++ b/docs/src/pages/CodeDocBlock.module.css @@ -0,0 +1,80 @@ +/* stylelint-disable docusaurus/copyright-header */ + +.DocBlock { + border-top: 1px solid #414141; + padding-top: 3rem; + /* display: flex; */ + /* justify-content: space-between; */ + margin-top: 5rem; + /* width: 100%; */ + /* align-items: center; */ +} + +.DocSideBySide { + margin-top: 2rem; +} + +.CodeParams { + display: block; + width: 100%; +} + +.CodeSnippets { + display: block; + width: 100%; +} + +@media screen and (min-width: 768px) { + .DocSideBySide { + display: flex; + width: 100%; + } + .CodeParams { + margin-right: 3rem; + width: 50%; + } + .CodeSnippets { + width: 50%; + } +} + +.Parameter { + padding: 1em 0em; + margin-bottom: 1em; + border-top: 1px solid #414141; + /* // border-bottom: 1px solid #414141; */ +} + +.ParameterName { + font-weight: 700; +} + +.ParameterHeader { + font-family: mono; + padding: 0.1em 0em; +} + +.Field { + /* // padding: 1em 0em; */ + margin: 1em 0em 1em 1em; + /* // border-top: 1px solid #414141; */ + /* // border-bottom: 1px solid #414141; */ +} +.Field section { + padding: 0em 1em; +} + +.FlagItem { + margin: 0 0.5rem; + color: #767676; + font-weight: 600; +} + +.Heading { + font-size: 1.24rem; + font-weight: 700; +} +.SubHeading { + /* font-size: 1.24rem; */ + font-weight: 600; +} From 6a796bf1ec13186f52fd44ed33cfd312acfb56c7 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:44:22 -0500 Subject: [PATCH 08/28] feat: api http methods page --- docs/src/api/http.md | 406 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 406 insertions(+) create mode 100644 docs/src/api/http.md diff --git a/docs/src/api/http.md b/docs/src/api/http.md new file mode 100644 index 00000000000000..107db9eeb4ec33 --- /dev/null +++ b/docs/src/api/http.md @@ -0,0 +1,406 @@ +--- +title: JSON RPC HTTP Methods +displayed_sidebar: apiHttpMethodsSidebar +hide_table_of_contents: true +--- + +Solana nodes accept HTTP requests using the [JSON-RPC 2.0](https://www.jsonrpc.org/specification) specification. + +:::info +For JavaScript applications, use the [@solana/web3.js](https://github.com/solana-labs/solana-web3.js) library as a convenient interface for the RPC methods to interact with a Solana node. + +For an PubSub connection to a Solana node, use the [Websocket API](./websocket.md). +::: + +## RPC HTTP Endpoint + +**Default port:** 8899 e.g. [http://localhost:8899](http://localhost:8899), [http://192.168.1.88:8899](http://192.168.1.88:8899) + +## Request Formatting + +To make a JSON-RPC request, send an HTTP POST request with a `Content-Type: application/json` header. The JSON request data should contain 4 fields: + +- `jsonrpc: ` - set to `"2.0"` +- `id: ` - a unique client-generated identifying integer +- `method: ` - a string containing the method to be invoked +- `params: ` - a JSON array of ordered parameter values + +Example using curl: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getBalance", + "params": [ + "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" + ] + } +' +``` + +The response output will be a JSON object with the following fields: + +- `jsonrpc: ` - matching the request specification +- `id: ` - matching the request identifier +- `result: ` - requested data or success confirmation + +Requests can be sent in batches by sending an array of JSON-RPC request objects as the data for a single POST. + +## Definitions + +- Hash: A SHA-256 hash of a chunk of data. +- Pubkey: The public key of a Ed25519 key-pair. +- Transaction: A list of Solana instructions signed by a client keypair to authorize those actions. +- Signature: An Ed25519 signature of transaction's payload data including instructions. This can be used to identify transactions. + +## Configuring State Commitment + +For preflight checks and transaction processing, Solana nodes choose which bank +state to query based on a commitment requirement set by the client. The +commitment describes how finalized a block is at that point in time. When +querying the ledger state, it's recommended to use lower levels of commitment +to report progress and higher levels to ensure the state will not be rolled back. + +In descending order of commitment (most finalized to least finalized), clients +may specify: + +- `"finalized"` - the node will query the most recent block confirmed by supermajority + of the cluster as having reached maximum lockout, meaning the cluster has + recognized this block as finalized +- `"confirmed"` - the node will query the most recent block that has been voted on by supermajority of the cluster. + - It incorporates votes from gossip and replay. + - It does not count votes on descendants of a block, only direct votes on that block. + - This confirmation level also upholds "optimistic confirmation" guarantees in + release 1.3 and onwards. +- `"processed"` - the node will query its most recent block. Note that the block + may still be skipped by the cluster. + +For processing many dependent transactions in series, it's recommended to use +`"confirmed"` commitment, which balances speed with rollback safety. +For total safety, it's recommended to use`"finalized"` commitment. + +#### Example + +The commitment parameter should be included as the last element in the `params` array: + +```bash +curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' + { + "jsonrpc": "2.0", + "id": 1, + "method": "getBalance", + "params": [ + "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", + { + "commitment": "finalized" + } + ] + } +' +``` + +#### Default: + +If commitment configuration is not provided, the node will default to `"finalized"` commitment + +Only methods that query bank state accept the commitment parameter. They are indicated in the API Reference below. + +#### RpcResponse Structure + +Many methods that take a commitment parameter return an RpcResponse JSON object comprised of two parts: + +- `context` : An RpcResponseContext JSON structure including a `slot` field at which the operation was evaluated. +- `value` : The value returned by the operation itself. + +#### Parsed Responses + +Some methods support an `encoding` parameter, and can return account or +instruction data in parsed JSON format if `"encoding":"jsonParsed"` is requested +and the node has a parser for the owning program. Solana nodes currently support +JSON parsing for the following native and SPL programs: + +| Program | Account State | Instructions | +| ---------------------------- | ------------- | ------------ | +| Address Lookup | v1.15.0 | v1.15.0 | +| BPF Loader | n/a | stable | +| BPF Upgradeable Loader | stable | stable | +| Config | stable | | +| SPL Associated Token Account | n/a | stable | +| SPL Memo | n/a | stable | +| SPL Token | stable | stable | +| SPL Token 2022 | stable | stable | +| Stake | stable | stable | +| Vote | stable | stable | + +The list of account parsers can be found [here](https://github.com/solana-labs/solana/blob/master/account-decoder/src/parse_account_data.rs), and instruction parsers [here](https://github.com/solana-labs/solana/blob/master/transaction-status/src/parse_instruction.rs). + +## Health Check + +Although not a JSON RPC API, a `GET /health` at the RPC HTTP Endpoint provides a +health-check mechanism for use by load balancers or other network +infrastructure. This request will always return a HTTP 200 OK response with a body of +"ok", "behind" or "unknown" based on the following conditions: + +1. If one or more `--known-validator` arguments are provided to `solana-validator` - "ok" is returned + when the node has within `HEALTH_CHECK_SLOT_DISTANCE` slots of the highest + known validator, otherwise "behind". "unknown" is returned when no slot + information from known validators is not yet available. +2. "ok" is always returned if no known validators are provided. + +## JSON RPC API Reference + +import GetAccountInfo from "./methods/\_getAccountInfo.mdx" + + + +import GetBalance from "./methods/\_getBalance.mdx" + + + +import GetBlock from "./methods/\_getBlock.mdx" + + + +import GetBlockHeight from "./methods/\_getBlockHeight.mdx" + + + +import GetBlockProduction from "./methods/\_getBlockProduction.mdx" + + + +import GetBlockCommitment from "./methods/\_getBlockCommitment.mdx" + + + +import GetBlocks from "./methods/\_getBlocks.mdx" + + + +import GetBlocksWithLimit from "./methods/\_getBlocksWithLimit.mdx" + + + +import GetBlockTime from "./methods/\_getBlockTime.mdx" + + + +import GetClusterNodes from "./methods/\_getClusterNodes.mdx" + + + +import GetEpochInfo from "./methods/\_getEpochInfo.mdx" + + + +import GetEpochSchedule from "./methods/\_getEpochSchedule.mdx" + + + +import GetFeeForMessage from "./methods/\_getFeeForMessage.mdx" + + + +import GetFirstAvailableBlock from "./methods/\_getFirstAvailableBlock.mdx" + + + +import GetGenesisHash from "./methods/\_getGenesisHash.mdx" + + + +import GetHealth from "./methods/\_getHealth.mdx" + + + +import GetHighestSnapshotSlot from "./methods/\_getHighestSnapshotSlot.mdx" + + + +import GetIdentity from "./methods/\_getIdentity.mdx" + + + +import GetInflationGovernor from "./methods/\_getInflationGovernor.mdx" + + + +import GetInflationRate from "./methods/\_getInflationRate.mdx" + + + +import GetInflationReward from "./methods/\_getInflationReward.mdx" + + + +import GetLargestAccounts from "./methods/\_getLargestAccounts.mdx" + + + +import GetLatestBlockhash from "./methods/\_getLatestBlockhash.mdx" + + + +import GetLeaderSchedule from "./methods/\_getLeaderSchedule.mdx" + + + +import GetMaxRetransmitSlot from "./methods/\_getMaxRetransmitSlot.mdx" + + + +import GetMaxShredInsertSlot from "./methods/\_getMaxShredInsertSlot.mdx" + + + +import GetMinimumBalanceForRentExemption from "./methods/\_getMinimumBalanceForRentExemption.mdx" + + + +import GetMultipleAccounts from "./methods/\_getMultipleAccounts.mdx" + + + +import GetProgramAccounts from "./methods/\_getProgramAccounts.mdx" + + + +import GetRecentPerformanceSamples from "./methods/\_getRecentPerformanceSamples.mdx" + + + +import GetRecentPrioritizationFees from "./methods/\_getRecentPrioritizationFees.mdx" + + + +import GetSignaturesForAddress from "./methods/\_getSignaturesForAddress.mdx" + + + +import GetSignatureStatuses from "./methods/\_getSignatureStatuses.mdx" + + + +import GetSlot from "./methods/\_getSlot.mdx" + + + +import GetSlotLeader from "./methods/\_getSlotLeader.mdx" + + + +import GetSlotLeaders from "./methods/\_getSlotLeaders.mdx" + + + +import GetStakeActivation from "./methods/\_getStakeActivation.mdx" + + + +import GetStakeMinimumDelegation from "./methods/\_getStakeMinimumDelegation.mdx" + + + +import GetSupply from "./methods/\_getSupply.mdx" + + + +import GetTokenAccountBalance from "./methods/\_getTokenAccountBalance.mdx" + + + +import GetTokenAccountsByDelegate from "./methods/\_getTokenAccountsByDelegate.mdx" + + + +import GetTokenAccountsByOwner from "./methods/\_getTokenAccountsByOwner.mdx" + + + +import GetTokenLargestAccounts from "./methods/\_getTokenLargestAccounts.mdx" + + + +import GetTokenSupply from "./methods/\_getTokenSupply.mdx" + + + +import GetTransaction from "./methods/\_getTransaction.mdx" + + + +import GetTransactionCount from "./methods/\_getTransactionCount.mdx" + + + +import GetVersion from "./methods/\_getVersion.mdx" + + + +import GetVoteAccounts from "./methods/\_getVoteAccounts.mdx" + + + +import IsBlockhashValid from "./methods/\_isBlockhashValid.mdx" + + + +import MinimumLedgerSlot from "./methods/\_minimumLedgerSlot.mdx" + + + +import RequestAirdrop from "./methods/\_requestAirdrop.mdx" + + + +import SendTransaction from "./methods/\_sendTransaction.mdx" + + + +import SimulateTransaction from "./methods/\_simulateTransaction.mdx" + + + +## JSON RPC API Deprecated Methods + +import GetConfirmedBlock from "./deprecated/\_getConfirmedBlock.mdx" + + + +import GetConfirmedBlocks from "./deprecated/\_getConfirmedBlocks.mdx" + + + +import GetConfirmedBlocksWithLimit from "./deprecated/\_getConfirmedBlocksWithLimit.mdx" + + + +import GetConfirmedSignaturesForAddress2 from "./deprecated/\_getConfirmedSignaturesForAddress2.mdx" + + + +import GetConfirmedTransaction from "./deprecated/\_getConfirmedTransaction.mdx" + + + +import GetFeeCalculatorForBlockhash from "./deprecated/\_getFeeCalculatorForBlockhash.mdx" + + + +import GetFeeRateGovernor from "./deprecated/\_getFeeRateGovernor.mdx" + + + +import GetFees from "./deprecated/\_getFees.mdx" + + + +import GetRecentBlockhash from "./deprecated/\_getRecentBlockhash.mdx" + + + +import GetSnapshotSlot from "./deprecated/\_getSnapshotSlot.mdx" + + From d79916ec721aa400404c51e9333369e49896fc10 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:44:45 -0500 Subject: [PATCH 09/28] feat: sidebar --- docs/sidebars.js | 6 +- docs/sidebars/api.js | 492 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 496 insertions(+), 2 deletions(-) create mode 100644 docs/sidebars/api.js diff --git a/docs/sidebars.js b/docs/sidebars.js index cb77015c7e4267..eccc85c00aaf03 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -1,4 +1,6 @@ module.exports = { + // load the API specific sidebars file + ...require("./sidebars/api.js"), introductionSidebar: [ { type: "category", @@ -195,8 +197,8 @@ module.exports = { label: "Clients", items: [ { - type: "doc", - id: "developing/clients/jsonrpc-api", + type: "link", + href: "/api", label: "JSON RPC API", }, { diff --git a/docs/sidebars/api.js b/docs/sidebars/api.js new file mode 100644 index 00000000000000..53e15baf099f85 --- /dev/null +++ b/docs/sidebars/api.js @@ -0,0 +1,492 @@ +module.exports = { + apiSidebar: [ + { + type: "link", + href: "/api", + label: "JSON RPC API", + }, + { + type: "doc", + id: "api/http", + label: "HTTP Methods", + }, + { + type: "doc", + id: "api/websocket", + label: "Websocket Methods", + }, + ], + apiHttpMethodsSidebar: [ + { + type: "link", + href: "/api", + label: "JSON RPC API", + }, + { + type: "doc", + id: "api/websocket", + label: "Websocket Methods", + }, + { + type: "category", + link: { type: "doc", id: "api/http" }, + label: "HTTP Methods", + collapsed: false, + items: [ + { + type: "link", + href: "#getaccountinfo", + label: "getAccountInfo", + }, + { + type: "link", + href: "#getbalance", + label: "getBalance", + }, + { + type: "link", + href: "#getblockheight", + label: "getBlockHeight", + }, + { + type: "link", + href: "#getblock", + label: "getBlock", + }, + { + type: "link", + href: "#getblockproduction", + label: "getBlockProduction", + }, + { + type: "link", + href: "#getblockcommitment", + label: "getBlockCommitment", + }, + { + type: "link", + href: "#getblocks", + label: "getBlocks", + }, + { + type: "link", + href: "#getblockswithlimit", + label: "getBlocksWithLimit", + }, + { + type: "link", + href: "#getblocktime", + label: "getBlockTime", + }, + { + type: "link", + href: "#getclusternodes", + label: "getClusterNodes", + }, + { + type: "link", + href: "#getepochinfo", + label: "getEpochInfo", + }, + { + type: "link", + href: "#getepochschedule", + label: "getEpochSchedule", + }, + { + type: "link", + href: "#getfeeformessage", + label: "getFeeForMessage", + }, + { + type: "link", + href: "#getfirstavailableblock", + label: "getFirstAvailableBlock", + }, + { + type: "link", + href: "#getgenesishash", + label: "getGenesisHash", + }, + { + type: "link", + href: "#gethealth", + label: "getHealth", + }, + { + type: "link", + href: "#gethighestsnapshotslot", + label: "getHighestSnapshotSlot", + }, + { + type: "link", + href: "#getidentity", + label: "getIdentity", + }, + { + type: "link", + href: "#getinflationgovernor", + label: "getInflationGovernor", + }, + { + type: "link", + href: "#getinflationrate", + label: "getInflationRate", + }, + { + type: "link", + href: "#getinflationreward", + label: "getInflationReward", + }, + { + type: "link", + href: "#getlargestaccounts", + label: "getLargestAccounts", + }, + { + type: "link", + href: "#getlatestblockhash", + label: "getLatestBlockhash", + }, + { + type: "link", + href: "#getleaderschedule", + label: "getLeaderSchedule", + }, + { + type: "link", + href: "#getmaxretransmitslot", + label: "getMaxRetransmitSlot", + }, + { + type: "link", + href: "#getmaxshredinsertslot", + label: "getMaxShredInsertSlot", + }, + { + type: "link", + href: "#getminimumbalanceforrentexemption", + label: "getMinimumBalanceForRentExemption", + }, + { + type: "link", + href: "#getmultipleaccounts", + label: "getMultipleAccounts", + }, + { + type: "link", + href: "#getprogramaccounts", + label: "getProgramAccounts", + }, + { + type: "link", + href: "#getrecentperformancesamples", + label: "getRecentPerformanceSamples", + }, + { + type: "link", + href: "#getrecentprioritizationfees", + label: "getRecentPrioritizationFees", + }, + { + type: "link", + href: "#getsignaturesforaddress", + label: "getSignaturesForAddress", + }, + { + type: "link", + href: "#getsignaturestatuses", + label: "getSignatureStatuses", + }, + { + type: "link", + href: "#getslot", + label: "getSlot", + }, + { + type: "link", + href: "#getslotleader", + label: "getSlotLeader", + }, + { + type: "link", + href: "#getslotleaders", + label: "getSlotLeaders", + }, + { + type: "link", + href: "#getstakeactivation", + label: "getStakeActivation", + }, + { + type: "link", + href: "#getstakeminimumdelegation", + label: "getStakeMinimumDelegation", + }, + { + type: "link", + href: "#getsupply", + label: "getSupply", + }, + { + type: "link", + href: "#gettokenaccountbalance", + label: "getTokenAccountBalance", + }, + { + type: "link", + href: "#gettokenaccountsbydelegate", + label: "getTokenAccountsByDelegate", + }, + { + type: "link", + href: "#gettokenaccountsbyowner", + label: "getTokenAccountsByOwner", + }, + { + type: "link", + href: "#gettokenlargestaccounts", + label: "getTokenLargestAccounts", + }, + { + type: "link", + href: "#gettokensupply", + label: "getTokenSupply", + }, + { + type: "link", + href: "#gettransaction", + label: "getTransaction", + }, + { + type: "link", + href: "#gettransactioncount", + label: "getTransactionCount", + }, + { + type: "link", + href: "#getversion", + label: "getVersion", + }, + { + type: "link", + href: "#getvoteaccounts", + label: "getVoteAccounts", + }, + { + type: "link", + href: "#isblockhashvalid", + label: "isBlockhashValid", + }, + { + type: "link", + href: "#minimumledgerslot", + label: "minimumLedgerSlot", + }, + { + type: "link", + href: "#requestairdrop", + label: "requestAirdrop", + }, + { + type: "link", + href: "#sendtransaction", + label: "sendTransaction", + }, + { + type: "link", + href: "#simulatetransaction", + label: "simulateTransaction", + }, + ], + }, + // { + // type: "category", + // label: "Unstable Methods", + // collapsed: true, + // items: [ + // { + // type: "link", + // href: "#blocksubscribe", + // label: "blockSubscribe", + // }, + // ], + // }, + { + type: "category", + label: "Deprecated Methods", + collapsed: true, + items: [ + { + type: "link", + href: "#getconfirmedblock", + label: "getConfirmedBlock", + }, + { + type: "link", + href: "#getconfirmedblocks", + label: "getConfirmedBlocks", + }, + { + type: "link", + href: "#getconfirmedblockswithlimit", + label: "getConfirmedBlocksWithLimit", + }, + { + type: "link", + href: "#getconfirmedsignaturesforaddress2", + label: "getConfirmedSignaturesForAddress2", + }, + { + type: "link", + href: "#getconfirmedtransaction", + label: "getConfirmedTransaction", + }, + { + type: "link", + href: "#getfeecalculatorforblockhash", + label: "getFeeCalculatorForBlockhash", + }, + { + type: "link", + href: "#getfeerategovernor", + label: "getFeeRateGovernor", + }, + { + type: "link", + href: "#getfees", + label: "getFees", + }, + { + type: "link", + href: "#getrecentblockhash", + label: "getRecentBlockhash", + }, + { + type: "link", + href: "#getsnapshotslot", + label: "getSnapshotSlot", + }, + ], + }, + ], + apiWebsocketMethodsSidebar: [ + { + type: "link", + href: "/api", + label: "JSON RPC API", + }, + { + type: "doc", + id: "api/http", + label: "HTTP Methods", + }, + { + type: "category", + link: { type: "doc", id: "api/websocket" }, + label: "Websocket Methods", + collapsed: false, + items: [ + { + type: "link", + href: "#accountsubscribe", + label: "accountSubscribe", + }, + { + type: "link", + href: "#accountunsubscribe", + label: "accountUnsubscribe", + }, + { + type: "link", + href: "#logssubscribe", + label: "logsSubscribe", + }, + { + type: "link", + href: "#logsunsubscribe", + label: "logsUnsubscribe", + }, + { + type: "link", + href: "#programsubscribe", + label: "programSubscribe", + }, + { + type: "link", + href: "#programunsubscribe", + label: "programUnsubscribe", + }, + { + type: "link", + href: "#signaturesubscribe", + label: "signatureSubscribe", + }, + { + type: "link", + href: "#signatureunsubscribe", + label: "signatureUnsubscribe", + }, + { + type: "link", + href: "#slotsubscribe", + label: "slotSubscribe", + }, + { + type: "link", + href: "#slotunsubscribe", + label: "slotUnsubscribe", + }, + ], + }, + { + type: "category", + label: "Unstable Methods", + collapsed: false, + items: [ + { + type: "link", + href: "#blocksubscribe", + label: "blockSubscribe", + }, + { + type: "link", + href: "#blockunsubscribe", + label: "blockUnsubscribe", + }, + { + type: "link", + href: "#slotsupdatessubscribe", + label: "slotsUpdatesSubscribe", + }, + { + type: "link", + href: "#slotsupdatesunsubscribe", + label: "slotsUpdatesUnsubscribe", + }, + { + type: "link", + href: "#votesubscribe", + label: "voteSubscribe", + }, + { + type: "link", + href: "#voteunsubscribe", + label: "voteUnsubscribe", + }, + ], + }, + // { + // type: "category", + // label: "Deprecated Methods", + // collapsed: true, + // items: [ + // { + // type: "link", + // href: "#getconfirmedblock", + // label: "getConfirmedBlock", + // }, + // ], + // }, + ], +}; From 54ba3dc163e80d3b16c986252e315f6be91c228f Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:54:33 -0500 Subject: [PATCH 10/28] refactor: proposal api links --- .../rpc-transaction-history.md | 14 +++++++------- docs/src/implemented-proposals/transaction-fees.md | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/src/implemented-proposals/rpc-transaction-history.md b/docs/src/implemented-proposals/rpc-transaction-history.md index 4853d19e6f2290..c8eb878eae45ce 100644 --- a/docs/src/implemented-proposals/rpc-transaction-history.md +++ b/docs/src/implemented-proposals/rpc-transaction-history.md @@ -10,13 +10,13 @@ fall back to the external data store. The affected RPC endpoints are: -- [getFirstAvailableBlock](developing/clients/jsonrpc-api.md#getfirstavailableblock) -- [getConfirmedBlock](developing/clients/jsonrpc-api.md#getconfirmedblock) -- [getConfirmedBlocks](developing/clients/jsonrpc-api.md#getconfirmedblocks) -- [getConfirmedSignaturesForAddress](developing/clients/jsonrpc-api.md#getconfirmedsignaturesforaddress) -- [getConfirmedTransaction](developing/clients/jsonrpc-api.md#getconfirmedtransaction) -- [getSignatureStatuses](developing/clients/jsonrpc-api.md#getsignaturestatuses) -- [getBlockTime](developing/clients/jsonrpc-api.md#getblocktime) +- [getFirstAvailableBlock](../api/http#getfirstavailableblock) +- [getConfirmedBlock](../api/http#getconfirmedblock) +- [getConfirmedBlocks](../api/http#getconfirmedblocks) +- [getConfirmedSignaturesForAddress](../api/http#getconfirmedsignaturesforaddress) +- [getConfirmedTransaction](../api/http#getconfirmedtransaction) +- [getSignatureStatuses](../api/http#getsignaturestatuses) +- [getBlockTime](../api/http#getblocktime) Some system design constraints: diff --git a/docs/src/implemented-proposals/transaction-fees.md b/docs/src/implemented-proposals/transaction-fees.md index 02245647b594c0..042db21a50af76 100644 --- a/docs/src/implemented-proposals/transaction-fees.md +++ b/docs/src/implemented-proposals/transaction-fees.md @@ -6,14 +6,14 @@ title: Deterministic Transaction Fees Before sending a transaction to the cluster, a client may query the network to determine what the transaction's fee will be via the rpc request -[getFeeForMessage](/developing/clients/jsonrpc-api#getfeeformessage). +[getFeeForMessage](../api/http#getfeeformessage). ## Fee Parameters The fee is based on the number of signatures in the transaction, the more signatures a transaction contains, the higher the fee. In addition, a transaction can specify an additional fee that determines how the transaction is -relatively prioritized against others. A transaction's prioritization fee is +relatively prioritized against others. A transaction's prioritization fee is calculated by multiplying the number of compute units by the compute unit price (measured in micro-lamports) set by the transaction via compute budget instructions. From b122c22a21007c20c3c8f96e50143e98dda73072 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 18:58:23 -0500 Subject: [PATCH 11/28] refactor: internal linking --- docs/src/cluster/rpc-endpoints.md | 12 ++++++------ docs/src/developing/clients/javascript-api.md | 2 +- docs/src/developing/clients/javascript-reference.md | 4 ++-- docs/src/developing/test-validator.md | 6 +++--- docs/src/developing/versioned-transactions.md | 2 +- docs/src/transaction_fees.md | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/src/cluster/rpc-endpoints.md b/docs/src/cluster/rpc-endpoints.md index 9ae28f7cd5c3b3..50173fa9087334 100644 --- a/docs/src/cluster/rpc-endpoints.md +++ b/docs/src/cluster/rpc-endpoints.md @@ -2,7 +2,7 @@ title: Solana Cluster RPC Endpoints --- -Solana maintains dedicated api nodes to fulfill [JSON-RPC](developing/clients/jsonrpc-api.md) +Solana maintains dedicated api nodes to fulfill [JSON-RPC](/api) requests for each public cluster, and third parties may as well. Here are the public RPC endpoints currently available and recommended for each public cluster: @@ -36,7 +36,7 @@ public RPC endpoints currently available and recommended for each public cluster ## Mainnet Beta -#### Endpoints* +#### Endpoints\* - `https://api.mainnet-beta.solana.com` - Solana-hosted api node cluster, backed by a load balancer; rate-limited @@ -48,7 +48,7 @@ public RPC endpoints currently available and recommended for each public cluster - Maximum connection rate per 10 seconds per IP: 40 - Maximum amount of data per 30 second: 100 MB -*The public RPC endpoints are not intended for production applications. Please +\*The public RPC endpoints are not intended for production applications. Please use dedicated/private RPC servers when you launch your application, drop NFTs, etc. The public services are subject to abuse and rate limits may change without prior notice. Likewise, high-traffic websites may be blocked without @@ -58,6 +58,6 @@ prior notice. - 403 -- Your IP address or website has been blocked. It is time to run your own RPC server(s) or find a private service. - 429 -- Your IP address is exceeding the rate limits. Slow down! Use the -[Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) -HTTP response header to determine how long to wait before making another -request. + [Retry-After](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) + HTTP response header to determine how long to wait before making another + request. diff --git a/docs/src/developing/clients/javascript-api.md b/docs/src/developing/clients/javascript-api.md index 862905b39bc71d..8dad0f46a00698 100644 --- a/docs/src/developing/clients/javascript-api.md +++ b/docs/src/developing/clients/javascript-api.md @@ -4,7 +4,7 @@ title: Web3 JavaScript API ## What is Solana-Web3.js? -The Solana-Web3.js library aims to provide complete coverage of Solana. The library was built on top of the [Solana JSON RPC API](../clients/jsonrpc-api.md). +The Solana-Web3.js library aims to provide complete coverage of Solana. The library was built on top of the [Solana JSON RPC API](/api). You can find the full documentation for the `@solana/web3.js` library [here](https://solana-labs.github.io/solana-web3.js/). diff --git a/docs/src/developing/clients/javascript-reference.md b/docs/src/developing/clients/javascript-reference.md index 91b346bee64342..4d7dfd6c9a962b 100644 --- a/docs/src/developing/clients/javascript-reference.md +++ b/docs/src/developing/clients/javascript-reference.md @@ -4,7 +4,7 @@ title: Web3 API Reference ## Web3 API Reference Guide -The `@solana/web3.js` library is a package that has coverage over the [Solana JSON RPC API](../clients/jsonrpc-api.md). +The `@solana/web3.js` library is a package that has coverage over the [Solana JSON RPC API](/api). You can find the full documentation for the `@solana/web3.js` library [here](https://solana-labs.github.io/solana-web3.js/). @@ -14,7 +14,7 @@ You can find the full documentation for the `@solana/web3.js` library [here](htt [Source Documentation](https://solana-labs.github.io/solana-web3.js/classes/Connection.html) -Connection is used to interact with the [Solana JSON RPC](../clients/jsonrpc-api.md). You can use Connection to confirm transactions, get account info, and more. +Connection is used to interact with the [Solana JSON RPC](/api). You can use Connection to confirm transactions, get account info, and more. You create a connection by defining the JSON RPC cluster endpoint and the desired commitment. Once this is complete, you can use this connection object to interact with any of the Solana JSON RPC API. diff --git a/docs/src/developing/test-validator.md b/docs/src/developing/test-validator.md index 72dea3ea4a0878..b835692a9a4668 100644 --- a/docs/src/developing/test-validator.md +++ b/docs/src/developing/test-validator.md @@ -140,7 +140,7 @@ JSON RPC URL: http://127.0.0.1:8899 ``` - The network address of the [Gossip](/validator/gossip#gossip-overview), - [Transaction Processing Unit](/validator/tpu) and [JSON RPC](clients/jsonrpc-api#json-rpc-api-reference) + [Transaction Processing Unit](/validator/tpu) and [JSON RPC](../api/http#json-rpc-api-reference) service, respectively ``` @@ -148,7 +148,7 @@ JSON RPC URL: http://127.0.0.1:8899 ``` - Session running time, current slot of the the three block - [commitment levels](clients/jsonrpc-api#configuring-state-commitment), + [commitment levels](../api/http#configuring-state-commitment), slot height of the last snapshot, transaction count, [voting authority](/running-validator/vote-accounts#vote-authority) balance @@ -166,4 +166,4 @@ Since this may not always be desired, especially when testing programs meant for ```bash solana-test-validator --deactivate-feature --deactivate-feature -``` \ No newline at end of file +``` diff --git a/docs/src/developing/versioned-transactions.md b/docs/src/developing/versioned-transactions.md index 410325bf159ca4..eaf7902ae34553 100644 --- a/docs/src/developing/versioned-transactions.md +++ b/docs/src/developing/versioned-transactions.md @@ -16,7 +16,7 @@ The Solana runtime supports two transaction versions: ## Max supported transaction version -All RPC requests that return a transaction **_should_** specify the highest version of transactions they will support in their application using the `maxSupportedTransactionVersion` option, including [`getBlock`](./clients/jsonrpc-api.md#getblock) and [`getTransaction`](./clients/jsonrpc-api.md#gettransaction). +All RPC requests that return a transaction **_should_** specify the highest version of transactions they will support in their application using the `maxSupportedTransactionVersion` option, including [`getBlock`](../api/http#getblock) and [`getTransaction`](../api/http#gettransaction). An RPC request will fail if a [Versioned Transaction](./versioned-transactions.md) is returned that is higher than the set `maxSupportedTransactionVersion`. (i.e. if a version `0` transaction is returned when `legacy` is selected) diff --git a/docs/src/transaction_fees.md b/docs/src/transaction_fees.md index dd29e5949c4ffa..154933df496236 100644 --- a/docs/src/transaction_fees.md +++ b/docs/src/transaction_fees.md @@ -65,7 +65,7 @@ Since each transaction may require a different amount of computational resources The execution of each instruction within a transaction consumes a different number of _compute units_. After the maximum number of _compute units_ has been consumed (aka compute budget exhaustion), the runtime will halt the transaction and return an error. This results in a failed transaction. -> **Learn more:** compute units and the [Compute Budget](./developing/programming-model/runtime#compute-budget) in the Runtime and [requesting a fee estimate](./developing/clients/jsonrpc-api.md#getfeeformessage) from the RPC. +> **Learn more:** compute units and the [Compute Budget](./developing/programming-model/runtime#compute-budget) in the Runtime and [requesting a fee estimate](../api/http#getfeeformessage) from the RPC. ## Prioritization fee From 12fdc5ebd97d459bbde424487669ac3e74feceac Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:01:17 -0500 Subject: [PATCH 12/28] refactor: more internal links --- docs/src/developing/clients/rust-api.md | 2 +- docs/src/developing/intro/rent.md | 2 +- docs/src/developing/programming-model/accounts.md | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/src/developing/clients/rust-api.md b/docs/src/developing/clients/rust-api.md index 25e99ae1606154..5f74cf78df32bc 100644 --- a/docs/src/developing/clients/rust-api.md +++ b/docs/src/developing/clients/rust-api.md @@ -19,7 +19,7 @@ Some important crates: that do not run on-chain will import this. - [`solana-client`] — For interacting with a Solana node via the - [JSON RPC API](jsonrpc-api). + [JSON RPC API](/api). - [`solana-cli-config`] — Loading and saving the Solana CLI configuration file. diff --git a/docs/src/developing/intro/rent.md b/docs/src/developing/intro/rent.md index 05cdebb948abf1..544608efe4551a 100644 --- a/docs/src/developing/intro/rent.md +++ b/docs/src/developing/intro/rent.md @@ -21,7 +21,7 @@ Currently, the rent rate is a static amount and stored in the the [Rent sysvar]( Accounts that maintain a minimum LAMPORT balance greater than 2 years worth of rent payments are considered "_rent exempt_" and will not incur a rent collection. -> At the time of writing this, new Accounts and Programs **are required** to be initialized with enough LAMPORTS to become rent-exempt. The RPC endpoints have the ability to calculate this [estimated rent exempt balance](../clients/jsonrpc-api.md#getminimumbalanceforrentexemption) and is recommended to be used. +> At the time of writing this, new Accounts and Programs **are required** to be initialized with enough LAMPORTS to become rent-exempt. The RPC endpoints have the ability to calculate this [estimated rent exempt balance](../../api/http#getminimumbalanceforrentexemption) and is recommended to be used. Every time an account's balance is reduced, a check is performed to see if the account is still rent exempt. Transactions that would cause an account's balance to drop below the rent exempt threshold will fail. diff --git a/docs/src/developing/programming-model/accounts.md b/docs/src/developing/programming-model/accounts.md index 814b6fa8b809f1..09265b7bcabec7 100644 --- a/docs/src/developing/programming-model/accounts.md +++ b/docs/src/developing/programming-model/accounts.md @@ -148,10 +148,12 @@ that would reduce the balance to below the minimum amount will fail. Program executable accounts are required by the runtime to be rent-exempt to avoid being purged. -Note: Use the [`getMinimumBalanceForRentExemption` RPC -endpoint](developing/clients/jsonrpc-api.md#getminimumbalanceforrentexemption) to calculate the +:::info +Use the [`getMinimumBalanceForRentExemption`](../../api/http#getminimumbalanceforrentexemption) RPC +endpoint to calculate the minimum balance for a particular account size. The following calculation is illustrative only. +::: For example, a program executable with the size of 15,000 bytes requires a balance of 105,290,880 lamports (=~ 0.105 SOL) to be rent-exempt: From 8c6839168c0d3cfb47f466ffb2ae3d1c70754cf5 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:07:22 -0500 Subject: [PATCH 13/28] refactor: internal link and note cards --- docs/src/getstarted/hello-world.md | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/src/getstarted/hello-world.md b/docs/src/getstarted/hello-world.md index fa129a07f3d635..beb8eacf5fc3e6 100644 --- a/docs/src/getstarted/hello-world.md +++ b/docs/src/getstarted/hello-world.md @@ -44,8 +44,9 @@ Next, import the project into your local workspace by clicking the "**Import**" Normally with [local development](./local.md), you will need to create a file system wallet for use with the Solana CLI. But with the Solana Playground, you only need to click a few buttons to create a browser based wallet. -> **Note:** -> Your _Playground Wallet_ will be saved in your browser's local storage. Clearing your browser cache will remove your saved wallet. When creating a new wallet, you will have the option to save a local copy of your wallet's keypair file. +:::caution +Your _Playground Wallet_ will be saved in your browser's local storage. Clearing your browser cache will remove your saved wallet. When creating a new wallet, you will have the option to save a local copy of your wallet's keypair file. +::: Click on the red status indicator button at the bottom left of the screen, (optionally) save your wallet's keypair file to your computer for backup, then click "**Continue**". @@ -103,8 +104,9 @@ If you look at the Playground's terminal, you should see your Solana program beg ![Viewing a successful build of your Rust based program](/img/quickstarts/solana-get-started-successful-build.png) -> Note: -> You may receive _warning_ when your program is compiled due to unused variables. Don't worry, these warning will not affect your build. They are due to our very simple program not using all the variables we declared in the `process_instruction` function. +:::caution +You may receive _warning_ when your program is compiled due to unused variables. Don't worry, these warning will not affect your build. They are due to our very simple program not using all the variables we declared in the `process_instruction` function. +::: ### Deploy your program @@ -137,8 +139,9 @@ Once you have successfully deployed a Solana program to the blockchain, you will Like most developers creating dApps and websites, we will interact with our on chain program using JavaScript. Specifically, will use the open source [NPM package](https://www.npmjs.com/package/@solana/web3.js) `@solana/web3.js` to aid in our client application. -> **NOTE:** -> This web3.js package is an abstraction layer on top of the [JSON RPC API](./../developing/clients/jsonrpc-api.md) that reduced the need for rewriting common boilerplate, helping to simplify your client side application code. +:::info +This web3.js package is an abstraction layer on top of the [JSON RPC API](/api) that reduced the need for rewriting common boilerplate, helping to simplify your client side application code. +::: ### Initialize client @@ -154,8 +157,9 @@ We have created `client` folder and a default `client.ts`. This is where we will In playground, there are many utilities that are globally available for us to use without installing or setting up anything. Most important ones for our `hello world` program are `web3` for `@solana/web3.js` and `pg` for Solana Playground utilities. -> Note: -> You can go over all of the available globals by pressing `CTRL+SPACE` (or `CMD+SPACE` on macOS) inside the editor. +:::info +You can go over all of the available globals by pressing `CTRL+SPACE` (or `CMD+SPACE` on macOS) inside the editor. +::: ### Call the program @@ -191,8 +195,9 @@ const txHash = await web3.sendAndConfirmTransaction( console.log("Transaction sent with hash:", txHash); ``` -> Note: -> The first signer in the signers array is the transaction fee payer by default. We are signing with our keypair `pg.wallet.keypair`. +:::info +The first signer in the signers array is the transaction fee payer by default. We are signing with our keypair `pg.wallet.keypair`. +::: ### Run the application From 010bd0e77ee5980fef3e1cb7327c93651499a1b8 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:09:27 -0500 Subject: [PATCH 14/28] refactor: local links --- docs/src/integrations/exchange.md | 19 +++++++++---------- .../src/integrations/retrying-transactions.md | 16 ++++++++-------- docs/src/running-validator/validator-stake.md | 2 +- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/docs/src/integrations/exchange.md b/docs/src/integrations/exchange.md index 7d4e741022da3f..02306f4332d6d4 100644 --- a/docs/src/integrations/exchange.md +++ b/docs/src/integrations/exchange.md @@ -156,7 +156,7 @@ We recommend using a unique deposit account for each of your users. Solana accounts must be made rent-exempt by containing 2-years worth of [rent](developing/programming-model/accounts.md#rent) in SOL. In order to find the minimum rent-exempt balance for your deposit accounts, query the -[`getMinimumBalanceForRentExemption` endpoint](developing/clients/jsonrpc-api.md#getminimumbalanceforrentexemption): +[`getMinimumBalanceForRentExemption` endpoint](../api/http#getminimumbalanceforrentexemption): ```bash curl localhost:8899 -X POST -H "Content-Type: application/json" -d '{ @@ -218,7 +218,7 @@ To track all the deposit accounts for your exchange, poll for each confirmed block and inspect for addresses of interest, using the JSON-RPC service of your Solana API node. -- To identify which blocks are available, send a [`getBlocks` request](developing/clients/jsonrpc-api.md#getblocks), +- To identify which blocks are available, send a [`getBlocks`](../api/http#getblocks) request, passing the last block you have already processed as the start-slot parameter: ```bash @@ -235,7 +235,7 @@ curl https://api.devnet.solana.com -X POST -H "Content-Type: application/json" - Not every slot produces a block, so there may be gaps in the sequence of integers. -- For each block, request its contents with a [`getBlock` request](developing/clients/jsonrpc-api.md#getblock): +- For each block, request its contents with a [`getBlock`](../api/http#getblock) request: ### Block Fetching Tips @@ -352,7 +352,7 @@ generally _not_ a viable method for tracking all your deposit addresses over all slots, but may be useful for examining a few accounts for a specific period of time. -- Send a [`getSignaturesForAddress`](developing/clients/jsonrpc-api.md#getsignaturesforaddress) +- Send a [`getSignaturesForAddress`](../api/http#getsignaturesforaddress) request to the api node: ```bash @@ -402,7 +402,7 @@ curl localhost:8899 -X POST -H "Content-Type: application/json" -d '{ ``` - For each signature returned, get the transaction details by sending a - [`getTransaction`](developing/clients/jsonrpc-api.md#gettransaction) request: + [`getTransaction`](../api/http#gettransaction) request: ```bash curl https://api.devnet.solana.com -X POST -H 'Content-Type: application/json' -d '{ @@ -544,8 +544,7 @@ before retrying a withdrawal transfer that does not appear to have been confirmed or finalized by the cluster. Otherwise, you risk a double spend. See more on [blockhash expiration](#blockhash-expiration) below. -First, get a recent blockhash using the [`getFees` endpoint](developing/clients/jsonrpc-api.md#getfees) -or the CLI command: +First, get a recent blockhash using the [`getFees`](../api/http#getfees) endpoint or the CLI command: ```bash solana fees --url http://localhost:8899 @@ -559,12 +558,12 @@ solana transfer --no-wait --allow-unfunded-recipient --b ``` You can also build, sign, and serialize the transaction manually, and fire it off to -the cluster using the JSON-RPC [`sendTransaction` endpoint](developing/clients/jsonrpc-api.md#sendtransaction). +the cluster using the JSON-RPC [`sendTransaction`](../api/http#sendtransaction) endpoint. #### Transaction Confirmations & Finality Get the status of a batch of transactions using the -[`getSignatureStatuses` JSON-RPC endpoint](developing/clients/jsonrpc-api.md#getsignaturestatuses). +[`getSignatureStatuses`](../api/http#getsignaturestatuses) JSON-RPC endpoint. The `confirmations` field reports how many [confirmed blocks](../terminology.md#confirmed-block) have elapsed since the transaction was processed. If `confirmations: null`, it is [finalized](../terminology.md#finality). @@ -615,7 +614,7 @@ curl localhost:8899 -X POST -H "Content-Type: application/json" -d '{ #### Blockhash Expiration You can check whether a particular blockhash is still valid by sending a -[`getFeeCalculatorForBlockhash`](developing/clients/jsonrpc-api.md#getfeecalculatorforblockhash) +[`getFeeCalculatorForBlockhash`](../api/http#getfeecalculatorforblockhash) request with the blockhash as a parameter. If the response value is `null`, the blockhash is expired, and the withdrawal transaction using that blockhash should never succeed. diff --git a/docs/src/integrations/retrying-transactions.md b/docs/src/integrations/retrying-transactions.md index 66c59c205cdaf4..c2d7ff24be2292 100644 --- a/docs/src/integrations/retrying-transactions.md +++ b/docs/src/integrations/retrying-transactions.md @@ -38,7 +38,7 @@ so that they can be processed into a block. There are two main ways in which a transaction can be sent to leaders: 1. By proxy via an RPC server and the - [sendTransaction](../developing/clients/jsonrpc-api#sendtransaction) + [sendTransaction](../api/http#sendtransaction) JSON-RPC method 2. Directly to leaders via a [TPU Client](https://docs.rs/solana-client/1.7.3/solana_client/tpu_client/index.html) @@ -138,7 +138,7 @@ is queried from the advanced part of the pool (Backend A). When the transaction is submitted to the lagging part of the pool (Backend B), the nodes will not recognize the advanced blockhash and will drop the transaction. This can be detected upon transaction submission if developers enable -[preflight checks](../developing/clients/jsonrpc-api#sendtransaction) +[preflight checks](../api/http#sendtransaction) on `sendTransaction`. ![Dropped via RPC Pool](../../static/img/rt-dropped-via-rpc-pool.png) @@ -190,7 +190,7 @@ the transaction will be processed or finalized by the cluster. - `skipPreflight`: `boolean` - if true, skip the preflight transaction checks (default: false) - (optional) `preflightCommitment`: `string` - - [Commitment](../developing/clients/jsonrpc-api#configuring-state-commitment) + [Commitment](../api/http#configuring-state-commitment) level to use for preflight simulations against the bank slot (default: "finalized"). - (optional) `encoding`: `string` - Encoding used for the transaction data. @@ -204,7 +204,7 @@ Response - `transaction id`: `string` - First transaction signature embedded in the transaction, as base-58 encoded string. This transaction id can be used with - [getSignatureStatuses](../developing/clients/jsonrpc-api#getsignaturestatuses) + [`getSignatureStatuses`](../api/http#getsignaturestatuses) to poll for status updates. ::: @@ -219,9 +219,9 @@ developers to manually control the retry process A common pattern for manually retrying transactions involves temporarily storing the `lastValidBlockHeight` that comes from -[getLatestBlockhash](../developing/clients/jsonrpc-api#getlatestblockhash). +[getLatestBlockhash](../api/http#getlatestblockhash). Once stashed, an application can then -[poll the cluster’s blockheight](../developing/clients/jsonrpc-api#getblockheight) +[poll the cluster’s blockheight](../api/http#getblockheight) and manually retry the transaction at an appropriate interval. In times of network congestion, it’s advantageous to set `maxRetries` to 0 and manually rebroadcast via a custom algorithm. While some applications may employ an @@ -289,7 +289,7 @@ const sleep = async (ms: number) => { When polling via `getLatestBlockhash`, applications should specify their intended -[commitment](../developing/clients/jsonrpc-api#configuring-state-commitment) +[commitment](../api/http#configuring-state-commitment) level. By setting its commitment to `confirmed` (voted on) or `finalized` (~30 blocks after `confirmed`), an application can avoid polling a blockhash from a minority fork. @@ -331,6 +331,6 @@ In Solana, a dropped transaction can be safely discarded once the blockhash it references is older than the `lastValidBlockHeight` received from `getLatestBlockhash`. Developers should keep track of this `lastValidBlockHeight` by querying -[`getEpochInfo`](../developing/clients/jsonrpc-api#getepochinfo) +[`getEpochInfo`](../api/http#getepochinfo) and comparing with `blockHeight` in the response. Once a blockhash is invalidated, clients may re-sign with a newly-queried blockhash. diff --git a/docs/src/running-validator/validator-stake.md b/docs/src/running-validator/validator-stake.md index de1034fd9a4999..ae430ae9675c8f 100644 --- a/docs/src/running-validator/validator-stake.md +++ b/docs/src/running-validator/validator-stake.md @@ -71,7 +71,7 @@ account. This is a normal transaction so the standard transaction fee will apply. The transaction fee range is defined by the genesis block. The actual fee will fluctuate based on transaction load. You can determine the current fee via the -[RPC API “getRecentBlockhash”](developing/clients/jsonrpc-api.md#getrecentblockhash) +[RPC API “getRecentBlockhash”](../api/http#getrecentblockhash) before submitting a transaction. Learn more about [transaction fees here](../implemented-proposals/transaction-fees.md). From a2737e0512f54eef5c028d9c458720446c6f56ee Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:11:12 -0500 Subject: [PATCH 15/28] refactor: local links and auto save prettier --- docs/src/running-validator/validator-start.md | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/docs/src/running-validator/validator-start.md b/docs/src/running-validator/validator-start.md index 69966e28865c0a..dd4e6366740db4 100644 --- a/docs/src/running-validator/validator-start.md +++ b/docs/src/running-validator/validator-start.md @@ -81,6 +81,7 @@ sudo sysctl -p /etc/sysctl.d/21-solana-validator.conf ``` ##### **Increase systemd and session file limits** + Add ``` @@ -226,14 +227,14 @@ Read more about the [difference between SOL and lamports here](../introduction.m ## Create Authorized Withdrawer Account If you haven't already done so, create an authorized-withdrawer keypair to be used -as the ultimate authority over your validator. This keypair will have the +as the ultimate authority over your validator. This keypair will have the authority to withdraw from your vote account, and will have the additional -authority to change all other aspects of your vote account. Needless to say, +authority to change all other aspects of your vote account. Needless to say, this is a very important keypair as anyone who possesses it can make any changes to your vote account, including taking ownership of it permanently. So it is very important to keep your authorized-withdrawer keypair in a safe -location. It does not need to be stored on your validator, and should not be -stored anywhere from where it could be accessed by unauthorized parties. To +location. It does not need to be stored on your validator, and should not be +stored anywhere from where it could be accessed by unauthorized parties. To create your authorized-withdrawer keypair: ```bash @@ -363,7 +364,7 @@ WantedBy=multi-user.target Now create `/home/sol/bin/validator.sh` to include the desired `solana-validator` command-line. Ensure that the 'exec' command is used to -start the validator process (i.e. "exec solana-validator ..."). This is +start the validator process (i.e. "exec solana-validator ..."). This is important because without it, logrotate will end up killing the validator every time the logs are rotated. @@ -474,13 +475,13 @@ command-line arguments and restart the validator. As the number of populated accounts on the cluster grows, account-data RPC requests that scan the entire account set -- like -[`getProgramAccounts`](developing/clients/jsonrpc-api.md#getprogramaccounts) and -[SPL-token-specific requests](developing/clients/jsonrpc-api.md#gettokenaccountsbydelegate) -- +[`getProgramAccounts`](../api/http#getprogramaccounts) and +[SPL-token-specific requests](../api/http#gettokenaccountsbydelegate) -- may perform poorly. If your validator needs to support any of these requests, you can use the `--account-index` parameter to activate one or more in-memory account indexes that significantly improve RPC performance by indexing accounts by the key field. Currently supports the following parameter values: -- `program-id`: each account indexed by its owning program; used by [`getProgramAccounts`](developing/clients/jsonrpc-api.md#getprogramaccounts) -- `spl-token-mint`: each SPL token account indexed by its token Mint; used by [getTokenAccountsByDelegate](developing/clients/jsonrpc-api.md#gettokenaccountsbydelegate), and [getTokenLargestAccounts](developing/clients/jsonrpc-api.md#gettokenlargestaccounts) -- `spl-token-owner`: each SPL token account indexed by the token-owner address; used by [getTokenAccountsByOwner](developing/clients/jsonrpc-api.md#gettokenaccountsbyowner), and [`getProgramAccounts`](developing/clients/jsonrpc-api.md#getprogramaccounts) requests that include an spl-token-owner filter. +- `program-id`: each account indexed by its owning program; used by [getProgramAccounts](../api/http#getprogramaccounts) +- `spl-token-mint`: each SPL token account indexed by its token Mint; used by [getTokenAccountsByDelegate](../api/http#gettokenaccountsbydelegate), and [getTokenLargestAccounts](../api/http#gettokenlargestaccounts) +- `spl-token-owner`: each SPL token account indexed by the token-owner address; used by [getTokenAccountsByOwner](../api/http#gettokenaccountsbyowner), and [getProgramAccounts](../api/http#getprogramaccounts) requests that include an spl-token-owner filter. From 461cb58d421ff3c0c7852e7aa2201c90d0e5ea8f Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:27:53 -0500 Subject: [PATCH 16/28] feat: added numNonVoteTransaction data details --- .../api/methods/_getRecentPerformanceSamples.mdx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/src/api/methods/_getRecentPerformanceSamples.mdx b/docs/src/api/methods/_getRecentPerformanceSamples.mdx index ce071ddea259b8..0d746c1fb9a8db 100644 --- a/docs/src/api/methods/_getRecentPerformanceSamples.mdx +++ b/docs/src/api/methods/_getRecentPerformanceSamples.mdx @@ -33,6 +33,15 @@ An array of `RpcPerfSample` with the following fields: - `numTransactions: ` - Number of transactions in sample - `numSlots: ` - Number of slots in sample - `samplePeriodSecs: ` - Number of seconds in a sample window +- `numNonVoteTransaction: ` - Number of non-vote transactions in + sample. + +:::info +`numNonVoteTransaction` is present starting with v1.15. + +To get a number of voting transactions compute:
    +`numTransactions - numNonVoteTransaction` +::: @@ -58,24 +67,28 @@ curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' { "numSlots": 126, "numTransactions": 126, + "numNonVoteTransaction": 1, "samplePeriodSecs": 60, "slot": 348125 }, { "numSlots": 126, "numTransactions": 126, + "numNonVoteTransaction": 1, "samplePeriodSecs": 60, "slot": 347999 }, { "numSlots": 125, "numTransactions": 125, + "numNonVoteTransaction": 0, "samplePeriodSecs": 60, "slot": 347873 }, { "numSlots": 125, "numTransactions": 125, + "numNonVoteTransaction": 0, "samplePeriodSecs": 60, "slot": 347748 } From 28d57b18d1dfb6d69b61e155a60d21e995dd0a35 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:32:50 -0500 Subject: [PATCH 17/28] fix: updated getRecentPrioritizationFees --- docs/src/api/methods/_getRecentPrioritizationFees.mdx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/src/api/methods/_getRecentPrioritizationFees.mdx b/docs/src/api/methods/_getRecentPrioritizationFees.mdx index 8c6759bd3ea683..c0e8919c5ba825 100644 --- a/docs/src/api/methods/_getRecentPrioritizationFees.mdx +++ b/docs/src/api/methods/_getRecentPrioritizationFees.mdx @@ -12,7 +12,7 @@ import { ## getRecentPrioritizationFees -Returns a list of minimum prioritization fees from recent blocks. +Returns a list of prioritization fees from recent blocks. :::info Currently, a node's prioritization-fee cache stores data from up to 150 blocks. @@ -25,7 +25,7 @@ Currently, a node's prioritization-fee cache stores data from up to 150 blocks. -An array of Account addresses, as base-58 encoded strings +An array of Account addresses (up to a maximum of 128 addresses), as base-58 encoded strings :::note If this parameter is provided, the response will reflect the minimum prioritization fee to land a transaction locking all of the provided accounts as writable. @@ -37,8 +37,9 @@ If this parameter is provided, the response will reflect the minimum prioritizat An array of `RpcPrioritizationFee` with the following fields: -- `slot: ` - Slot in which minimum fee was observed -- `prioritizationFee: ` - Minimum fee paid for a successfully landed transaction +- `slot: ` - slot in which the fee was observed +- `prioritizationFee: ` - the per-compute-unit fee paid by at least + one successfully landed transaction, specified in increments of 0.000001 lamports From be42a34821c85060ec56d9c912eef2f243ec00b9 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:48:19 -0500 Subject: [PATCH 18/28] fix: corrected wording --- docs/src/api/methods/_getRecentPrioritizationFees.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/api/methods/_getRecentPrioritizationFees.mdx b/docs/src/api/methods/_getRecentPrioritizationFees.mdx index c0e8919c5ba825..7d7fcc791de6ea 100644 --- a/docs/src/api/methods/_getRecentPrioritizationFees.mdx +++ b/docs/src/api/methods/_getRecentPrioritizationFees.mdx @@ -28,7 +28,7 @@ Currently, a node's prioritization-fee cache stores data from up to 150 blocks. An array of Account addresses (up to a maximum of 128 addresses), as base-58 encoded strings :::note -If this parameter is provided, the response will reflect the minimum prioritization fee to land a transaction locking all of the provided accounts as writable. +If this parameter is provided, the response will reflect a fee to land a transaction locking all of the provided accounts as writable. ::: From ee278229c1401d1350b33a6649adfcd4b70a3a3b Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Wed, 18 Jan 2023 19:51:56 -0500 Subject: [PATCH 19/28] fix: version typo --- docs/src/api/methods/_getProgramAccounts.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/api/methods/_getProgramAccounts.mdx b/docs/src/api/methods/_getProgramAccounts.mdx index 9af709d546af56..f8db3db983d50f 100644 --- a/docs/src/api/methods/_getProgramAccounts.mdx +++ b/docs/src/api/methods/_getProgramAccounts.mdx @@ -78,7 +78,7 @@ filter results using up to 4 filter objects listed below: - `offset: usize` - offset into program account data to start comparison - `bytes: string` - data to match, as encoded string - `encoding: string` - encoding for filter `bytes` data, either "base58" or "base64". Data is limited in size to 128 or fewer decoded bytes. - **NEW: This field, and base64 support generally, is only available in solana-core v1.11.2 or newer. Please omit when querying nodes on earlier versions** + **NEW: This field, and base64 support generally, is only available in solana-core v1.14.0 or newer. Please omit when querying nodes on earlier versions** - `dataSize: u64` - compares the program account data length with the provided data size From a980a4f756fe87baf46f500a08ec71fc5eda9ae3 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 20 Jan 2023 09:25:20 -0500 Subject: [PATCH 20/28] fix: commitment links --- docs/src/api/deprecated/_getConfirmedBlock.mdx | 2 +- docs/src/api/deprecated/_getConfirmedBlocks.mdx | 2 +- docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx | 2 +- .../src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx | 2 +- docs/src/api/deprecated/_getConfirmedTransaction.mdx | 2 +- docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx | 2 +- docs/src/api/deprecated/_getFees.mdx | 2 +- docs/src/api/deprecated/_getRecentBlockhash.mdx | 2 +- docs/src/api/methods/_getAccountInfo.mdx | 2 +- docs/src/api/methods/_getBalance.mdx | 2 +- docs/src/api/methods/_getBlock.mdx | 2 +- docs/src/api/methods/_getBlockHeight.mdx | 2 +- docs/src/api/methods/_getBlockProduction.mdx | 2 +- docs/src/api/methods/_getBlocks.mdx | 2 +- docs/src/api/methods/_getBlocksWithLimit.mdx | 2 +- docs/src/api/methods/_getEpochInfo.mdx | 2 +- docs/src/api/methods/_getFeeForMessage.mdx | 2 +- docs/src/api/methods/_getInflationGovernor.mdx | 2 +- docs/src/api/methods/_getInflationReward.mdx | 2 +- docs/src/api/methods/_getLargestAccounts.mdx | 2 +- docs/src/api/methods/_getLatestBlockhash.mdx | 2 +- docs/src/api/methods/_getLeaderSchedule.mdx | 2 +- docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx | 2 +- docs/src/api/methods/_getMultipleAccounts.mdx | 2 +- docs/src/api/methods/_getProgramAccounts.mdx | 2 +- docs/src/api/methods/_getSignatureStatuses.mdx | 2 +- docs/src/api/methods/_getSignaturesForAddress.mdx | 4 ++-- docs/src/api/methods/_getSlot.mdx | 4 ++-- docs/src/api/methods/_getSlotLeader.mdx | 2 +- docs/src/api/methods/_getStakeActivation.mdx | 2 +- docs/src/api/methods/_getStakeMinimumDelegation.mdx | 2 +- docs/src/api/methods/_getSupply.mdx | 2 +- docs/src/api/methods/_getTokenAccountBalance.mdx | 2 +- docs/src/api/methods/_getTokenAccountsByDelegate.mdx | 2 +- docs/src/api/methods/_getTokenAccountsByOwner.mdx | 2 +- docs/src/api/methods/_getTokenLargestAccounts.mdx | 2 +- docs/src/api/methods/_getTokenSupply.mdx | 2 +- docs/src/api/methods/_getTransaction.mdx | 2 +- docs/src/api/methods/_getTransactionCount.mdx | 2 +- docs/src/api/methods/_getVoteAccounts.mdx | 2 +- docs/src/api/methods/_isBlockhashValid.mdx | 2 +- docs/src/api/methods/_requestAirdrop.mdx | 2 +- docs/src/api/methods/_sendTransaction.mdx | 2 +- docs/src/api/methods/_simulateTransaction.mdx | 2 +- docs/src/api/websocket.md | 2 +- docs/src/api/websocket/_accountSubscribe.mdx | 2 +- docs/src/api/websocket/_blockSubscribe.mdx | 2 +- docs/src/api/websocket/_logsSubscribe.mdx | 2 +- docs/src/api/websocket/_programSubscribe.mdx | 2 +- docs/src/api/websocket/_signatureSubscribe.mdx | 2 +- 50 files changed, 52 insertions(+), 52 deletions(-) diff --git a/docs/src/api/deprecated/_getConfirmedBlock.mdx b/docs/src/api/deprecated/_getConfirmedBlock.mdx index 5e482fab91ba1b..05c6930da7f629 100644 --- a/docs/src/api/deprecated/_getConfirmedBlock.mdx +++ b/docs/src/api/deprecated/_getConfirmedBlock.mdx @@ -37,7 +37,7 @@ Configuration object containing the following fields: type="string" defaultValue="finalized" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx b/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx index f05b472ce1f18f..a09de8f53c74d8 100644 --- a/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx +++ b/docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx @@ -40,7 +40,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx b/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx index 2b80610be41a39..7d8c803d061544 100644 --- a/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx +++ b/docs/src/api/deprecated/_getConfirmedSignaturesForAddress2.mdx @@ -39,7 +39,7 @@ Configuration object containing the following fields: type="string" defaultValue="finalized" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/deprecated/_getConfirmedTransaction.mdx b/docs/src/api/deprecated/_getConfirmedTransaction.mdx index 62f79f12c7ec35..5e167554efe00c 100644 --- a/docs/src/api/deprecated/_getConfirmedTransaction.mdx +++ b/docs/src/api/deprecated/_getConfirmedTransaction.mdx @@ -36,7 +36,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx b/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx index 6f95a133475a51..647c5e93d4b9da 100644 --- a/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx +++ b/docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx @@ -36,7 +36,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/deprecated/_getFees.mdx b/docs/src/api/deprecated/_getFees.mdx index 1d2fcffc2259dc..aab95ae03eebe2 100644 --- a/docs/src/api/deprecated/_getFees.mdx +++ b/docs/src/api/deprecated/_getFees.mdx @@ -38,7 +38,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/deprecated/_getRecentBlockhash.mdx b/docs/src/api/deprecated/_getRecentBlockhash.mdx index f2e9a023e17be8..e9b4cc4d10fccf 100644 --- a/docs/src/api/deprecated/_getRecentBlockhash.mdx +++ b/docs/src/api/deprecated/_getRecentBlockhash.mdx @@ -36,7 +36,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getAccountInfo.mdx b/docs/src/api/methods/_getAccountInfo.mdx index 15ad5eebd9d11e..ca4b4fa42c0982 100644 --- a/docs/src/api/methods/_getAccountInfo.mdx +++ b/docs/src/api/methods/_getAccountInfo.mdx @@ -31,7 +31,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getBalance.mdx b/docs/src/api/methods/_getBalance.mdx index e91e181d4fa0f7..6e2349adcb4433 100644 --- a/docs/src/api/methods/_getBalance.mdx +++ b/docs/src/api/methods/_getBalance.mdx @@ -31,7 +31,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getBlock.mdx b/docs/src/api/methods/_getBlock.mdx index 0a46c15d043f09..fe4536f5d1fa76 100644 --- a/docs/src/api/methods/_getBlock.mdx +++ b/docs/src/api/methods/_getBlock.mdx @@ -32,7 +32,7 @@ Configuration object containing the following fields: type="string" optional={true} defaultValue={"finalized"} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" >
  • the default is finalized diff --git a/docs/src/api/methods/_getBlockHeight.mdx b/docs/src/api/methods/_getBlockHeight.mdx index d8b3ff0bb263e9..37feb65fb8c731 100644 --- a/docs/src/api/methods/_getBlockHeight.mdx +++ b/docs/src/api/methods/_getBlockHeight.mdx @@ -27,7 +27,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getBlockProduction.mdx b/docs/src/api/methods/_getBlockProduction.mdx index d0d65d1e53f8fd..37fc0150220caf 100644 --- a/docs/src/api/methods/_getBlockProduction.mdx +++ b/docs/src/api/methods/_getBlockProduction.mdx @@ -27,7 +27,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getBlocks.mdx b/docs/src/api/methods/_getBlocks.mdx index 2648d3302ec717..ea7c8324e4ce87 100644 --- a/docs/src/api/methods/_getBlocks.mdx +++ b/docs/src/api/methods/_getBlocks.mdx @@ -37,7 +37,7 @@ Configuration object containing the following fields: type="string" optional={true} defaultValue={"finalized"} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > - "processed" is not supported diff --git a/docs/src/api/methods/_getBlocksWithLimit.mdx b/docs/src/api/methods/_getBlocksWithLimit.mdx index ab7fe4eab943fa..1725c5e229ad15 100644 --- a/docs/src/api/methods/_getBlocksWithLimit.mdx +++ b/docs/src/api/methods/_getBlocksWithLimit.mdx @@ -37,7 +37,7 @@ Configuration object containing the following field: type="string" optional={true} defaultValue="finalized" - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > - "processed" is not supported diff --git a/docs/src/api/methods/_getEpochInfo.mdx b/docs/src/api/methods/_getEpochInfo.mdx index 2a9b3fe2c67b0c..d5a75d4177330f 100644 --- a/docs/src/api/methods/_getEpochInfo.mdx +++ b/docs/src/api/methods/_getEpochInfo.mdx @@ -31,7 +31,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getFeeForMessage.mdx b/docs/src/api/methods/_getFeeForMessage.mdx index adac11e5402678..3d1d3f5f4ec429 100644 --- a/docs/src/api/methods/_getFeeForMessage.mdx +++ b/docs/src/api/methods/_getFeeForMessage.mdx @@ -35,7 +35,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getInflationGovernor.mdx b/docs/src/api/methods/_getInflationGovernor.mdx index 60d859b9adcb2f..6873f10a5c675e 100644 --- a/docs/src/api/methods/_getInflationGovernor.mdx +++ b/docs/src/api/methods/_getInflationGovernor.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getInflationReward.mdx b/docs/src/api/methods/_getInflationReward.mdx index ec94c43acc576f..ca8944e786a27e 100644 --- a/docs/src/api/methods/_getInflationReward.mdx +++ b/docs/src/api/methods/_getInflationReward.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getLargestAccounts.mdx b/docs/src/api/methods/_getLargestAccounts.mdx index e4b9c56729ad2a..7087b9dacf4fcf 100644 --- a/docs/src/api/methods/_getLargestAccounts.mdx +++ b/docs/src/api/methods/_getLargestAccounts.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getLatestBlockhash.mdx b/docs/src/api/methods/_getLatestBlockhash.mdx index e2bf514c88ed56..666194116931a8 100644 --- a/docs/src/api/methods/_getLatestBlockhash.mdx +++ b/docs/src/api/methods/_getLatestBlockhash.mdx @@ -31,7 +31,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getLeaderSchedule.mdx b/docs/src/api/methods/_getLeaderSchedule.mdx index 148d166f137800..512e55baef1050 100644 --- a/docs/src/api/methods/_getLeaderSchedule.mdx +++ b/docs/src/api/methods/_getLeaderSchedule.mdx @@ -33,7 +33,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx b/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx index 36849899effa0d..6b878cc07e17c9 100644 --- a/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx +++ b/docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getMultipleAccounts.mdx b/docs/src/api/methods/_getMultipleAccounts.mdx index 2e4e314179db79..e1b7f57b611117 100644 --- a/docs/src/api/methods/_getMultipleAccounts.mdx +++ b/docs/src/api/methods/_getMultipleAccounts.mdx @@ -32,7 +32,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getProgramAccounts.mdx b/docs/src/api/methods/_getProgramAccounts.mdx index f8db3db983d50f..f377b6348c664d 100644 --- a/docs/src/api/methods/_getProgramAccounts.mdx +++ b/docs/src/api/methods/_getProgramAccounts.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getSignatureStatuses.mdx b/docs/src/api/methods/_getSignatureStatuses.mdx index 61768de62f4c09..3ca94ea0f48430 100644 --- a/docs/src/api/methods/_getSignatureStatuses.mdx +++ b/docs/src/api/methods/_getSignatureStatuses.mdx @@ -53,7 +53,7 @@ An array of `RpcResponse` consisting of either: - `err: ` - Error if transaction failed, null if transaction succeeded. See [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - `confirmationStatus: ` - The transaction's cluster confirmation status; - Either `processed`, `confirmed`, or `finalized`. See [Commitment](/api#configuring-state-commitment) for more on optimistic confirmation. + Either `processed`, `confirmed`, or `finalized`. See [Commitment](/api/http#configuring-state-commitment) for more on optimistic confirmation. - DEPRECATED: `status: ` - Transaction status - `"Ok": ` - Transaction was successful - `"Err": ` - Transaction failed with TransactionError diff --git a/docs/src/api/methods/_getSignaturesForAddress.mdx b/docs/src/api/methods/_getSignaturesForAddress.mdx index dcf86d2673200e..5921cf58adfb37 100644 --- a/docs/src/api/methods/_getSignaturesForAddress.mdx +++ b/docs/src/api/methods/_getSignaturesForAddress.mdx @@ -32,7 +32,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > @@ -68,7 +68,7 @@ signature information with the following fields: - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available. - `confirmationStatus: ` - The transaction's cluster confirmation status; - Either `processed`, `confirmed`, or `finalized`. See [Commitment](/api#configuring-state-commitment) + Either `processed`, `confirmed`, or `finalized`. See [Commitment](/api/http#configuring-state-commitment) for more on optimistic confirmation. diff --git a/docs/src/api/methods/_getSlot.mdx b/docs/src/api/methods/_getSlot.mdx index d653febb68e00b..90bd6d0c91b9f2 100644 --- a/docs/src/api/methods/_getSlot.mdx +++ b/docs/src/api/methods/_getSlot.mdx @@ -12,7 +12,7 @@ import { ## getSlot -Returns the slot that has reached the [given or default commitment level](/api#configuring-state-commitment) +Returns the slot that has reached the [given or default commitment level](/api/http#configuring-state-commitment) @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getSlotLeader.mdx b/docs/src/api/methods/_getSlotLeader.mdx index 6410973d59a448..0c568fa42f4757 100644 --- a/docs/src/api/methods/_getSlotLeader.mdx +++ b/docs/src/api/methods/_getSlotLeader.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getStakeActivation.mdx b/docs/src/api/methods/_getStakeActivation.mdx index 0e0527bc430a97..daed3a8fd6fa36 100644 --- a/docs/src/api/methods/_getStakeActivation.mdx +++ b/docs/src/api/methods/_getStakeActivation.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getStakeMinimumDelegation.mdx b/docs/src/api/methods/_getStakeMinimumDelegation.mdx index d093f91f7ae4b8..d9f2db58509c6f 100644 --- a/docs/src/api/methods/_getStakeMinimumDelegation.mdx +++ b/docs/src/api/methods/_getStakeMinimumDelegation.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getSupply.mdx b/docs/src/api/methods/_getSupply.mdx index 9cb98f03d3ebe6..24bee37a25c2cf 100644 --- a/docs/src/api/methods/_getSupply.mdx +++ b/docs/src/api/methods/_getSupply.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTokenAccountBalance.mdx b/docs/src/api/methods/_getTokenAccountBalance.mdx index 2d1b75c9ccefdb..e22c717db1dc50 100644 --- a/docs/src/api/methods/_getTokenAccountBalance.mdx +++ b/docs/src/api/methods/_getTokenAccountBalance.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTokenAccountsByDelegate.mdx b/docs/src/api/methods/_getTokenAccountsByDelegate.mdx index 75e786e9196bd3..33b8dd6270a668 100644 --- a/docs/src/api/methods/_getTokenAccountsByDelegate.mdx +++ b/docs/src/api/methods/_getTokenAccountsByDelegate.mdx @@ -39,7 +39,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTokenAccountsByOwner.mdx b/docs/src/api/methods/_getTokenAccountsByOwner.mdx index f7fff459df8fa9..e88e34bb1d98d8 100644 --- a/docs/src/api/methods/_getTokenAccountsByOwner.mdx +++ b/docs/src/api/methods/_getTokenAccountsByOwner.mdx @@ -39,7 +39,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTokenLargestAccounts.mdx b/docs/src/api/methods/_getTokenLargestAccounts.mdx index 45452cd829b16a..e554fabc7c5ed2 100644 --- a/docs/src/api/methods/_getTokenLargestAccounts.mdx +++ b/docs/src/api/methods/_getTokenLargestAccounts.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTokenSupply.mdx b/docs/src/api/methods/_getTokenSupply.mdx index 61c05be2afce67..e4e59c7ca7fa7a 100644 --- a/docs/src/api/methods/_getTokenSupply.mdx +++ b/docs/src/api/methods/_getTokenSupply.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTransaction.mdx b/docs/src/api/methods/_getTransaction.mdx index 0b8ee163ed01fa..281929f885216e 100644 --- a/docs/src/api/methods/_getTransaction.mdx +++ b/docs/src/api/methods/_getTransaction.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getTransactionCount.mdx b/docs/src/api/methods/_getTransactionCount.mdx index cbb2a04b9c972c..37fc6f0b542a8d 100644 --- a/docs/src/api/methods/_getTransactionCount.mdx +++ b/docs/src/api/methods/_getTransactionCount.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_getVoteAccounts.mdx b/docs/src/api/methods/_getVoteAccounts.mdx index 76b227430657d0..dcc4164c5bd057 100644 --- a/docs/src/api/methods/_getVoteAccounts.mdx +++ b/docs/src/api/methods/_getVoteAccounts.mdx @@ -26,7 +26,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_isBlockhashValid.mdx b/docs/src/api/methods/_isBlockhashValid.mdx index e13cff1ba47b4c..5d96c7da14acf3 100644 --- a/docs/src/api/methods/_isBlockhashValid.mdx +++ b/docs/src/api/methods/_isBlockhashValid.mdx @@ -35,7 +35,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_requestAirdrop.mdx b/docs/src/api/methods/_requestAirdrop.mdx index ffe7be2b8dbb41..a95a64dd1654ab 100644 --- a/docs/src/api/methods/_requestAirdrop.mdx +++ b/docs/src/api/methods/_requestAirdrop.mdx @@ -34,7 +34,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/methods/_sendTransaction.mdx b/docs/src/api/methods/_sendTransaction.mdx index ab725ff5f99a96..0741888eb9ea0f 100644 --- a/docs/src/api/methods/_sendTransaction.mdx +++ b/docs/src/api/methods/_sendTransaction.mdx @@ -67,7 +67,7 @@ Values: `base58` (_slow_, **DEPRECATED**), or `base64`. Commitment level to use for preflight. diff --git a/docs/src/api/methods/_simulateTransaction.mdx b/docs/src/api/methods/_simulateTransaction.mdx index 564ee66f36e836..ca85c83fc12877 100644 --- a/docs/src/api/methods/_simulateTransaction.mdx +++ b/docs/src/api/methods/_simulateTransaction.mdx @@ -37,7 +37,7 @@ Configuration object containing the following fields: type="string" defaultValue="finalized" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > Commitment level to simulate the transaction at diff --git a/docs/src/api/websocket.md b/docs/src/api/websocket.md index 06b51d051ce9d1..d409072f462901 100644 --- a/docs/src/api/websocket.md +++ b/docs/src/api/websocket.md @@ -8,7 +8,7 @@ After connecting to the RPC PubSub websocket at `ws://
    /`: - Submit subscription requests to the websocket using the methods below - Multiple subscriptions may be active at once -- Many subscriptions take the optional [`commitment` parameter](/api#configuring-state-commitment), defining how finalized a change should be to trigger a notification. For subscriptions, if commitment is unspecified, the default value is `finalized`. +- Many subscriptions take the optional [`commitment` parameter](/api/http#configuring-state-commitment), defining how finalized a change should be to trigger a notification. For subscriptions, if commitment is unspecified, the default value is `finalized`. ## RPC PubSub WebSocket Endpoint diff --git a/docs/src/api/websocket/_accountSubscribe.mdx b/docs/src/api/websocket/_accountSubscribe.mdx index b26d432bf490e0..b103924554960b 100644 --- a/docs/src/api/websocket/_accountSubscribe.mdx +++ b/docs/src/api/websocket/_accountSubscribe.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/websocket/_blockSubscribe.mdx b/docs/src/api/websocket/_blockSubscribe.mdx index fb5a89ce78ea61..857f83ae494161 100644 --- a/docs/src/api/websocket/_blockSubscribe.mdx +++ b/docs/src/api/websocket/_blockSubscribe.mdx @@ -50,7 +50,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/websocket/_logsSubscribe.mdx b/docs/src/api/websocket/_logsSubscribe.mdx index 2a285ced9a59a2..e23bdf4e64eec2 100644 --- a/docs/src/api/websocket/_logsSubscribe.mdx +++ b/docs/src/api/websocket/_logsSubscribe.mdx @@ -48,7 +48,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/websocket/_programSubscribe.mdx b/docs/src/api/websocket/_programSubscribe.mdx index b79b7f979ce5f9..541af28b0727a6 100644 --- a/docs/src/api/websocket/_programSubscribe.mdx +++ b/docs/src/api/websocket/_programSubscribe.mdx @@ -32,7 +32,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > diff --git a/docs/src/api/websocket/_signatureSubscribe.mdx b/docs/src/api/websocket/_signatureSubscribe.mdx index 8fe3117a8d327c..6b6f6d2ddfc61f 100644 --- a/docs/src/api/websocket/_signatureSubscribe.mdx +++ b/docs/src/api/websocket/_signatureSubscribe.mdx @@ -30,7 +30,7 @@ Configuration object containing the following fields: name="commitment" type="string" optional={true} - href="/api#configuring-state-commitment" + href="/api/http#configuring-state-commitment" > From 9cee32921c8dc73ba356af7ea2c49212979145c6 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 20 Jan 2023 09:27:01 -0500 Subject: [PATCH 21/28] fix: parsed response links --- docs/src/api/deprecated/_getConfirmedBlock.mdx | 2 +- docs/src/api/deprecated/_getConfirmedTransaction.mdx | 2 +- docs/src/api/methods/_getAccountInfo.mdx | 2 +- docs/src/api/methods/_getBlock.mdx | 2 +- docs/src/api/methods/_getMultipleAccounts.mdx | 4 ++-- docs/src/api/methods/_getProgramAccounts.mdx | 4 ++-- docs/src/api/methods/_getTokenAccountsByDelegate.mdx | 2 +- docs/src/api/methods/_getTokenAccountsByOwner.mdx | 2 +- docs/src/api/methods/_getTransaction.mdx | 2 +- docs/src/api/methods/_sendTransaction.mdx | 2 +- docs/src/api/websocket/_accountSubscribe.mdx | 2 +- docs/src/api/websocket/_blockSubscribe.mdx | 2 +- docs/src/api/websocket/_programSubscribe.mdx | 4 ++-- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docs/src/api/deprecated/_getConfirmedBlock.mdx b/docs/src/api/deprecated/_getConfirmedBlock.mdx index 05c6930da7f629..ca0ab5ba132a24 100644 --- a/docs/src/api/deprecated/_getConfirmedBlock.mdx +++ b/docs/src/api/deprecated/_getConfirmedBlock.mdx @@ -53,7 +53,7 @@ Configuration object containing the following fields: whether to populate the `rewards` array. - + Encoding format for Account data diff --git a/docs/src/api/deprecated/_getConfirmedTransaction.mdx b/docs/src/api/deprecated/_getConfirmedTransaction.mdx index 5e167554efe00c..bb4e58477e0c88 100644 --- a/docs/src/api/deprecated/_getConfirmedTransaction.mdx +++ b/docs/src/api/deprecated/_getConfirmedTransaction.mdx @@ -39,7 +39,7 @@ Configuration object containing the following fields: href="/api/http#configuring-state-commitment" > - + Encoding format for Account data diff --git a/docs/src/api/methods/_getAccountInfo.mdx b/docs/src/api/methods/_getAccountInfo.mdx index ca4b4fa42c0982..56d599002a97c3 100644 --- a/docs/src/api/methods/_getAccountInfo.mdx +++ b/docs/src/api/methods/_getAccountInfo.mdx @@ -34,7 +34,7 @@ Configuration object containing the following fields: href="/api/http#configuring-state-commitment" > - + Encoding format for Account data diff --git a/docs/src/api/methods/_getBlock.mdx b/docs/src/api/methods/_getBlock.mdx index fe4536f5d1fa76..7a4c8f82ef2182 100644 --- a/docs/src/api/methods/_getBlock.mdx +++ b/docs/src/api/methods/_getBlock.mdx @@ -42,7 +42,7 @@ Configuration object containing the following fields: - + encoding format for each returned Transaction diff --git a/docs/src/api/methods/_getMultipleAccounts.mdx b/docs/src/api/methods/_getMultipleAccounts.mdx index e1b7f57b611117..207828fb4e5c39 100644 --- a/docs/src/api/methods/_getMultipleAccounts.mdx +++ b/docs/src/api/methods/_getMultipleAccounts.mdx @@ -45,7 +45,7 @@ limit the returned account data using the provided `offset: ` and `length - + encoding format for the returned Account data @@ -57,7 +57,7 @@ encoding format for the returned Account data - `base64` will return base64 encoded data for Account data of any size. - `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. -- [`jsonParsed` encoding](/api#parsed-responses) attempts to use program-specific state parsers to +- [`jsonParsed` encoding](/api/http#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64` encoding, detectable when the `data` field is type ``. diff --git a/docs/src/api/methods/_getProgramAccounts.mdx b/docs/src/api/methods/_getProgramAccounts.mdx index f377b6348c664d..111820c4a26e46 100644 --- a/docs/src/api/methods/_getProgramAccounts.mdx +++ b/docs/src/api/methods/_getProgramAccounts.mdx @@ -41,7 +41,7 @@ Configuration object containing the following fields: wrap the result in an RpcResponse JSON object - + encoding format for the returned Account data @@ -53,7 +53,7 @@ encoding format for the returned Account data - `base64` will return base64 encoded data for Account data of any size. - `base64+zstd` compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. -- [`jsonParsed` encoding](/api#parsed-responses) attempts to use program-specific state +- [`jsonParsed` encoding](/api/http#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64` encoding, detectable when the `data` field is type ``. diff --git a/docs/src/api/methods/_getTokenAccountsByDelegate.mdx b/docs/src/api/methods/_getTokenAccountsByDelegate.mdx index 33b8dd6270a668..80dab4544bdc39 100644 --- a/docs/src/api/methods/_getTokenAccountsByDelegate.mdx +++ b/docs/src/api/methods/_getTokenAccountsByDelegate.mdx @@ -54,7 +54,7 @@ and `length: ` fields; only available for `base58`, - + Encoding format for Account data diff --git a/docs/src/api/methods/_getTokenAccountsByOwner.mdx b/docs/src/api/methods/_getTokenAccountsByOwner.mdx index e88e34bb1d98d8..2b6d2aea22d7bb 100644 --- a/docs/src/api/methods/_getTokenAccountsByOwner.mdx +++ b/docs/src/api/methods/_getTokenAccountsByOwner.mdx @@ -54,7 +54,7 @@ and `length: ` fields; only available for - + Encoding format for Account data diff --git a/docs/src/api/methods/_getTransaction.mdx b/docs/src/api/methods/_getTransaction.mdx index 281929f885216e..c9632c49d4e4be 100644 --- a/docs/src/api/methods/_getTransaction.mdx +++ b/docs/src/api/methods/_getTransaction.mdx @@ -40,7 +40,7 @@ Configuration object containing the following fields: transaction will prompt the error. - + Encoding for the returned Transaction diff --git a/docs/src/api/methods/_sendTransaction.mdx b/docs/src/api/methods/_sendTransaction.mdx index 0741888eb9ea0f..0e49249e587bd4 100644 --- a/docs/src/api/methods/_sendTransaction.mdx +++ b/docs/src/api/methods/_sendTransaction.mdx @@ -52,7 +52,7 @@ submission. Configuration object containing the following optional fields: - + Encoding used for the transaction data. diff --git a/docs/src/api/websocket/_accountSubscribe.mdx b/docs/src/api/websocket/_accountSubscribe.mdx index b103924554960b..2993dc3d7ba0e7 100644 --- a/docs/src/api/websocket/_accountSubscribe.mdx +++ b/docs/src/api/websocket/_accountSubscribe.mdx @@ -33,7 +33,7 @@ Configuration object containing the following fields: href="/api/http#configuring-state-commitment" > - + Encoding format for Account data diff --git a/docs/src/api/websocket/_blockSubscribe.mdx b/docs/src/api/websocket/_blockSubscribe.mdx index 857f83ae494161..921879d5333b88 100644 --- a/docs/src/api/websocket/_blockSubscribe.mdx +++ b/docs/src/api/websocket/_blockSubscribe.mdx @@ -61,7 +61,7 @@ Configuration object containing the following fields: whether to populate the `rewards` array. - + Encoding format for Account data diff --git a/docs/src/api/websocket/_programSubscribe.mdx b/docs/src/api/websocket/_programSubscribe.mdx index 541af28b0727a6..2d36473eb80aaa 100644 --- a/docs/src/api/websocket/_programSubscribe.mdx +++ b/docs/src/api/websocket/_programSubscribe.mdx @@ -42,7 +42,7 @@ filter criteria to be included in results - + Encoding format for Account data @@ -51,7 +51,7 @@ Encoding format for Account data
    - `base58` is slow. -- [`jsonParsed`](/api#parsed-responses">) encoding attempts to use program-specific +- [`jsonParsed`](/api/http#parsed-responses">) encoding attempts to use program-specific state parsers to return more human-readable and explicit account state data. - If `jsonParsed` is requested but a parser cannot be found, the field falls back to `base64` encoding, detectable when the `data` field is type `string`. From a48d69c0fc3d915294565cb32b53d2b77aa4cb31 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 20 Jan 2023 09:32:16 -0500 Subject: [PATCH 22/28] fix: dangling links --- docs/src/api/methods/_getHighestSnapshotSlot.mdx | 2 +- docs/src/api/methods/_getTokenAccountsByOwner.mdx | 2 +- docs/src/api/websocket/_blockSubscribe.mdx | 2 +- docs/src/api/websocket/_programSubscribe.mdx | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/src/api/methods/_getHighestSnapshotSlot.mdx b/docs/src/api/methods/_getHighestSnapshotSlot.mdx index b4a284b8a99d9e..5028f77e6feeca 100644 --- a/docs/src/api/methods/_getHighestSnapshotSlot.mdx +++ b/docs/src/api/methods/_getHighestSnapshotSlot.mdx @@ -19,7 +19,7 @@ snapshot slot _based on_ the full snapshot slot, if there is one. :::caution NEW: This method is only available in solana-core v1.9 or newer. Please use -[getSnapshotSlot](/api#getsnapshotslot) for solana-core v1.8 +[getSnapshotSlot](/api/http#getsnapshotslot) for solana-core v1.8 ::: diff --git a/docs/src/api/methods/_getTokenAccountsByOwner.mdx b/docs/src/api/methods/_getTokenAccountsByOwner.mdx index 2b6d2aea22d7bb..7685c572e9a025 100644 --- a/docs/src/api/methods/_getTokenAccountsByOwner.mdx +++ b/docs/src/api/methods/_getTokenAccountsByOwner.mdx @@ -90,7 +90,7 @@ The result will be an RpcResponse JSON object with `value` equal to an array of - `rentEpoch: ` - the epoch at which this account will next owe rent, as u64 - `size: ` - the data size of the account -When the data is requested with the `jsonParsed` encoding a format similar to that of the [Token Balances Structure](/api#token-balances-structure) can be expected inside the structure, both for the `tokenAmount` and the `delegatedAmount` - with the latter being an optional object. +When the data is requested with the `jsonParsed` encoding a format similar to that of the [Token Balances Structure](/api/http#token-balances-structure) can be expected inside the structure, both for the `tokenAmount` and the `delegatedAmount` - with the latter being an optional object. diff --git a/docs/src/api/websocket/_blockSubscribe.mdx b/docs/src/api/websocket/_blockSubscribe.mdx index 921879d5333b88..c7a7b6eb5aac17 100644 --- a/docs/src/api/websocket/_blockSubscribe.mdx +++ b/docs/src/api/websocket/_blockSubscribe.mdx @@ -134,7 +134,7 @@ The notification will be an object with the following fields: - `slot: ` - The corresponding slot. - `err: ` - Error if something went wrong publishing the notification otherwise null. -- `block: ` - A block object as seen in the [getBlock](/api#getblock) RPC HTTP method. +- `block: ` - A block object as seen in the [getBlock](/api/http#getblock) RPC HTTP method. ```json { diff --git a/docs/src/api/websocket/_programSubscribe.mdx b/docs/src/api/websocket/_programSubscribe.mdx index 2d36473eb80aaa..39774b751ea1cf 100644 --- a/docs/src/api/websocket/_programSubscribe.mdx +++ b/docs/src/api/websocket/_programSubscribe.mdx @@ -125,7 +125,7 @@ Encoding format for Account data #### Notification format -The notification format is a single program account object as seen in the [getProgramAccounts](/api#getProgramAccounts) RPC HTTP method. +The notification format is a single program account object as seen in the [getProgramAccounts](/api/http#getprogramaccounts) RPC HTTP method. Base58 encoding: From f0aa66999017daf29746898712cf8e1460ede757 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 20 Jan 2023 09:47:55 -0500 Subject: [PATCH 23/28] refactor: filter criteria --- docs/src/api/http.md | 13 +++++++++++++ docs/src/api/methods/_getProgramAccounts.mdx | 13 ++----------- docs/src/api/websocket/_programSubscribe.mdx | 9 ++++++--- 3 files changed, 21 insertions(+), 14 deletions(-) diff --git a/docs/src/api/http.md b/docs/src/api/http.md index 107db9eeb4ec33..63163fbfa4ccdf 100644 --- a/docs/src/api/http.md +++ b/docs/src/api/http.md @@ -136,6 +136,19 @@ JSON parsing for the following native and SPL programs: The list of account parsers can be found [here](https://github.com/solana-labs/solana/blob/master/account-decoder/src/parse_account_data.rs), and instruction parsers [here](https://github.com/solana-labs/solana/blob/master/transaction-status/src/parse_instruction.rs). +## Filter criteria + +Some methods support providing a `filters` object to enable pre-filtering the data returned within the RpcResponse JSON object. The following filters exist: + +- `memcmp: object` - compares a provided series of bytes with program account data at a particular offset. Fields: + + - `offset: usize` - offset into program account data to start comparison + - `bytes: string` - data to match, as encoded string + - `encoding: string` - encoding for filter `bytes` data, either "base58" or "base64". Data is limited in size to 128 or fewer decoded bytes.
    + **NEW: This field, and base64 support generally, is only available in solana-core v1.14.0 or newer. Please omit when querying nodes on earlier versions** + +- `dataSize: u64` - compares the program account data length with the provided data size + ## Health Check Although not a JSON RPC API, a `GET /health` at the RPC HTTP Endpoint provides a diff --git a/docs/src/api/methods/_getProgramAccounts.mdx b/docs/src/api/methods/_getProgramAccounts.mdx index 111820c4a26e46..937d47a06e8f0a 100644 --- a/docs/src/api/methods/_getProgramAccounts.mdx +++ b/docs/src/api/methods/_getProgramAccounts.mdx @@ -69,18 +69,9 @@ limit the returned account data using the provided `offset: usize` and `length: - + -filter results using up to 4 filter objects listed below: - -- `memcmp: object` - compares a provided series of bytes with program account data at a particular offset. Fields: - - - `offset: usize` - offset into program account data to start comparison - - `bytes: string` - data to match, as encoded string - - `encoding: string` - encoding for filter `bytes` data, either "base58" or "base64". Data is limited in size to 128 or fewer decoded bytes. - **NEW: This field, and base64 support generally, is only available in solana-core v1.14.0 or newer. Please omit when querying nodes on earlier versions** - -- `dataSize: u64` - compares the program account data length with the provided data size +filter results using up to 4 filter objects :::info The resultant account(s) must meet **ALL** filter criteria to be included in the returned results diff --git a/docs/src/api/websocket/_programSubscribe.mdx b/docs/src/api/websocket/_programSubscribe.mdx index 39774b751ea1cf..895470a96515e6 100644 --- a/docs/src/api/websocket/_programSubscribe.mdx +++ b/docs/src/api/websocket/_programSubscribe.mdx @@ -35,10 +35,13 @@ Configuration object containing the following fields: href="/api/http#configuring-state-commitment" > - + -filter results using various [filter objects](#filters); account must meet all -filter criteria to be included in results +filter results using various [filter objects](/api/http#filter-criteria) + +:::info +The resultant account must meet **ALL** filter criteria to be included in the returned results +::: From 06949343901caa2589f21644b309000da9e4716c Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 20 Jan 2023 09:51:07 -0500 Subject: [PATCH 24/28] docs: removed jsonrpc-api.md file --- docs/src/developing/clients/jsonrpc-api.md | 5512 -------------------- 1 file changed, 5512 deletions(-) delete mode 100644 docs/src/developing/clients/jsonrpc-api.md diff --git a/docs/src/developing/clients/jsonrpc-api.md b/docs/src/developing/clients/jsonrpc-api.md deleted file mode 100644 index cb5d167addda09..00000000000000 --- a/docs/src/developing/clients/jsonrpc-api.md +++ /dev/null @@ -1,5512 +0,0 @@ ---- -title: JSON RPC API ---- - -Solana nodes accept HTTP requests using the [JSON-RPC 2.0](https://www.jsonrpc.org/specification) specification. - -To interact with a Solana node inside a JavaScript application, use the -[solana-web3.js](https://github.com/solana-labs/solana-web3.js) library, which -gives a convenient interface for the RPC methods. - -## RPC HTTP Endpoint - -**Default port:** 8899 e.g. [http://localhost:8899](http://localhost:8899), [http://192.168.1.88:8899](http://192.168.1.88:8899) - -## RPC PubSub WebSocket Endpoint - -**Default port:** 8900 e.g. ws://localhost:8900, [http://192.168.1.88:8900](http://192.168.1.88:8900) - -## Methods - -- [getAccountInfo](jsonrpc-api.md#getaccountinfo) -- [getBalance](jsonrpc-api.md#getbalance) -- [getBlock](jsonrpc-api.md#getblock) -- [getBlockHeight](jsonrpc-api.md#getblockheight) -- [getBlockProduction](jsonrpc-api.md#getblockproduction) -- [getBlockCommitment](jsonrpc-api.md#getblockcommitment) -- [getBlocks](jsonrpc-api.md#getblocks) -- [getBlocksWithLimit](jsonrpc-api.md#getblockswithlimit) -- [getBlockTime](jsonrpc-api.md#getblocktime) -- [getClusterNodes](jsonrpc-api.md#getclusternodes) -- [getEpochInfo](jsonrpc-api.md#getepochinfo) -- [getEpochSchedule](jsonrpc-api.md#getepochschedule) -- [getFeeForMessage](jsonrpc-api.md#getfeeformessage) -- [getFirstAvailableBlock](jsonrpc-api.md#getfirstavailableblock) -- [getGenesisHash](jsonrpc-api.md#getgenesishash) -- [getHealth](jsonrpc-api.md#gethealth) -- [getHighestSnapshotSlot](jsonrpc-api.md#gethighestsnapshotslot) -- [getIdentity](jsonrpc-api.md#getidentity) -- [getInflationGovernor](jsonrpc-api.md#getinflationgovernor) -- [getInflationRate](jsonrpc-api.md#getinflationrate) -- [getInflationReward](jsonrpc-api.md#getinflationreward) -- [getLargestAccounts](jsonrpc-api.md#getlargestaccounts) -- [getLatestBlockhash](jsonrpc-api.md#getlatestblockhash) -- [getLeaderSchedule](jsonrpc-api.md#getleaderschedule) -- [getMaxRetransmitSlot](jsonrpc-api.md#getmaxretransmitslot) -- [getMaxShredInsertSlot](jsonrpc-api.md#getmaxshredinsertslot) -- [getMinimumBalanceForRentExemption](jsonrpc-api.md#getminimumbalanceforrentexemption) -- [getMultipleAccounts](jsonrpc-api.md#getmultipleaccounts) -- [getProgramAccounts](jsonrpc-api.md#getprogramaccounts) -- [getRecentPerformanceSamples](jsonrpc-api.md#getrecentperformancesamples) -- [getRecentPrioritizationFees](jsonrpc-api.md#getrecentprioritizationfees) -- [getSignaturesForAddress](jsonrpc-api.md#getsignaturesforaddress) -- [getSignatureStatuses](jsonrpc-api.md#getsignaturestatuses) -- [getSlot](jsonrpc-api.md#getslot) -- [getSlotLeader](jsonrpc-api.md#getslotleader) -- [getSlotLeaders](jsonrpc-api.md#getslotleaders) -- [getStakeActivation](jsonrpc-api.md#getstakeactivation) -- [getStakeMinimumDelegation](jsonrpc-api.md#getstakeminimumdelegation) -- [getSupply](jsonrpc-api.md#getsupply) -- [getTokenAccountBalance](jsonrpc-api.md#gettokenaccountbalance) -- [getTokenAccountsByDelegate](jsonrpc-api.md#gettokenaccountsbydelegate) -- [getTokenAccountsByOwner](jsonrpc-api.md#gettokenaccountsbyowner) -- [getTokenLargestAccounts](jsonrpc-api.md#gettokenlargestaccounts) -- [getTokenSupply](jsonrpc-api.md#gettokensupply) -- [getTransaction](jsonrpc-api.md#gettransaction) -- [getTransactionCount](jsonrpc-api.md#gettransactioncount) -- [getVersion](jsonrpc-api.md#getversion) -- [getVoteAccounts](jsonrpc-api.md#getvoteaccounts) -- [isBlockhashValid](jsonrpc-api.md#isblockhashvalid) -- [minimumLedgerSlot](jsonrpc-api.md#minimumledgerslot) -- [requestAirdrop](jsonrpc-api.md#requestairdrop) -- [sendTransaction](jsonrpc-api.md#sendtransaction) -- [simulateTransaction](jsonrpc-api.md#simulatetransaction) -- [Subscription Websocket](jsonrpc-api.md#subscription-websocket) - - [accountSubscribe](jsonrpc-api.md#accountsubscribe) - - [accountUnsubscribe](jsonrpc-api.md#accountunsubscribe) - - [logsSubscribe](jsonrpc-api.md#logssubscribe) - - [logsUnsubscribe](jsonrpc-api.md#logsunsubscribe) - - [programSubscribe](jsonrpc-api.md#programsubscribe) - - [programUnsubscribe](jsonrpc-api.md#programunsubscribe) - - [signatureSubscribe](jsonrpc-api.md#signaturesubscribe) - - [signatureUnsubscribe](jsonrpc-api.md#signatureunsubscribe) - - [slotSubscribe](jsonrpc-api.md#slotsubscribe) - - [slotUnsubscribe](jsonrpc-api.md#slotunsubscribe) - -### Unstable Methods - -Unstable methods may see breaking changes in patch releases and may not be supported in perpetuity. - -- [blockSubscribe](jsonrpc-api.md#blocksubscribe---unstable-disabled-by-default) -- [blockUnsubscribe](jsonrpc-api.md#blockunsubscribe) -- [slotsUpdatesSubscribe](jsonrpc-api.md#slotsupdatessubscribe---unstable) -- [slotsUpdatesUnsubscribe](jsonrpc-api.md#slotsupdatesunsubscribe) -- [voteSubscribe](jsonrpc-api.md#votesubscribe---unstable-disabled-by-default) -- [voteUnsubscribe](jsonrpc-api.md#voteunsubscribe) - -### Deprecated Methods - -- [getConfirmedBlock](jsonrpc-api.md#getconfirmedblock) -- [getConfirmedBlocks](jsonrpc-api.md#getconfirmedblocks) -- [getConfirmedBlocksWithLimit](jsonrpc-api.md#getconfirmedblockswithlimit) -- [getConfirmedSignaturesForAddress2](jsonrpc-api.md#getconfirmedsignaturesforaddress2) -- [getConfirmedTransaction](jsonrpc-api.md#getconfirmedtransaction) -- [getFeeCalculatorForBlockhash](jsonrpc-api.md#getfeecalculatorforblockhash) -- [getFeeRateGovernor](jsonrpc-api.md#getfeerategovernor) -- [getFees](jsonrpc-api.md#getfees) -- [getRecentBlockhash](jsonrpc-api.md#getrecentblockhash) -- [getSnapshotSlot](jsonrpc-api.md#getsnapshotslot) - -## Request Formatting - -To make a JSON-RPC request, send an HTTP POST request with a `Content-Type: -application/json` header. The JSON request data should contain 4 fields: - -- `jsonrpc: `, set to `"2.0"` -- `id: `, a unique client-generated identifying integer -- `method: `, a string containing the method to be invoked -- `params: `, a JSON array of ordered parameter values - -Example using curl: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getBalance", - "params": [ - "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" - ] - } -' -``` - -The response output will be a JSON object with the following fields: - -- `jsonrpc: `, matching the request specification -- `id: `, matching the request identifier -- `result: `, requested data or success confirmation - -Requests can be sent in batches by sending an array of JSON-RPC request objects as the data for a single POST. - -## Definitions - -- Hash: A SHA-256 hash of a chunk of data. -- Pubkey: The public key of a Ed25519 key-pair. -- Transaction: A list of Solana instructions signed by a client keypair to authorize those actions. -- Signature: An Ed25519 signature of transaction's payload data including instructions. This can be used to identify transactions. - -## Configuring State Commitment - -For preflight checks and transaction processing, Solana nodes choose which bank -state to query based on a commitment requirement set by the client. The -commitment describes how finalized a block is at that point in time. When -querying the ledger state, it's recommended to use lower levels of commitment -to report progress and higher levels to ensure the state will not be rolled back. - -In descending order of commitment (most finalized to least finalized), clients -may specify: - -- `"finalized"` - the node will query the most recent block confirmed by supermajority - of the cluster as having reached maximum lockout, meaning the cluster has - recognized this block as finalized -- `"confirmed"` - the node will query the most recent block that has been voted on by supermajority of the cluster. - - It incorporates votes from gossip and replay. - - It does not count votes on descendants of a block, only direct votes on that block. - - This confirmation level also upholds "optimistic confirmation" guarantees in - release 1.3 and onwards. -- `"processed"` - the node will query its most recent block. Note that the block - may still be skipped by the cluster. - -For processing many dependent transactions in series, it's recommended to use -`"confirmed"` commitment, which balances speed with rollback safety. -For total safety, it's recommended to use`"finalized"` commitment. - -#### Example - -The commitment parameter should be included as the last element in the `params` array: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getBalance", - "params": [ - "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", - { - "commitment": "finalized" - } - ] - } -' -``` - -#### Default: - -If commitment configuration is not provided, the node will default to `"finalized"` commitment - -Only methods that query bank state accept the commitment parameter. They are indicated in the API Reference below. - -#### RpcResponse Structure - -Many methods that take a commitment parameter return an RpcResponse JSON object comprised of two parts: - -- `context` : An RpcResponseContext JSON structure including a `slot` field at which the operation was evaluated. -- `value` : The value returned by the operation itself. - -#### Parsed Responses - -Some methods support an `encoding` parameter, and can return account or -instruction data in parsed JSON format if `"encoding":"jsonParsed"` is requested -and the node has a parser for the owning program. Solana nodes currently support -JSON parsing for the following native and SPL programs: - -| Program | Account State | Instructions | -| --- | --- | --- | -| Address Lookup | v1.15.0 | v1.15.0 | -| BPF Loader | n/a | stable | -| BPF Upgradeable Loader | stable | stable | -| Config | stable | | -| SPL Associated Token Account | n/a | stable | -| SPL Memo | n/a | stable | -| SPL Token | stable | stable | -| SPL Token 2022 | stable | stable | -| Stake | stable | stable | -| Vote | stable | stable | - -The list of account parsers can be found [here](https://github.com/solana-labs/solana/blob/master/account-decoder/src/parse_account_data.rs), and instruction parsers [here](https://github.com/solana-labs/solana/blob/master/transaction-status/src/parse_instruction.rs). - -## Health Check - -Although not a JSON RPC API, a `GET /health` at the RPC HTTP Endpoint provides a -health-check mechanism for use by load balancers or other network -infrastructure. This request will always return a HTTP 200 OK response with a body of -"ok", "behind" or "unknown" based on the following conditions: - -1. If one or more `--known-validator` arguments are provided to `solana-validator`, "ok" is returned - when the node has within `HEALTH_CHECK_SLOT_DISTANCE` slots of the highest - known validator, otherwise "behind". "unknown" is returned when no slot - information from known validators is not yet available. -2. "ok" is always returned if no known validators are provided. - -## JSON RPC API Reference - -### getAccountInfo - -Returns all information associated with the account of provided Pubkey - -#### Parameters: - -- `` - Pubkey of account to query, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd", or "jsonParsed". - "base58" is limited to Account data of less than 129 bytes. - "base64" will return base64 encoded data for Account data of any size. - "base64+zstd" compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to "base64" encoding, detectable when the `data` field is type ``. - - (optional) `dataSlice: ` - limit the returned account data using the provided `offset: ` and `length: ` fields; has no effect on parsed account data. - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to: - -- `` - if the requested account doesn't exist -- `` - otherwise, a JSON object containing: - - `lamports: `, number of lamports assigned to this account, as a u64 - - `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - - `data: <[string, encoding]|object>`, data associated with the account, either as encoded binary data or JSON format `{: }`, depending on encoding parameter - - `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) - - `rentEpoch: `, the epoch at which this account will next owe rent, as u64 - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getAccountInfo", - "params": [ - "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", - { - "encoding": "base58" - } - ] - } -' -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": { - "data": [ - "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHRTPuR3oZ1EioKtYGiYxpxMG5vpbZLsbcBYBEmZZcMKaSoGx9JZeAuWf", - "base58" - ], - "executable": false, - "lamports": 1000000000, - "owner": "11111111111111111111111111111111", - "rentEpoch": 2, - "space": 80 - } - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getAccountInfo", - "params": [ - "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA", - { - "encoding": "jsonParsed" - } - ] - } -' -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": { - "data": { - "nonce": { - "initialized": { - "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX", - "blockhash": "3xLP3jK6dVJwpeGeTDYTwdDK3TKchUf1gYYGHa4sF3XJ", - "feeCalculator": { - "lamportsPerSignature": 5000 - } - } - } - }, - "executable": false, - "lamports": 1000000000, - "owner": "11111111111111111111111111111111", - "rentEpoch": 2, - "space": 80 - } - }, - "id": 1 -} -``` - -### getBalance - -Returns the balance of the account of provided Pubkey - -#### Parameters: - -- `` - Pubkey of account to query, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `RpcResponse` - RpcResponse JSON object with `value` field set to the balance - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getBalance", "params":["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { "context": { "slot": 1 }, "value": 0 }, - "id": 1 -} -``` - -### getBlock - -Returns identity and transaction information about a confirmed block in the ledger - -#### Parameters: - -- `` - slot, as u64 integer -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `encoding: ` - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (_slow_), "base64". If parameter not provided, the default encoding is "json". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific instruction parsers to return more human-readable and explicit data in the `transaction.message.instructions` list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). - - (optional) `transactionDetails: ` - level of transaction detail to return, either "full", "accounts", "signatures", or "none". If parameter not provided, the default detail level is "full". If "accounts" are requested, transaction details only include signatures and an annotated list of accounts in each transaction. Transaction metadata is limited to only: fee, err, pre_balances, post_balances, pre_token_balances, and post_token_balances. - - (optional) `rewards: bool` - whether to populate the `rewards` array. If parameter not provided, the default includes rewards. - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - - (optional) `maxSupportedTransactionVersion: ` - set the max transaction version to return in responses. If the requested block contains a transaction with a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and a block containing any versioned transaction will prompt the error. - -#### Results: - -The result field will be an object with the following fields: - -- `` - if specified block is not confirmed -- `` - if block is confirmed, an object with the following fields: - - `blockhash: ` - the blockhash of this block, as base-58 encoded string - - `previousBlockhash: ` - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111" - - `parentSlot: ` - the slot index of this block's parent - - `transactions: ` - present if "full" transaction details are requested; an array of JSON objects containing: - - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter - - `meta: ` - transaction status metadata object, containing `null` or: - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - - `fee: ` - fee this transaction was charged, as u64 integer - - `preBalances: ` - array of u64 account balances from before the transaction was processed - - `postBalances: ` - array of u64 account balances after the transaction was processed - - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction - - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction - - `rewards: ` - transaction-level rewards, populated if rewards are requested; an array of JSON objects containing: - - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward - - `lamports: `- number of reward lamports credited or debited by the account, as a i64 - - `postBalance: ` - account balance in lamports after the reward was applied - - `rewardType: ` - type of reward: "fee", "rent", "voting", "staking" - - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards - - DEPRECATED: `status: ` - Transaction status - - `"Ok": ` - Transaction was successful - - `"Err": ` - Transaction failed with TransactionError - - `loadedAddresses: ` - Transaction addresses loaded from address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set in request params. - - `writable: ` - Ordered list of base-58 encoded addresses for writable loaded accounts - - `readonly: ` - Ordered list of base-58 encoded addresses for readonly loaded accounts - - `returnData: ` - the most-recent return data generated by an instruction in the transaction, with the following fields: - - `programId: `, the program that generated the return data, as base-58 encoded Pubkey - - `data: <[string, encoding]>`, the return data itself, as base-64 encoded binary data - - `computeUnitsConsumed: `, number of [compute units](developing/programming-model/runtime.md#compute-budget) consumed by the transaction - - `version: <"legacy"|number|undefined>` - Transaction version. Undefined if `maxSupportedTransactionVersion` is not set in request params. - - `signatures: ` - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block - - `rewards: ` - block-level rewards, present if rewards are requested; an array of JSON objects containing: - - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward - - `lamports: `- number of reward lamports credited or debited by the account, as a i64 - - `postBalance: ` - account balance in lamports after the reward was applied - - `rewardType: ` - type of reward: "fee", "rent", "voting", "staking" - - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards - - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available - - `blockHeight: ` - the number of blocks beneath this block - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getBlock","params":[430, {"encoding": "json","maxSupportedTransactionVersion":0,"transactionDetails":"full","rewards":false}]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "blockHeight": 428, - "blockTime": null, - "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", - "parentSlot": 429, - "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", - "transactions": [ - { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "logMessages": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "rewards": null, - "status": { - "Ok": null - } - }, - "transaction": { - "message": { - "accountKeys": [ - "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", - "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", - "SysvarS1otHashes111111111111111111111111111", - "SysvarC1ock11111111111111111111111111111111", - "Vote111111111111111111111111111111111111111" - ], - "header": { - "numReadonlySignedAccounts": 0, - "numReadonlyUnsignedAccounts": 3, - "numRequiredSignatures": 1 - }, - "instructions": [ - { - "accounts": [1, 2, 3, 0], - "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", - "programIdIndex": 4 - } - ], - "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" - }, - "signatures": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" - ] - } - } - ] - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getBlock","params":[430, "base64"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "blockHeight": 428, - "blockTime": null, - "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", - "parentSlot": 429, - "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", - "rewards": [], - "transactions": [ - { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": null, - "logMessages": null, - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "rewards": [], - "status": { - "Ok": null - } - }, - "transaction": [ - "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==", - "base64" - ] - } - ] - }, - "id": 1 -} -``` - -#### Transaction Structure - -Transactions are quite different from those on other blockchains. Be sure to review [Anatomy of a Transaction](developing/programming-model/transactions.md) to learn about transactions on Solana. - -The JSON structure of a transaction is defined as follows: - -- `signatures: ` - A list of base-58 encoded signatures applied to the transaction. The list is always of length `message.header.numRequiredSignatures` and not empty. The signature at index `i` corresponds to the public key at index `i` in `message.accountKeys`. The first one is used as the [transaction id](../../terminology.md#transaction-id). -- `message: ` - Defines the content of the transaction. - - `accountKeys: ` - List of base-58 encoded public keys used by the transaction, including by the instructions and for signatures. The first `message.header.numRequiredSignatures` public keys must sign the transaction. - - `header: ` - Details the account types and signatures required by the transaction. - - `numRequiredSignatures: ` - The total number of signatures required to make the transaction valid. The signatures must match the first `numRequiredSignatures` of `message.accountKeys`. - - `numReadonlySignedAccounts: ` - The last `numReadonlySignedAccounts` of the signed keys are read-only accounts. Programs may process multiple transactions that load read-only accounts within a single PoH entry, but are not permitted to credit or debit lamports or modify account data. Transactions targeting the same read-write account are evaluated sequentially. - - `numReadonlyUnsignedAccounts: ` - The last `numReadonlyUnsignedAccounts` of the unsigned keys are read-only accounts. - - `recentBlockhash: ` - A base-58 encoded hash of a recent block in the ledger used to prevent transaction duplication and to give transactions lifetimes. - - `instructions: ` - List of program instructions that will be executed in sequence and committed in one atomic transaction if all succeed. - - `programIdIndex: ` - Index into the `message.accountKeys` array indicating the program account that executes this instruction. - - `accounts: ` - List of ordered indices into the `message.accountKeys` array indicating which accounts to pass to the program. - - `data: ` - The program input data encoded in a base-58 string. - - `addressTableLookups: ` - List of address table lookups used by a transaction to dynamically load addresses from on-chain address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set. - - `accountKey: ` - base-58 encoded public key for an address lookup table account. - - `writableIndexes: ` - List of indices used to load addresses of writable accounts from a lookup table. - - `readonlyIndexes: ` - List of indices used to load addresses of readonly accounts from a lookup table. - -#### Inner Instructions Structure - -The Solana runtime records the cross-program instructions that are invoked during transaction processing and makes these available for greater transparency of what was executed on-chain per transaction instruction. Invoked instructions are grouped by the originating transaction instruction and are listed in order of processing. - -The JSON structure of inner instructions is defined as a list of objects in the following structure: - -- `index: number` - Index of the transaction instruction from which the inner instruction(s) originated -- `instructions: ` - Ordered list of inner program instructions that were invoked during a single transaction instruction. - - `programIdIndex: ` - Index into the `message.accountKeys` array indicating the program account that executes this instruction. - - `accounts: ` - List of ordered indices into the `message.accountKeys` array indicating which accounts to pass to the program. - - `data: ` - The program input data encoded in a base-58 string. - -#### Token Balances Structure - -The JSON structure of token balances is defined as a list of objects in the following structure: - -- `accountIndex: ` - Index of the account in which the token balance is provided for. -- `mint: ` - Pubkey of the token's mint. -- `owner: ` - Pubkey of token balance's owner. -- `programId: ` - Pubkey of the Token program that owns the account. -- `uiTokenAmount: ` - - - `amount: ` - Raw amount of tokens as a string, ignoring decimals. - - `decimals: ` - Number of decimals configured for token's mint. - - `uiAmount: ` - Token amount as a float, accounting for decimals. **DEPRECATED** - - `uiAmountString: ` - Token amount as a string, accounting for decimals. - -### getBlockHeight - -Returns the current block height of the node - -#### Parameters: - -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `` - Current block height - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getBlockHeight"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 1233, "id": 1 } -``` - -### getBlockProduction - -Returns recent block production information from the current or previous epoch. - -#### Parameters: - -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `range: ` - Slot range to return block production for. If parameter not provided, defaults to current epoch. - - `firstSlot: ` - first slot to return block production information for (inclusive) - - (optional) `lastSlot: ` - last slot to return block production information for (inclusive). If parameter not provided, defaults to the highest slot - - (optional) `identity: ` - Only return results for this validator identity (base-58 encoded) - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to: - -- `` - - `byIdentity: ` - a dictionary of validator identities, - as base-58 encoded strings. Value is a two element array containing the - number of leader slots and the number of blocks produced. - - `range: ` - Block production slot range - - `firstSlot: ` - first slot of the block production information (inclusive) - - `lastSlot: ` - last slot of block production information (inclusive) - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getBlockProduction"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 9887 - }, - "value": { - "byIdentity": { - "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [9888, 9886] - }, - "range": { - "firstSlot": 0, - "lastSlot": 9887 - } - } - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getBlockProduction", - "params": [ - { - "identity": "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr", - "range": { - "firstSlot": 40, - "lastSlot": 50 - } - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 10102 - }, - "value": { - "byIdentity": { - "85iYT5RuzRTDgjyRa3cP8SYhM2j21fj7NhfJ3peu1DPr": [11, 11] - }, - "range": { - "firstSlot": 50, - "lastSlot": 40 - } - } - }, - "id": 1 -} -``` - -### getBlockCommitment - -Returns commitment for particular block - -#### Parameters: - -- `` - block, identified by Slot - -#### Results: - -The result field will be a JSON object containing: - -- `commitment` - commitment, comprising either: - - `` - Unknown block - - `` - commitment, array of u64 integers logging the amount of cluster stake in lamports that has voted on the block at each depth from 0 to `MAX_LOCKOUT_HISTORY` + 1 -- `totalStake` - total active stake, in lamports, of the current epoch - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getBlockCommitment","params":[5]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "commitment": [ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 10, 32 - ], - "totalStake": 42 - }, - "id": 1 -} -``` - -### getBlocks - -Returns a list of confirmed blocks between two slots - -#### Parameters: - -- `` - start_slot, as u64 integer -- (optional) `` - end_slot, as u64 integer (must be no more than 500,000 blocks higher than the `start_slot`) -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -The result field will be an array of u64 integers listing confirmed blocks -between `start_slot` and either `end_slot`, if provided, or latest confirmed block, -inclusive. Max range allowed is 500,000 slots. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getBlocks","params":[5, 10]} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": [5, 6, 7, 8, 9, 10], "id": 1 } -``` - -### getBlocksWithLimit - -Returns a list of confirmed blocks starting at the given slot - -#### Parameters: - -- `` - start_slot, as u64 integer -- `` - limit, as u64 integer (must be no more than 500,000 blocks higher than the `start_slot`) -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -The result field will be an array of u64 integers listing confirmed blocks -starting at `start_slot` for up to `limit` blocks, inclusive. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getBlocksWithLimit","params":[5, 3]} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": [5, 6, 7], "id": 1 } -``` - -### getBlockTime - -Returns the estimated production time of a block. - -Each validator reports their UTC time to the ledger on a regular interval by -intermittently adding a timestamp to a Vote for a particular block. A requested -block's time is calculated from the stake-weighted mean of the Vote timestamps -in a set of recent blocks recorded on the ledger. - -#### Parameters: - -- `` - block, identified by Slot - -#### Results: - -- `` - estimated production time, as Unix timestamp (seconds since the Unix epoch) -- `` - timestamp is not available for this block - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getBlockTime","params":[5]} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 1574721591, "id": 1 } -``` - -### getClusterNodes - -Returns information about all the nodes participating in the cluster - -#### Parameters: - -None - -#### Results: - -The result field will be an array of JSON objects, each with the following sub fields: - -- `pubkey: ` - Node public key, as base-58 encoded string -- `gossip: ` - Gossip network address for the node -- `tpu: ` - TPU network address for the node -- `rpc: ` - JSON RPC network address for the node, or `null` if the JSON RPC service is not enabled -- `version: ` - The software version of the node, or `null` if the version information is not available -- `featureSet: ` - The unique identifier of the node's feature set -- `shredVersion: ` - The shred version the node has been configured to use - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getClusterNodes"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "gossip": "10.239.6.48:8001", - "pubkey": "9QzsJf7LPLj8GkXbYT3LFDKqsj2hHG7TA3xinJHu8epQ", - "rpc": "10.239.6.48:8899", - "tpu": "10.239.6.48:8856", - "version": "1.0.0 c375ce1f" - } - ], - "id": 1 -} -``` - -### getEpochInfo - -Returns information about the current epoch - -#### Parameters: - -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result field will be an object with the following fields: - -- `absoluteSlot: `, the current slot -- `blockHeight: `, the current block height -- `epoch: `, the current epoch -- `slotIndex: `, the current slot relative to the start of the current epoch -- `slotsInEpoch: `, the number of slots in this epoch -- `transactionCount: `, total number of transactions processed without error since genesis - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getEpochInfo"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "absoluteSlot": 166598, - "blockHeight": 166500, - "epoch": 27, - "slotIndex": 2790, - "slotsInEpoch": 8192, - "transactionCount": 22661093 - }, - "id": 1 -} -``` - -### getEpochSchedule - -Returns epoch schedule information from this cluster's genesis config - -#### Parameters: - -None - -#### Results: - -The result field will be an object with the following fields: - -- `slotsPerEpoch: `, the maximum number of slots in each epoch -- `leaderScheduleSlotOffset: `, the number of slots before beginning of an epoch to calculate a leader schedule for that epoch -- `warmup: `, whether epochs start short and grow -- `firstNormalEpoch: `, first normal-length epoch, log2(slotsPerEpoch) - log2(MINIMUM_SLOTS_PER_EPOCH) -- `firstNormalSlot: `, MINIMUM_SLOTS_PER_EPOCH \* (2.pow(firstNormalEpoch) - 1) - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getEpochSchedule"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "firstNormalEpoch": 8, - "firstNormalSlot": 8160, - "leaderScheduleSlotOffset": 8192, - "slotsPerEpoch": 8192, - "warmup": true - }, - "id": 1 -} -``` - -### getFeeForMessage - -**NEW: This method is only available in solana-core v1.9 or newer. Please use -[getFees](jsonrpc-api.md#getfees) for solana-core v1.8** - -Get the fee the network will charge for a particular Message - -#### Parameters: - -- `message: ` - Base-64 encoded Message -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) (used for retrieving blockhash) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `` - Fee corresponding to the message at the specified blockhash - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' -{ - "id":1, - "jsonrpc":"2.0", - "method":"getFeeForMessage", - "params":[ - "AQABAgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEBAQAA", - { - "commitment":"processed" - } - ] -} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { "context": { "slot": 5068 }, "value": 5000 }, - "id": 1 -} -``` - -### getFirstAvailableBlock - -Returns the slot of the lowest confirmed block that has not been purged from the ledger - -#### Parameters: - -None - -#### Results: - -- `` - Slot - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getFirstAvailableBlock"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 250000, "id": 1 } -``` - -### getGenesisHash - -Returns the genesis hash - -#### Parameters: - -None - -#### Results: - -- `` - a Hash as base-58 encoded string - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getGenesisHash"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": "GH7ome3EiwEr7tu9JuTh2dpYWBJK3z69Xm1ZE3MEE6JC", - "id": 1 -} -``` - -### getHealth - -Returns the current health of the node. - -If one or more `--known-validator` arguments are provided to -`solana-validator`, "ok" is returned when the node has within -`HEALTH_CHECK_SLOT_DISTANCE` slots of the highest known validator, otherwise -an error is returned. "ok" is always returned if no known validators are -provided. - -#### Parameters: - -None - -#### Results: - -If the node is healthy: "ok" -If the node is unhealthy, a JSON RPC error response is returned. The specifics -of the error response are **UNSTABLE** and may change in the future - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getHealth"} -' -``` - -Healthy Result: - -```json -{ "jsonrpc": "2.0", "result": "ok", "id": 1 } -``` - -Unhealthy Result (generic): - -```json -{ - "jsonrpc": "2.0", - "error": { - "code": -32005, - "message": "Node is unhealthy", - "data": {} - }, - "id": 1 -} -``` - -Unhealthy Result (if additional information is available) - -```json -{ - "jsonrpc": "2.0", - "error": { - "code": -32005, - "message": "Node is behind by 42 slots", - "data": { - "numSlotsBehind": 42 - } - }, - "id": 1 -} -``` - -### getHighestSnapshotSlot - -**NEW: This method is only available in solana-core v1.9 or newer. Please use -[getSnapshotSlot](jsonrpc-api.md#getsnapshotslot) for solana-core v1.8** - -Returns the highest slot information that the node has snapshots for. - -This will find the highest full snapshot slot, and the highest incremental -snapshot slot _based on_ the full snapshot slot, if there is one. - -#### Parameters: - -None - -#### Results: - -- `` - - `full: ` - Highest full snapshot slot - - `incremental: ` - Highest incremental snapshot slot _based on_ `full` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1,"method":"getHighestSnapshotSlot"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": { "full": 100, "incremental": 110 }, "id": 1 } -``` - -Result when the node has no snapshot: - -```json -{ - "jsonrpc": "2.0", - "error": { "code": -32008, "message": "No snapshot" }, - "id": 1 -} -``` - -### getIdentity - -Returns the identity pubkey for the current node - -#### Parameters: - -None - -#### Results: - -The result field will be a JSON object with the following fields: - -- `identity`, the identity pubkey of the current node \(as a base-58 encoded string\) - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getIdentity"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { "identity": "2r1F4iWqVcb8M1DbAjQuFpebkQHY9hcVU4WuW2DJBppN" }, - "id": 1 -} -``` - -### getInflationGovernor - -Returns the current inflation governor - -#### Parameters: - -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -The result field will be a JSON object with the following fields: - -- `initial: `, the initial inflation percentage from time 0 -- `terminal: `, terminal inflation percentage -- `taper: `, rate per year at which inflation is lowered. - Rate reduction is derived using the target slot time in genesis config -- `foundation: `, percentage of total inflation allocated to the foundation -- `foundationTerm: `, duration of foundation pool inflation in years - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getInflationGovernor"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "foundation": 0.05, - "foundationTerm": 7, - "initial": 0.15, - "taper": 0.15, - "terminal": 0.015 - }, - "id": 1 -} -``` - -### getInflationRate - -Returns the specific inflation values for the current epoch - -#### Parameters: - -None - -#### Results: - -The result field will be a JSON object with the following fields: - -- `total: `, total inflation -- `validator: `, inflation allocated to validators -- `foundation: `, inflation allocated to the foundation -- `epoch: `, epoch for which these values are valid - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getInflationRate"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "epoch": 100, - "foundation": 0.001, - "total": 0.149, - "validator": 0.148 - }, - "id": 1 -} -``` - -### getInflationReward - -Returns the inflation / staking reward for a list of addresses for an epoch - -#### Parameters: - -- `` - An array of addresses to query, as base-58 encoded strings -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `epoch: ` - An epoch for which the reward occurs. If omitted, the previous epoch will be used - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results - -The result field will be a JSON array with the following fields: - -- `epoch: `, epoch for which reward occured -- `effectiveSlot: `, the slot in which the rewards are effective -- `amount: `, reward amount in lamports -- `postBalance: `, post balance of the account in lamports -- `commission: ` - vote account commission when the reward was credited - -#### Example - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getInflationReward", - "params": [ - ["6dmNQ5jwLeLk5REvio1JcMshcbvkYMwy26sJ8pbkvStu", "BGsqMegLpV6n6Ve146sSX2dTjUMj3M92HnU8BbNRMhF2"], {"epoch": 2} - ] - } -' -``` - -Response: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "amount": 2500, - "effectiveSlot": 224, - "epoch": 2, - "postBalance": 499999442500 - }, - null - ], - "id": 1 -} -``` - -### getLargestAccounts - -Returns the 20 largest accounts, by lamport balance (results may be cached up to two hours) - -#### Parameters: - -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `filter: ` - filter results by account type; currently supported: `circulating|nonCirculating` - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to an array of: - -- `` - otherwise, a JSON object containing: - - `address: `, base-58 encoded address of the account - - `lamports: `, number of lamports in the account, as a u64 - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getLargestAccounts"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 54 - }, - "value": [ - { - "lamports": 999974, - "address": "99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ" - }, - { - "lamports": 42, - "address": "uPwWLo16MVehpyWqsLkK3Ka8nLowWvAHbBChqv2FZeL" - }, - { - "lamports": 42, - "address": "aYJCgU7REfu3XF8b3QhkqgqQvLizx8zxuLBHA25PzDS" - }, - { - "lamports": 42, - "address": "CTvHVtQ4gd4gUcw3bdVgZJJqApXE9nCbbbP4VTS5wE1D" - }, - { - "lamports": 20, - "address": "4fq3xJ6kfrh9RkJQsmVd5gNMvJbuSHfErywvEjNQDPxu" - }, - { - "lamports": 4, - "address": "AXJADheGVp9cruP8WYu46oNkRbeASngN5fPCMVGQqNHa" - }, - { - "lamports": 2, - "address": "8NT8yS6LiwNprgW4yM1jPPow7CwRUotddBVkrkWgYp24" - }, - { - "lamports": 1, - "address": "SysvarEpochSchedu1e111111111111111111111111" - }, - { - "lamports": 1, - "address": "11111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "Stake11111111111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "SysvarC1ock11111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "StakeConfig11111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "SysvarRent111111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "Config1111111111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "SysvarStakeHistory1111111111111111111111111" - }, - { - "lamports": 1, - "address": "SysvarRecentB1ockHashes11111111111111111111" - }, - { - "lamports": 1, - "address": "SysvarFees111111111111111111111111111111111" - }, - { - "lamports": 1, - "address": "Vote111111111111111111111111111111111111111" - } - ] - }, - "id": 1 -} -``` - -### getLatestBlockhash - -**NEW: This method is only available in solana-core v1.9 or newer. Please use -[getRecentBlockhash](jsonrpc-api.md#getrecentblockhash) for solana-core v1.8** - -Returns the latest blockhash - -#### Parameters: - -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) (used for retrieving blockhash) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `RpcResponse` - RpcResponse JSON object with `value` field set to a JSON object including: -- `blockhash: ` - a Hash as base-58 encoded string -- `lastValidBlockHeight: ` - last [block height](../../terminology.md#block-height) at which the blockhash will be valid - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "id":1, - "jsonrpc":"2.0", - "method":"getLatestBlockhash", - "params":[ - { - "commitment":"processed" - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 2792 - }, - "value": { - "blockhash": "EkSnNWid2cvwEVnVx9aBqawnmiCNiDgp3gUdkDPTKN1N", - "lastValidBlockHeight": 3090 - } - }, - "id": 1 -} -``` - -### getLeaderSchedule - -Returns the leader schedule for an epoch - -#### Parameters: - -- (optional) `` - Fetch the leader schedule for the epoch that corresponds to the provided slot. - If unspecified, the leader schedule for the current epoch is fetched -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `identity: ` - Only return results for this validator identity (base-58 encoded) - -#### Results: - -- `` - if requested epoch is not found -- `` - otherwise, the result field will be a dictionary of validator identities, - as base-58 encoded strings, and their corresponding leader slot indices as values - (indices are relative to the first slot in the requested epoch) - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63 - ] - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getLeaderSchedule", - "params": [ - null, - { - "identity": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F" - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F": [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63 - ] - }, - "id": 1 -} -``` - -### getMaxRetransmitSlot - -Get the max slot seen from retransmit stage. - -#### Results: - -- `` - Slot - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getMaxRetransmitSlot"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 1234, "id": 1 } -``` - -### getMaxShredInsertSlot - -Get the max slot seen from after shred insert. - -#### Results: - -- `` - Slot - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getMaxShredInsertSlot"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 1234, "id": 1 } -``` - -### getMinimumBalanceForRentExemption - -Returns minimum balance required to make account rent exempt. - -#### Parameters: - -- `` - account data length -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -- `` - minimum lamports required in account - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getMinimumBalanceForRentExemption", "params":[50]} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 500, "id": 1 } -``` - -### getMultipleAccounts - -Returns the account information for a list of Pubkeys. - -#### Parameters: - -- `` - An array of Pubkeys to query, as base-58 encoded strings (up to a maximum of 100). -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd", or "jsonParsed". - "base58" is limited to Account data of less than 129 bytes. - "base64" will return base64 encoded data for Account data of any size. - "base64+zstd" compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to "base64" encoding, detectable when the `data` field is type ``. - - (optional) `dataSlice: ` - limit the returned account data using the provided `offset: ` and `length: ` fields; has no effect on parsed account data. - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to: - -An array of: - -- `` - if the account at that Pubkey doesn't exist -- `` - otherwise, a JSON object containing: - - `lamports: `, number of lamports assigned to this account, as a u64 - - `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - - `data: <[string, encoding]|object>`, data associated with the account, either as encoded binary data or JSON format `{: }`, depending on encoding parameter - - `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) - - `rentEpoch: `, the epoch at which this account will next owe rent, as u64 - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getMultipleAccounts", - "params": [ - [ - "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", - "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" - ], - { - "dataSlice": { - "offset": 0, - "length": 0 - } - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": [ - { - "data": ["", "base64"], - "executable": false, - "lamports": 1000000000, - "owner": "11111111111111111111111111111111", - "rentEpoch": 2, - "space": 16 - }, - { - "data": ["", "base64"], - "executable": false, - "lamports": 5000000000, - "owner": "11111111111111111111111111111111", - "rentEpoch": 2, - "space": 0 - } - ] - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getMultipleAccounts", - "params": [ - [ - "vines1vzrYbzLMRdu58ou5XTby4qAqVRLmqo36NKPTg", - "4fYNw3dojWmQ4dXtSGE9epjRGy9pFSx62YypT7avPYvA" - ], - { - "encoding": "base58" - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": [ - { - "data": [ - "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHRTPuR3oZ1EioKtYGiYxpxMG5vpbZLsbcBYBEmZZcMKaSoGx9JZeAuWf", - "base58" - ], - "executable": false, - "lamports": 1000000000, - "owner": "11111111111111111111111111111111", - "rentEpoch": 2, - "space": 80 - }, - { - "data": ["", "base58"], - "executable": false, - "lamports": 5000000000, - "owner": "11111111111111111111111111111111", - "rentEpoch": 2, - "space": 0 - } - ] - }, - "id": 1 -} -``` - -### getProgramAccounts - -Returns all accounts owned by the provided program Pubkey - -#### Parameters: - -- `` - Pubkey of program, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd", or "jsonParsed". - "base58" is limited to Account data of less than 129 bytes. - "base64" will return base64 encoded data for Account data of any size. - "base64+zstd" compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to "base64" encoding, detectable when the `data` field is type ``. - - (optional) `dataSlice: ` - limit the returned account data using the provided `offset: ` and `length: ` fields; has no effect on parsed account data. - - (optional) `filters: ` - filter results using up to 4 [filter objects](jsonrpc-api.md#filters); account must meet all filter criteria to be included in results - - (optional) `withContext: bool` - wrap the result in an RpcResponse JSON object. - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -##### Filters: - -- `memcmp: ` - compares a provided series of bytes with program account data at a particular offset. Fields: - - - `offset: ` - offset into program account data to start comparison - - `bytes: ` - data to match, as encoded string - - `encoding: ` - encoding for filter `bytes` data, either "base58" or "base64". Data is limited in size to 128 or fewer decoded bytes. - **NEW: This field, and base64 support generally, is only available in solana-core v1.14.0 or newer. Please omit when querying nodes on earlier versions** - -- `dataSize: ` - compares the program account data length with the provided data size - -#### Results: - -By default the result field will be an array of JSON objects. If `withContext` flag is set the array will be wrapped in an RpcResponse JSON object. - -The array will contain: - -- `pubkey: ` - the account Pubkey as base-58 encoded string -- `account: ` - a JSON object, with the following sub fields: - - `lamports: `, number of lamports assigned to this account, as a u64 - - `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - - `data: <[string,encoding]|object>`, data associated with the account, either as encoded binary data or JSON format `{: }`, depending on encoding parameter - - `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) - - `rentEpoch: `, the epoch at which this account will next owe rent, as u64 - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getProgramAccounts", "params":["4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "account": { - "data": "2R9jLfiAQ9bgdcw6h8s44439", - "executable": false, - "lamports": 15298080, - "owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", - "rentEpoch": 28, - "space": 16 - }, - "pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY" - } - ], - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getProgramAccounts", - "params": [ - "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", - { - "filters": [ - { - "dataSize": 17 - }, - { - "memcmp": { - "offset": 4, - "bytes": "3Mc6vR" - } - } - ] - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "account": { - "data": "2R9jLfiAQ9bgdcw6h8s44439", - "executable": false, - "lamports": 15298080, - "owner": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", - "rentEpoch": 28, - "space": 42 - }, - "pubkey": "CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY" - } - ], - "id": 1 -} -``` - -### getRecentPerformanceSamples - -Returns a list of recent performance samples, in reverse slot order. Performance -samples are taken every 60 seconds and include the number of transactions and -slots that occur in a given time window. - -#### Parameters: - -- (optional) `limit: ` - number of samples to return (maximum 720) - -#### Results: - -An array of: - -- `RpcPerfSample` - - `slot: ` - Slot in which sample was taken at - - `numTransactions: ` - Number of transactions in sample - - `numNonVoteTransaction: ` - Number of non-vote transactions in - sample.
    - To get a number of voting transactions compute `numTransactions - - numNonVoteTransaction`.
    - This field is present starting with v1.15. - - `numSlots: ` - Number of slots in sample - - `samplePeriodSecs: ` - Number of seconds in a sample window - -#### Example: - -Request: - -```bash -// Request -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getRecentPerformanceSamples", "params": [4]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "numSlots": 126, - "numTransactions": 126, - "numNonVoteTransaction": 1, - "samplePeriodSecs": 60, - "slot": 348125 - }, - { - "numSlots": 126, - "numTransactions": 126, - "numNonVoteTransaction": 1, - "samplePeriodSecs": 60, - "slot": 347999 - }, - { - "numSlots": 125, - "numTransactions": 125, - "numNonVoteTransaction": 0, - "samplePeriodSecs": 60, - "slot": 347873 - }, - { - "numSlots": 125, - "numTransactions": 125, - "numNonVoteTransaction": 0, - "samplePeriodSecs": 60, - "slot": 347748 - } - ], - "id": 1 -} -``` - -### getRecentPrioritizationFees - -Returns a list of prioritization fees from recent blocks. Currently, a -node's prioritization-fee cache stores data from up to 150 blocks. - -#### Parameters: - -- `` - (optional) An array of account address strings (up to a maximum of 128 addresses). If this parameter is provided, the response will reflect a fee to land a transaction locking all of the provided accounts as writable. - -#### Results: - -An array of: - -- `RpcPrioritizationFee` - - `slot: ` - Slot in which fee was observed - - `prioritizationFee: ` - the per-compute-unit fee paid by at least one successfully landed transaction, specified in increments of 0.000001 lamports - -#### Example: - -Request: - -```bash -// Request -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getRecentPrioritizationFees", "params": [["CxELquR1gPP8wHe33gZ4QxqGB3sZ9RSwsJ2KshVewkFY"]]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "slot": 348125, - "prioritizationFee": 0 - }, - { - "slot": 348126, - "prioritizationFee": 1000 - }, - { - "slot": 348127, - "prioritizationFee": 500 - }, - { - "slot": 348128, - "prioritizationFee": 0 - }, - { - "slot": 348129, - "prioritizationFee": 1234 - } - ], - "id": 1 -} -``` - -### getSignaturesForAddress - -Returns signatures for confirmed transactions that include the given address in -their `accountKeys` list. Returns signatures backwards in time from the -provided signature or most recent confirmed block - -#### Parameters: - -- `` - account address as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `limit: ` - maximum transaction signatures to return (between 1 and 1,000, default: 1,000). - - (optional) `before: ` - start searching backwards from this transaction signature. - If not provided the search starts from the top of the highest max confirmed block. - - (optional) `until: ` - search until this transaction signature, if found before limit reached. - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result field will be an array of transaction signature information, ordered -from newest to oldest transaction: - -- `` - - `signature: ` - transaction signature as base-58 encoded string - - `slot: ` - The slot that contains the block with the transaction - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - - `memo: ` - Memo associated with the transaction, null if no memo is present - - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available. - - `confirmationStatus: ` - The transaction's cluster confirmation status; either `processed`, `confirmed`, or `finalized`. See [Commitment](jsonrpc-api.md#configuring-state-commitment) for more on optimistic confirmation. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getSignaturesForAddress", - "params": [ - "Vote111111111111111111111111111111111111111", - { - "limit": 1 - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "err": null, - "memo": null, - "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", - "slot": 114, - "blockTime": null - } - ], - "id": 1 -} -``` - -### getSignatureStatuses - -Returns the statuses of a list of signatures. Unless the -`searchTransactionHistory` configuration parameter is included, this method only -searches the recent status cache of signatures, which retains statuses for all -active slots plus `MAX_RECENT_BLOCKHASHES` rooted slots. - -#### Parameters: - -- `` - An array of transaction signatures to confirm, as base-58 encoded strings (up to a maximum of 256) -- (optional) `` - Configuration object containing the following field: - - `searchTransactionHistory: ` - if true, a Solana node will search its ledger cache for any signatures not found in the recent status cache - -#### Results: - -An RpcResponse containing a JSON object consisting of an array of TransactionStatus objects. - -- `RpcResponse` - RpcResponse JSON object with `value` field: - -An array of: - -- `` - Unknown transaction -- `` - - `slot: ` - The slot the transaction was processed - - `confirmations: ` - Number of blocks since signature confirmation, null if rooted, as well as finalized by a supermajority of the cluster - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - - `confirmationStatus: ` - The transaction's cluster confirmation status; either `processed`, `confirmed`, or `finalized`. See [Commitment](jsonrpc-api.md#configuring-state-commitment) for more on optimistic confirmation. - - DEPRECATED: `status: ` - Transaction status - - `"Ok": ` - Transaction was successful - - `"Err": ` - Transaction failed with TransactionError - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getSignatureStatuses", - "params": [ - [ - "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW", - "5j7s6NiJS3JAkvgkoc18WVAsiSaci2pxB2A6ueCJP4tprA2TFg9wSyTLeYouxPBJEMzJinENTkpA52YStRW5Dia7" - ] - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 82 - }, - "value": [ - { - "slot": 72, - "confirmations": 10, - "err": null, - "status": { - "Ok": null - }, - "confirmationStatus": "confirmed" - }, - null - ] - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getSignatureStatuses", - "params": [ - [ - "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW" - ], - { - "searchTransactionHistory": true - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 82 - }, - "value": [ - { - "slot": 48, - "confirmations": null, - "err": null, - "status": { - "Ok": null - }, - "confirmationStatus": "finalized" - }, - null - ] - }, - "id": 1 -} -``` - -### getSlot - -Returns the slot that has reached the [given or default commitment level](jsonrpc-api.md#configuring-state-commitment) - -#### Parameters: - -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `` - Current slot - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getSlot"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 1234, "id": 1 } -``` - -### getSlotLeader - -Returns the current slot leader - -#### Parameters: - -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `` - Node identity Pubkey as base-58 encoded string - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getSlotLeader"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": "ENvAW7JScgYq6o4zKZwewtkzzJgDzuJAFxYasvmEQdpS", - "id": 1 -} -``` - -### getSlotLeaders - -Returns the slot leaders for a given slot range - -#### Parameters: - -- `` - Start slot, as u64 integer -- `` - Limit, as u64 integer (between 1 and 5,000) - -#### Results: - -- `` - Node identity public keys as base-58 encoded strings - -#### Example: - -If the current slot is #99, query the next 10 leaders with the following request: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getSlotLeaders", "params":[100, 10]} -' -``` - -Result: - -The first leader returned is the leader for slot #100: - -```json -{ - "jsonrpc": "2.0", - "result": [ - "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", - "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", - "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", - "ChorusmmK7i1AxXeiTtQgQZhQNiXYU84ULeaYF1EH15n", - "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", - "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", - "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", - "Awes4Tr6TX8JDzEhCZY2QVNimT6iD1zWHzf1vNyGvpLM", - "DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP", - "DWvDTSh3qfn88UoQTEKRV2JnLt5jtJAVoiCo3ivtMwXP" - ], - "id": 1 -} -``` - -### getStakeActivation - -Returns epoch activation information for a stake account - -#### Parameters: - -- `` - Pubkey of stake account to query, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `epoch: ` - epoch for which to calculate activation details. If parameter not provided, defaults to current epoch. - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result will be a JSON object with the following fields: - -- `state: ` - stake active during the epoch -- `inactive: ` - stake inactive during the epoch - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getStakeActivation", "params": ["CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { "active": 197717120, "inactive": 0, "state": "active" }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getStakeActivation", - "params": [ - "CYRJWqiSjLitBAcRxPvWpgX3s5TvmN2SuRY3eEYypFvT", - { - "epoch": 4 - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "active": 124429280, - "inactive": 73287840, - "state": "activating" - }, - "id": 1 -} -``` - -### getStakeMinimumDelegation - -Returns the stake minimum delegation, in lamports. - -#### Parameters: - -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to: - -- `` - The stake minimum delegation, in lamports - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1,"method":"getStakeMinimumDelegation"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 501 - }, - "value": 1000000000 - }, - "id": 1 -} -``` - -### getSupply - -Returns information about the current supply. - -#### Parameters: - -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `excludeNonCirculatingAccountsList: ` - exclude non circulating accounts list from response - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: - -- `total: ` - Total supply in lamports -- `circulating: ` - Circulating supply in lamports -- `nonCirculating: ` - Non-circulating supply in lamports -- `nonCirculatingAccounts: ` - an array of account addresses of non-circulating accounts, as strings. If `excludeNonCirculatingAccountsList` is enabled, the returned array will be empty. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getSupply"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1114 - }, - "value": { - "circulating": 16000, - "nonCirculating": 1000000, - "nonCirculatingAccounts": [ - "FEy8pTbP5fEoqMV1GdTz83byuA8EKByqYat1PKDgVAq5", - "9huDUZfxoJ7wGMTffUE7vh1xePqef7gyrLJu9NApncqA", - "3mi1GmwEE3zo2jmfDuzvjSX9ovRXsDUKHvsntpkhuLJ9", - "BYxEJTDerkaRWBem3XgnVcdhppktBXa2HbkHPKj2Ui4Z" - ], - "total": 1016000 - } - }, - "id": 1 -} -``` - -### getTokenAccountBalance - -Returns the token balance of an SPL Token account. - -#### Parameters: - -- `` - Pubkey of Token account to query, as base-58 encoded string -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: - -- `amount: ` - the raw balance without decimals, a string representation of u64 -- `decimals: ` - number of base 10 digits to the right of the decimal place -- `uiAmount: ` - the balance, using mint-prescribed decimals **DEPRECATED** -- `uiAmountString: ` - the balance as a string, using mint-prescribed decimals - -For more details on returned data: The -[Token Balances Structure](jsonrpc-api.md#token-balances-structure) response from [getBlock](jsonrpc-api.md#getblock) follows a similar structure. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getTokenAccountBalance", "params": ["7fUAJdStEuGbc3sM84cKRL6yYaaSstyLSU4ve5oovLS7"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1114 - }, - "value": { - "amount": "9864", - "decimals": 2, - "uiAmount": 98.64, - "uiAmountString": "98.64" - }, - "id": 1 - } -} -``` - -### getTokenAccountsByDelegate - -Returns all SPL Token accounts by approved Delegate. - -#### Parameters: - -- `` - Pubkey of account delegate to query, as base-58 encoded string -- `` - Either: - - `mint: ` - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or - - `programId: ` - Pubkey of the Token program that owns the accounts, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd", or "jsonParsed". - "base58" is limited to Account data of less than 129 bytes. - "base64" will return base64 encoded data for Account data of any size. - "base64+zstd" compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to "base64" encoding, detectable when the `data` field is type ``. - - (optional) `dataSlice: ` - limit the returned account data using the provided `offset: ` and `length: ` fields; has no effect on parsed account data. - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain: - -- `pubkey: ` - the account Pubkey as base-58 encoded string -- `account: ` - a JSON object, with the following sub fields: - - `lamports: `, number of lamports assigned to this account, as a u64 - - `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - - `data: `, Token state data associated with the account, either as encoded binary data or in JSON format `{: }` - - `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) - - `rentEpoch: `, the epoch at which this account will next owe rent, as u64 - -When the data is requested with the `jsonParsed` encoding a format similar to that of the [Token Balances Structure](jsonrpc-api.md#token-balances-structure) can be expected inside the structure, both for the `tokenAmount` and the `delegatedAmount`, with the latter being an optional object. - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getTokenAccountsByDelegate", - "params": [ - "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", - { - "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "encoding": "jsonParsed" - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1114 - }, - "value": [ - { - "account": { - "data": { - "program": "spl-token", - "parsed": { - "info": { - "tokenAmount": { - "amount": "1", - "decimals": 1, - "uiAmount": 0.1, - "uiAmountString": "0.1" - }, - "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", - "delegatedAmount": { - "amount": "1", - "decimals": 1, - "uiAmount": 0.1, - "uiAmountString": "0.1" - }, - "state": "initialized", - "isNative": false, - "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", - "owner": "CnPoSPKXu7wJqxe59Fs72tkBeALovhsCxYeFwPCQH9TD" - }, - "type": "account" - }, - "space": 165 - }, - "executable": false, - "lamports": 1726080, - "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", - "rentEpoch": 4, - "space": 165 - }, - "pubkey": "28YTZEwqtMHWrhWcvv34se7pjS7wctgqzCPB3gReCFKp" - } - ] - }, - "id": 1 -} -``` - -### getTokenAccountsByOwner - -Returns all SPL Token accounts by token owner. - -#### Parameters: - -- `` - Pubkey of account owner to query, as base-58 encoded string -- `` - Either: - - `mint: ` - Pubkey of the specific token Mint to limit accounts to, as base-58 encoded string; or - - `programId: ` - Pubkey of the Token program that owns the accounts, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd", or "jsonParsed". - "base58" is limited to Account data of less than 129 bytes. - "base64" will return base64 encoded data for Account data of any size. - "base64+zstd" compresses the Account data using [Zstandard](https://facebook.github.io/zstd/) and base64-encodes the result. - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to "base64" encoding, detectable when the `data` field is type ``. - - (optional) `dataSlice: ` - limit the returned account data using the provided `offset: ` and `length: ` fields; has no effect on parsed account data. - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects, which will contain: - -- `pubkey: ` - the account Pubkey as base-58 encoded string -- `account: ` - a JSON object, with the following sub fields: - - `lamports: `, number of lamports assigned to this account, as a u64 - - `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - - `data: `, Token state data associated with the account, either as encoded binary data or in JSON format `{: }` - - `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) - - `rentEpoch: `, the epoch at which this account will next owe rent, as u64 - -When the data is requested with the `jsonParsed` encoding a format similar to that of the [Token Balances Structure](jsonrpc-api.md#token-balances-structure) can be expected inside the structure, both for the `tokenAmount` and the `delegatedAmount`, with the latter being an optional object. - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getTokenAccountsByOwner", - "params": [ - "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F", - { - "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E" - }, - { - "encoding": "jsonParsed" - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1114 - }, - "value": [ - { - "account": { - "data": { - "program": "spl-token", - "parsed": { - "accountType": "account", - "info": { - "tokenAmount": { - "amount": "1", - "decimals": 1, - "uiAmount": 0.1, - "uiAmountString": "0.1" - }, - "delegate": "4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T", - "delegatedAmount": { - "amount": "1", - "decimals": 1, - "uiAmount": 0.1, - "uiAmountString": "0.1" - }, - "state": "initialized", - "isNative": false, - "mint": "3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E", - "owner": "4Qkev8aNZcqFNSRhQzwyLMFSsi94jHqE8WNVTJzTP99F" - }, - "type": "account" - }, - "space": 165 - }, - "executable": false, - "lamports": 1726080, - "owner": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA", - "rentEpoch": 4, - "space": 165 - }, - "pubkey": "C2gJg6tKpQs41PRS1nC8aw3ZKNZK3HQQZGVrDFDup5nx" - } - ] - }, - "id": 1 -} -``` - -### getTokenLargestAccounts - -Returns the 20 largest accounts of a particular SPL Token type. - -#### Parameters: - -- `` - Pubkey of token Mint to query, as base-58 encoded string -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to an array of JSON objects containing: - -- `address: ` - the address of the token account -- `amount: ` - the raw token account balance without decimals, a string representation of u64 -- `decimals: ` - number of base 10 digits to the right of the decimal place -- `uiAmount: ` - the token account balance, using mint-prescribed decimals **DEPRECATED** -- `uiAmountString: ` - the token account balance as a string, using mint-prescribed decimals - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getTokenLargestAccounts", "params": ["3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1114 - }, - "value": [ - { - "address": "FYjHNoFtSQ5uijKrZFyYAxvEr87hsKXkXcxkcmkBAf4r", - "amount": "771", - "decimals": 2, - "uiAmount": 7.71, - "uiAmountString": "7.71" - }, - { - "address": "BnsywxTcaYeNUtzrPxQUvzAWxfzZe3ZLUJ4wMMuLESnu", - "amount": "229", - "decimals": 2, - "uiAmount": 2.29, - "uiAmountString": "2.29" - } - ] - }, - "id": 1 -} -``` - -### getTokenSupply - -Returns the total supply of an SPL Token type. - -#### Parameters: - -- `` - Pubkey of token Mint to query, as base-58 encoded string -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to a JSON object containing: - -- `amount: ` - the raw total token supply without decimals, a string representation of u64 -- `decimals: ` - number of base 10 digits to the right of the decimal place -- `uiAmount: ` - the total token supply, using mint-prescribed decimals **DEPRECATED** -- `uiAmountString: ` - the total token supply as a string, using mint-prescribed decimals - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0", "id":1, "method":"getTokenSupply", "params": ["3wyAj7Rt1TWVPZVteFJPLa26JmLvdb1CAKEFZm3NY75E"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1114 - }, - "value": { - "amount": "100000", - "decimals": 2, - "uiAmount": 1000, - "uiAmountString": "1000" - } - }, - "id": 1 -} -``` - -### getTransaction - -Returns transaction details for a confirmed transaction - -#### Parameters: - -- `` - transaction signature as base-58 encoded string -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `encoding: ` - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (_slow_), "base64". If parameter not provided, the default encoding is "json". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific instruction parsers to return more human-readable and explicit data in the `transaction.message.instructions` list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - - (optional) `maxSupportedTransactionVersion: ` - set the max transaction version to return in responses. If the requested transaction is a higher version, an error will be returned. If this parameter is omitted, only legacy transactions will be returned, and any versioned transaction will prompt the error. - -#### Results: - -- `` - if transaction is not found or not confirmed -- `` - if transaction is confirmed, an object with the following fields: - - `slot: ` - the slot this transaction was processed in - - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter - - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available - - `meta: ` - transaction status metadata object: - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/transaction/enum.TransactionError.html) - - `fee: ` - fee this transaction was charged, as u64 integer - - `preBalances: ` - array of u64 account balances from before the transaction was processed - - `postBalances: ` - array of u64 account balances after the transaction was processed - - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction - - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction - - DEPRECATED: `status: ` - Transaction status - - `"Ok": ` - Transaction was successful - - `"Err": ` - Transaction failed with TransactionError - - `rewards: ` - transaction-level rewards, populated if rewards are requested; an array of JSON objects containing: - - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward - - `lamports: `- number of reward lamports credited or debited by the account, as a i64 - - `postBalance: ` - account balance in lamports after the reward was applied - - `rewardType: ` - type of reward: currently only "rent", other types may be added in the future - - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards - - `loadedAddresses: ` - Transaction addresses loaded from address lookup tables. Undefined if `maxSupportedTransactionVersion` is not set in request params. - - `writable: ` - Ordered list of base-58 encoded addresses for writable loaded accounts - - `readonly: ` - Ordered list of base-58 encoded addresses for readonly loaded accounts - - `returnData: ` - the most-recent return data generated by an instruction in the transaction, with the following fields: - - `programId: `, the program that generated the return data, as base-58 encoded Pubkey - - `data: <[string, encoding]>`, the return data itself, as base-64 encoded binary data - - `computeUnitsConsumed: `, number of [compute units](developing/programming-model/runtime.md#compute-budget) consumed by the transaction - - `version: <"legacy"|number|undefined>` - Transaction version. Undefined if `maxSupportedTransactionVersion` is not set in request params. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getTransaction", - "params": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv", - "json" - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "rewards": [], - "status": { - "Ok": null - } - }, - "slot": 430, - "transaction": { - "message": { - "accountKeys": [ - "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", - "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", - "SysvarS1otHashes111111111111111111111111111", - "SysvarC1ock11111111111111111111111111111111", - "Vote111111111111111111111111111111111111111" - ], - "header": { - "numReadonlySignedAccounts": 0, - "numReadonlyUnsignedAccounts": 3, - "numRequiredSignatures": 1 - }, - "instructions": [ - { - "accounts": [1, 2, 3, 0], - "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", - "programIdIndex": 4 - } - ], - "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" - }, - "signatures": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" - ] - } - }, - "blockTime": null, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getTransaction", - "params": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv", - "base64" - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "rewards": null, - "status": { - "Ok": null - } - }, - "slot": 430, - "transaction": [ - "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==", - "base64" - ] - }, - "id": 1 -} -``` - -### getTransactionCount - -Returns the current Transaction count from the ledger - -#### Parameters: - -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `` - count - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getTransactionCount"} -' - -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 268, "id": 1 } -``` - -### getVersion - -Returns the current solana versions running on the node - -#### Parameters: - -None - -#### Results: - -The result field will be a JSON object with the following fields: - -- `solana-core`, software version of solana-core -- `feature-set`, unique identifier of the current software's feature set - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getVersion"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": { "solana-core": "1.15.0" }, "id": 1 } -``` - -### getVoteAccounts - -Returns the account info and associated stake for all the voting accounts in the current bank. - -#### Parameters: - -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `votePubkey: ` - Only return results for this validator vote address (base-58 encoded) - - (optional) `keepUnstakedDelinquents: ` - Do not filter out delinquent validators with no stake - - (optional) `delinquentSlotDistance: ` - Specify the number of slots behind the tip that a validator must fall to be considered delinquent. **NOTE:** For the sake of consistency between ecosystem products, _it is **not** recommended that this argument be specified._ - -#### Results: - -The result field will be a JSON object of `current` and `delinquent` accounts, -each containing an array of JSON objects with the following sub fields: - -- `votePubkey: ` - Vote account address, as base-58 encoded string -- `nodePubkey: ` - Validator identity, as base-58 encoded string -- `activatedStake: ` - the stake, in lamports, delegated to this vote account and active in this epoch -- `epochVoteAccount: ` - bool, whether the vote account is staked for this epoch -- `commission: `, percentage (0-100) of rewards payout owed to the vote account -- `lastVote: ` - Most recent slot voted on by this vote account -- `epochCredits: ` - Latest history of earned credits for up to five epochs, as an array of arrays containing: `[epoch, credits, previousCredits]`. -- `rootSlot: ` - Current root slot for this vote account - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "current": [ - { - "commission": 0, - "epochVoteAccount": true, - "epochCredits": [ - [1, 64, 0], - [2, 192, 64] - ], - "nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD", - "lastVote": 147, - "activatedStake": 42, - "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" - } - ], - "delinquent": [ - { - "commission": 127, - "epochVoteAccount": false, - "epochCredits": [], - "nodePubkey": "6ZPxeQaDo4bkZLRsdNrCzchNQr5LN9QMc9sipXv9Kw8f", - "lastVote": 0, - "activatedStake": 0, - "votePubkey": "CmgCk4aMS7KW1SHX3s9K5tBJ6Yng2LBaC8MFov4wx9sm" - } - ] - }, - "id": 1 -} -``` - -#### Example: Restrict results to a single validator vote account - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getVoteAccounts", - "params": [ - { - "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "current": [ - { - "commission": 0, - "epochVoteAccount": true, - "epochCredits": [ - [1, 64, 0], - [2, 192, 64] - ], - "nodePubkey": "B97CCUW3AEZFGy6uUg6zUdnNYvnVq5VG8PUtb2HayTDD", - "lastVote": 147, - "activatedStake": 42, - "votePubkey": "3ZT31jkAGhUaw8jsy4bTknwBMP8i4Eueh52By4zXcsVw" - } - ], - "delinquent": [] - }, - "id": 1 -} -``` - -### isBlockhashValid - -**NEW: This method is only available in solana-core v1.9 or newer. Please use -[getFeeCalculatorForBlockhash](jsonrpc-api.md#getfeecalculatorforblockhash) for solana-core v1.8** - -Returns whether a blockhash is still valid or not - -#### Parameters: - -- `blockhash: ` - the blockhash of this block, as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) (used for retrieving blockhash) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -- `` - True if the blockhash is still valid - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "id":45, - "jsonrpc":"2.0", - "method":"isBlockhashValid", - "params":[ - "J7rBdM6AecPDEZp8aPq5iPSNKVkU5Q76F3oAV4eW5wsW", - {"commitment":"processed"} - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 2483 - }, - "value": false - }, - "id": 1 -} -``` - -### minimumLedgerSlot - -Returns the lowest slot that the node has information about in its ledger. This -value may increase over time if the node is configured to purge older ledger data - -#### Parameters: - -None - -#### Results: - -- `u64` - Minimum ledger slot - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"minimumLedgerSlot"} -' - -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 1234, "id": 1 } -``` - -### requestAirdrop - -Requests an airdrop of lamports to a Pubkey - -#### Parameters: - -- `` - Pubkey of account to receive lamports, as base-58 encoded string -- `` - lamports, as a u64 -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) (used for retrieving blockhash and verifying airdrop success) - -#### Results: - -- `` - Transaction Signature of airdrop, as base-58 encoded string - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"requestAirdrop", "params":["83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri", 1000000000]} -' - -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW", - "id": 1 -} -``` - -### sendTransaction - -Submits a signed transaction to the cluster for processing. - -This method does not alter the transaction in any way; it relays the -transaction created by clients to the node as-is. - -If the node's rpc service receives the transaction, this method immediately -succeeds, without waiting for any confirmations. A successful response from -this method does not guarantee the transaction is processed or confirmed by the -cluster. - -While the rpc service will reasonably retry to submit it, the transaction -could be rejected if transaction's `recent_blockhash` expires before it lands. - -Use [`getSignatureStatuses`](jsonrpc-api.md#getsignaturestatuses) to ensure -a transaction is processed and confirmed. - -Before submitting, the following preflight checks are performed: - -1. The transaction signatures are verified -2. The transaction is simulated against the bank slot specified by the preflight - commitment. On failure an error will be returned. Preflight checks may be - disabled if desired. It is recommended to specify the same commitment and - preflight commitment to avoid confusing behavior. - -The returned signature is the first signature in the transaction, which -is used to identify the transaction ([transaction id](../../terminology.md#transaction-id)). -This identifier can be easily extracted from the transaction data before -submission. - -#### Parameters: - -- `` - fully-signed Transaction, as encoded string -- (optional) `` - Configuration object containing the following field: - - `skipPreflight: ` - if true, skip the preflight transaction checks (default: false) - - (optional) `preflightCommitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) level to use for preflight (default: `"finalized"`). - - (optional) `encoding: ` - Encoding used for the transaction data. Either `"base58"` (_slow_, **DEPRECATED**), or `"base64"`. (default: `"base58"`). - - (optional) `maxRetries: ` - Maximum number of times for the RPC node to retry sending the transaction to the leader. - If this parameter not provided, the RPC node will retry the transaction until it is finalized or until the blockhash expires. - - (optional) `minContextSlot: ` - set the minimum slot at which to perform preflight transaction checks. - -#### Results: - -- `` - First Transaction Signature embedded in the transaction, as base-58 encoded string ([transaction id](../../terminology.md#transaction-id)) - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "sendTransaction", - "params": [ - "4hXTCkRzt9WyecNzV1XPgCDfGAZzQKNxLXgynz5QDuWWPSAZBZSHptvWRL3BjCvzUXRdKvHL2b7yGrRQcWyaqsaBCncVG7BFggS8w9snUts67BSh3EqKpXLUm5UMHfD7ZBe9GhARjbNQMLJ1QD3Spr6oMTBU6EhdB4RD8CP2xUxr2u3d6fos36PD98XS6oX8TQjLpsMwncs5DAMiD4nNnR8NBfyghGCWvCVifVwvA8B8TJxE1aiyiv2L429BCWfyzAme5sZW8rDb14NeCQHhZbtNqfXhcp2tAnaAT" - ] - } -' - -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": "2id3YC2jK9G5Wo2phDx4gJVAew8DcY5NAojnVuao8rkxwPYPe8cSwE5GzhEgJA2y8fVjDEo6iR6ykBvDxrTQrtpb", - "id": 1 -} -``` - -### simulateTransaction - -Simulate sending a transaction - -#### Parameters: - -- `` - Transaction, as an encoded string. The transaction must have a valid blockhash, but is not required to be signed. -- (optional) `` - Configuration object containing the following fields: - - `sigVerify: ` - if true the transaction signatures will be verified (default: false, conflicts with `replaceRecentBlockhash`) - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) level to simulate the transaction at (default: `"finalized"`). - - (optional) `encoding: ` - Encoding used for the transaction data. Either `"base58"` (_slow_, **DEPRECATED**), or `"base64"`. (default: `"base58"`). - - (optional) `replaceRecentBlockhash: ` - if true the transaction recent blockhash will be replaced with the most recent blockhash. - (default: false, conflicts with `sigVerify`) - - (optional) `accounts: ` - Accounts configuration object containing the following fields: - - (optional) `encoding: ` - encoding for returned Account data, either "base64" (default), "base64+zstd" or "jsonParsed". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to binary encoding, detectable when the `data` field is type ``. - - `addresses: ` - An array of accounts to return, as base-58 encoded strings - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -An RpcResponse containing a TransactionStatus object -The result will be an RpcResponse JSON object with `value` set to a JSON object with the following fields: - -- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) -- `logs: ` - Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure) -- `accounts: ` - array of accounts with the same length as the `accounts.addresses` array in the request - - `` - if the account doesn't exist or if `err` is not null - - `` - otherwise, a JSON object containing: - - `lamports: `, number of lamports assigned to this account, as a u64 - - `owner: `, base-58 encoded Pubkey of the program this account has been assigned to - - `data: <[string, encoding]|object>`, data associated with the account, either as encoded binary data or JSON format `{: }`, depending on encoding parameter - - `executable: `, boolean indicating if the account contains a program \(and is strictly read-only\) - - `rentEpoch: `, the epoch at which this account will next owe rent, as u64 -- `unitsConsumed: `, The number of compute budget units consumed during the processing of this transaction -- `returnData: ` - the most-recent return data generated by an instruction in the transaction, with the following fields: - - `programId: `, the program that generated the return data, as base-58 encoded Pubkey - - `data: <[string, encoding]>`, the return data itself, as base-64 encoded binary data - -#### Example: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "simulateTransaction", - "params": [ - "AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEDArczbMia1tLmq7zz4DinMNN0pJ1JtLdqIJPUw3YrGCzYAMHBsgN27lcgB6H2WQvFgyZuJYHa46puOQo9yQ8CVQbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCp20C7Wj2aiuk5TReAXo+VTVg8QTHjs0UjNMMKCvpzZ+ABAgEBARU=", - { - "encoding":"base64", - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 218 - }, - "value": { - "err": null, - "accounts": null, - "logs": [ - "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri invoke [1]", - "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri consumed 2366 of 1400000 compute units", - "Program return: 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri KgAAAAAAAAA=", - "Program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success" - ], - "returnData": { - "data": ["Kg==", "base64"], - "programId": "83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri" - }, - "unitsConsumed": 2366 - } - }, - "id": 1 -} -``` - -## Subscription Websocket - -After connecting to the RPC PubSub websocket at `ws://
    /`: - -- Submit subscription requests to the websocket using the methods below -- Multiple subscriptions may be active at once -- Many subscriptions take the optional [`commitment` parameter](jsonrpc-api.md#configuring-state-commitment), defining how finalized a change should be to trigger a notification. For subscriptions, if commitment is unspecified, the default value is `"finalized"`. - -### accountSubscribe - -Subscribe to an account to receive notifications when the lamports or data for a given account public key changes - -#### Parameters: - -- `` - account Pubkey, as base-58 encoded string -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd" or "jsonParsed". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to binary encoding, detectable when the `data` field is type ``. - -#### Results: - -- `` - Subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "method": "accountSubscribe", - "params": [ - "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12", - { - "encoding": "base64", - "commitment": "finalized" - } - ] -} -{ - "jsonrpc": "2.0", - "id": 1, - "method": "accountSubscribe", - "params": [ - "CM78CPUeXjn8o3yroDHxUtKsZZgoy4GPkPPXfouKNH12", - { - "encoding": "jsonParsed" - } - ] -} -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 23784, "id": 1 } -``` - -#### Notification Format: - -The notification format is the same as seen in the [getAccountInfo](jsonrpc-api.md#getAccountInfo) RPC HTTP method. - -Base58 encoding: - -```json -{ - "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 - } -} -``` - -Parsed-JSON encoding: - -```json -{ - "jsonrpc": "2.0", - "method": "accountNotification", - "params": { - "result": { - "context": { - "slot": 5199307 - }, - "value": { - "data": { - "program": "nonce", - "parsed": { - "type": "initialized", - "info": { - "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX", - "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k", - "feeCalculator": { - "lamportsPerSignature": 5000 - } - } - } - }, - "executable": false, - "lamports": 33594, - "owner": "11111111111111111111111111111111", - "rentEpoch": 635, - "space": 80 - } - }, - "subscription": 23784 - } -} -``` - -### accountUnsubscribe - -Unsubscribe from account change notifications - -#### Parameters: - -- `` - id of account Subscription to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "accountUnsubscribe", "params": [0] } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### blockSubscribe - Unstable, disabled by default - -**This subscription is unstable and only available if the validator was started -with the `--rpc-pubsub-enable-block-subscription` flag. The format of this -subscription may change in the future** - -Subscribe to receive notification anytime a new block is Confirmed or Finalized. - -#### Parameters: - -- `filter: |` - filter criteria for the logs to receive results by account type; currently supported: - - "all" - include all transactions in block - - `{ "mentionsAccountOrProgram": }` - return only transactions that mention the provided public key (as base-58 encoded string). If no mentions in a given block, then no notification will be sent. -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd" or "jsonParsed". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the `data` field is type ``. Default is "base64". - - (optional) `transactionDetails: ` - level of transaction detail to return, either "full", "signatures", or "none". If parameter not provided, the default detail level is "full". - - (optional) `showRewards: bool` - whether to populate the `rewards` array. If parameter not provided, the default includes rewards. - -#### Results: - -- `integer` - subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": "1", "method": "blockSubscribe", "params": ["all"] } -``` - -```json -{ - "jsonrpc": "2.0", - "id": "1", - "method": "blockSubscribe", - "params": [ - { - "mentionsAccountOrProgram": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op" - }, - { - "commitment": "confirmed", - "encoding": "base64", - "showRewards": true, - "transactionDetails": "full" - } - ] -} -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 0, "id": 1 } -``` - -#### Notification Format: - -The notification will be an object with the following fields: - --`slot: ` - The corresponding slot. - -- `err: ` - Error if something went wrong publishing the notification otherwise null. -- `block: ` - A block object as seen in the [getBlock](jsonrpc-api.md#getblock) RPC HTTP method. - -```json -{ - "jsonrpc": "2.0", - "method": "blockNotification", - "params": { - "result": { - "context": { - "slot": 112301554 - }, - "value": { - "slot": 112301554, - "block": { - "previousBlockhash": "GJp125YAN4ufCSUvZJVdCyWQJ7RPWMmwxoyUQySydZA", - "blockhash": "6ojMHjctdqfB55JDpEpqfHnP96fiaHEcvzEQ2NNcxzHP", - "parentSlot": 112301553, - "transactions": [ - { - "transaction": [ - "OpltwoUvWxYi1P2U8vbIdE/aPntjYo5Aa0VQ2JJyeJE2g9Vvxk8dDGgFMruYfDu8/IfUWb0REppTe7IpAuuLRgIBAAkWnj4KHRpEWWW7gvO1c0BHy06wZi2g7/DLqpEtkRsThAXIdBbhXCLvltw50ZnjDx2hzw74NVn49kmpYj2VZHQJoeJoYJqaKcvuxCi/2i4yywedcVNDWkM84Iuw+cEn9/ROCrXY4qBFI9dveEERQ1c4kdU46xjxj9Vi+QXkb2Kx45QFVkG4Y7HHsoS6WNUiw2m4ffnMNnOVdF9tJht7oeuEfDMuUEaO7l9JeUxppCvrGk3CP45saO51gkwVYEgKzhpKjCx3rgsYxNR81fY4hnUQXSbbc2Y55FkwgRBpVvQK7/+clR4Gjhd3L4y+OtPl7QF93Akg1LaU9wRMs5nvfDFlggqI9PqJl+IvVWrNRdBbPS8LIIhcwbRTkSbqlJQWxYg3Bo2CTVbw7rt1ZubuHWWp0mD/UJpLXGm2JprWTePNULzHu67sfqaWF99LwmwjTyYEkqkRt1T0Je5VzHgJs0N5jY4iIU9K3lMqvrKOIn/2zEMZ+ol2gdgjshx+sphIyhw65F3J/Dbzk04LLkK+CULmN571Y+hFlXF2ke0BIuUG6AUF+4214Cu7FXnqo3rkxEHDZAk0lRrAJ8X/Z+iwuwI5cgbd9uHXZaGT2cvhRs7reawctIXtX1s3kTqM9YV+/wCpDLAp8axcEkaQkLDKRoWxqp8XLNZSKial7Rk+ELAVVKWoWLRXRZ+OIggu0OzMExvVLE5VHqy71FNHq4gGitkiKYNFWSLIE4qGfdFLZXy/6hwS+wq9ewjikCpd//C9BcCL7Wl0iQdUslxNVCBZHnCoPYih9JXvGefOb9WWnjGy14sG9j70+RSVx6BlkFELWwFvIlWR/tHn3EhHAuL0inS2pwX7ZQTAU6gDVaoqbR2EiJ47cKoPycBNvHLoKxoY9AZaBjPl6q8SKQJSFyFd9n44opAgI6zMTjYF/8Ok4VpXEESp3QaoUyTI9sOJ6oFP6f4dwnvQelgXS+AEfAsHsKXxGAIUDQENAgMEBQAGBwgIDg8IBJCER3QXl1AVDBADCQoOAAQLERITDAjb7ugh3gOuTy==", - "base64" - ], - "meta": { - "err": null, - "status": { - "Ok": null - }, - "fee": 5000, - "preBalances": [ - 1758510880, 2067120, 1566000, 1461600, 2039280, 2039280, - 1900080, 1865280, 0, 3680844220, 2039280 - ], - "postBalances": [ - 1758505880, 2067120, 1566000, 1461600, 2039280, 2039280, - 1900080, 1865280, 0, 3680844220, 2039280 - ], - "innerInstructions": [ - { - "index": 0, - "instructions": [ - { - "programIdIndex": 13, - "accounts": [1, 15, 3, 4, 2, 14], - "data": "21TeLgZXNbtHXVBzCaiRmH" - }, - { - "programIdIndex": 14, - "accounts": [3, 4, 1], - "data": "6qfC8ic7Aq99" - }, - { - "programIdIndex": 13, - "accounts": [1, 15, 3, 5, 2, 14], - "data": "21TeLgZXNbsn4QEpaSEr3q" - }, - { - "programIdIndex": 14, - "accounts": [3, 5, 1], - "data": "6LC7BYyxhFRh" - } - ] - }, - { - "index": 1, - "instructions": [ - { - "programIdIndex": 14, - "accounts": [4, 3, 0], - "data": "7aUiLHFjSVdZ" - }, - { - "programIdIndex": 19, - "accounts": [17, 18, 16, 9, 11, 12, 14], - "data": "8kvZyjATKQWYxaKR1qD53V" - }, - { - "programIdIndex": 14, - "accounts": [9, 11, 18], - "data": "6qfC8ic7Aq99" - } - ] - } - ], - "logMessages": [ - "Program QMNeHCGYnLVDn1icRAfQZpjPLBNkfGbSKRB83G5d8KB invoke [1]", - "Program QMWoBmAyJLAsA1Lh9ugMTw2gciTihncciphzdNzdZYV invoke [2]" - ], - "preTokenBalances": [ - { - "accountIndex": 4, - "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", - "uiTokenAmount": { - "uiAmount": null, - "decimals": 6, - "amount": "0", - "uiAmountString": "0" - }, - "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op", - "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "accountIndex": 5, - "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", - "uiTokenAmount": { - "uiAmount": 11513.0679, - "decimals": 6, - "amount": "11513067900", - "uiAmountString": "11513.0679" - }, - "owner": "rXhAofQCT7NN9TUqigyEAUzV1uLL4boeD8CRkNBSkYk", - "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "accountIndex": 10, - "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", - "uiTokenAmount": { - "uiAmount": null, - "decimals": 6, - "amount": "0", - "uiAmountString": "0" - }, - "owner": "CL9wkGFT3SZRRNa9dgaovuRV7jrVVigBUZ6DjcgySsCU", - "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "accountIndex": 11, - "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", - "uiTokenAmount": { - "uiAmount": 15138.514093, - "decimals": 6, - "amount": "15138514093", - "uiAmountString": "15138.514093" - }, - "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op", - "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "postTokenBalances": [ - { - "accountIndex": 4, - "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", - "uiTokenAmount": { - "uiAmount": null, - "decimals": 6, - "amount": "0", - "uiAmountString": "0" - }, - "owner": "LieKvPRE8XeX3Y2xVNHjKlpAScD12lYySBVQ4HqoJ5op", - "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "accountIndex": 5, - "mint": "iouQcQBAiEXe6cKLS85zmZxUqaCqBdeHFpqKoSz615u", - "uiTokenAmount": { - "uiAmount": 11513.103028, - "decimals": 6, - "amount": "11513103028", - "uiAmountString": "11513.103028" - }, - "owner": "rXhAofQCT7NN9TUqigyEAUzV1uLL4boeD8CRkNBSkYk", - "programId": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA" - }, - { - "accountIndex": 10, - "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", - "uiTokenAmount": { - "uiAmount": null, - "decimals": 6, - "amount": "0", - "uiAmountString": "0" - }, - "owner": "CL9wkGFT3SZRRNa9dgaovuRV7jrVVigBUZ6DjcgySsCU", - "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - }, - { - "accountIndex": 11, - "mint": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", - "uiTokenAmount": { - "uiAmount": 15489.767829, - "decimals": 6, - "amount": "15489767829", - "uiAmountString": "15489.767829" - }, - "owner": "BeiHVPRE8XeX3Y2xVNrSsTpAScH94nYySBVQ4HqgN9at", - "programId": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb" - } - ], - "rewards": [] - } - } - ], - "blockTime": 1639926816, - "blockHeight": 101210751 - }, - "err": null - } - }, - "subscription": 14 - } -} -``` - -### blockUnsubscribe - -Unsubscribe from block notifications - -#### Parameters: - -- `` - subscription id to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "blockUnsubscribe", "params": [0] } -``` - -Response: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### logsSubscribe - -Subscribe to transaction logging - -#### Parameters: - -- `filter: |` - filter criteria for the logs to receive results by account type; currently supported: - - "all" - subscribe to all transactions except for simple vote transactions - - "allWithVotes" - subscribe to all transactions including simple vote transactions - - `{ "mentions": [ ] }` - subscribe to all transactions that mention the provided Pubkey (as base-58 encoded string) -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -- `` - Subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "method": "logsSubscribe", - "params": [ - { - "mentions": [ "11111111111111111111111111111111" ] - }, - { - "commitment": "finalized" - } - ] -} -{ - "jsonrpc": "2.0", - "id": 1, - "method": "logsSubscribe", - "params": [ "all" ] -} -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 24040, "id": 1 } -``` - -#### Notification Format: - -The notification will be an RpcResponse JSON object with value equal to: - -- `signature: ` - The transaction signature base58 encoded. -- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) -- `logs: ` - Array of log messages the transaction instructions output during execution, null if simulation failed before the transaction was able to execute (for example due to an invalid blockhash or signature verification failure) - -Example: - -```json -{ - "jsonrpc": "2.0", - "method": "logsNotification", - "params": { - "result": { - "context": { - "slot": 5208469 - }, - "value": { - "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", - "err": null, - "logs": [ - "SBF program 83astBRguLMdt2h5U1Tpdq5tjFoJ6noeGwaY3mDLVcri success" - ] - } - }, - "subscription": 24040 - } -} -``` - -### logsUnsubscribe - -Unsubscribe from transaction logging - -#### Parameters: - -- `` - id of subscription to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "logsUnsubscribe", "params": [0] } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### programSubscribe - -Subscribe to a program to receive notifications when the lamports or data for an account owned by the given program changes - -#### Parameters: - -- `` - program_id Pubkey, as base-58 encoded string -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - `encoding: ` - encoding for Account data, either "base58" (_slow_), "base64", "base64+zstd" or "jsonParsed". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific state parsers to return more human-readable and explicit account state data. If "jsonParsed" is requested but a parser cannot be found, the field falls back to base64 encoding, detectable when the `data` field is type ``. - - (optional) `filters: ` - filter results using various [filter objects](jsonrpc-api.md#filters); account must meet all filter criteria to be included in results - -#### Results: - -- `` - Subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "method": "programSubscribe", - "params": [ - "11111111111111111111111111111111", - { - "encoding": "base64", - "commitment": "finalized" - } - ] -} -{ - "jsonrpc": "2.0", - "id": 1, - "method": "programSubscribe", - "params": [ - "11111111111111111111111111111111", - { - "encoding": "jsonParsed" - } - ] -} -{ - "jsonrpc": "2.0", - "id": 1, - "method": "programSubscribe", - "params": [ - "11111111111111111111111111111111", - { - "encoding": "base64", - "filters": [ - { - "dataSize": 80 - } - ] - } - ] -} -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 24040, "id": 1 } -``` - -#### Notification Format: - -The notification format is a single program account object as seen in the [getProgramAccounts](jsonrpc-api.md#getProgramAccounts) RPC HTTP method. - -Base58 encoding: - -```json -{ - "jsonrpc": "2.0", - "method": "programNotification", - "params": { - "result": { - "context": { - "slot": 5208469 - }, - "value": { - "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq", - "account": { - "data": [ - "11116bv5nS2h3y12kD1yUKeMZvGcKLSjQgX6BeV7u1FrjeJcKfsHPXHRDEHrBesJhZyqnnq9qJeUuF7WHxiuLuL5twc38w2TXNLxnDbjmuR", - "base58" - ], - "executable": false, - "lamports": 33594, - "owner": "11111111111111111111111111111111", - "rentEpoch": 636, - "space": 80 - } - } - }, - "subscription": 24040 - } -} -``` - -Parsed-JSON encoding: - -```json -{ - "jsonrpc": "2.0", - "method": "programNotification", - "params": { - "result": { - "context": { - "slot": 5208469 - }, - "value": { - "pubkey": "H4vnBqifaSACnKa7acsxstsY1iV1bvJNxsCY7enrd1hq", - "account": { - "data": { - "program": "nonce", - "parsed": { - "type": "initialized", - "info": { - "authority": "Bbqg1M4YVVfbhEzwA9SpC9FhsaG83YMTYoR4a8oTDLX", - "blockhash": "LUaQTmM7WbMRiATdMMHaRGakPtCkc2GHtH57STKXs6k", - "feeCalculator": { - "lamportsPerSignature": 5000 - } - } - } - }, - "executable": false, - "lamports": 33594, - "owner": "11111111111111111111111111111111", - "rentEpoch": 636, - "space": 80 - } - } - }, - "subscription": 24040 - } -} -``` - -### programUnsubscribe - -Unsubscribe from program-owned account change notifications - -#### Parameters: - -- `` - id of account Subscription to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "programUnsubscribe", "params": [0] } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### signatureSubscribe - -Subscribe to a transaction signature to receive notification when a given transaction is committed. On `signatureNotification`, the subscription is automatically cancelled. - -#### Parameters: - -- `` - Transaction Signature, as base-58 encoded string -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -- `integer` - subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "method": "signatureSubscribe", - "params": [ - "2EBVM6cB8vAAD93Ktr6Vd8p67XPbQzCJX47MpReuiCXJAtcjaxpvWpcg9Ege1Nr5Tk3a2GFrByT7WPBjdsTycY9b" - ] -} - -{ - "jsonrpc": "2.0", - "id": 1, - "method": "signatureSubscribe", - "params": [ - "2EBVM6cB8vAAD93Ktr6Vd8p67XPbQzCJX47MpReuiCXJAtcjaxpvWpcg9Ege1Nr5Tk3a2GFrByT7WPBjdsTycY9b", - { - "commitment": "finalized" - } - ] -} -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 0, "id": 1 } -``` - -#### Notification Format: - -The notification will be an RpcResponse JSON object with value containing an object with: - -- `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - -Example: - -```json -{ - "jsonrpc": "2.0", - "method": "signatureNotification", - "params": { - "result": { - "context": { - "slot": 5207624 - }, - "value": { - "err": null - } - }, - "subscription": 24006 - } -} -``` - -### signatureUnsubscribe - -Unsubscribe from signature confirmation notification - -#### Parameters: - -- `` - subscription id to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "signatureUnsubscribe", "params": [0] } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### slotSubscribe - -Subscribe to receive notification anytime a slot is processed by the validator - -#### Parameters: - -None - -#### Results: - -- `integer` - subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "slotSubscribe" } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 0, "id": 1 } -``` - -#### Notification Format: - -The notification will be an object with the following fields: - -- `parent: ` - The parent slot -- `root: ` - The current root slot -- `slot: ` - The newly set slot value - -Example: - -```json -{ - "jsonrpc": "2.0", - "method": "slotNotification", - "params": { - "result": { - "parent": 75, - "root": 44, - "slot": 76 - }, - "subscription": 0 - } -} -``` - -### slotUnsubscribe - -Unsubscribe from slot notifications - -#### Parameters: - -- `` - subscription id to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "slotUnsubscribe", "params": [0] } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### slotsUpdatesSubscribe - Unstable - -**This subscription is unstable; the format of this subscription may change in -the future and it may not always be supported** - -Subscribe to receive a notification from the validator on a variety of updates -on every slot - -#### Parameters: - -None - -#### Results: - -- `integer` - subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "slotsUpdatesSubscribe" } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 0, "id": 1 } -``` - -#### Notification Format: - -The notification will be an object with the following fields: - -- `parent: ` - The parent slot -- `slot: ` - The newly updated slot -- `timestamp: ` - The Unix timestamp of the update -- `type: ` - The update type, one of: - - "firstShredReceived" - - "completed" - - "createdBank" - - "frozen" - - "dead" - - "optimisticConfirmation" - - "root" - -```bash -{ - "jsonrpc": "2.0", - "method": "slotsUpdatesNotification", - "params": { - "result": { - "parent": 75, - "slot": 76, - "timestamp": 1625081266243, - "type": "optimisticConfirmation" - }, - "subscription": 0 - } -} -``` - -### slotsUpdatesUnsubscribe - -Unsubscribe from slot-update notifications - -#### Parameters: - -- `` - subscription id to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ - "jsonrpc": "2.0", - "id": 1, - "method": "slotsUpdatesUnsubscribe", - "params": [0] -} -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### rootSubscribe - -Subscribe to receive notification anytime a new root is set by the validator. - -#### Parameters: - -None - -#### Results: - -- `integer` - subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "rootSubscribe" } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 0, "id": 1 } -``` - -#### Notification Format: - -The result is the latest root slot number. - -```json -{ - "jsonrpc": "2.0", - "method": "rootNotification", - "params": { - "result": 42, - "subscription": 0 - } -} -``` - -### rootUnsubscribe - -Unsubscribe from root notifications - -#### Parameters: - -- `` - subscription id to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "rootUnsubscribe", "params": [0] } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -### voteSubscribe - Unstable, disabled by default - -**This subscription is unstable and only available if the validator was started -with the `--rpc-pubsub-enable-vote-subscription` flag. The format of this -subscription may change in the future** - -Subscribe to receive notification anytime a new vote is observed in gossip. -These votes are pre-consensus therefore there is no guarantee these votes will -enter the ledger. - -#### Parameters: - -None - -#### Results: - -- `integer` - subscription id \(needed to unsubscribe\) - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "voteSubscribe" } -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 0, "id": 1 } -``` - -#### Notification Format: - -The notification will be an object with the following fields: - -- `hash: ` - The vote hash -- `slots: ` - The slots covered by the vote, as an array of u64 integers -- `timestamp: ` - The timestamp of the vote -- `signature: ` - The signature of the transaction that contained this vote - -```json -{ - "jsonrpc": "2.0", - "method": "voteNotification", - "params": { - "result": { - "hash": "8Rshv2oMkPu5E4opXTRyuyBeZBqQ4S477VG26wUTFxUM", - "slots": [1, 2], - "timestamp": null - }, - "subscription": 0 - } -} -``` - -### voteUnsubscribe - -Unsubscribe from vote notifications - -#### Parameters: - -- `` - subscription id to cancel - -#### Results: - -- `` - unsubscribe success message - -#### Example: - -Request: - -```json -{ "jsonrpc": "2.0", "id": 1, "method": "voteUnsubscribe", "params": [0] } -``` - -Response: - -```json -{ "jsonrpc": "2.0", "result": true, "id": 1 } -``` - -## JSON RPC API Deprecated Methods - -### getConfirmedBlock - -**DEPRECATED: Please use [getBlock](jsonrpc-api.md#getblock) instead** -This method is expected to be removed in solana-core v2.0 - -Returns identity and transaction information about a confirmed block in the ledger - -#### Parameters: - -- `` - slot, as u64 integer -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `encoding: ` - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (_slow_), "base64". If parameter not provided, the default encoding is "json". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific instruction parsers to return more human-readable and explicit data in the `transaction.message.instructions` list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). - - (optional) `transactionDetails: ` - level of transaction detail to return, either "full", "signatures", or "none". If parameter not provided, the default detail level is "full". - - (optional) `rewards: bool` - whether to populate the `rewards` array. If parameter not provided, the default includes rewards. - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -The result field will be an object with the following fields: - -- `` - if specified block is not confirmed -- `` - if block is confirmed, an object with the following fields: - - `blockhash: ` - the blockhash of this block, as base-58 encoded string - - `previousBlockhash: ` - the blockhash of this block's parent, as base-58 encoded string; if the parent block is not available due to ledger cleanup, this field will return "11111111111111111111111111111111" - - `parentSlot: ` - the slot index of this block's parent - - `transactions: ` - present if "full" transaction details are requested; an array of JSON objects containing: - - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter - - `meta: ` - transaction status metadata object, containing `null` or: - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - - `fee: ` - fee this transaction was charged, as u64 integer - - `preBalances: ` - array of u64 account balances from before the transaction was processed - - `postBalances: ` - array of u64 account balances after the transaction was processed - - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction - - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction - - DEPRECATED: `status: ` - Transaction status - - `"Ok": ` - Transaction was successful - - `"Err": ` - Transaction failed with TransactionError - - `signatures: ` - present if "signatures" are requested for transaction details; an array of signatures strings, corresponding to the transaction order in the block - - `rewards: ` - present if rewards are requested; an array of JSON objects containing: - - `pubkey: ` - The public key, as base-58 encoded string, of the account that received the reward - - `lamports: `- number of reward lamports credited or debited by the account, as a i64 - - `postBalance: ` - account balance in lamports after the reward was applied - - `rewardType: ` - type of reward: "fee", "rent", "voting", "staking" - - `commission: ` - vote account commission when the reward was credited, only present for voting and staking rewards - - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch). null if not available - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, {"encoding": "json","transactionDetails":"full","rewards":false}]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "blockTime": null, - "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", - "parentSlot": 429, - "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", - "transactions": [ - { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "logMessages": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "status": { - "Ok": null - } - }, - "transaction": { - "message": { - "accountKeys": [ - "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", - "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", - "SysvarS1otHashes111111111111111111111111111", - "SysvarC1ock11111111111111111111111111111111", - "Vote111111111111111111111111111111111111111" - ], - "header": { - "numReadonlySignedAccounts": 0, - "numReadonlyUnsignedAccounts": 3, - "numRequiredSignatures": 1 - }, - "instructions": [ - { - "accounts": [1, 2, 3, 0], - "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", - "programIdIndex": 4 - } - ], - "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" - }, - "signatures": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" - ] - } - } - ] - }, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getConfirmedBlock","params":[430, "base64"]} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "blockTime": null, - "blockhash": "3Eq21vXNB5s86c62bVuUfTeaMif1N2kUqRPBmGRJhyTA", - "parentSlot": 429, - "previousBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B", - "rewards": [], - "transactions": [ - { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "logMessages": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "status": { - "Ok": null - } - }, - "transaction": [ - "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==", - "base64" - ] - } - ] - }, - "id": 1 -} -``` - -For more details on returned data: -[Transaction Structure](jsonrpc-api.md#transaction-structure) -[Inner Instructions Structure](jsonrpc-api.md#inner-instructions-structure) -[Token Balances Structure](jsonrpc-api.md#token-balances-structure) - -### getConfirmedBlocks - -**DEPRECATED: Please use [getBlocks](jsonrpc-api.md#getblocks) instead** -This method is expected to be removed in solana-core v2.0 - -Returns a list of confirmed blocks between two slots - -#### Parameters: - -- `` - start_slot, as u64 integer -- (optional) `` - end_slot, as u64 integer -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -The result field will be an array of u64 integers listing confirmed blocks -between `start_slot` and either `end_slot`, if provided, or latest confirmed block, -inclusive. Max range allowed is 500,000 slots. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getConfirmedBlocks","params":[5, 10]} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": [5, 6, 7, 8, 9, 10], "id": 1 } -``` - -### getConfirmedBlocksWithLimit - -**DEPRECATED: Please use [getBlocksWithLimit](jsonrpc-api.md#getblockswithlimit) instead** -This method is expected to be removed in solana-core v2.0 - -Returns a list of confirmed blocks starting at the given slot - -#### Parameters: - -- `` - start_slot, as u64 integer -- `` - limit, as u64 integer -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -The result field will be an array of u64 integers listing confirmed blocks -starting at `start_slot` for up to `limit` blocks, inclusive. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc": "2.0","id":1,"method":"getConfirmedBlocksWithLimit","params":[5, 3]} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": [5, 6, 7], "id": 1 } -``` - -### getConfirmedSignaturesForAddress2 - -**DEPRECATED: Please use [getSignaturesForAddress](jsonrpc-api.md#getsignaturesforaddress) instead** -This method is expected to be removed in solana-core v2.0 - -Returns signatures for confirmed transactions that include the given address in -their `accountKeys` list. Returns signatures backwards in time from the -provided signature or most recent confirmed block - -#### Parameters: - -- `` - account address as base-58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `limit: ` - maximum transaction signatures to return (between 1 and 1,000, default: 1,000). - - (optional) `before: ` - start searching backwards from this transaction signature. - If not provided the search starts from the top of the highest max confirmed block. - - (optional) `until: ` - search until this transaction signature, if found before limit reached. - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -The result field will be an array of transaction signature information, ordered -from newest to oldest transaction: - -- `` - - `signature: ` - transaction signature as base-58 encoded string - - `slot: ` - The slot that contains the block with the transaction - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://github.com/solana-labs/solana/blob/c0c60386544ec9a9ec7119229f37386d9f070523/sdk/src/transaction/error.rs#L13) - - `memo: ` - Memo associated with the transaction, null if no memo is present - - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when transaction was processed. null if not available. - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getConfirmedSignaturesForAddress2", - "params": [ - "Vote111111111111111111111111111111111111111", - { - "limit": 1 - } - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": [ - { - "err": null, - "memo": null, - "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", - "slot": 114, - "blockTime": null - } - ], - "id": 1 -} -``` - -### getConfirmedTransaction - -**DEPRECATED: Please use [getTransaction](jsonrpc-api.md#gettransaction) instead** -This method is expected to be removed in solana-core v2.0 - -Returns transaction details for a confirmed transaction - -#### Parameters: - -- `` - transaction signature as base-58 encoded string -- (optional) `` - Configuration object containing the following optional fields: - - (optional) `encoding: ` - encoding for each returned Transaction, either "json", "jsonParsed", "base58" (_slow_), "base64". If parameter not provided, the default encoding is "json". - ["jsonParsed" encoding](jsonrpc-api.md#parsed-responses) attempts to use program-specific instruction parsers to return more human-readable and explicit data in the `transaction.message.instructions` list. If "jsonParsed" is requested but a parser cannot be found, the instruction falls back to regular JSON encoding (`accounts`, `data`, and `programIdIndex` fields). - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment); "processed" is not supported. If parameter not provided, the default is "finalized". - -#### Results: - -- `` - if transaction is not found or not confirmed -- `` - if transaction is confirmed, an object with the following fields: - - `slot: ` - the slot this transaction was processed in - - `transaction: ` - [Transaction](#transaction-structure) object, either in JSON format or encoded binary data, depending on encoding parameter - - `blockTime: ` - estimated production time, as Unix timestamp (seconds since the Unix epoch) of when the transaction was processed. null if not available - - `meta: ` - transaction status metadata object: - - `err: ` - Error if transaction failed, null if transaction succeeded. [TransactionError definitions](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/transaction/enum.TransactionError.html) - - `fee: ` - fee this transaction was charged, as u64 integer - - `preBalances: ` - array of u64 account balances from before the transaction was processed - - `postBalances: ` - array of u64 account balances after the transaction was processed - - `innerInstructions: ` - List of [inner instructions](#inner-instructions-structure) or `null` if inner instruction recording was not enabled during this transaction - - `preTokenBalances: ` - List of [token balances](#token-balances-structure) from before the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `postTokenBalances: ` - List of [token balances](#token-balances-structure) from after the transaction was processed or omitted if token balance recording was not yet enabled during this transaction - - `logMessages: ` - array of string log messages or `null` if log message recording was not enabled during this transaction - - DEPRECATED: `status: ` - Transaction status - - `"Ok": ` - Transaction was successful - - `"Err": ` - Transaction failed with TransactionError - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getConfirmedTransaction", - "params": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv", - "json" - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "status": { - "Ok": null - } - }, - "slot": 430, - "transaction": { - "message": { - "accountKeys": [ - "3UVYmECPPMZSCqWKfENfuoTv51fTDTWicX9xmBD2euKe", - "AjozzgE83A3x1sHNUR64hfH7zaEBWeMaFuAN9kQgujrc", - "SysvarS1otHashes111111111111111111111111111", - "SysvarC1ock11111111111111111111111111111111", - "Vote111111111111111111111111111111111111111" - ], - "header": { - "numReadonlySignedAccounts": 0, - "numReadonlyUnsignedAccounts": 3, - "numRequiredSignatures": 1 - }, - "instructions": [ - { - "accounts": [1, 2, 3, 0], - "data": "37u9WtQpcm6ULa3WRQHmj49EPs4if7o9f1jSRVZpm2dvihR9C8jY4NqEwXUbLwx15HBSNcP1", - "programIdIndex": 4 - } - ], - "recentBlockhash": "mfcyqEXB3DnHXki6KjjmZck6YjmZLvpAByy2fj4nh6B" - }, - "signatures": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv" - ] - } - }, - "blockTime": null, - "id": 1 -} -``` - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getConfirmedTransaction", - "params": [ - "2nBhEBYYvfaAe16UMNqRHre4YNSskvuYgx3M6E4JP1oDYvZEJHvoPzyUidNgNX5r9sTyN1J9UxtbCXy2rqYcuyuv", - "base64" - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "meta": { - "err": null, - "fee": 5000, - "innerInstructions": [], - "postBalances": [499998932500, 26858640, 1, 1, 1], - "postTokenBalances": [], - "preBalances": [499998937500, 26858640, 1, 1, 1], - "preTokenBalances": [], - "status": { - "Ok": null - } - }, - "slot": 430, - "transaction": [ - "AVj7dxHlQ9IrvdYVIjuiRFs1jLaDMHixgrv+qtHBwz51L4/ImLZhszwiyEJDIp7xeBSpm/TX5B7mYzxa+fPOMw0BAAMFJMJVqLw+hJYheizSoYlLm53KzgT82cDVmazarqQKG2GQsLgiqktA+a+FDR4/7xnDX7rsusMwryYVUdixfz1B1Qan1RcZLwqvxvJl4/t3zHragsUp0L47E24tAFUgAAAABqfVFxjHdMkoVmOYaR1etoteuKObS21cc1VbIQAAAAAHYUgdNXR0u3xNdiTr072z2DVec9EQQ/wNo1OAAAAAAAtxOUhPBp2WSjUNJEgfvy70BbxI00fZyEPvFHNfxrtEAQQEAQIDADUCAAAAAQAAAAAAAACtAQAAAAAAAAdUE18R96XTJCe+YfRfUp6WP+YKCy/72ucOL8AoBFSpAA==", - "base64" - ] - }, - "id": 1 -} -``` - -### getFeeCalculatorForBlockhash - -**DEPRECATED: Please use [isBlockhashValid](jsonrpc-api.md#isblockhashvalid) or [getFeeForMessage](jsonrpc-api.md#getfeeformessage) instead** -This method is expected to be removed in solana-core v2.0 - -Returns the fee calculator associated with the query blockhash, or `null` if the blockhash has expired - -#### Parameters: - -- `` - query blockhash as a Base58 encoded string -- (optional) `` - Configuration object containing the following fields: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - - (optional) `minContextSlot: ` - set the minimum slot that the request can be evaluated at. - -#### Results: - -The result will be an RpcResponse JSON object with `value` equal to: - -- `` - if the query blockhash has expired -- `` - otherwise, a JSON object containing: - - `feeCalculator: `, `FeeCalculator` object describing the cluster fee rate at the queried blockhash - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - { - "jsonrpc": "2.0", - "id": 1, - "method": "getFeeCalculatorForBlockhash", - "params": [ - "GJxqhuxcgfn5Tcj6y3f8X4FeCDd2RQ6SnEMo1AAxrPRZ" - ] - } -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 221 - }, - "value": { - "feeCalculator": { - "lamportsPerSignature": 5000 - } - } - }, - "id": 1 -} -``` - -### getFeeRateGovernor - -Returns the fee rate governor information from the root bank - -#### Parameters: - -None - -#### Results: - -The `result` field will be an `object` with the following fields: - -- `burnPercent: `, Percentage of fees collected to be destroyed -- `maxLamportsPerSignature: `, Largest value `lamportsPerSignature` can attain for the next slot -- `minLamportsPerSignature: `, Smallest value `lamportsPerSignature` can attain for the next slot -- `targetLamportsPerSignature: `, Desired fee rate for the cluster -- `targetSignaturesPerSlot: `, Desired signature rate for the cluster - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getFeeRateGovernor"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 54 - }, - "value": { - "feeRateGovernor": { - "burnPercent": 50, - "maxLamportsPerSignature": 100000, - "minLamportsPerSignature": 5000, - "targetLamportsPerSignature": 10000, - "targetSignaturesPerSlot": 20000 - } - } - }, - "id": 1 -} -``` - -### getFees - -**DEPRECATED: Please use [getFeeForMessage](jsonrpc-api.md#getfeeformessage) instead** -This method is expected to be removed in solana-core v2.0 - -Returns a recent block hash from the ledger, a fee schedule that can be used to -compute the cost of submitting a transaction using it, and the last slot in -which the blockhash will be valid. - -#### Parameters: - -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -The result will be an RpcResponse JSON object with `value` set to a JSON object with the following fields: - -- `blockhash: ` - a Hash as base-58 encoded string -- `feeCalculator: ` - FeeCalculator object, the fee schedule for this block hash -- `lastValidSlot: ` - DEPRECATED - this value is inaccurate and should not be relied upon -- `lastValidBlockHeight: ` - last [block height](../../terminology.md#block-height) at which the blockhash will be valid - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getFees"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": { - "blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", - "feeCalculator": { - "lamportsPerSignature": 5000 - }, - "lastValidSlot": 297, - "lastValidBlockHeight": 296 - } - }, - "id": 1 -} -``` - -### getRecentBlockhash - -**DEPRECATED: Please use [getLatestBlockhash](jsonrpc-api.md#getlatestblockhash) instead** -This method is expected to be removed in solana-core v2.0 - -Returns a recent block hash from the ledger, and a fee schedule that can be used to compute the cost of submitting a transaction using it. - -#### Parameters: - -- (optional) `` - Configuration object containing the following field: - - (optional) `commitment: ` - [Commitment](jsonrpc-api.md#configuring-state-commitment) - -#### Results: - -An RpcResponse containing a JSON object consisting of a string blockhash and FeeCalculator JSON object. - -- `RpcResponse` - RpcResponse JSON object with `value` field set to a JSON object including: -- `blockhash: ` - a Hash as base-58 encoded string -- `feeCalculator: ` - FeeCalculator object, the fee schedule for this block hash - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getRecentBlockhash"} -' -``` - -Result: - -```json -{ - "jsonrpc": "2.0", - "result": { - "context": { - "slot": 1 - }, - "value": { - "blockhash": "CSymwgTNX1j3E4qhKfJAUE41nBWEwXufoYryPbkde5RR", - "feeCalculator": { - "lamportsPerSignature": 5000 - } - } - }, - "id": 1 -} -``` - -### getSnapshotSlot - -**DEPRECATED: Please use [getHighestSnapshotSlot](jsonrpc-api.md#gethighestsnapshotslot) instead** -This method is expected to be removed in solana-core v2.0 - -Returns the highest slot that the node has a snapshot for - -#### Parameters: - -None - -#### Results: - -- `` - Snapshot slot - -#### Example: - -Request: - -```bash -curl http://localhost:8899 -X POST -H "Content-Type: application/json" -d ' - {"jsonrpc":"2.0","id":1, "method":"getSnapshotSlot"} -' -``` - -Result: - -```json -{ "jsonrpc": "2.0", "result": 100, "id": 1 } -``` - -Result when the node has no snapshot: - -```json -{ - "jsonrpc": "2.0", - "error": { "code": -32008, "message": "No snapshot" }, - "id": 1 -} -``` From 4ea088ea3e2758420ee1cb0aa77cb11399ab1089 Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Fri, 20 Jan 2023 09:54:08 -0500 Subject: [PATCH 25/28] fix: dangling links --- docs/src/developing/intro/transaction_fees.md | 2 +- docs/src/developing/transaction_confirmation.md | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/src/developing/intro/transaction_fees.md b/docs/src/developing/intro/transaction_fees.md index 520cfe30431d1c..382dae826217e8 100644 --- a/docs/src/developing/intro/transaction_fees.md +++ b/docs/src/developing/intro/transaction_fees.md @@ -92,4 +92,4 @@ Note that adding a `RequestUnits` compute budget instruction will take up 39 ext ### Calculate transaction fees with RPC API -In order to simplify fee calculation for developers, a new `getFeeForMessage` RPC API is planned to be released in v1.9 of the Solana protocol. This new method accepts a blockhash along with an encoded transaction message and will return the amount of fees that would be deducted if the transaction message is signed, sent, and processed by the cluster. Full documentation can be found on the "edge" version of the Solana docs here: [https://edge.docs.solana.com/developing/clients/jsonrpc-api#getfeeformessage](https://edge.docs.solana.com/developing/clients/jsonrpc-api#getfeeformessage) +In order to simplify fee calculation for developers, a new [`getFeeForMessage`](/api/http#getfeeformessage) RPC API is planned to be released in v1.9 of the Solana protocol. This new method accepts a blockhash along with an encoded transaction message and will return the amount of fees that would be deducted if the transaction message is signed, sent, and processed by the cluster. diff --git a/docs/src/developing/transaction_confirmation.md b/docs/src/developing/transaction_confirmation.md index dd5b2a5482f008..9fa1c6ab0b5fa3 100644 --- a/docs/src/developing/transaction_confirmation.md +++ b/docs/src/developing/transaction_confirmation.md @@ -114,7 +114,7 @@ One minute is not a lot of time considering that a client needs to fetch a recen Given the short expiration time frame, it’s imperative that clients help users create transactions with blockhash that is as recent as possible. -When fetching blockhashes, the current recommended RPC API is called [`getLatestBlockhash`](./clients/jsonrpc-api#getlatestblockhash). By default, this API uses the `"finalized"` commitment level to return the most recently finalized block’s blockhash. However, you can override this behavior by [setting the `commitment` parameter](./clients/jsonrpc-api#configuring-state-commitment) to a different commitment level. +When fetching blockhashes, the current recommended RPC API is called [`getLatestBlockhash`](/api/http#getlatestblockhash). By default, this API uses the `"finalized"` commitment level to return the most recently finalized block’s blockhash. However, you can override this behavior by [setting the `commitment` parameter](/api/http#configuring-state-commitment) to a different commitment level. **Recommendation** @@ -145,7 +145,7 @@ When your application uses an RPC pool service or when the RPC endpoint differs For `sendTransaction` requests, clients should keep resending a transaction to a RPC node on a frequent interval so that if an RPC node is slightly lagging behind the cluster, it will eventually catch up and detect your transaction’s expiration properly. -For `simulateTransaction` requests, clients should use the [`replaceRecentBlockhash`](./clients/jsonrpc-api#simulatetransaction) parameter to tell the RPC node to replace the simulated transaction’s blockhash with a blockhash that will always be valid for simulation. +For `simulateTransaction` requests, clients should use the [`replaceRecentBlockhash`](/api/http#simulatetransaction) parameter to tell the RPC node to replace the simulated transaction’s blockhash with a blockhash that will always be valid for simulation. ### Avoid reusing stale blockhashes @@ -169,16 +169,16 @@ Lagging RPC nodes can therefore respond to blockhash requests with blockhashes t Monitor the health of your RPC nodes to ensure that they have an up-to-date view of the cluster state with one of the following methods: -1. Fetch your RPC node’s highest processed slot by using the [`getSlot`](./clients/jsonrpc-api#getslot) RPC API with the `"processed"` commitment level and then call the [`getMaxShredInsertSlot](./clients/jsonrpc-api#getmaxshredinsertslot) RPC API to get the highest slot that your RPC node has received a “shred” of a block for. If the difference between these responses is very large, the cluster is producing blocks far ahead of what the RPC node has processed. -2. Call the `getLatestBlockhash` RPC API with the `"confirmed"` commitment level on a few different RPC API nodes and use the blockhash from the node that returns the highest slot for its [context slot](./clients/jsonrpc-api#rpcresponse-structure). +1. Fetch your RPC node’s highest processed slot by using the [`getSlot`](/api/http#getslot) RPC API with the `"processed"` commitment level and then call the [`getMaxShredInsertSlot](/api/http#getmaxshredinsertslot) RPC API to get the highest slot that your RPC node has received a “shred” of a block for. If the difference between these responses is very large, the cluster is producing blocks far ahead of what the RPC node has processed. +2. Call the `getLatestBlockhash` RPC API with the `"confirmed"` commitment level on a few different RPC API nodes and use the blockhash from the node that returns the highest slot for its [context slot](/api/http#rpcresponse-structure). ### Wait long enough for expiration **Recommendation** -When calling [`getLatestBlockhash`](./clients/jsonrpc-api#getlatestblockhash) RPC API to get a recent blockhash for your transaction, take note of the `"lastValidBlockHeight"` in the response. +When calling [`getLatestBlockhash`](/api/http#getlatestblockhash) RPC API to get a recent blockhash for your transaction, take note of the `"lastValidBlockHeight"` in the response. -Then, poll the [`getBlockHeight`](./clients/jsonrpc-api#getblockheight) RPC API with the “confirmed” commitment level until it returns a block height greater than the previously returned last valid block height. +Then, poll the [`getBlockHeight`](/api/http#getblockheight) RPC API with the “confirmed” commitment level until it returns a block height greater than the previously returned last valid block height. ### Consider using “durable” transactions From 8f2c04891c9d8f48a955fed75c262430e2adef0e Mon Sep 17 00:00:00 2001 From: nickfrosty Date: Tue, 24 Jan 2023 13:04:11 -0500 Subject: [PATCH 26/28] style: removed whitespaces for CI --- docs/components/CodeDocBlock.jsx | 2 +- docs/src/api/deprecated/_getConfirmedBlock.mdx | 3 ++- docs/src/api/deprecated/_getConfirmedBlocks.mdx | 3 ++- docs/src/api/deprecated/_getConfirmedBlocksWithLimit.mdx | 3 ++- docs/src/api/deprecated/_getConfirmedTransaction.mdx | 3 ++- docs/src/api/deprecated/_getFeeCalculatorForBlockhash.mdx | 3 ++- docs/src/api/deprecated/_getFees.mdx | 3 ++- docs/src/api/deprecated/_getRecentBlockhash.mdx | 3 ++- docs/src/api/methods/_getAccountInfo.mdx | 3 ++- docs/src/api/methods/_getBalance.mdx | 3 ++- docs/src/api/methods/_getBlock.mdx | 3 ++- 11 files changed, 21 insertions(+), 11 deletions(-) diff --git a/docs/components/CodeDocBlock.jsx b/docs/components/CodeDocBlock.jsx index 8e2212938bb2ca..bd0099b99e7830 100644 --- a/docs/components/CodeDocBlock.jsx +++ b/docs/components/CodeDocBlock.jsx @@ -50,7 +50,7 @@ export function Parameter(props) { } /* - Display a single Parameter's field data + Display a single Parameter's field data */ export function Field(props) { const { diff --git a/docs/src/api/deprecated/_getConfirmedBlock.mdx b/docs/src/api/deprecated/_getConfirmedBlock.mdx index ca0ab5ba132a24..d0ca7ab787b4b9 100644 --- a/docs/src/api/deprecated/_getConfirmedBlock.mdx +++ b/docs/src/api/deprecated/_getConfirmedBlock.mdx @@ -29,7 +29,8 @@ Returns identity and transaction information about a confirmed block in the ledg slot number, as u64 integer - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: u64 integer - + + Configuration object containing the following fields: Date: Tue, 24 Jan 2023 21:31:38 -0500 Subject: [PATCH 27/28] style: removed whitespace --- docs/src/api/methods/_getBlockHeight.mdx | 3 ++- docs/src/api/methods/_getBlockProduction.mdx | 3 ++- docs/src/api/methods/_getBlocks.mdx | 3 ++- docs/src/api/methods/_getBlocksWithLimit.mdx | 3 ++- docs/src/api/methods/_getEpochInfo.mdx | 3 ++- docs/src/api/methods/_getFeeForMessage.mdx | 3 ++- docs/src/api/methods/_getInflationGovernor.mdx | 3 ++- docs/src/api/methods/_getInflationReward.mdx | 3 ++- docs/src/api/methods/_getLargestAccounts.mdx | 3 ++- docs/src/api/methods/_getLatestBlockhash.mdx | 3 ++- docs/src/api/methods/_getLeaderSchedule.mdx | 3 ++- docs/src/api/methods/_getMinimumBalanceForRentExemption.mdx | 3 ++- docs/src/api/methods/_getProgramAccounts.mdx | 3 ++- docs/src/api/methods/_getSignatureStatuses.mdx | 3 ++- docs/src/api/methods/_getSignaturesForAddress.mdx | 3 ++- docs/src/api/methods/_getSlot.mdx | 3 ++- docs/src/api/methods/_getSlotLeader.mdx | 3 ++- docs/src/api/methods/_getStakeActivation.mdx | 3 ++- docs/src/api/methods/_getStakeMinimumDelegation.mdx | 3 ++- docs/src/api/methods/_getSupply.mdx | 3 ++- docs/src/api/methods/_getTokenAccountBalance.mdx | 3 ++- docs/src/api/methods/_getTokenAccountsByDelegate.mdx | 3 ++- docs/src/api/methods/_getTokenAccountsByOwner.mdx | 3 ++- docs/src/api/methods/_getTokenLargestAccounts.mdx | 3 ++- docs/src/api/methods/_getTokenSupply.mdx | 3 ++- docs/src/api/methods/_getTransaction.mdx | 3 ++- docs/src/api/methods/_getTransactionCount.mdx | 3 ++- docs/src/api/methods/_getVoteAccounts.mdx | 3 ++- docs/src/api/methods/_isBlockhashValid.mdx | 3 ++- docs/src/api/methods/_requestAirdrop.mdx | 3 ++- docs/src/api/methods/_sendTransaction.mdx | 3 ++- docs/src/api/methods/_simulateTransaction.mdx | 3 ++- docs/src/api/websocket/_accountSubscribe.mdx | 3 ++- docs/src/api/websocket/_blockSubscribe.mdx | 3 ++- docs/src/api/websocket/_logsSubscribe.mdx | 3 ++- docs/src/api/websocket/_programSubscribe.mdx | 3 ++- docs/src/api/websocket/_signatureSubscribe.mdx | 3 ++- 37 files changed, 74 insertions(+), 37 deletions(-) diff --git a/docs/src/api/methods/_getBlockHeight.mdx b/docs/src/api/methods/_getBlockHeight.mdx index 37feb65fb8c731..9b8a07d0fd6a2b 100644 --- a/docs/src/api/methods/_getBlockHeight.mdx +++ b/docs/src/api/methods/_getBlockHeight.mdx @@ -20,7 +20,8 @@ Returns the current block height of the node ### Parameters: - + + Configuration object containing the following fields: + + Configuration object containing the following fields: - + + Configuration object containing the following fields: start_slot) - + + Configuration object containing the following field: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: + + Configuration object containing the following fields: - + + Configuration object containing the following fields: + + Configuration object containing the following fields: + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: diff --git a/docs/src/api/methods/_getSignaturesForAddress.mdx b/docs/src/api/methods/_getSignaturesForAddress.mdx index 5921cf58adfb37..dc0517058d34c7 100644 --- a/docs/src/api/methods/_getSignaturesForAddress.mdx +++ b/docs/src/api/methods/_getSignaturesForAddress.mdx @@ -25,7 +25,8 @@ provided signature or most recent confirmed block Account address as base-58 encoded string - + + Configuration object containing the following fields: + + Configuration object containing the following fields: + + Configuration object containing the following fields: - + + Configuration object containing the following fields: + + Configuration object containing the following fields: + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: + + Configuration object containing the following fields: + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following optional fields: diff --git a/docs/src/api/methods/_simulateTransaction.mdx b/docs/src/api/methods/_simulateTransaction.mdx index ca85c83fc12877..10fca9dce9c561 100644 --- a/docs/src/api/methods/_simulateTransaction.mdx +++ b/docs/src/api/methods/_simulateTransaction.mdx @@ -29,7 +29,8 @@ The transaction must have a valid blockhash, but is not required to be signed. - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: - + + Configuration object containing the following fields: Date: Wed, 25 Jan 2023 17:55:53 -0500 Subject: [PATCH 28/28] style: fixed whitespaces --- docs/src/api/methods/_getBlock.mdx | 6 +++--- docs/src/api/methods/_getRecentPerformanceSamples.mdx | 3 ++- docs/src/api/methods/_simulateTransaction.mdx | 3 ++- docs/src/api/websocket/_blockSubscribe.mdx | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/src/api/methods/_getBlock.mdx b/docs/src/api/methods/_getBlock.mdx index 5aa34e81c45104..dd70eaf5b95347 100644 --- a/docs/src/api/methods/_getBlock.mdx +++ b/docs/src/api/methods/_getBlock.mdx @@ -61,9 +61,9 @@ encoding format for each returned Transaction - + level of transaction detail to return - +
    @@ -78,7 +78,7 @@ level of transaction detail to return - + the max transaction version to return in responses.
    diff --git a/docs/src/api/methods/_getRecentPerformanceSamples.mdx b/docs/src/api/methods/_getRecentPerformanceSamples.mdx index 0d746c1fb9a8db..131cc80ba794d9 100644 --- a/docs/src/api/methods/_getRecentPerformanceSamples.mdx +++ b/docs/src/api/methods/_getRecentPerformanceSamples.mdx @@ -20,7 +20,8 @@ include the number of transactions and slots that occur in a given time window. ### Parameters: - + + number of samples to return (maximum 720) diff --git a/docs/src/api/methods/_simulateTransaction.mdx b/docs/src/api/methods/_simulateTransaction.mdx index 10fca9dce9c561..fbae901244a97b 100644 --- a/docs/src/api/methods/_simulateTransaction.mdx +++ b/docs/src/api/methods/_simulateTransaction.mdx @@ -70,7 +70,8 @@ Values: `base58` (_slow_, **DEPRECATED**), or `base64`. - + + Accounts configuration object containing the following fields: diff --git a/docs/src/api/websocket/_blockSubscribe.mdx b/docs/src/api/websocket/_blockSubscribe.mdx index 31c6df5b13b005..078f7585846e7f 100644 --- a/docs/src/api/websocket/_blockSubscribe.mdx +++ b/docs/src/api/websocket/_blockSubscribe.mdx @@ -26,7 +26,8 @@ with the `--rpc-pubsub-enable-block-subscription` flag. ### Parameters: - + + filter criteria for the logs to receive results by account type; currently supported: