Trait VersionedTransactionExtension

Source
pub trait VersionedTransactionExtension {
    // Required methods
    fn new<T: Signers + ?Sized>(message: VersionedMessage, keypairs: &T) -> Self;
    fn new_unsigned_v0(
        payer: &Pubkey,
        instructions: &[Instruction],
        address_lookup_tables: &[AddressLookupTableAccount],
        recent_blockhash: Hash,
    ) -> Result<VersionedTransaction, CompileError>;
    fn new_unsigned(message: VersionedMessage) -> VersionedTransaction;
    fn try_sign<T: Signers + ?Sized>(
        &mut self,
        signers: &T,
        recent_blockhash: Option<Hash>,
    ) -> Result<&mut Self, SignerError>;
    fn try_sign_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>(
        &mut self,
        wallet: &W,
        recent_blockhash: Option<Hash>,
    ) -> impl Future<Output = WalletResult<&mut Self>>;
    fn try_sign_unchecked<T: Signers + ?Sized>(
        &mut self,
        signers: &T,
        positions: Vec<usize>,
        recent_blockhash: Option<Hash>,
    ) -> Result<(), SignerError>;
    fn try_sign_unchecked_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>(
        &mut self,
        wallet: &W,
        position: usize,
        recent_blockhash: Option<Hash>,
    ) -> impl Future<Output = WalletResult<()>>;
    fn get_signing_keypair_positions(
        &self,
        pubkeys: &[Pubkey],
    ) -> Result<Vec<Option<usize>>, SignerError>;
    fn is_signed(&self) -> bool;
    fn sign_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>(
        &mut self,
        wallet: &W,
        recent_blockhash: Option<Hash>,
    ) -> impl Future<Output = WalletResult<&mut Self>>;
    fn sign_with_wallet<W: WalletSolanaSignTransaction>(
        self,
        wallet: &W,
        options: Option<SolanaSignTransactionOptions>,
    ) -> impl Future<Output = WalletResult<VersionedTransaction>>;

    // Provided method
    fn sign<T: Signers + ?Sized>(
        &mut self,
        signers: &T,
        recent_blockhash: Option<Hash>,
    ) -> &mut Self { ... }
}
Expand description

Add extensions which make it possible to partially sign a versioned transaction.

Required Methods§

Source

fn new<T: Signers + ?Sized>(message: VersionedMessage, keypairs: &T) -> Self

Create a new signed transaction from from the provided VersionedMessage.

Source

fn new_unsigned_v0( payer: &Pubkey, instructions: &[Instruction], address_lookup_tables: &[AddressLookupTableAccount], recent_blockhash: Hash, ) -> Result<VersionedTransaction, CompileError>

Create a new unsigned transction from the payer and instructions with a recent blockhash. Under the hood this creates the message which needs to be signed.

Source

fn new_unsigned(message: VersionedMessage) -> VersionedTransaction

Source

fn try_sign<T: Signers + ?Sized>( &mut self, signers: &T, recent_blockhash: Option<Hash>, ) -> Result<&mut Self, SignerError>

Attempt to sign this transaction with provided signers.

Source

fn try_sign_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>( &mut self, wallet: &W, recent_blockhash: Option<Hash>, ) -> impl Future<Output = WalletResult<&mut Self>>

Source

fn try_sign_unchecked<T: Signers + ?Sized>( &mut self, signers: &T, positions: Vec<usize>, recent_blockhash: Option<Hash>, ) -> Result<(), SignerError>

Sign the transaction with a subset of required keys, returning any errors.

This places each of the signatures created from keypairs in the corresponding position, as specified in the positions vector, in the transactions signatures field. It does not verify that the signature positions are correct.

§Errors

Returns an error if signing fails.

Source

fn try_sign_unchecked_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>( &mut self, wallet: &W, position: usize, recent_blockhash: Option<Hash>, ) -> impl Future<Output = WalletResult<()>>

Source

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

Source

fn is_signed(&self) -> bool

Check whether the transaction is fully signed with valid signatures.

Source

fn sign_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>( &mut self, wallet: &W, recent_blockhash: Option<Hash>, ) -> impl Future<Output = WalletResult<&mut Self>>

Sign the transaction with a solana wallet.

Source

fn sign_with_wallet<W: WalletSolanaSignTransaction>( self, wallet: &W, options: Option<SolanaSignTransactionOptions>, ) -> impl Future<Output = WalletResult<VersionedTransaction>>

Provided Methods§

Source

fn sign<T: Signers + ?Sized>( &mut self, signers: &T, recent_blockhash: Option<Hash>, ) -> &mut Self

Sign the transaction with a subset of required keys, panicking when an error is met.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl VersionedTransactionExtension for VersionedTransaction

Source§

fn new_unsigned(message: VersionedMessage) -> Self

Create an unsigned transction from a VersionedMessage.

Source§

fn try_sign<T: Signers + ?Sized>( &mut self, keypairs: &T, recent_blockhash: Option<Hash>, ) -> Result<&mut Self, SignerError>

Sign the transaction with a subset of required keys, returning any errors.

Unlike VersionedTransaction::try_new, this method does not require all keypairs to be provided, allowing a transaction to be signed in multiple steps.

It is permitted to sign a transaction with the same keypair multiple times.

If recent_blockhash is different than recorded in the transaction message’s VersionedMessage::recent_blockhash() method, then the message’s recent_blockhash will be updated to the provided recent_blockhash, and any prior signatures will be cleared.

Source§

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

Get the positions of the pubkeys in VersionedMessage::static_account_keys associated with signing keypairs.

Source§

fn new<T: Signers + ?Sized>(message: VersionedMessage, keypairs: &T) -> Self

Source§

fn new_unsigned_v0( payer: &Pubkey, instructions: &[Instruction], address_lookup_tables: &[AddressLookupTableAccount], recent_blockhash: Hash, ) -> Result<Self, CompileError>

Source§

fn try_sign_unchecked<T: Signers + ?Sized>( &mut self, keypairs: &T, positions: Vec<usize>, recent_blockhash: Option<Hash>, ) -> Result<(), SignerError>

Source§

fn is_signed(&self) -> bool

Source§

fn try_sign_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>( &mut self, wallet: &W, recent_blockhash: Option<Hash>, ) -> impl Future<Output = WalletResult<&mut Self>>

Source§

fn try_sign_unchecked_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>( &mut self, wallet: &W, position: usize, recent_blockhash: Option<Hash>, ) -> impl Future<Output = WalletResult<()>>

Source§

fn sign_async<W: WalletSolanaSignMessage + WalletSolanaPubkey>( &mut self, wallet: &W, recent_blockhash: Option<Hash>, ) -> impl Future<Output = WalletResult<&mut Self>>

Source§

fn sign_with_wallet<W: WalletSolanaSignTransaction>( self, wallet: &W, options: Option<SolanaSignTransactionOptions>, ) -> impl Future<Output = WalletResult<Self>>

Implementors§