CCIP v1.6.0 Aptos Client API Reference
The ccip::client
module provides helper #[view]
functions that can be called on-chain to aid in constructing CCIP messages. The primary use case is encoding the extra_args
parameter for different destination chain families.
This function encodes the extra arguments required when sending a CCIP message from Aptos to an EVM-based chain (like Ethereum) or another Aptos module. It takes a gas limit and a boolean flag, BCS-encodes them, and prepends the standard GENERIC_EXTRA_ARGS_V2_TAG
(0x181dcf10
).
#[view]
public fun encode_generic_extra_args_v2(
gas_limit: u256,
allow_out_of_order_execution: bool
): vector<u8>
Name | Type | Description |
---|
gas_limit | u256 | The gas limit to allocate for the execution of the message on the destination chain. |
allow_out_of_order_execution | bool | A flag indicating if the message can be processed out of order. It is recommended to set this to true . |
Name | Type | Description |
---|
encoded_vector | vector<u8> | A byte vector containing the 4-byte tag followed by the BCS-encoded parameters, ready to be used in ccip_send . |
This function encodes the more complex extra arguments required when sending a CCIP message from Aptos to an SVM-based chain (like Solana). It constructs a byte vector by prepending the SVM_EXTRA_ARGS_V1_TAG
(0x1f3b3aba
) to the BCS-encoded parameters, which include details specific to the SVM account model.
#[view]
public fun encode_svm_extra_args_v1(
compute_units: u32,
account_is_writable_bitmap: u64,
allow_out_of_order_execution: bool,
token_receiver: vector<u8>,
accounts: vector<vector<u8>>
): vector<u8>
Name | Type | Description |
---|
compute_units | u32 | The number of compute units to allocate for the message's execution on the destination SVM chain. |
account_is_writable_bitmap | u64 | A bitmask indicating which of the provided accounts are writable. Bit i corresponds to accounts[i] . |
allow_out_of_order_execution | bool | A flag indicating if the message can be processed out of order. |
token_receiver | vector<u8> | The 32-byte public key of the account on the SVM chain that will receive any transferred tokens. |
accounts | vector<vector<u8>> | A vector of 32-byte public keys representing the accounts required by the receiver program on the destination SVM chain. |
Name | Type | Description |
---|
encoded_vector | vector<u8> | A byte vector containing the 4-byte tag followed by the BCS-encoded SVM-specific parameters. |