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
Fields of CreateAccount
new_account_address: AccountAddressauth_key_prefix: Vec<u8, Global>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:
- A
ExperimentalAccount::CreateAccountEventwith thecreatedfield beingnew_account_address, and therold_idfield beingRoles::VALIDATOR_ROLE_ID. This is emitted on theExperimentalAccount::AccountOperationsCapabilitycreation_eventshandle.
Parameters
| Name | Type | Description |
|---|---|---|
dr_account | signer | The signer of the sending account of this transaction. Must be the Diem Root signer. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce) to be used for this transaction. |
new_account_address | address | Address of the to-be-created Validator account. |
auth_key_prefix | vector<u8> | The authentication key prefix that will be used initially for the newly created account. |
human_name | vector<u8> | ASCII-encoded human name for the validator. |
Common Abort Conditions
| Error Category | Error Reason | Description |
|---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under dr_account. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::REQUIRES_ROLE | Roles::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::ALREADY_PUBLISHED | Roles::EROLE_ID | The new_account_address address is already taken. |
Related Scripts
AccountCreationScripts::create_validator_operator_accountValidatorAdministrationScripts::add_validator_and_reconfigureValidatorAdministrationScripts::register_validator_configValidatorAdministrationScripts::remove_validator_and_reconfigureValidatorAdministrationScripts::set_validator_operatorValidatorAdministrationScripts::set_validator_operator_with_nonce_adminValidatorAdministrationScripts::set_validator_config_and_reconfigure
Fields of CreateValidatorAccount
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:
- A
ExperimentalAccount::CreateAccountEventwith thecreatedfield beingnew_account_address, and therold_idfield beingRoles::VALIDATOR_OPERATOR_ROLE_ID. This is emitted on theExperimentalAccount::AccountOperationsCapabilitycreation_eventshandle.
Parameters
| Name | Type | Description |
|---|---|---|
dr_account | signer | The signer of the sending account of this transaction. Must be the Diem Root signer. |
sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce) to be used for this transaction. |
new_account_address | address | Address of the to-be-created Validator account. |
auth_key_prefix | vector<u8> | The authentication key prefix that will be used initially for the newly created account. |
human_name | vector<u8> | ASCII-encoded human name for the validator. |
Common Abort Conditions
| Error Category | Error Reason | Description |
|---|---|---|
Errors::NOT_PUBLISHED | SlidingNonce::ESLIDING_NONCE | A SlidingNonce resource is not published under dr_account. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_OLD | The sliding_nonce is too old and it’s impossible to determine if it’s duplicated or not. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_TOO_NEW | The sliding_nonce is too far in the future. |
Errors::INVALID_ARGUMENT | SlidingNonce::ENONCE_ALREADY_RECORDED | The sliding_nonce has been previously recorded. |
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::REQUIRES_ROLE | Roles::EDIEM_ROOT | The sending account is not the Diem Root account. |
Errors::ALREADY_PUBLISHED | Roles::EROLE_ID | The new_account_address address is already taken. |
Related Scripts
AccountCreationScripts::create_validator_accountValidatorAdministrationScripts::add_validator_and_reconfigureValidatorAdministrationScripts::register_validator_configValidatorAdministrationScripts::remove_validator_and_reconfigureValidatorAdministrationScripts::set_validator_operatorValidatorAdministrationScripts::set_validator_operator_with_nonce_adminValidatorAdministrationScripts::set_validator_config_and_reconfigure
Fields of CreateValidatorOperatorAccount
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: AccountAddressSummary
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
| Name | Type | Description |
|---|---|---|
account | signer | Signer of the sending account. Must be the Diem Root account. |
_sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce) to be used for this transaction. |
Common Abort Conditions
| Error Category | Error Reason | Description |
|---|---|---|
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | account is not the Diem Root account. |
Fields of InitializeDiemConsensusConfig
_sliding_nonce: u64BARS account mints amount copies of BARS tokens to the artist’s account.
Fields of MintBars
Initialize this module
Fields of NftInitialize
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
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
| Name | Type | Description |
|---|---|---|
account | signer | Signer of the sending account. Must be the Diem Root account. |
_sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce) to be used for this transaction. |
global_memory_per_byte_cost | u64 | The new cost to read global memory per-byte to be used for gas metering. |
global_memory_per_byte_write_cost | u64 | The new cost to write global memory per-byte to be used for gas metering. |
min_transaction_gas_units | u64 | The new flat minimum amount of gas required for any transaction. |
large_transaction_cutoff | u64 | The new size over which an additional charge will be assessed for each additional byte. |
intrinsic_gas_per_byte | u64 | The new number of units of gas that to be charged per-byte over the new large_transaction_cutoff. |
maximum_number_of_gas_units | u64 | The new maximum number of gas units that can be set in a transaction. |
min_price_per_gas_unit | u64 | The new minimum gas price that can be set for a transaction. |
max_price_per_gas_unit | u64 | The new maximum gas price that can be set for a transaction. |
max_transaction_size_in_bytes | u64 | The new maximum size of a transaction that can be processed. |
gas_unit_scaling_factor | u64 | The new scaling factor to use when scaling between external and internal gas units. |
default_account_size | u64 | The new default account size to use when assessing final costs for reads and writes to global storage. |
Common Abort Conditions
| Error Category | Error Reason | Description |
|---|---|---|
Errors::INVALID_ARGUMENT | DiemVMConfig::EGAS_CONSTANT_INCONSISTENCY | The provided gas constants are inconsistent. |
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | account 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: u64Transfer 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
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
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
| Name | Type | Description |
|---|---|---|
account | signer | Signer of the sending account. Must be the Diem Root account. |
_sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce) to be used for this transaction. |
config | vector<u8> | The serialized bytes of consensus config. |
Common Abort Conditions
| Error Category | Error Reason | Description |
|---|---|---|
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | account is not the Diem Root account. |
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
| Name | Type | Description |
|---|---|---|
account | signer | Signer of the sending account. Must be the Diem Root account. |
_sliding_nonce | u64 | The sliding_nonce (see: SlidingNonce) to be used for this transaction. |
major | u64 | The major version of the VM to be used from this transaction on. |
Common Abort Conditions
| Error Category | Error Reason | Description |
|---|---|---|
Errors::REQUIRES_ADDRESS | CoreAddresses::EDIEM_ROOT | account is not the Diem Root account. |
Errors::INVALID_ARGUMENT | DiemVersion::EINVALID_MAJOR_VERSION_NUMBER | major is less-than or equal to the current major version stored on-chain. |
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
type Parameters = ()
type Parameters = ()
The type of parameters that arbitrary_with accepts for configuration
of the generated Strategy. Parameters must implement Default. Read more
type Strategy = TupleUnion<((u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<TypeTag as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy), fn((TypeTag, AccountAddress)) -> ScriptFunctionCall>>), (u32, Arc<Map<<u64 as Arbitrary>::Strategy, fn(u64) -> ScriptFunctionCall>>), (u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>, Vec<u8, Global>, u64)) -> ScriptFunctionCall>>), (u32, Arc<fn() -> ScriptFunctionCall>), (u32, Arc<fn() -> ScriptFunctionCall>), (u32, Arc<Map<(<u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, (<u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy)), fn((u64, u64, u64, u64, u64, u64, u64, u64, u64, (u64, u64, u64))) -> ScriptFunctionCall>>), (u32, Arc<TupleUnion<((u32, Arc<Map<(<TypeTag as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((TypeTag, AccountAddress, u64, AccountAddress, u64)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<TypeTag as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((TypeTag, AccountAddress, u64, AccountAddress, u64)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<u64 as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((u64, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((u64, u64)) -> ScriptFunctionCall>>))>>))>
type Strategy = TupleUnion<((u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<TypeTag as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy), fn((TypeTag, AccountAddress)) -> ScriptFunctionCall>>), (u32, Arc<Map<<u64 as Arbitrary>::Strategy, fn(u64) -> ScriptFunctionCall>>), (u32, Arc<Map<(<AccountAddress as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((AccountAddress, Vec<u8, Global>, Vec<u8, Global>, u64)) -> ScriptFunctionCall>>), (u32, Arc<fn() -> ScriptFunctionCall>), (u32, Arc<fn() -> ScriptFunctionCall>), (u32, Arc<Map<(<u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, (<u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy)), fn((u64, u64, u64, u64, u64, u64, u64, u64, u64, (u64, u64, u64))) -> ScriptFunctionCall>>), (u32, Arc<TupleUnion<((u32, Arc<Map<(<TypeTag as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((TypeTag, AccountAddress, u64, AccountAddress, u64)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<TypeTag as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy, <AccountAddress as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((TypeTag, AccountAddress, u64, AccountAddress, u64)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<u64 as Arbitrary>::Strategy, <Vec<u8, Global> as Arbitrary>::Strategy), fn((u64, Vec<u8, Global>)) -> ScriptFunctionCall>>), (u32, Arc<Map<(<u64 as Arbitrary>::Strategy, <u64 as Arbitrary>::Strategy), fn((u64, u64)) -> ScriptFunctionCall>>))>>))>
pub fn arbitrary_with(
_top: <ScriptFunctionCall as Arbitrary>::Parameters
) -> <ScriptFunctionCall as Arbitrary>::Strategy
pub fn arbitrary_with(
_top: <ScriptFunctionCall as Arbitrary>::Parameters
) -> <ScriptFunctionCall as Arbitrary>::Strategy
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
Auto Trait Implementations
impl RefUnwindSafe for ScriptFunctionCall
impl Send for ScriptFunctionCall
impl Sync for ScriptFunctionCall
impl Unpin for ScriptFunctionCall
impl UnwindSafe for ScriptFunctionCall
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more
type Output = T
type Output = T
Should always be Self