API Version: v1.6.0

CCIP v1.6.0 Aptos Client API Reference

Client

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.

encode_generic_extra_args_v2

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>

Parameters

NameTypeDescription
gas_limitu256The gas limit to allocate for the execution of the message on the destination chain.
allow_out_of_order_executionboolA flag indicating if the message can be processed out of order. It is recommended to set this to true.

Returns

NameTypeDescription
encoded_vectorvector<u8>A byte vector containing the 4-byte tag followed by the BCS-encoded parameters, ready to be used in ccip_send.

encode_svm_extra_args_v1

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>

Parameters

NameTypeDescription
compute_unitsu32The number of compute units to allocate for the message's execution on the destination SVM chain.
account_is_writable_bitmapu64A bitmask indicating which of the provided accounts are writable. Bit i corresponds to accounts[i].
allow_out_of_order_executionboolA flag indicating if the message can be processed out of order.
token_receivervector<u8>The 32-byte public key of the account on the SVM chain that will receive any transferred tokens.
accountsvector<vector<u8>>A vector of 32-byte public keys representing the accounts required by the receiver program on the destination SVM chain.

Returns

NameTypeDescription
encoded_vectorvector<u8>A byte vector containing the 4-byte tag followed by the BCS-encoded SVM-specific parameters.

Get the latest Chainlink content straight to your inbox.