From 8f08953100a25eb65a306069eddd28464f3622eb Mon Sep 17 00:00:00 2001 From: Tiago Carvalho Date: Thu, 1 Jul 2021 05:04:37 +0100 Subject: [PATCH] Added formats to notifications in WebSocket RPC client. (#18231) (cherry picked from commit 8e7d393b706bb24f3b978cea55d7a9789de4a5f2) --- docs/src/developing/clients/jsonrpc-api.md | 32 ++++++++++++++++++---- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/docs/src/developing/clients/jsonrpc-api.md b/docs/src/developing/clients/jsonrpc-api.md index ec1a20a892..e778577f74 100644 --- a/docs/src/developing/clients/jsonrpc-api.md +++ b/docs/src/developing/clients/jsonrpc-api.md @@ -3373,6 +3373,8 @@ Result: #### Notification Format: +The notification format is the same as seen in the [getAccountInfo](jsonrpc-api.md#getAccountInfo) RPC HTTP method. + Base58 encoding: ```json { @@ -3505,7 +3507,14 @@ Result: #### Notification Format: -Base58 encoding: +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/master/sdk/src/transaction.rs#L24) +- `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", @@ -3545,7 +3554,6 @@ Unsubscribe from transaction logging Request: ```json {"jsonrpc":"2.0", "id":1, "method":"logsUnsubscribe", "params":[0]} - ``` Result: @@ -3622,6 +3630,8 @@ Result: #### 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 { @@ -3756,7 +3766,12 @@ Result: ``` #### Notification Format: -```bash + +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/master/sdk/src/transaction.rs#L24) + +Example: +```json { "jsonrpc": "2.0", "method": "signatureNotification", @@ -3826,7 +3841,14 @@ Result: #### Notification Format: -```bash +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", @@ -3981,7 +4003,7 @@ Result: The result is the latest root slot number. -```bash +```json { "jsonrpc": "2.0", "method": "rootNotification",