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 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>
Trait Implementations§
Source§impl Clone for InputEntryFunctionData
impl Clone for InputEntryFunctionData
Source§fn clone(&self) -> InputEntryFunctionData
fn clone(&self) -> InputEntryFunctionData
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for InputEntryFunctionData
impl RefUnwindSafe for InputEntryFunctionData
impl Send for InputEntryFunctionData
impl Sync for InputEntryFunctionData
impl Unpin for InputEntryFunctionData
impl UnwindSafe for InputEntryFunctionData
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more