decodeTransactionFromRpcResponse
Call Signature
Decodes a confirmed-transaction RPC response (any of encoding: 'base64',
'base58', or 'json') into a CompiledTransactionMessage plus,
for 'base64' and 'base58', a re-encodable Transaction. The
JSON path does not produce a Transaction: the server has already
decompiled the wire format, so there are no message bytes to carry.
Because it reads only the transaction / meta / version envelope —
not a method-specific response shape — it accepts results from any method
that returns confirmed transactions in these encodings: getTransaction,
getTransactionsForAddress, and getBlock (the latter two with
transactionDetails: 'full'). The array-returning methods just need a map:
'jsonParsed' is not supported — its instructions arrive
pre-parsed by the server and lack raw bytes, so they cannot be
round-tripped through the auto-generated parseXInstruction clients.
Passing a 'jsonParsed' response throws
SOLANA_ERROR__TRANSACTION_INTROSPECTION__CANNOT_DECODE_JSON_PARSED_TRANSACTION;
any other unrecognized input throws
SOLANA_ERROR__TRANSACTION_INTROSPECTION__UNRECOGNIZED_GET_TRANSACTION_RESPONSE.
A response carrying a transaction version this package cannot decode
throws SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED —
raised by the JSON path for an unrecognized version, and by the wire
decoders for malformed binary input.
Use this together with getInstructionsFromCompiledTransactionMessage
(or walkInstructions) to inspect a confirmed transaction's
instructions in a form the auto-generated @solana-program/* clients
can parse directly.
Prefer encoding: 'base64' when bandwidth allows — it is the most
compact, the wire bytes round-trip cleanly through the kit codecs, and
the return type statically guarantees a re-encodable transaction.
Parameters
| Parameter | Type |
|---|---|
rpcTx | DecodableWireTransactionResponse |
Returns
Readonly<{
compiledMessage: CompiledTransactionMessage & Readonly<{
lifetimeToken: string;
}>;
loadedAddresses: LoadedAddresses;
transaction?: Readonly<{
messageBytes: TransactionMessageBytes;
signatures: SignaturesMap;
}>;
}> & object
Example
Call Signature
Decodes a confirmed-transaction RPC response (any of encoding: 'base64',
'base58', or 'json') into a CompiledTransactionMessage plus,
for 'base64' and 'base58', a re-encodable Transaction. The
JSON path does not produce a Transaction: the server has already
decompiled the wire format, so there are no message bytes to carry.
Because it reads only the transaction / meta / version envelope —
not a method-specific response shape — it accepts results from any method
that returns confirmed transactions in these encodings: getTransaction,
getTransactionsForAddress, and getBlock (the latter two with
transactionDetails: 'full'). The array-returning methods just need a map:
'jsonParsed' is not supported — its instructions arrive
pre-parsed by the server and lack raw bytes, so they cannot be
round-tripped through the auto-generated parseXInstruction clients.
Passing a 'jsonParsed' response throws
SOLANA_ERROR__TRANSACTION_INTROSPECTION__CANNOT_DECODE_JSON_PARSED_TRANSACTION;
any other unrecognized input throws
SOLANA_ERROR__TRANSACTION_INTROSPECTION__UNRECOGNIZED_GET_TRANSACTION_RESPONSE.
A response carrying a transaction version this package cannot decode
throws SOLANA_ERROR__TRANSACTION__VERSION_NUMBER_NOT_SUPPORTED —
raised by the JSON path for an unrecognized version, and by the wire
decoders for malformed binary input.
Use this together with getInstructionsFromCompiledTransactionMessage
(or walkInstructions) to inspect a confirmed transaction's
instructions in a form the auto-generated @solana-program/* clients
can parse directly.
Prefer encoding: 'base64' when bandwidth allows — it is the most
compact, the wire bytes round-trip cleanly through the kit codecs, and
the return type statically guarantees a re-encodable transaction.
Parameters
| Parameter | Type |
|---|---|
rpcTx | DecodableJsonTransactionResponse |
Returns
Readonly<{
compiledMessage: CompiledTransactionMessage & Readonly<{
lifetimeToken: string;
}>;
loadedAddresses: LoadedAddresses;
transaction?: Readonly<{
messageBytes: TransactionMessageBytes;
signatures: SignaturesMap;
}>;
}> & object