Struct solana_sdk::transaction::Transaction[][src]

pub struct Transaction {
    pub signatures: Vec<Signature>,
    pub message: Message,
}
Expand description

An atomic transaction

Fields

signatures: Vec<Signature>
Expand description

A set of digital signatures of account_keys, program_ids, recent_blockhash, and instructions, signed by the first signatures.len() keys of account_keys NOTE: Serialization-related changes must be paired with the direct read at sigverify.

message: Message
Expand description

The message to sign.

Implementations

impl Transaction[src]

pub fn new_unsigned(message: Message) -> Self[src]

pub fn new_with_payer(
    instructions: &[Instruction],
    payer: Option<&Pubkey>
) -> Self
[src]

pub fn new_signed_with_payer<T: Signers>(
    instructions: &[Instruction],
    payer: Option<&Pubkey>,
    signing_keypairs: &T,
    recent_blockhash: Hash
) -> Self
[src]

Create a signed transaction with the given payer.

Panics

Panics when signing fails.

pub fn new<T: Signers>(
    from_keypairs: &T,
    message: Message,
    recent_blockhash: Hash
) -> Transaction
[src]

Create a signed transaction.

Panics

Panics when signing fails.

pub fn new_with_compiled_instructions<T: Signers>(
    from_keypairs: &T,
    keys: &[Pubkey],
    recent_blockhash: Hash,
    program_ids: Vec<Pubkey>,
    instructions: Vec<CompiledInstruction>
) -> Self
[src]

Create a signed transaction

  • from_keypairs - The keys used to sign the transaction.
  • keys - The keys for the transaction. These are the program state instances or lamport recipient keys.
  • recent_blockhash - The PoH hash.
  • program_ids - The keys that identify programs used in the instruction vector.
  • instructions - Instructions that will be executed atomically.

Panics

Panics when signing fails.

pub fn data(&self, instruction_index: usize) -> &[u8]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
[src]

pub fn key(
    &self,
    instruction_index: usize,
    accounts_index: usize
) -> Option<&Pubkey>
[src]

pub fn signer_key(
    &self,
    instruction_index: usize,
    accounts_index: usize
) -> Option<&Pubkey>
[src]

pub fn message(&self) -> &Message[src]

Return a message containing all data that should be signed.

pub fn message_data(&self) -> Vec<u8>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

Return the serialized message data to sign.

pub fn sign<T: Signers>(&mut self, keypairs: &T, recent_blockhash: Hash)[src]

Check keys and keypair lengths, then sign this transaction.

Panics

Panics when signing fails, use Transaction::try_sign to handle the error.

pub fn partial_sign<T: Signers>(&mut self, keypairs: &T, recent_blockhash: Hash)[src]

Sign using some subset of required keys if recent_blockhash is not the same as currently in the transaction, clear any prior signatures and update recent_blockhash

Panics

Panics when signing fails, use Transaction::try_partial_sign to handle the error.

pub fn partial_sign_unchecked<T: Signers>(
    &mut self,
    keypairs: &T,
    positions: Vec<usize>,
    recent_blockhash: Hash
)
[src]

Sign the transaction and place the signatures in their associated positions in signatures without checking that the positions are correct.

Panics

Panics when signing fails, use Transaction::try_partial_sign_unchecked to handle the error.

pub fn try_sign<T: Signers>(
    &mut self,
    keypairs: &T,
    recent_blockhash: Hash
) -> Result<(), SignerError>
[src]

Check keys and keypair lengths, then sign this transaction, returning any signing errors encountered

pub fn try_partial_sign<T: Signers>(
    &mut self,
    keypairs: &T,
    recent_blockhash: Hash
) -> Result<(), SignerError>
[src]

Sign using some subset of required keys, returning any signing errors encountered. If recent_blockhash is not the same as currently in the transaction, clear any prior signatures and update recent_blockhash

pub fn try_partial_sign_unchecked<T: Signers>(
    &mut self,
    keypairs: &T,
    positions: Vec<usize>,
    recent_blockhash: Hash
) -> Result<(), SignerError>
[src]

Sign the transaction, returning any signing errors encountered, and place the signatures in their associated positions in signatures without checking that the positions are correct.

pub fn verify(&self) -> Result<()>[src]

Verify the transaction

pub fn verify_and_hash_message(&self) -> Result<Hash>[src]

Verify the transaction and hash its message

pub fn verify_with_results(&self) -> Vec<bool>

Notable traits for Vec<u8, A>

impl<A> Write for Vec<u8, A> where
    A: Allocator
[src]

pub fn verify_precompiles(&self) -> Result<()>[src]

pub fn get_signing_keypair_positions(
    &self,
    pubkeys: &[Pubkey]
) -> Result<Vec<Option<usize>>>
[src]

Get the positions of the pubkeys in account_keys associated with signing keypairs

pub fn replace_signatures(
    &mut self,
    signers: &[(Pubkey, Signature)]
) -> Result<()>
[src]

Replace all the signatures and pubkeys

pub fn is_signed(&self) -> bool[src]

Trait Implementations

impl AbiExample for Transaction[src]

fn example() -> Self[src]

impl Clone for Transaction[src]

fn clone(&self) -> Transaction[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Transaction[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for Transaction[src]

fn default() -> Transaction[src]

Returns the “default value” for a type. Read more

impl<'de> Deserialize<'de> for Transaction[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl PartialEq<Transaction> for Transaction[src]

fn eq(&self, other: &Transaction) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, other: &Transaction) -> bool[src]

This method tests for !=.

impl Sanitize for Transaction[src]

impl Serialize for Transaction[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

impl Eq for Transaction[src]

impl StructuralEq for Transaction[src]

impl StructuralPartialEq for Transaction[src]

Auto Trait Implementations

Blanket Implementations

impl<T> AbiEnumVisitor for T where
    T: Serialize + AbiExample + ?Sized
[src]

pub default fn visit_for_abi(
    &self,
    digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
[src]

impl<T> AbiEnumVisitor for T where
    T: Serialize + ?Sized
[src]

pub default fn visit_for_abi(
    &self,
    _digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
[src]

impl<T> AbiExample for T[src]

pub default fn example() -> T[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]