pub struct Transaction {
pub signatures: Vec<SignatureBytes>,
pub message: Message,
}
Expand description
A Solana transaction
Fields§
§signatures: Vec<SignatureBytes>
The signatures
message: Message
The message
Implementations§
Source§impl Transaction
impl Transaction
Sourcepub fn add_signature(&mut self, signature: SignatureBytes)
pub fn add_signature(&mut self, signature: SignatureBytes)
Add a signature to the transaction
Sourcepub fn num_required_signatures(&self) -> u8
pub fn num_required_signatures(&self) -> u8
Get the number of required signatures
Sourcepub fn num_readonly_signed_accounts(&self) -> u8
pub fn num_readonly_signed_accounts(&self) -> u8
Get the number of read-only signed accounts
Sourcepub fn num_readonly_unsigned_accounts(&self) -> u8
pub fn num_readonly_unsigned_accounts(&self) -> u8
Get the number of read-only unsigned accounts
Sourcepub fn account_keys(&self) -> &[Pubkey]
pub fn account_keys(&self) -> &[Pubkey]
Get the account keys
Sourcepub fn recent_blockhash(&self) -> &[u8; 32]
pub fn recent_blockhash(&self) -> &[u8; 32]
Get the recent blockhash
Sourcepub fn instructions(&self) -> &[CompiledInstruction]
pub fn instructions(&self) -> &[CompiledInstruction]
Get the instructions
Sourcepub fn deserialize_with_version(bytes: &[u8]) -> Result<Self>
pub fn deserialize_with_version(bytes: &[u8]) -> Result<Self>
Deserialize a transaction from bytes
Sourcepub fn serialize_legacy(&self) -> Result<Vec<u8>>
pub fn serialize_legacy(&self) -> Result<Vec<u8>>
Serializes the full transaction into the Solana legacy wire format.
Sourcepub fn sign(&mut self, private_keys: &[&[u8]]) -> Result<()>
pub fn sign(&mut self, private_keys: &[&[u8]]) -> Result<()>
Sign the transaction with one or more private keys The private keys must correspond to the signing accounts in the same order
Sourcepub fn partial_sign(
&mut self,
private_keys: &[&[u8]],
public_keys: &[Pubkey],
) -> Result<()>
pub fn partial_sign( &mut self, private_keys: &[&[u8]], public_keys: &[Pubkey], ) -> Result<()>
Partially sign the transaction with specific private keys Updates only the signatures for the provided keys based on their public key positions
Sourcepub fn is_signed(&self) -> bool
pub fn is_signed(&self) -> bool
Check if the transaction has been signed by all required signers
Sourcepub fn validate_size(&self) -> Result<()>
pub fn validate_size(&self) -> Result<()>
Validate transaction size is within limits (1232 bytes)
Trait Implementations§
Source§impl BorshDeserialize for Transaction
impl BorshDeserialize for Transaction
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
Source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
Source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where
R: Read,
Source§impl BorshSerialize for Transaction
impl BorshSerialize for Transaction
Source§impl Clone for Transaction
impl Clone for Transaction
Source§fn clone(&self) -> Transaction
fn clone(&self) -> Transaction
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more