pub struct InputEntryFunctionData { /* private fields */ }Expand description
A type-safe builder for entry function payloads.
This builder provides an ergonomic way to construct entry function calls with automatic BCS encoding of arguments.
§Example
use aptos_sdk::transaction::InputEntryFunctionData;
use aptos_sdk::types::AccountAddress;
let payload = InputEntryFunctionData::new("0x1::aptos_account::transfer")
.arg(AccountAddress::from_hex("0x123").unwrap())
.arg(1_000_000u64) // 0.01 APT in octas
.build()?;Implementations§
Source§impl InputEntryFunctionData
impl InputEntryFunctionData
Sourcepub fn new(function_id: &str) -> InputEntryFunctionDataBuilder
pub fn new(function_id: &str) -> InputEntryFunctionDataBuilder
Sourcepub fn from_parts(
module: MoveModuleId,
function: impl Into<String>,
) -> InputEntryFunctionDataBuilder
pub fn from_parts( module: MoveModuleId, function: impl Into<String>, ) -> InputEntryFunctionDataBuilder
Creates a builder from module and function name.
§Arguments
module- The module IDfunction- The function name
Sourcepub fn transfer_apt(
recipient: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn transfer_apt( recipient: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds an APT transfer payload.
§Arguments
recipient- The recipient addressamount- Amount in octas (1 APT = 10^8 octas)
§Example
let payload = InputEntryFunctionData::transfer_apt(recipient, 1_000_000)?;§Errors
Returns an error if the function ID is invalid or if BCS encoding of arguments fails.
Sourcepub fn transfer_coin(
coin_type: &str,
recipient: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn transfer_coin( coin_type: &str, recipient: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds a coin transfer payload for any coin type.
§Arguments
coin_type- The coin type (e.g., “0x1::aptos_coin::AptosCoin”)recipient- The recipient addressamount- Amount in the coin’s smallest unit
§Errors
Returns an error if the function ID is invalid, the coin type is invalid, or if BCS encoding of arguments fails.
Sourcepub fn transfer_fungible_asset(
metadata: AccountAddress,
recipient: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn transfer_fungible_asset( metadata: AccountAddress, recipient: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds a fungible-asset transfer payload.
Calls 0x1::primary_fungible_store::transfer, moving amount units of
the fungible asset identified by metadata (the address of its
0x1::fungible_asset::Metadata object) from the sender’s primary store
to the recipient’s primary store, creating the recipient’s store if
needed. This is the current (FA standard) counterpart to
transfer_coin and matches the TypeScript SDK’s
transferFungibleAsset.
§Arguments
metadata- Address of the fungible asset’sMetadataobject (e.g.0xafor APT as a fungible asset).recipient- The recipient address.amount- Amount in the asset’s smallest unit.
§Errors
Returns an error if the function ID or type tag is invalid, or if BCS encoding of arguments fails.
Sourcepub fn create_account(
auth_key: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn create_account( auth_key: AccountAddress, ) -> AptosResult<TransactionPayload>
Sourcepub fn rotate_authentication_key(
from_scheme: u8,
from_public_key_bytes: Vec<u8>,
to_scheme: u8,
to_public_key_bytes: Vec<u8>,
cap_rotate_key: Vec<u8>,
cap_update_table: Vec<u8>,
) -> AptosResult<TransactionPayload>
pub fn rotate_authentication_key( from_scheme: u8, from_public_key_bytes: Vec<u8>, to_scheme: u8, to_public_key_bytes: Vec<u8>, cap_rotate_key: Vec<u8>, cap_update_table: Vec<u8>, ) -> AptosResult<TransactionPayload>
Sourcepub fn register_coin(coin_type: &str) -> AptosResult<TransactionPayload>
pub fn register_coin(coin_type: &str) -> AptosResult<TransactionPayload>
Sourcepub fn publish_package(
metadata_serialized: Vec<u8>,
code: Vec<Vec<u8>>,
) -> AptosResult<TransactionPayload>
pub fn publish_package( metadata_serialized: Vec<u8>, code: Vec<Vec<u8>>, ) -> AptosResult<TransactionPayload>
Sourcepub fn transfer_object(
object: AccountAddress,
to: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn transfer_object( object: AccountAddress, to: AccountAddress, ) -> AptosResult<TransactionPayload>
Builds a payload to transfer ownership of an object.
Calls 0x1::object::transfer_call, which moves the object at address
object to to. Works for any object (including digital assets); for a
typed transfer use transfer_digital_asset.
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn transfer_digital_asset(
token: AccountAddress,
to: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn transfer_digital_asset( token: AccountAddress, to: AccountAddress, ) -> AptosResult<TransactionPayload>
Builds a payload to transfer a digital asset (NFT) to another address.
Calls 0x1::object::transfer with the 0x4::token::Token type, matching
the TypeScript SDK’s transferDigitalAsset.
§Errors
Returns an error if the function ID or type tag is invalid or if BCS encoding fails.
Sourcepub fn create_collection(
description: &str,
max_supply: u64,
name: &str,
uri: &str,
config: CollectionConfig,
royalty_numerator: u64,
royalty_denominator: u64,
) -> AptosResult<TransactionPayload>
pub fn create_collection( description: &str, max_supply: u64, name: &str, uri: &str, config: CollectionConfig, royalty_numerator: u64, royalty_denominator: u64, ) -> AptosResult<TransactionPayload>
Builds a payload to create a digital-asset collection
(0x4::aptos_token::create_collection).
config controls the collection/token mutability and burn/freeze
permissions (CollectionConfig::default enables all of them, matching
the most permissive TypeScript SDK defaults). royalty_numerator / royalty_denominator express the royalty as a fraction (use 0 / 1 for
none).
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn mint_digital_asset(
collection: &str,
description: &str,
name: &str,
uri: &str,
property_keys: Vec<String>,
property_types: Vec<String>,
property_values: Vec<Vec<u8>>,
) -> AptosResult<TransactionPayload>
pub fn mint_digital_asset( collection: &str, description: &str, name: &str, uri: &str, property_keys: Vec<String>, property_types: Vec<String>, property_values: Vec<Vec<u8>>, ) -> AptosResult<TransactionPayload>
Builds a payload to mint a digital asset into a collection
(0x4::aptos_token::mint).
The three property vectors must be equal length (a key, a Move type string, and BCS-encoded value per property); pass empty vectors for no properties.
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn mint_soul_bound_digital_asset(
collection: &str,
description: &str,
name: &str,
uri: &str,
property_keys: Vec<String>,
property_types: Vec<String>,
property_values: Vec<Vec<u8>>,
soul_bound_to: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn mint_soul_bound_digital_asset( collection: &str, description: &str, name: &str, uri: &str, property_keys: Vec<String>, property_types: Vec<String>, property_values: Vec<Vec<u8>>, soul_bound_to: AccountAddress, ) -> AptosResult<TransactionPayload>
Builds a payload to mint a soul-bound (non-transferable) digital asset
(0x4::aptos_token::mint_soul_bound), bound to soul_bound_to.
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn burn_digital_asset(
token: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn burn_digital_asset( token: AccountAddress, ) -> AptosResult<TransactionPayload>
Builds a payload to burn a digital asset (0x4::aptos_token::burn).
§Errors
Returns an error if the function ID or type tag is invalid or if BCS encoding fails.
Sourcepub fn freeze_digital_asset_transfer(
token: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn freeze_digital_asset_transfer( token: AccountAddress, ) -> AptosResult<TransactionPayload>
Builds a payload to freeze transfers of a digital asset
(0x4::aptos_token::freeze_transfer).
§Errors
Returns an error if the function ID or type tag is invalid or if BCS encoding fails.
Sourcepub fn unfreeze_digital_asset_transfer(
token: AccountAddress,
) -> AptosResult<TransactionPayload>
pub fn unfreeze_digital_asset_transfer( token: AccountAddress, ) -> AptosResult<TransactionPayload>
Builds a payload to unfreeze transfers of a digital asset
(0x4::aptos_token::unfreeze_transfer).
§Errors
Returns an error if the function ID or type tag is invalid or if BCS encoding fails.
Sourcepub fn delegation_add_stake(
pool_address: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn delegation_add_stake( pool_address: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds a payload to add stake to a delegation pool
(0x1::delegation_pool::add_stake).
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn delegation_unlock(
pool_address: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn delegation_unlock( pool_address: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds a payload to unlock stake from a delegation pool
(0x1::delegation_pool::unlock). Unlocked stake becomes withdrawable
after the pool’s lockup expires.
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn delegation_reactivate_stake(
pool_address: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn delegation_reactivate_stake( pool_address: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds a payload to reactivate previously-unlocked stake
(0x1::delegation_pool::reactivate_stake).
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn delegation_withdraw(
pool_address: AccountAddress,
amount: u64,
) -> AptosResult<TransactionPayload>
pub fn delegation_withdraw( pool_address: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>
Builds a payload to withdraw unlocked stake from a delegation pool
(0x1::delegation_pool::withdraw).
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn add_authentication_function(
module_address: AccountAddress,
module_name: &str,
function_name: &str,
) -> AptosResult<TransactionPayload>
pub fn add_authentication_function( module_address: AccountAddress, module_name: &str, function_name: &str, ) -> AptosResult<TransactionPayload>
Builds a payload to enable account abstraction by registering a custom
authentication function (0x1::account_abstraction::add_authentication_function).
The function is identified by the module it lives in (module_address +
module_name) and its function_name.
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn remove_authentication_function(
module_address: AccountAddress,
module_name: &str,
function_name: &str,
) -> AptosResult<TransactionPayload>
pub fn remove_authentication_function( module_address: AccountAddress, module_name: &str, function_name: &str, ) -> AptosResult<TransactionPayload>
Builds a payload to remove a previously-registered authentication
function (0x1::account_abstraction::remove_authentication_function).
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Sourcepub fn remove_authenticator() -> AptosResult<TransactionPayload>
pub fn remove_authenticator() -> AptosResult<TransactionPayload>
Builds a payload to fully disable account abstraction, removing all
registered authentication functions
(0x1::account_abstraction::remove_authenticator).
§Errors
Returns an error if the function ID is invalid or if BCS encoding fails.
Trait Implementations§
Source§impl Clone for InputEntryFunctionData
impl Clone for InputEntryFunctionData
Source§fn clone(&self) -> InputEntryFunctionData
fn clone(&self) -> InputEntryFunctionData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more