pub struct TransactionView<const SANITIZED: bool, D: TransactionData> { /* private fields */ }
Expand description
A view into a serialized transaction.
This struct provides access to the transaction data without
deserializing it. This is done by parsing and caching metadata
about the layout of the serialized transaction.
The owned data
is abstracted through the TransactionData
trait,
so that different containers for the serialized transaction can be used.
Implementations§
Source§impl<D: TransactionData> TransactionView<false, D>
impl<D: TransactionData> TransactionView<false, D>
Sourcepub fn try_new_unsanitized(data: D) -> Result<Self>
pub fn try_new_unsanitized(data: D) -> Result<Self>
Creates a new TransactionView
without running sanitization checks.
Sourcepub fn sanitize(self) -> Result<SanitizedTransactionView<D>>
pub fn sanitize(self) -> Result<SanitizedTransactionView<D>>
Sanitizes the transaction view, returning a sanitized view on success.
Source§impl<D: TransactionData> TransactionView<true, D>
impl<D: TransactionData> TransactionView<true, D>
Sourcepub fn try_new_sanitized(data: D) -> Result<Self>
pub fn try_new_sanitized(data: D) -> Result<Self>
Creates a new TransactionView
, running sanitization checks.
Source§impl<const SANITIZED: bool, D: TransactionData> TransactionView<SANITIZED, D>
impl<const SANITIZED: bool, D: TransactionData> TransactionView<SANITIZED, D>
Sourcepub fn num_signatures(&self) -> u8
pub fn num_signatures(&self) -> u8
Return the number of signatures in the transaction.
Sourcepub fn version(&self) -> TransactionVersion
pub fn version(&self) -> TransactionVersion
Return the version of the transaction.
Sourcepub fn num_required_signatures(&self) -> u8
pub fn num_required_signatures(&self) -> u8
Return the number of required signatures in the transaction.
Sourcepub fn num_readonly_signed_static_accounts(&self) -> u8
pub fn num_readonly_signed_static_accounts(&self) -> u8
Return the number of readonly signed static accounts in the transaction.
Sourcepub fn num_readonly_unsigned_static_accounts(&self) -> u8
pub fn num_readonly_unsigned_static_accounts(&self) -> u8
Return the number of readonly unsigned static accounts in the transaction.
Sourcepub fn num_static_account_keys(&self) -> u8
pub fn num_static_account_keys(&self) -> u8
Return the number of static account keys in the transaction.
Sourcepub fn num_instructions(&self) -> u16
pub fn num_instructions(&self) -> u16
Return the number of instructions in the transaction.
Sourcepub fn num_address_table_lookups(&self) -> u8
pub fn num_address_table_lookups(&self) -> u8
Return the number of address table lookups in the transaction.
Sourcepub fn total_writable_lookup_accounts(&self) -> u16
pub fn total_writable_lookup_accounts(&self) -> u16
Return the number of writable lookup accounts in the transaction.
Sourcepub fn total_readonly_lookup_accounts(&self) -> u16
pub fn total_readonly_lookup_accounts(&self) -> u16
Return the number of readonly lookup accounts in the transaction.
Sourcepub fn signatures(&self) -> &[Signature]
pub fn signatures(&self) -> &[Signature]
Return the slice of signatures in the transaction.
Sourcepub fn static_account_keys(&self) -> &[Pubkey]
pub fn static_account_keys(&self) -> &[Pubkey]
Return the slice of static account keys in the transaction.
Sourcepub fn recent_blockhash(&self) -> &Hash
pub fn recent_blockhash(&self) -> &Hash
Return the recent blockhash in the transaction.
Sourcepub fn instructions_iter(&self) -> InstructionsIterator<'_>
pub fn instructions_iter(&self) -> InstructionsIterator<'_>
Return an iterator over the instructions in the transaction.
Sourcepub fn address_table_lookup_iter(&self) -> AddressTableLookupIterator<'_>
pub fn address_table_lookup_iter(&self) -> AddressTableLookupIterator<'_>
Return an iterator over the address table lookups in the transaction.
Sourcepub fn message_data(&self) -> &[u8] ⓘ
pub fn message_data(&self) -> &[u8] ⓘ
Return the serialized message data. This does not include the signatures.
Source§impl<D: TransactionData> TransactionView<true, D>
impl<D: TransactionData> TransactionView<true, D>
Sourcepub fn program_instructions_iter(
&self,
) -> impl Iterator<Item = (&Pubkey, SVMInstruction<'_>)> + Clone
pub fn program_instructions_iter( &self, ) -> impl Iterator<Item = (&Pubkey, SVMInstruction<'_>)> + Clone
Return an iterator over the instructions paired with their program ids.
Sourcepub fn total_num_accounts(&self) -> u16
pub fn total_num_accounts(&self) -> u16
Return the total number of accounts in the transactions.
Sourcepub fn num_requested_write_locks(&self) -> u64
pub fn num_requested_write_locks(&self) -> u64
Return the number of requested writable keys.