pub struct TxBuilder { /* private fields */ }Expand description
A builder for constructing Stellar TransactionEnvelopes (V1).
Implementations§
Source§impl TxBuilder
impl TxBuilder
pub fn new() -> Self
Sourcepub fn source_account(self, address: &str) -> Result<Self, BuilderError>
pub fn source_account(self, address: &str) -> Result<Self, BuilderError>
Set the source account from a public key (G…)
Sourcepub fn sequence_number(self, seq: i64) -> Self
pub fn sequence_number(self, seq: i64) -> Self
Set the sequence number
Sourcepub fn memo_text(self, text: &str) -> Result<Self, BuilderError>
pub fn memo_text(self, text: &str) -> Result<Self, BuilderError>
Set a text memo
Sourcepub fn add_operation(self, op: Operation) -> Self
pub fn add_operation(self, op: Operation) -> Self
Add a pre-built Operation
Sourcepub fn invoke_contract(
self,
contract_id: &str,
function: &str,
args: Vec<ScVal>,
) -> Result<Self, BuilderError>
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.
Sourcepub fn set_ext(self, ext: TransactionExt) -> Self
pub fn set_ext(self, ext: TransactionExt) -> Self
Set ext to V1 with SorobanTransactionData (for host functions)
Sourcepub fn max_time(self, max_time: u64) -> Self
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.
Sourcepub fn build(self) -> Result<TransactionEnvelope, BuilderError>
pub fn build(self) -> Result<TransactionEnvelope, BuilderError>
Build the TransactionEnvelope (unsigned).
Sourcepub fn build_base64(self) -> Result<String, BuilderError>
pub fn build_base64(self) -> Result<String, BuilderError>
Build and encode to base64