Enum diem_sdk::transaction_builder::experimental_stdlib::ScriptFunctionCall[][src]

pub enum ScriptFunctionCall {
Show 13 variants CreateAccount { new_account_address: AccountAddress, auth_key_prefix: Vec<u8, Global>, }, CreateValidatorAccount { new_account_address: AccountAddress, auth_key_prefix: Vec<u8, Global>, human_name: Vec<u8, Global>, }, CreateValidatorOperatorAccount { new_account_address: AccountAddress, auth_key_prefix: Vec<u8, Global>, human_name: Vec<u8, Global>, }, GcBallots { proposal: TypeTag, addr: AccountAddress, }, InitializeDiemConsensusConfig { _sliding_nonce: u64, }, MintBars { artist: AccountAddress, artist_name: Vec<u8, Global>, content_uri: Vec<u8, Global>, amount: u64, }, NftInitialize {}, RegisterBarsUser {}, SetGasConstants { _sliding_nonce: u64, global_memory_per_byte_cost: u64, global_memory_per_byte_write_cost: u64, min_transaction_gas_units: u64, large_transaction_cutoff: u64, intrinsic_gas_per_byte: u64, maximum_number_of_gas_units: u64, min_price_per_gas_unit: u64, max_price_per_gas_unit: u64, max_transaction_size_in_bytes: u64, gas_unit_scaling_factor: u64, default_account_size: u64, }, TransferMultiTokenBetweenGalleries { token_type: TypeTag, to: AccountAddress, amount: u64, creator: AccountAddress, creation_num: u64, }, TransferTokenBetweenGalleries { token_type: TypeTag, to: AccountAddress, amount: u64, creator: AccountAddress, creation_num: u64, }, UpdateDiemConsensusConfig { _sliding_nonce: u64, config: Vec<u8, Global>, }, UpdateDiemVersion { _sliding_nonce: u64, major: u64, },
}
Expand description

Structured representation of a call into a known Move script function.

impl ScriptFunctionCall {
    pub fn encode(self) -> TransactionPayload { .. }
    pub fn decode(&TransactionPayload) -> Option<ScriptFunctionCall> { .. }
}

Variants

CreateAccount

Fields of CreateAccount

new_account_address: AccountAddressauth_key_prefix: Vec<u8, Global>
CreateValidatorAccount

Summary

Creates a Validator account. This transaction can only be sent by the Diem Root account.

Technical Description

Creates an account with a Validator role at new_account_address, with authentication key auth_key_prefix | new_account_address. It publishes a ValidatorConfig::ValidatorConfig resource with empty config, and operator_account fields. The human_name field of the ValidatorConfig::ValidatorConfig is set to the passed in human_name. This script does not add the validator to the validator set or the system, but only creates the account. Authentication keys, prefixes, and how to construct them from an ed25519 public key are described here.

Events

Successful execution will emit:

Parameters

NameTypeDescription
dr_accountsignerThe signer of the sending account of this transaction. Must be the Diem Root signer.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_account_addressaddressAddress of the to-be-created Validator account.
auth_key_prefixvector<u8>The authentication key prefix that will be used initially for the newly created account.
human_namevector<u8>ASCII-encoded human name for the validator.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under dr_account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce has been previously recorded.
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::REQUIRES_ROLERoles::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe new_account_address address is already taken.

Related Scripts

Fields of CreateValidatorAccount

new_account_address: AccountAddressauth_key_prefix: Vec<u8, Global>human_name: Vec<u8, Global>
CreateValidatorOperatorAccount

Summary

Creates a Validator Operator account. This transaction can only be sent by the Diem Root account.

Technical Description

Creates an account with a Validator Operator role at new_account_address, with authentication key auth_key_prefix | new_account_address. It publishes a ValidatorOperatorConfig::ValidatorOperatorConfig resource with the specified human_name. This script does not assign the validator operator to any validator accounts but only creates the account. Authentication key prefixes, and how to construct them from an ed25519 public key are described here.

Events

Successful execution will emit:

Parameters

NameTypeDescription
dr_accountsignerThe signer of the sending account of this transaction. Must be the Diem Root signer.
sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
new_account_addressaddressAddress of the to-be-created Validator account.
auth_key_prefixvector<u8>The authentication key prefix that will be used initially for the newly created account.
human_namevector<u8>ASCII-encoded human name for the validator.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::NOT_PUBLISHEDSlidingNonce::ESLIDING_NONCEA SlidingNonce resource is not published under dr_account.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_OLDThe sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_TOO_NEWThe sliding_nonce is too far in the future.
Errors::INVALID_ARGUMENTSlidingNonce::ENONCE_ALREADY_RECORDEDThe sliding_nonce has been previously recorded.
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::REQUIRES_ROLERoles::EDIEM_ROOTThe sending account is not the Diem Root account.
Errors::ALREADY_PUBLISHEDRoles::EROLE_IDThe new_account_address address is already taken.

Related Scripts

Fields of CreateValidatorOperatorAccount

new_account_address: AccountAddressauth_key_prefix: Vec<u8, Global>human_name: Vec<u8, Global>
GcBallots

gc_ballots deletes all the expired ballots of the type Proposal under the provided address addr. The signer can be anybody and does not need to have the same address as addr

Fields of GcBallots

proposal: TypeTagaddr: AccountAddress
InitializeDiemConsensusConfig

Summary

Initializes the Diem consensus config that is stored on-chain. This transaction can only be sent from the Diem Root account.

Technical Description

Initializes the DiemConsensusConfig on-chain config to empty and allows future updates from DiemRoot via update_diem_consensus_config. This doesn’t emit a DiemConfig::NewEpochEvent.

Parameters

NameTypeDescription
accountsignerSigner of the sending account. Must be the Diem Root account.
_sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTaccount is not the Diem Root account.

Fields of InitializeDiemConsensusConfig

_sliding_nonce: u64
MintBars

BARS account mints amount copies of BARS tokens to the artist’s account.

Fields of MintBars

artist: AccountAddressartist_name: Vec<u8, Global>content_uri: Vec<u8, Global>amount: u64
NftInitialize

Initialize this module

Fields of NftInitialize

RegisterBarsUser

Call this function to set up relevant resources in order to mint and receive tokens. Note that this also gives BARS account a capability to mint BARS NFTs on behalf of the user. (the NFTs of other types cannot be created by BARS account).

Fields of RegisterBarsUser

SetGasConstants

Summary

Updates the gas constants stored on chain and used by the VM for gas metering. This transaction can only be sent from the Diem Root account.

Technical Description

Updates the on-chain config holding the DiemVMConfig and emits a DiemConfig::NewEpochEvent to trigger a reconfiguration of the system.

Parameters

NameTypeDescription
accountsignerSigner of the sending account. Must be the Diem Root account.
_sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
global_memory_per_byte_costu64The new cost to read global memory per-byte to be used for gas metering.
global_memory_per_byte_write_costu64The new cost to write global memory per-byte to be used for gas metering.
min_transaction_gas_unitsu64The new flat minimum amount of gas required for any transaction.
large_transaction_cutoffu64The new size over which an additional charge will be assessed for each additional byte.
intrinsic_gas_per_byteu64The new number of units of gas that to be charged per-byte over the new large_transaction_cutoff.
maximum_number_of_gas_unitsu64The new maximum number of gas units that can be set in a transaction.
min_price_per_gas_unitu64The new minimum gas price that can be set for a transaction.
max_price_per_gas_unitu64The new maximum gas price that can be set for a transaction.
max_transaction_size_in_bytesu64The new maximum size of a transaction that can be processed.
gas_unit_scaling_factoru64The new scaling factor to use when scaling between external and internal gas units.
default_account_sizeu64The new default account size to use when assessing final costs for reads and writes to global storage.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::INVALID_ARGUMENTDiemVMConfig::EGAS_CONSTANT_INCONSISTENCYThe provided gas constants are inconsistent.
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTaccount is not the Diem Root account.

Fields of SetGasConstants

_sliding_nonce: u64global_memory_per_byte_cost: u64global_memory_per_byte_write_cost: u64min_transaction_gas_units: u64large_transaction_cutoff: u64intrinsic_gas_per_byte: u64maximum_number_of_gas_units: u64min_price_per_gas_unit: u64max_price_per_gas_unit: u64max_transaction_size_in_bytes: u64gas_unit_scaling_factor: u64default_account_size: u64
TransferMultiTokenBetweenGalleries

Transfer amount of token with id GUID::id(creator, creation_num) from owner’s balance to to’s balance. This operation has to be done by either the owner or an approved operator of the owner.

Fields of TransferMultiTokenBetweenGalleries

token_type: TypeTagto: AccountAddressamount: u64creator: AccountAddresscreation_num: u64
TransferTokenBetweenGalleries

Transfer amount of token with id GUID::id(creator, creation_num) from owner’s balance to to’s balance. This operation has to be done by either the owner or an approved operator of the owner.

Fields of TransferTokenBetweenGalleries

token_type: TypeTagto: AccountAddressamount: u64creator: AccountAddresscreation_num: u64
UpdateDiemConsensusConfig

Summary

Updates the Diem consensus config that is stored on-chain and is used by the Consensus. This transaction can only be sent from the Diem Root account.

Technical Description

Updates the DiemConsensusConfig on-chain config and emits a DiemConfig::NewEpochEvent to trigger a reconfiguration of the system.

Parameters

NameTypeDescription
accountsignerSigner of the sending account. Must be the Diem Root account.
_sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
configvector<u8>The serialized bytes of consensus config.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTaccount is not the Diem Root account.

Fields of UpdateDiemConsensusConfig

_sliding_nonce: u64config: Vec<u8, Global>
UpdateDiemVersion

Summary

Updates the Diem major version that is stored on-chain and is used by the VM. This transaction can only be sent from the Diem Root account.

Technical Description

Updates the DiemVersion on-chain config and emits a DiemConfig::NewEpochEvent to trigger a reconfiguration of the system. The major version that is passed in must be strictly greater than the current major version held on-chain. The VM reads this information and can use it to preserve backwards compatibility with previous major versions of the VM.

Parameters

NameTypeDescription
accountsignerSigner of the sending account. Must be the Diem Root account.
_sliding_nonceu64The sliding_nonce (see: SlidingNonce) to be used for this transaction.
majoru64The major version of the VM to be used from this transaction on.

Common Abort Conditions

Error CategoryError ReasonDescription
Errors::REQUIRES_ADDRESSCoreAddresses::EDIEM_ROOTaccount is not the Diem Root account.
Errors::INVALID_ARGUMENTDiemVersion::EINVALID_MAJOR_VERSION_NUMBERmajor is less-than or equal to the current major version stored on-chain.

Fields of UpdateDiemVersion

_sliding_nonce: u64major: u64

Implementations

Build a Diem TransactionPayload from a structured object ScriptFunctionCall.

Try to recognize a Diem TransactionPayload and convert it into a structured object ScriptFunctionCall.

Trait Implementations

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

The type of Strategy used to generate values of type Self. Read more

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

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.