| Crates.io | solana-transaction-introspection |
| lib.rs | solana-transaction-introspection |
| version | 0.4.1 |
| created_at | 2024-09-01 16:18:20.297073+00 |
| updated_at | 2024-09-06 21:03:53.499868+00 |
| description | Deserialize signed transactions from Ed25519Instruction data |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1359751 |
| size | 28,895 |
Deserialize signed Solana transactions into instructions, signers and blockhash from Ed25519Instruction data for use in payment channels and other L2 settlement scenarios.
SignedTransactionSignedTransactionA struct representing the signed transaction, containing the following fields:
header: A SignedTransactionHeader including the number of signers and readonly accounts.signers: A vector of unique public keys representing the signers of the transaction.recent_blockhash: The blockhash at the time the transaction was created.instructions: A vector of SignedTransactionInstruction structs representing the transaction's instructions.SignedTransactionHeaderA struct that holds metadata about the transaction:
signers: Number of writable signers.readonly_signers: Number of readonly signers.readonly: Number of readonly accounts.SignedTransactionInstructionA struct representing a single instruction in the transaction:
program_id: The program ID associated with this instruction.accounts: A vector of public keys representing the accounts involved in the instruction.data: A vector of bytes representing the instruction data.To deserialize a signed transaction from bytes:
use solana_program::pubkey;
use solana_signer_transaction::SignedTransaction;
fn main() {
let transaction_bytes = [/* Ed25519Instruction data */];
let transaction = SignedTransaction::from_bytes(&transaction_bytes).unwrap();
// Access transaction components
println!("{:?}", transaction.signers);
println!("{:?}", transaction.recent_blockhash);
println!("{:?}", transaction.instructions);
}
Unit tests are included to verify the correctness of deserialization.
cargo test
This project is licensed under the MIT License. See the LICENSE file for details.