pub struct TxBuilder { /* private fields */ }Expand description
High-level builder for Solana versioned transaction messages.
Implementations§
Source§impl TxBuilder
impl TxBuilder
Sourcepub fn add_instruction(self, instruction: Instruction) -> Self
pub fn add_instruction(self, instruction: Instruction) -> Self
Appends one instruction.
Sourcepub fn add_instructions<I>(self, instructions: I) -> Selfwhere
I: IntoIterator<Item = Instruction>,
pub fn add_instructions<I>(self, instructions: I) -> Selfwhere
I: IntoIterator<Item = Instruction>,
Appends many instructions.
Sourcepub const fn with_compute_unit_limit(self, units: u32) -> Self
pub const fn with_compute_unit_limit(self, units: u32) -> Self
Sets compute unit limit.
Sourcepub const fn with_priority_fee_micro_lamports(self, micro_lamports: u64) -> Self
pub const fn with_priority_fee_micro_lamports(self, micro_lamports: u64) -> Self
Sets priority fee in micro-lamports.
Sourcepub const fn tip_developer(self) -> Self
pub const fn tip_developer(self) -> Self
Enables default developer tip.
Sourcepub const fn tip_developer_lamports(self, lamports: u64) -> Self
pub const fn tip_developer_lamports(self, lamports: u64) -> Self
Enables developer tip with explicit lamports.
Sourcepub const fn tip_to(self, recipient: Pubkey, lamports: u64) -> Self
pub const fn tip_to(self, recipient: Pubkey, lamports: u64) -> Self
Sets a custom tip recipient and lamports.
Sourcepub const fn with_message_version(self, version: TxMessageVersion) -> Self
pub const fn with_message_version(self, version: TxMessageVersion) -> Self
Sets the message version emitted by the builder.
Sourcepub const fn with_legacy_message(self) -> Self
pub const fn with_legacy_message(self) -> Self
Forces legacy message output.
Sourcepub const fn with_v0_message(self) -> Self
pub const fn with_v0_message(self) -> Self
Forces version 0 message output.
Sourcepub fn build_unsigned(self, recent_blockhash: [u8; 32]) -> UnsignedTx
pub fn build_unsigned(self, recent_blockhash: [u8; 32]) -> UnsignedTx
Builds an unsigned transaction wrapper.
Sourcepub fn build_and_sign<T>(
self,
recent_blockhash: [u8; 32],
signers: &T,
) -> Result<VersionedTransaction, BuilderError>
pub fn build_and_sign<T>( self, recent_blockhash: [u8; 32], signers: &T, ) -> Result<VersionedTransaction, BuilderError>
Builds and signs a transaction in one step.
§Errors
Returns BuilderError::SignTransaction when signer validation or signing fails.
Sourcepub fn build_message(self, recent_blockhash: [u8; 32]) -> VersionedMessage
pub fn build_message(self, recent_blockhash: [u8; 32]) -> VersionedMessage
Builds a message wrapped as a versioned message.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TxBuilder
impl RefUnwindSafe for TxBuilder
impl Send for TxBuilder
impl Sync for TxBuilder
impl Unpin for TxBuilder
impl UnsafeUnpin for TxBuilder
impl UnwindSafe for TxBuilder
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
Converts
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>
Converts
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