From d2efa3aa15f6ae6d32efb830a384908362925dba Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 12 Feb 2021 02:13:32 +0000 Subject: [PATCH] RPC documentation updates for token deltas / blockTimes in getConfirmedSignatures2/getConfirmedTransaction (#14871) (#15284) * docs: add token balances response info * docs: add blockTime to getConfirmedSignatures and getConfirmedTransaction * docs: update example responses * fix: remove space (cherry picked from commit 6b8e71098863b8e61ac07ba300678c5c4a37c789) Co-authored-by: Josh --- docs/src/developing/clients/jsonrpc-api.md | 29 +++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/docs/src/developing/clients/jsonrpc-api.md b/docs/src/developing/clients/jsonrpc-api.md index 4e0480a393..4bbf56c258 100644 --- a/docs/src/developing/clients/jsonrpc-api.md +++ b/docs/src/developing/clients/jsonrpc-api.md @@ -481,6 +481,8 @@ The result field will be an object with the following fields: - `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 omitted if inner instruction recording was not yet 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 omitted if log message recording was not yet enabled during this transaction - DEPRECATED: `status: ` - Transaction status - `"Ok": ` - Transaction was successful @@ -525,6 +527,7 @@ Result: 1, 1 ], + "postTokenBalances": [], "preBalances": [ 499998937500, 26858640, @@ -532,6 +535,7 @@ Result: 1, 1 ], + "preTokenBalances": [], "status": { "Ok": null } @@ -607,6 +611,7 @@ Result: 1, 1 ], + "postTokenBalances": [], "preBalances": [ 499998937500, 26858640, @@ -614,6 +619,7 @@ Result: 1, 1 ], + "preTokenBalances": [], "status": { "Ok": null } @@ -660,6 +666,17 @@ The JSON structure of inner instructions is defined as a list of objects in the - `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. +- `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. + ### getConfirmedBlocks Returns a list of confirmed blocks between two slots @@ -791,6 +808,7 @@ from newest to oldest transaction: * `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/master/sdk/src/transaction.rs#L24) * `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: @@ -819,7 +837,8 @@ Result: "err": null, "memo": null, "signature": "5h6xBEauJ3PK6SWCZ1PGjBvj8vDdWG3KpwATGy1ARAXFSDwt8GFXM7W5Ncn16wmqokgpiKRLuS83KUxyZyv2sUYv", - "slot": 114 + "slot": 114, + "blockTime": null } ], "id": 1 @@ -843,12 +862,15 @@ Returns transaction details for a confirmed transaction - `` - 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://github.com/solana-labs/solana/blob/master/sdk/src/transaction.rs#L24) - `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 omitted if inner instruction recording was not yet 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 omitted if log message recording was not yet enabled during this transaction - DEPRECATED: `status: ` - Transaction status - `"Ok": ` - Transaction was successful @@ -886,6 +908,7 @@ Result: 1, 1 ], + "postTokenBalances": [], "preBalances": [ 499998937500, 26858640, @@ -893,6 +916,7 @@ Result: 1, 1 ], + "preTokenBalances": [], "status": { "Ok": null } @@ -931,6 +955,7 @@ Result: ] } }, + "blockTime": null, "id": 1 } ``` @@ -967,6 +992,7 @@ Result: 1, 1 ], + "postTokenBalances": [], "preBalances": [ 499998937500, 26858640, @@ -974,6 +1000,7 @@ Result: 1, 1 ], + "preTokenBalances": [], "status": { "Ok": null }