Skip to main content

Command

Enum Command 

Source
#[non_exhaustive]
pub enum Command { MoveCall(MoveCall), TransferObjects(TransferObjects), SplitCoins(SplitCoins), MergeCoins(MergeCoins), Publish(Publish), MakeMoveVector(MakeMoveVector), Upgrade(Upgrade), }
Expand description

A single command in a programmable transaction.

§BCS

The BCS serialized form for this type is defined by the following ABNF:

command =  command-move-call
        =/ command-transfer-objects
        =/ command-split-coins
        =/ command-merge-coins
        =/ command-publish
        =/ command-make-move-vector
        =/ command-upgrade

command-move-call           = %d00 move-call
command-transfer-objects    = %d01 transfer-objects
command-split-coins         = %d02 split-coins
command-merge-coins         = %d03 merge-coins
command-publish             = %d04 publish
command-make-move-vector    = %d05 make-move-vector
command-upgrade             = %d06 upgrade

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MoveCall(MoveCall)

A call to either an entry or a public Move function

§

TransferObjects(TransferObjects)

(Vec<forall T:key+store. T>, address) It sends n-objects to the specified address. These objects must have store (public transfer) and either the previous owner must be an address or the object must be newly created.

§

SplitCoins(SplitCoins)

(&mut Coin<T>, Vec<u64>) -> Vec<Coin<T>> It splits off some amounts into a new coins with those amounts

§

MergeCoins(MergeCoins)

(&mut Coin<T>, Vec<Coin<T>>) It merges n-coins into the first coin

§

Publish(Publish)

Publishes a Move package. It takes the package bytes and a list of the package’s transitive dependencies to link against on-chain.

§

MakeMoveVector(MakeMoveVector)

forall T: Vec<T> -> vector<T> Given n-values of the same type, it constructs a vector. For non objects or an empty vector, the type tag must be specified.

§

Upgrade(Upgrade)

Upgrades a Move package Takes (in order):

  1. A vector of serialized modules for the package.
  2. A vector of object ids for the transitive dependencies of the new package.
  3. The object ID of the package being upgraded.
  4. An argument holding the UpgradeTicket that must have been produced from an earlier command in the same programmable transaction.

Implementations§

Source§

impl Command

Source

pub fn is_move_call(&self) -> bool

Checks if this is a move_call variant.

Source

pub fn as_move_call(&self) -> &MoveCall

Converts this into a move_call if it is a move_call variant, or panics otherwise.

Source

pub fn as_mut_move_call(&mut self) -> &mut MoveCall

Converts this into a mut move_call if it is a move_call variant, or panics otherwise.

Source

pub fn as_opt_move_call(&self) -> Option<&MoveCall>

Converts this into a move_call if it is a move_call variant, or returns None otherwise.

Source

pub fn as_opt_mut_move_call(&mut self) -> Option<&mut MoveCall>

Converts this into a mut move_call if it is a move_call variant, or returns None otherwise.

Source

pub fn into_opt_move_call(self) -> Option<MoveCall>

Converts this into a move_call if it is a move_call variant, or returns None otherwise.

Source

pub fn into_move_call(self) -> MoveCall

Converts this into a move_call if it is a move_call variant, or panics otherwise.

Source

pub fn is_transfer_objects(&self) -> bool

Checks if this is a transfer_objects variant.

Source

pub fn as_transfer_objects(&self) -> &TransferObjects

Converts this into a transfer_objects if it is a transfer_objects variant, or panics otherwise.

Source

pub fn as_mut_transfer_objects(&mut self) -> &mut TransferObjects

Converts this into a mut transfer_objects if it is a transfer_objects variant, or panics otherwise.

Source

pub fn as_opt_transfer_objects(&self) -> Option<&TransferObjects>

Converts this into a transfer_objects if it is a transfer_objects variant, or returns None otherwise.

Source

pub fn as_opt_mut_transfer_objects(&mut self) -> Option<&mut TransferObjects>

Converts this into a mut transfer_objects if it is a transfer_objects variant, or returns None otherwise.

Source

pub fn into_opt_transfer_objects(self) -> Option<TransferObjects>

Converts this into a transfer_objects if it is a transfer_objects variant, or returns None otherwise.

Source

pub fn into_transfer_objects(self) -> TransferObjects

Converts this into a transfer_objects if it is a transfer_objects variant, or panics otherwise.

Source

pub fn is_split_coins(&self) -> bool

Checks if this is a split_coins variant.

Source

pub fn as_split_coins(&self) -> &SplitCoins

Converts this into a split_coins if it is a split_coins variant, or panics otherwise.

Source

pub fn as_mut_split_coins(&mut self) -> &mut SplitCoins

Converts this into a mut split_coins if it is a split_coins variant, or panics otherwise.

Source

pub fn as_opt_split_coins(&self) -> Option<&SplitCoins>

Converts this into a split_coins if it is a split_coins variant, or returns None otherwise.

Source

pub fn as_opt_mut_split_coins(&mut self) -> Option<&mut SplitCoins>

Converts this into a mut split_coins if it is a split_coins variant, or returns None otherwise.

Source

pub fn into_opt_split_coins(self) -> Option<SplitCoins>

Converts this into a split_coins if it is a split_coins variant, or returns None otherwise.

Source

pub fn into_split_coins(self) -> SplitCoins

Converts this into a split_coins if it is a split_coins variant, or panics otherwise.

Source

pub fn is_merge_coins(&self) -> bool

Checks if this is a merge_coins variant.

Source

pub fn as_merge_coins(&self) -> &MergeCoins

Converts this into a merge_coins if it is a merge_coins variant, or panics otherwise.

Source

pub fn as_mut_merge_coins(&mut self) -> &mut MergeCoins

Converts this into a mut merge_coins if it is a merge_coins variant, or panics otherwise.

Source

pub fn as_opt_merge_coins(&self) -> Option<&MergeCoins>

Converts this into a merge_coins if it is a merge_coins variant, or returns None otherwise.

Source

pub fn as_opt_mut_merge_coins(&mut self) -> Option<&mut MergeCoins>

Converts this into a mut merge_coins if it is a merge_coins variant, or returns None otherwise.

Source

pub fn into_opt_merge_coins(self) -> Option<MergeCoins>

Converts this into a merge_coins if it is a merge_coins variant, or returns None otherwise.

Source

pub fn into_merge_coins(self) -> MergeCoins

Converts this into a merge_coins if it is a merge_coins variant, or panics otherwise.

Source

pub fn is_publish(&self) -> bool

Checks if this is a publish variant.

Source

pub fn as_publish(&self) -> &Publish

Converts this into a publish if it is a publish variant, or panics otherwise.

Source

pub fn as_mut_publish(&mut self) -> &mut Publish

Converts this into a mut publish if it is a publish variant, or panics otherwise.

Source

pub fn as_opt_publish(&self) -> Option<&Publish>

Converts this into a publish if it is a publish variant, or returns None otherwise.

Source

pub fn as_opt_mut_publish(&mut self) -> Option<&mut Publish>

Converts this into a mut publish if it is a publish variant, or returns None otherwise.

Source

pub fn into_opt_publish(self) -> Option<Publish>

Converts this into a publish if it is a publish variant, or returns None otherwise.

Source

pub fn into_publish(self) -> Publish

Converts this into a publish if it is a publish variant, or panics otherwise.

Source

pub fn is_make_move_vector(&self) -> bool

Checks if this is a make_move_vector variant.

Source

pub fn as_make_move_vector(&self) -> &MakeMoveVector

Converts this into a make_move_vector if it is a make_move_vector variant, or panics otherwise.

Source

pub fn as_mut_make_move_vector(&mut self) -> &mut MakeMoveVector

Converts this into a mut make_move_vector if it is a make_move_vector variant, or panics otherwise.

Source

pub fn as_opt_make_move_vector(&self) -> Option<&MakeMoveVector>

Converts this into a make_move_vector if it is a make_move_vector variant, or returns None otherwise.

Source

pub fn as_opt_mut_make_move_vector(&mut self) -> Option<&mut MakeMoveVector>

Converts this into a mut make_move_vector if it is a make_move_vector variant, or returns None otherwise.

Source

pub fn into_opt_make_move_vector(self) -> Option<MakeMoveVector>

Converts this into a make_move_vector if it is a make_move_vector variant, or returns None otherwise.

Source

pub fn into_make_move_vector(self) -> MakeMoveVector

Converts this into a make_move_vector if it is a make_move_vector variant, or panics otherwise.

Source

pub fn is_upgrade(&self) -> bool

Checks if this is a upgrade variant.

Source

pub fn as_upgrade(&self) -> &Upgrade

Converts this into a upgrade if it is a upgrade variant, or panics otherwise.

Source

pub fn as_mut_upgrade(&mut self) -> &mut Upgrade

Converts this into a mut upgrade if it is a upgrade variant, or panics otherwise.

Source

pub fn as_opt_upgrade(&self) -> Option<&Upgrade>

Converts this into a upgrade if it is a upgrade variant, or returns None otherwise.

Source

pub fn as_opt_mut_upgrade(&mut self) -> Option<&mut Upgrade>

Converts this into a mut upgrade if it is a upgrade variant, or returns None otherwise.

Source

pub fn into_opt_upgrade(self) -> Option<Upgrade>

Converts this into a upgrade if it is a upgrade variant, or returns None otherwise.

Source

pub fn into_upgrade(self) -> Upgrade

Converts this into a upgrade if it is a upgrade variant, or panics otherwise.

Source

pub fn new_move_call( package: ObjectId, module: Identifier, function: Identifier, type_arguments: Vec<TypeTag>, arguments: Vec<Argument>, ) -> Self

Create a command to call a Move function.

Source

pub fn new_transfer_objects(objects: Vec<Argument>, address: Argument) -> Self

Create a command to transfer objects to an address.

Source

pub fn new_split_coins(coin: Argument, amounts: Vec<Argument>) -> Self

Create a command to split a coin into multiple coins by amounts.

Source

pub fn new_merge_coins(coin: Argument, coins_to_merge: Vec<Argument>) -> Self

Create a command to merge multiple coins into one.

Source

pub fn new_publish(modules: Vec<Vec<u8>>, dependencies: Vec<ObjectId>) -> Self

Create a command to publish a new Move package.

Source

pub fn new_make_move_vector( type_tag: Option<TypeTag>, elements: Vec<Argument>, ) -> Self

Create a command to construct a Move vector from elements.

Source

pub fn new_upgrade( modules: Vec<Vec<u8>>, dependencies: Vec<ObjectId>, package: ObjectId, ticket: Argument, ) -> Self

Create a command to upgrade an existing Move package.

Trait Implementations§

Source§

impl Arbitrary for Command

Available on crate feature proptest only.
Source§

type Parameters = ()

The type of parameters that arbitrary_with accepts for configuration of the generated Strategy. Parameters must implement Default.
Source§

type Strategy = BoxedStrategy<Command>

The type of Strategy used to generate values of type Self.
Source§

fn arbitrary_with( args_shared: <Self as Arbitrary>::Parameters, ) -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). The strategy is passed the arguments given in args. Read more
Source§

fn arbitrary() -> Self::Strategy

Generates a Strategy for producing arbitrary values of type the implementing type (Self). Read more
Source§

impl Clone for Command

Source§

fn clone(&self) -> Command

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Command

Available on crate feature serde only.
Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Command

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Command

Source§

impl Hash for Command

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Command

Source§

fn eq(&self, other: &Command) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Command

Available on crate feature serde only.
Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Command

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts 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 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V