#[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 upgradeVariants (Non-exhaustive)§
This enum is marked as non-exhaustive
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):
- A vector of serialized modules for the package.
- A vector of object ids for the transitive dependencies of the new package.
- The object ID of the package being upgraded.
- An argument holding the
UpgradeTicketthat must have been produced from an earlier command in the same programmable transaction.
Implementations§
Source§impl Command
impl Command
Sourcepub fn is_move_call(&self) -> bool
pub fn is_move_call(&self) -> bool
Checks if this is a move_call variant.
Sourcepub fn as_move_call(&self) -> &MoveCall
pub fn as_move_call(&self) -> &MoveCall
Converts this into a move_call if it is a move_call variant, or panics otherwise.
Sourcepub fn as_mut_move_call(&mut self) -> &mut MoveCall
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.
Sourcepub fn as_opt_move_call(&self) -> Option<&MoveCall>
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.
Sourcepub fn as_opt_mut_move_call(&mut self) -> Option<&mut MoveCall>
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.
Sourcepub fn into_opt_move_call(self) -> Option<MoveCall>
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.
Sourcepub fn into_move_call(self) -> MoveCall
pub fn into_move_call(self) -> MoveCall
Converts this into a move_call if it is a move_call variant, or panics otherwise.
Sourcepub fn is_transfer_objects(&self) -> bool
pub fn is_transfer_objects(&self) -> bool
Checks if this is a transfer_objects variant.
Sourcepub fn as_transfer_objects(&self) -> &TransferObjects
pub fn as_transfer_objects(&self) -> &TransferObjects
Converts this into a transfer_objects if it is a transfer_objects variant, or panics otherwise.
Sourcepub fn as_mut_transfer_objects(&mut self) -> &mut TransferObjects
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.
Sourcepub fn as_opt_transfer_objects(&self) -> Option<&TransferObjects>
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.
Sourcepub fn as_opt_mut_transfer_objects(&mut self) -> Option<&mut TransferObjects>
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.
Sourcepub fn into_opt_transfer_objects(self) -> Option<TransferObjects>
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.
Sourcepub fn into_transfer_objects(self) -> TransferObjects
pub fn into_transfer_objects(self) -> TransferObjects
Converts this into a transfer_objects if it is a transfer_objects variant, or panics otherwise.
Sourcepub fn is_split_coins(&self) -> bool
pub fn is_split_coins(&self) -> bool
Checks if this is a split_coins variant.
Sourcepub fn as_split_coins(&self) -> &SplitCoins
pub fn as_split_coins(&self) -> &SplitCoins
Converts this into a split_coins if it is a split_coins variant, or panics otherwise.
Sourcepub fn as_mut_split_coins(&mut self) -> &mut SplitCoins
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.
Sourcepub fn as_opt_split_coins(&self) -> Option<&SplitCoins>
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.
Sourcepub fn as_opt_mut_split_coins(&mut self) -> Option<&mut SplitCoins>
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.
Sourcepub fn into_opt_split_coins(self) -> Option<SplitCoins>
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.
Sourcepub fn into_split_coins(self) -> SplitCoins
pub fn into_split_coins(self) -> SplitCoins
Converts this into a split_coins if it is a split_coins variant, or panics otherwise.
Sourcepub fn is_merge_coins(&self) -> bool
pub fn is_merge_coins(&self) -> bool
Checks if this is a merge_coins variant.
Sourcepub fn as_merge_coins(&self) -> &MergeCoins
pub fn as_merge_coins(&self) -> &MergeCoins
Converts this into a merge_coins if it is a merge_coins variant, or panics otherwise.
Sourcepub fn as_mut_merge_coins(&mut self) -> &mut MergeCoins
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.
Sourcepub fn as_opt_merge_coins(&self) -> Option<&MergeCoins>
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.
Sourcepub fn as_opt_mut_merge_coins(&mut self) -> Option<&mut MergeCoins>
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.
Sourcepub fn into_opt_merge_coins(self) -> Option<MergeCoins>
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.
Sourcepub fn into_merge_coins(self) -> MergeCoins
pub fn into_merge_coins(self) -> MergeCoins
Converts this into a merge_coins if it is a merge_coins variant, or panics otherwise.
Sourcepub fn is_publish(&self) -> bool
pub fn is_publish(&self) -> bool
Checks if this is a publish variant.
Sourcepub fn as_publish(&self) -> &Publish
pub fn as_publish(&self) -> &Publish
Converts this into a publish if it is a publish variant, or panics otherwise.
Sourcepub fn as_mut_publish(&mut self) -> &mut Publish
pub fn as_mut_publish(&mut self) -> &mut Publish
Converts this into a mut publish if it is a publish variant, or panics otherwise.
Sourcepub fn as_opt_publish(&self) -> Option<&Publish>
pub fn as_opt_publish(&self) -> Option<&Publish>
Converts this into a publish if it is a publish variant, or returns None otherwise.
Sourcepub fn as_opt_mut_publish(&mut self) -> Option<&mut Publish>
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.
Sourcepub fn into_opt_publish(self) -> Option<Publish>
pub fn into_opt_publish(self) -> Option<Publish>
Converts this into a publish if it is a publish variant, or returns None otherwise.
Sourcepub fn into_publish(self) -> Publish
pub fn into_publish(self) -> Publish
Converts this into a publish if it is a publish variant, or panics otherwise.
Sourcepub fn is_make_move_vector(&self) -> bool
pub fn is_make_move_vector(&self) -> bool
Checks if this is a make_move_vector variant.
Sourcepub fn as_make_move_vector(&self) -> &MakeMoveVector
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.
Sourcepub fn as_mut_make_move_vector(&mut self) -> &mut MakeMoveVector
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.
Sourcepub fn as_opt_make_move_vector(&self) -> Option<&MakeMoveVector>
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.
Sourcepub fn as_opt_mut_make_move_vector(&mut self) -> Option<&mut MakeMoveVector>
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.
Sourcepub fn into_opt_make_move_vector(self) -> Option<MakeMoveVector>
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.
Sourcepub fn into_make_move_vector(self) -> MakeMoveVector
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.
Sourcepub fn is_upgrade(&self) -> bool
pub fn is_upgrade(&self) -> bool
Checks if this is a upgrade variant.
Sourcepub fn as_upgrade(&self) -> &Upgrade
pub fn as_upgrade(&self) -> &Upgrade
Converts this into a upgrade if it is a upgrade variant, or panics otherwise.
Sourcepub fn as_mut_upgrade(&mut self) -> &mut Upgrade
pub fn as_mut_upgrade(&mut self) -> &mut Upgrade
Converts this into a mut upgrade if it is a upgrade variant, or panics otherwise.
Sourcepub fn as_opt_upgrade(&self) -> Option<&Upgrade>
pub fn as_opt_upgrade(&self) -> Option<&Upgrade>
Converts this into a upgrade if it is a upgrade variant, or returns None otherwise.
Sourcepub fn as_opt_mut_upgrade(&mut self) -> Option<&mut Upgrade>
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.
Sourcepub fn into_opt_upgrade(self) -> Option<Upgrade>
pub fn into_opt_upgrade(self) -> Option<Upgrade>
Converts this into a upgrade if it is a upgrade variant, or returns None otherwise.
Sourcepub fn into_upgrade(self) -> Upgrade
pub fn into_upgrade(self) -> Upgrade
Converts this into a upgrade if it is a upgrade variant, or panics otherwise.
Sourcepub fn new_move_call(
package: ObjectId,
module: Identifier,
function: Identifier,
type_arguments: Vec<TypeTag>,
arguments: Vec<Argument>,
) -> Self
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.
Sourcepub fn new_transfer_objects(objects: Vec<Argument>, address: Argument) -> Self
pub fn new_transfer_objects(objects: Vec<Argument>, address: Argument) -> Self
Create a command to transfer objects to an address.
Sourcepub fn new_split_coins(coin: Argument, amounts: Vec<Argument>) -> Self
pub fn new_split_coins(coin: Argument, amounts: Vec<Argument>) -> Self
Create a command to split a coin into multiple coins by amounts.
Sourcepub fn new_merge_coins(coin: Argument, coins_to_merge: Vec<Argument>) -> Self
pub fn new_merge_coins(coin: Argument, coins_to_merge: Vec<Argument>) -> Self
Create a command to merge multiple coins into one.
Sourcepub fn new_publish(modules: Vec<Vec<u8>>, dependencies: Vec<ObjectId>) -> Self
pub fn new_publish(modules: Vec<Vec<u8>>, dependencies: Vec<ObjectId>) -> Self
Create a command to publish a new Move package.
Trait Implementations§
Source§impl Arbitrary for Command
Available on crate feature proptest only.
impl Arbitrary for Command
proptest only.Source§type Parameters = ()
type Parameters = ()
arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default.Source§type Strategy = BoxedStrategy<Command>
type Strategy = BoxedStrategy<Command>
Strategy used to generate values of type Self.Source§fn arbitrary_with(
args_shared: <Self as Arbitrary>::Parameters,
) -> Self::Strategy
fn arbitrary_with( args_shared: <Self as Arbitrary>::Parameters, ) -> Self::Strategy
Source§impl<'de> Deserialize<'de> for Command
Available on crate feature serde only.
impl<'de> Deserialize<'de> for Command
serde only.