pub struct TransactionBuilder { /* private fields */ }Expand description
A builder for creating transactions. Use resolve to finalize the transaction data.
Implementations§
Source§impl TransactionBuilder
impl TransactionBuilder
pub fn gas(&mut self) -> Argument
pub fn pure_bytes(&mut self, bytes: Vec<u8>) -> Argument
pub fn pure<T: Serialize>(&mut self, value: &T) -> Argument
pub fn pure_bytes_unique(&mut self, bytes: Vec<u8>) -> Argument
pub fn pure_unique<T: Serialize>(&mut self, value: &T) -> Argument
pub fn object(&mut self, object: ObjectInput) -> Argument
Sourcepub fn add_gas_objects<O, I>(&mut self, gas: I)
pub fn add_gas_objects<O, I>(&mut self, gas: I)
Add one or more gas objects to use to pay for the transaction.
Sourcepub fn set_gas_budget(&mut self, budget: u64)
pub fn set_gas_budget(&mut self, budget: u64)
Set the gas budget for the transaction.
Sourcepub fn set_gas_price(&mut self, price: u64)
pub fn set_gas_price(&mut self, price: u64)
Set the gas price for the transaction.
Sourcepub fn set_sender(&mut self, sender: Address)
pub fn set_sender(&mut self, sender: Address)
Set the sender of the transaction.
Sourcepub fn set_sponsor(&mut self, sponsor: Address)
pub fn set_sponsor(&mut self, sponsor: Address)
Set the sponsor of the transaction.
Sourcepub fn set_expiration(&mut self, expiration: TransactionExpiration)
pub fn set_expiration(&mut self, expiration: TransactionExpiration)
Set the expiration of the transaction.
Sourcepub fn move_call(
&mut self,
function: Function,
arguments: Vec<Argument>,
) -> Argument
pub fn move_call( &mut self, function: Function, arguments: Vec<Argument>, ) -> Argument
Call a Move function with the given arguments.
functionis a structured representation of a package::module::function argument, optionally with type arguments.
Sourcepub fn transfer_objects(&mut self, objects: Vec<Argument>, address: Argument)
pub fn transfer_objects(&mut self, objects: Vec<Argument>, address: Argument)
Transfer a list of objects to the given address, without producing any result.
Sourcepub fn split_coins(
&mut self,
coin: Argument,
amounts: Vec<Argument>,
) -> Vec<Argument>
pub fn split_coins( &mut self, coin: Argument, amounts: Vec<Argument>, ) -> Vec<Argument>
Split a coin by the provided amounts, returning multiple results (as many as there are
amounts). The returned vector of Arguments is guaranteed to be the same length as the
provided amounts vector.
Sourcepub fn merge_coins(&mut self, coin: Argument, coins_to_merge: Vec<Argument>)
pub fn merge_coins(&mut self, coin: Argument, coins_to_merge: Vec<Argument>)
Merge a list of coins into a single coin, without producing any result.
Sourcepub fn make_move_vec(
&mut self,
type_: Option<TypeTag>,
elements: Vec<Argument>,
) -> Argument
pub fn make_move_vec( &mut self, type_: Option<TypeTag>, elements: Vec<Argument>, ) -> Argument
Make a move vector from a list of elements. If the elements are not objects, or the vector is empty, a type must be supplied. It returns the Move vector as an argument, that can be used in subsequent commands.
Sourcepub fn publish(
&mut self,
modules: Vec<Vec<u8>>,
dependencies: Vec<Address>,
) -> Argument
pub fn publish( &mut self, modules: Vec<Vec<u8>>, dependencies: Vec<Address>, ) -> Argument
Publish a list of modules with the given dependencies. The result is the
0x2::package::UpgradeCap Move type. Note that the upgrade capability needs to be handled
after this call:
- transfer it to the transaction sender or another address
- burn it
- wrap it for access control
- discard the it to make a package immutable
The arguments required for this command are:
modules: is the modules’ bytecode to be publisheddependencies: is the list of IDs of the transitive dependencies of the package
Sourcepub fn upgrade(
&mut self,
modules: Vec<Vec<u8>>,
dependencies: Vec<Address>,
package: Address,
ticket: Argument,
) -> Argument
pub fn upgrade( &mut self, modules: Vec<Vec<u8>>, dependencies: Vec<Address>, package: Address, ticket: Argument, ) -> Argument
Upgrade a Move package.
modules: is the modules’ bytecode for the modules to be publisheddependencies: is the list of IDs of the transitive dependencies of the package to be upgradedpackage: is the ID of the current package being upgradedticket: is the upgrade ticket
To get the ticket, you have to call the 0x2::package::authorize_upgrade function,
and pass the package ID, the upgrade policy, and package digest.
pub fn intent<I: Intent>(&mut self, intent: I) -> Argument
intents only.Sourcepub fn try_build(self) -> Result<Transaction, Error>
pub fn try_build(self) -> Result<Transaction, Error>
Assuming everything is resolved, convert this transaction into the
resolved form. Returns a [Transaction] if successful, or an Error if not.
pub async fn build(self, client: &mut Client) -> Result<Transaction, Error>
intents only.Trait Implementations§
Source§impl Default for TransactionBuilder
impl Default for TransactionBuilder
Source§fn default() -> TransactionBuilder
fn default() -> TransactionBuilder
Auto Trait Implementations§
impl Freeze for TransactionBuilder
impl !RefUnwindSafe for TransactionBuilder
impl Send for TransactionBuilder
impl Sync for TransactionBuilder
impl Unpin for TransactionBuilder
impl !UnwindSafe for TransactionBuilder
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. Read moreSource§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
§impl<T> Conv for T
impl<T> Conv for T
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> Tap for T
impl<T> Tap for T
§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read more§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read more§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read more§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read more§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read more§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read more§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.