Skip to main content

TxBuilder

Struct TxBuilder 

Source
pub struct TxBuilder { /* private fields */ }
Expand description

A builder for constructing Stellar TransactionEnvelopes (V1).

Implementations§

Source§

impl TxBuilder

Source

pub fn new() -> Self

Source

pub fn source_account(self, address: &str) -> Result<Self, BuilderError>

Set the source account from a public key (G…)

Source

pub fn sequence_number(self, seq: i64) -> Self

Set the sequence number

Source

pub fn fee(self, fee: u32) -> Self

Set the base fee

Source

pub fn memo_text(self, text: &str) -> Result<Self, BuilderError>

Set a text memo

Source

pub fn memo_id(self, id: u64) -> Self

Set an ID memo

Source

pub fn add_operation(self, op: Operation) -> Self

Add a pre-built Operation

Source

pub fn invoke_contract( self, contract_id: &str, function: &str, args: Vec<ScVal>, ) -> Result<Self, BuilderError>

Add an InvokeHostFunction operation for a smart-contract call.

This is a convenience that wraps a HostFunction::InvokeContract op without requiring the caller to hand-assemble the XDR Operation.

§Errors

Returns BuilderError::InvalidOperation if the contract ID (C...) or function name is invalid.

Source

pub fn set_ext(self, ext: TransactionExt) -> Self

Set ext to V1 with SorobanTransactionData (for host functions)

Source

pub fn max_time(self, max_time: u64) -> Self

Set timebounds timeout (from now to 0 means unbounded for now, or we can just leave None) Real implementations might take a minTime and maxTime. We provide a basic max_time setter.

Source

pub fn build(self) -> Result<TransactionEnvelope, BuilderError>

Build the TransactionEnvelope (unsigned).

Source

pub fn build_base64(self) -> Result<String, BuilderError>

Build and encode to base64

Trait Implementations§

Source§

impl Default for TxBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.