pub struct TransactionBuilder<'a, C, T = ()> { /* private fields */ }
Expand description
A builder for a transaction.
Implementations§
Source§impl<'a, C: Deref<Target = impl Signer> + Clone> TransactionBuilder<'a, C>
impl<'a, C: Deref<Target = impl Signer> + Clone> TransactionBuilder<'a, C>
Sourcepub fn merge(self, other: Self) -> Self
pub fn merge(self, other: Self) -> Self
Merge other TransactionBuilder
. The rpc fields will be empty after merging,
i.e., take_rpc
will return None
.
§Panics
Return if there are any errors.
§Notes
- All options including
cluster
,commiment
andprogram_id
will still be the same ofself
after merging.
Sourcepub fn try_merge(&mut self, other: &mut Self) -> Result<()>
pub fn try_merge(&mut self, other: &mut Self) -> Result<()>
Merge other TransactionBuilder
. The rpc fields will be empty after merging,
i.e., take_rpc
will return None
.
§Errors
Return error if the payer
s are not the same.
§Notes
- When success, the
other
will become a emptyTransactionBuilder
. - All options including
cluster
,commiment
, andprogram_id
will still be the same ofself
after merging.
Sourcepub fn into_bundle_with_options(
self,
options: BundleOptions,
) -> Result<BundleBuilder<'a, C>>
pub fn into_bundle_with_options( self, options: BundleOptions, ) -> Result<BundleBuilder<'a, C>>
Convert into a BundleBuilder
with the given options.
Sourcepub fn into_bundle(self) -> Result<BundleBuilder<'a, C>>
pub fn into_bundle(self) -> Result<BundleBuilder<'a, C>>
Convert into a BundleBuilder
.
Source§impl<'a, C: Deref<Target = impl Signer> + Clone, T> TransactionBuilder<'a, C, T>
impl<'a, C: Deref<Target = impl Signer> + Clone, T> TransactionBuilder<'a, C, T>
Sourcepub fn payer<C2>(self, payer: C2) -> TransactionBuilder<'a, C2, T>
pub fn payer<C2>(self, payer: C2) -> TransactionBuilder<'a, C2, T>
Set payer.
Sourcepub fn owned_signer(self, signer: impl Signer + Clone + 'static) -> Self
pub fn owned_signer(self, signer: impl Signer + Clone + 'static) -> Self
Add a owned sigenr to the signer list.
Sourcepub fn accounts(self, accounts: Vec<AccountMeta>) -> Self
pub fn accounts(self, accounts: Vec<AccountMeta>) -> Self
Append accounts for the main instruction.
Sourcepub fn anchor_accounts(self, accounts: impl ToAccountMetas) -> Self
pub fn anchor_accounts(self, accounts: impl ToAccountMetas) -> Self
Append accounts for the main instruction.
Sourcepub fn anchor_args(self, args: impl InstructionData) -> Self
pub fn anchor_args(self, args: impl InstructionData) -> Self
Set arguments for the main instruction.
Sourcepub fn compute_budget(self, budget: ComputeBudget) -> Self
pub fn compute_budget(self, budget: ComputeBudget) -> Self
Set compute budget.
Sourcepub fn compute_budget_mut(&mut self) -> &mut ComputeBudget
pub fn compute_budget_mut(&mut self) -> &mut ComputeBudget
Get mutable reference to the compute budget.
Sourcepub fn take_instruction(&mut self) -> Option<Instruction>
pub fn take_instruction(&mut self) -> Option<Instruction>
Take and construct the “main” instruction if present.
Sourcepub fn instructions(&self) -> Vec<Instruction>
pub fn instructions(&self) -> Vec<Instruction>
Construct all instructions.
Sourcepub fn instructions_with_options(
&self,
without_compute_budget: bool,
compute_unit_price_micro_lamports: Option<u64>,
) -> Vec<Instruction>
pub fn instructions_with_options( &self, without_compute_budget: bool, compute_unit_price_micro_lamports: Option<u64>, ) -> Vec<Instruction>
Construct all instructions with options.
Sourcepub fn get_output(&self) -> &T
pub fn get_output(&self) -> &T
Get the output.
Sourcepub fn swap_output<U>(self, output: U) -> (TransactionBuilder<'a, C, U>, T)
pub fn swap_output<U>(self, output: U) -> (TransactionBuilder<'a, C, U>, T)
Set the output and return the previous.
Sourcepub fn output<U>(self, output: U) -> TransactionBuilder<'a, C, U>
pub fn output<U>(self, output: U) -> TransactionBuilder<'a, C, U>
Set the output.
Sourcepub fn clear_output(self) -> TransactionBuilder<'a, C, ()>
pub fn clear_output(self) -> TransactionBuilder<'a, C, ()>
Clear the output.
Sourcepub fn pre_instruction(self, ix: Instruction) -> Self
pub fn pre_instruction(self, ix: Instruction) -> Self
Insert an instruction before the “main” instruction.
Sourcepub fn pre_instructions(self, ixs: Vec<Instruction>) -> Self
pub fn pre_instructions(self, ixs: Vec<Instruction>) -> Self
Insert instructions before the “main” instruction.
Sourcepub fn lookup_table(self, account: AddressLookupTableAccount) -> Self
pub fn lookup_table(self, account: AddressLookupTableAccount) -> Self
Insert an address lookup table account.
Sourcepub fn lookup_tables(
self,
tables: impl IntoIterator<Item = (Pubkey, Vec<Pubkey>)>,
) -> Self
pub fn lookup_tables( self, tables: impl IntoIterator<Item = (Pubkey, Vec<Pubkey>)>, ) -> Self
Insert many address lookup tables.
Sourcepub fn message_with_blockhash_and_options(
&self,
latest_hash: Hash,
without_compute_budget: bool,
compute_unit_price_micro_lamports: Option<u64>,
) -> Result<VersionedMessage>
pub fn message_with_blockhash_and_options( &self, latest_hash: Hash, without_compute_budget: bool, compute_unit_price_micro_lamports: Option<u64>, ) -> Result<VersionedMessage>
Get versioned message with the given hash and options.
Sourcepub async fn message_with_options(
&self,
without_compute_budget: bool,
compute_unit_price_micro_lamports: Option<u64>,
) -> Result<VersionedMessage>
pub async fn message_with_options( &self, without_compute_budget: bool, compute_unit_price_micro_lamports: Option<u64>, ) -> Result<VersionedMessage>
Get versioned message with options.
Sourcepub fn signed_transaction_with_blockhash_and_options(
&self,
latest_hash: Hash,
without_compute_budget: bool,
compute_unit_price_micro_lamports: Option<u64>,
) -> Result<VersionedTransaction>
pub fn signed_transaction_with_blockhash_and_options( &self, latest_hash: Hash, without_compute_budget: bool, compute_unit_price_micro_lamports: Option<u64>, ) -> Result<VersionedTransaction>
Get signed transaction with blockhash and options.
Sourcepub async fn signed_transaction_with_options(
&self,
without_compute_budget: bool,
compute_unit_price_micro_lamports: Option<u64>,
) -> Result<VersionedTransaction>
pub async fn signed_transaction_with_options( &self, without_compute_budget: bool, compute_unit_price_micro_lamports: Option<u64>, ) -> Result<VersionedTransaction>
Get signed transactoin with options.
Sourcepub async fn send_with_options(
&self,
without_compute_budget: bool,
compute_unit_price_micro_lamports: Option<u64>,
config: RpcSendTransactionConfig,
) -> Result<WithSlot<Signature>>
pub async fn send_with_options( &self, without_compute_budget: bool, compute_unit_price_micro_lamports: Option<u64>, config: RpcSendTransactionConfig, ) -> Result<WithSlot<Signature>>
Sign and send the transaction with options.
Sourcepub async fn send_without_preflight(self) -> Result<Signature>
pub async fn send_without_preflight(self) -> Result<Signature>
Build and send the transaction without preflight.
Sourcepub async fn send(self) -> Result<Signature>
pub async fn send(self) -> Result<Signature>
Build and send the transaction with default options.
Sourcepub fn get_complete_lookup_table(&self) -> HashSet<Pubkey>
pub fn get_complete_lookup_table(&self) -> HashSet<Pubkey>
Get complete lookup table.
Sourcepub fn transaction_size(&self, is_versioned_transaction: bool) -> usize
pub fn transaction_size(&self, is_versioned_transaction: bool) -> usize
Estimates the size of the result transaction.
See transaction_size()
for more information.
Trait Implementations§
Source§impl<'a, C: Clone, T: Clone> Clone for TransactionBuilder<'a, C, T>
impl<'a, C: Clone, T: Clone> Clone for TransactionBuilder<'a, C, T>
Source§fn clone(&self) -> TransactionBuilder<'a, C, T>
fn clone(&self) -> TransactionBuilder<'a, C, T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<'a, C: Deref<Target = impl Signer> + Clone> MakeBundleBuilder<'a, C> for TransactionBuilder<'a, C>
impl<'a, C: Deref<Target = impl Signer> + Clone> MakeBundleBuilder<'a, C> for TransactionBuilder<'a, C>
Source§async fn build_with_options(
&mut self,
options: BundleOptions,
) -> Result<BundleBuilder<'a, C>>
async fn build_with_options( &mut self, options: BundleOptions, ) -> Result<BundleBuilder<'a, C>>
Auto Trait Implementations§
impl<'a, C, T> Freeze for TransactionBuilder<'a, C, T>
impl<'a, C, T = ()> !RefUnwindSafe for TransactionBuilder<'a, C, T>
impl<'a, C, T = ()> !Send for TransactionBuilder<'a, C, T>
impl<'a, C, T = ()> !Sync for TransactionBuilder<'a, C, T>
impl<'a, C, T> Unpin for TransactionBuilder<'a, C, T>
impl<'a, C, T = ()> !UnwindSafe for TransactionBuilder<'a, C, T>
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more