Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

RPC: update websocket docs #33460

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/sidebars/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,16 @@ module.exports = {
href: "#programunsubscribe",
label: "programUnsubscribe",
},
{
type: "link",
href: "#rootsubscribe",
label: "rootSubscribe",
},
{
type: "link",
href: "#rootunsubscribe",
label: "rootUnsubscribe",
},
{
type: "link",
href: "#signaturesubscribe",
Expand Down
66 changes: 51 additions & 15 deletions docs/src/api/websocket/_blockSubscribe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ with the `--rpc-pubsub-enable-block-subscription` flag.

### Parameters:

<Parameter name="filter" type={"string | object"} optional={true}>
<Parameter name="filter" type={"string | object"} required={true}>
buffalojoec marked this conversation as resolved.
Show resolved Hide resolved

filter criteria for the logs to receive results by account type; currently supported:

Expand All @@ -52,35 +52,71 @@ Configuration object containing the following fields:
name="commitment"
type="string"
optional={true}
defaultValue={"finalized"}
href="/api/http#configuring-state-commitment"
></Field>

<Field name="transactionDetails" default="full" type="string" optional={true}>
level of transaction detail to return, either "full", "signatures", or "none".
>
<li>
the default is <code>finalized</code>
</li>
<li>
<code>processed</code> is not supported.
</li>
</Field>

<Field name="showRewards" type="bool" defaultValue="true" optional={true}>
whether to populate the `rewards` array.
<Field name="encoding" type="string" optional={true} defaultValue={"json"} href="/api/http#parsed-responses">

encoding format for each returned Transaction

<Values values={["json", "jsonParsed", "base58", "base64"]} />

<details>

- `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).

</details>

</Field>

<Field name="encoding" type="string" defaultValue="base64" optional={true} href="/api/http#parsed-responses">
<Field name="transactionDetails" type="string" optional={true} defaultValue={"full"}>

level of transaction detail to return

Encoding format for Account data
<Values values={["full", "accounts", "signatures", "none"]} />

<Values values={["base58", "base64", "base64+zstd", "jsonParsed"]} />
<details>

- 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.

</details>

</Field>

<Field name="maxSupportedTransactionVersion" type="number" optional={true}>

the max transaction version to return in responses.

<details>

- `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`.
- 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.

</details>

</Field>

<Field name="showRewards" type="bool" optional={true}>
whether to populate the `rewards` array. If parameter not provided, the
default includes rewards.
</Field>

</Parameter>

### Result:
Expand Down
8 changes: 7 additions & 1 deletion docs/src/api/websocket/_slotsUpdatesSubscribe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,14 @@ This subscription is unstable

The notification will be an object with the following fields:

- `parent: <u64>` - The parent slot
- `err: <string|undefined>` - The error message. Only present if the update is of type "dead".
- `parent: <u64|undefined>` - The parent slot. Only present if the update is of type "createdBank".
buffalojoec marked this conversation as resolved.
Show resolved Hide resolved
- `slot: <u64>` - The newly updated slot
- `stats: <object|undefined>` - The error message. Only present if the update is of type "frozen". An object with the following fields:
- `maxTransactionsPerEntry: <u64>`,
- `numFailedTransactions: <u64>`,
- `numSuccessfulTransactions: <u64>`,
- `numTransactionEntries: <u64>`,
- `timestamp: <i64>` - The Unix timestamp of the update
- `type: <string>` - The update type, one of:
- "firstShredReceived"
Expand Down
1 change: 1 addition & 0 deletions docs/src/api/websocket/_voteSubscribe.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The notification will be an object with the following fields:
- `slots: <array>` - The slots covered by the vote, as an array of u64 integers
- `timestamp: <i64|null>` - The timestamp of the vote
- `signature: <string>` - The signature of the transaction that contained this vote
- `votePubkey: <string>` - The public key of the vote account, as base-58 encoded string

```json
{
Expand Down