Skip to main content

InputEntryFunctionData

Struct InputEntryFunctionData 

Source
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

Source

pub fn new(function_id: &str) -> InputEntryFunctionDataBuilder

Creates a new entry function data builder.

§Arguments
  • function_id - The full function identifier (e.g., “0x1::coin::transfer”)
§Example
let builder = InputEntryFunctionData::new("0x1::aptos_account::transfer");
Source

pub fn from_parts( module: MoveModuleId, function: impl Into<String>, ) -> InputEntryFunctionDataBuilder

Creates a builder from module and function name.

§Arguments
  • module - The module ID
  • function - The function name
Source

pub fn transfer_apt( recipient: AccountAddress, amount: u64, ) -> AptosResult<TransactionPayload>

Builds an APT transfer payload.

§Arguments
  • recipient - The recipient address
  • amount - 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.

Source

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 address
  • amount - 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.

Source

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’s Metadata object (e.g. 0xa for 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.

Source

pub fn create_account( auth_key: AccountAddress, ) -> AptosResult<TransactionPayload>

Builds an account creation payload.

§Arguments
  • auth_key - The authentication key (32 bytes)
§Errors

Returns an error if the function ID is invalid or if BCS encoding of arguments fails.

Source

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>

Builds a payload to rotate an account’s authentication key.

§Arguments
  • Various rotation parameters
§Errors

Returns an error if the function ID is invalid or if BCS encoding of arguments fails.

Source

pub fn register_coin(coin_type: &str) -> AptosResult<TransactionPayload>

Builds a payload to register a coin store.

§Arguments
  • coin_type - The coin type to register
§Errors

Returns an error if the function ID is invalid, the coin type is invalid, or if building the payload fails.

Source

pub fn publish_package( metadata_serialized: Vec<u8>, code: Vec<Vec<u8>>, ) -> AptosResult<TransactionPayload>

Builds a payload to publish a module.

§Arguments
  • metadata_serialized - Serialized module metadata
  • code - Vector of module bytecode
§Errors

Returns an error if the function ID is invalid or if BCS encoding of arguments fails.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> InputEntryFunctionData

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 InputEntryFunctionData

Source§

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

Formats the value using the given formatter. Read more

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<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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

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

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more