pub struct ProgrammableTransactionBuilder { /* private fields */ }Expand description
Builder for a ProgrammableTransaction.
Implementations§
Source§impl ProgrammableTransactionBuilder
Base API.
impl ProgrammableTransactionBuilder
Base API.
pub fn new() -> Self
pub fn finish(self) -> ProgrammableTransaction
Sourcepub fn pure<T: Serialize + ?Sized>(&mut self, value: &T) -> Result<Argument>
pub fn pure<T: Serialize + ?Sized>(&mut self, value: &T) -> Result<Argument>
Potentially adds a pure argument to the PTB.
May not create a new PTB input if a previous one already has the same contents.
Sourcepub fn force_separate_pure<T: Serialize>(
&mut self,
value: T,
) -> Result<Argument>
pub fn force_separate_pure<T: Serialize>( &mut self, value: T, ) -> Result<Argument>
Like Self::pure but forces a separate input entry
Sourcepub fn pure_bytes(&mut self, bytes: Vec<u8>, force_separate: bool) -> Argument
pub fn pure_bytes(&mut self, bytes: Vec<u8>, force_separate: bool) -> Argument
Adds a pure argument to the PTB.
§Arguments
bytes: the BCS-serialized contents of the argumentforce_separate: whether to force a separate input argument to the PTB, else the builder re-uses a previously declared input argument if it has the same contents.
Source§impl ProgrammableTransactionBuilder
Address-balance helpers.
impl ProgrammableTransactionBuilder
Address-balance helpers.
Sourcepub fn funds_withdrawal(&mut self, withdrawal: FundsWithdrawal) -> Argument
pub fn funds_withdrawal(&mut self, withdrawal: FundsWithdrawal) -> Argument
Adds a FundsWithdrawal input to the PTB.
Sourcepub fn balance_from_sender(
&mut self,
amount: u64,
coin_type: TypeTag,
) -> Argument
pub fn balance_from_sender( &mut self, amount: u64, coin_type: TypeTag, ) -> Argument
Adds a FundsWithdrawal input withdrawing amount of coin_type from the sender’s
balance.
Sourcepub fn balance_from_sponsor(
&mut self,
amount: u64,
coin_type: TypeTag,
) -> Argument
pub fn balance_from_sponsor( &mut self, amount: u64, coin_type: TypeTag, ) -> Argument
Adds a FundsWithdrawal input withdrawing amount of coin_type from the sponsor’s
balance.
Sourcepub fn finish_address_balance(
self,
sender: Address,
sponsor: Address,
chain_identifier: Digest,
nonce: u32,
gas_price: u64,
gas_budget: u64,
current_epoch: u64,
) -> Transaction
pub fn finish_address_balance( self, sender: Address, sponsor: Address, chain_identifier: Digest, nonce: u32, gas_price: u64, gas_budget: u64, current_epoch: u64, ) -> Transaction
Consumes the builder and wraps the resulting ProgrammableTransaction in a
Transaction that pays gas from an address balance rather than from explicit gas coin
objects.
sponsor is the address whose balance covers gas; pass the same value as sender for the
common self-sponsored case.
The resulting transaction has:
- An empty
gas_payment.objectslist (balance-based payment) gas_payment.ownerset tosponsor- A
TransactionExpiration::ValidDuringwindow of[current_epoch, current_epoch + 1]anchored tochain_identifierwith the givennonce
Source§impl ProgrammableTransactionBuilder
Extensions to the base API.
impl ProgrammableTransactionBuilder
Extensions to the base API.
Trait Implementations§
Source§impl Clone for ProgrammableTransactionBuilder
impl Clone for ProgrammableTransactionBuilder
Source§fn clone(&self) -> ProgrammableTransactionBuilder
fn clone(&self) -> ProgrammableTransactionBuilder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Default for ProgrammableTransactionBuilder
impl Default for ProgrammableTransactionBuilder
Source§fn default() -> ProgrammableTransactionBuilder
fn default() -> ProgrammableTransactionBuilder
Source§impl From<ProgrammableTransactionBuilder> for ProgrammableTransaction
impl From<ProgrammableTransactionBuilder> for ProgrammableTransaction
Source§fn from(value: ProgrammableTransactionBuilder) -> Self
fn from(value: ProgrammableTransactionBuilder) -> Self
Auto Trait Implementations§
impl Freeze for ProgrammableTransactionBuilder
impl RefUnwindSafe for ProgrammableTransactionBuilder
impl Send for ProgrammableTransactionBuilder
impl Sync for ProgrammableTransactionBuilder
impl Unpin for ProgrammableTransactionBuilder
impl UnsafeUnpin for ProgrammableTransactionBuilder
impl UnwindSafe for ProgrammableTransactionBuilder
Blanket Implementations§
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,
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