splitSolanaRpcResponse
Call Signature
Decomposes a notification that may or may not be wrapped in a SolanaRpcResponse
envelope into its value and slot halves. Runtime-detects the envelope shape via duck-type
('context' in x && 'value' in x); raw notifications without the envelope pass through with
slot: undefined.
Accepts T | undefined so callers can pipe straight from store.getUnifiedState().data
without an external null-check.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The raw notification shape. |
Parameters
| Parameter | Type | Description |
|---|---|---|
notification | SolanaRpcResponse<T> | The value to decompose, or undefined while the store hasn't yet produced one. |
Returns
object
{ value, slot } where value is the unwrapped inner value (or the original
notification when it doesn't match the envelope shape) and slot is lifted from
context.slot (or undefined for raw notifications).
| Name | Type |
|---|---|
slot | bigint |
value | T |
Example
Call Signature
Decomposes a notification that may or may not be wrapped in a SolanaRpcResponse
envelope into its value and slot halves. Runtime-detects the envelope shape via duck-type
('context' in x && 'value' in x); raw notifications without the envelope pass through with
slot: undefined.
Accepts T | undefined so callers can pipe straight from store.getUnifiedState().data
without an external null-check.
Parameters
| Parameter | Type | Description |
|---|---|---|
notification | undefined | The value to decompose, or undefined while the store hasn't yet produced one. |
Returns
object
{ value, slot } where value is the unwrapped inner value (or the original
notification when it doesn't match the envelope shape) and slot is lifted from
context.slot (or undefined for raw notifications).
| Name | Type |
|---|---|
slot | undefined |
value | undefined |
Example
Call Signature
Decomposes a notification that may or may not be wrapped in a SolanaRpcResponse
envelope into its value and slot halves. Runtime-detects the envelope shape via duck-type
('context' in x && 'value' in x); raw notifications without the envelope pass through with
slot: undefined.
Accepts T | undefined so callers can pipe straight from store.getUnifiedState().data
without an external null-check.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The raw notification shape. |
Parameters
| Parameter | Type | Description |
|---|---|---|
notification | | Readonly<{ context: Readonly<{ slot: Slot; }>; value: T; }> | undefined | The value to decompose, or undefined while the store hasn't yet produced one. |
Returns
object
{ value, slot } where value is the unwrapped inner value (or the original
notification when it doesn't match the envelope shape) and slot is lifted from
context.slot (or undefined for raw notifications).
| Name | Type |
|---|---|
slot | bigint | undefined |
value | T | undefined |
Example
Call Signature
Decomposes a notification that may or may not be wrapped in a SolanaRpcResponse
envelope into its value and slot halves. Runtime-detects the envelope shape via duck-type
('context' in x && 'value' in x); raw notifications without the envelope pass through with
slot: undefined.
Accepts T | undefined so callers can pipe straight from store.getUnifiedState().data
without an external null-check.
Type Parameters
| Type Parameter | Description |
|---|---|
T | The raw notification shape. |
Parameters
| Parameter | Type | Description |
|---|---|---|
notification | T | The value to decompose, or undefined while the store hasn't yet produced one. |
Returns
object
{ value, slot } where value is the unwrapped inner value (or the original
notification when it doesn't match the envelope shape) and slot is lifted from
context.slot (or undefined for raw notifications).
| Name | Type |
|---|---|
slot | undefined |
value | T |