CCIP v1.6.0 Client Library API Reference
Client
A library that provides core data structures and utilities for building and handling cross-chain messages in CCIP.
Structs
Any2EVMMessage
Structure representing a message received from any chain to an EVM chain.
struct Any2EVMMessage {
bytes32 messageId;
uint64 sourceChainSelector;
bytes sender;
bytes data;
EVMTokenAmount[] destTokenAmounts;
}
Properties
Name | Type | Description |
---|---|---|
messageId | bytes32 | Message ID corresponding to ccipSend on source |
sourceChainSelector | uint64 | Identifier of the source chain |
sender | bytes | Sender address (use abi.decode if from EVM chain) |
data | bytes | Custom payload from the original message |
destTokenAmounts | EVMTokenAmount[] | Token amounts in destination chain representation |
EVM2AnyMessage
Structure for sending a message from an EVM chain to any supported chain.
struct EVM2AnyMessage {
bytes receiver;
bytes data;
EVMTokenAmount[] tokenAmounts;
address feeToken;
bytes extraArgs;
}
Properties
Name | Type | Description |
---|---|---|
receiver | bytes | Encoded receiver address for destination EVM chains |
data | bytes | Custom payload to send |
tokenAmounts | EVMTokenAmount[] | Tokens and amounts to transfer |
feeToken | address | Token used for fees (address(0) for native tokens) |
extraArgs | bytes | Additional arguments encoded with _argsToBytes |
EVMExtraArgsV1
Structure for V1 extra arguments in cross-chain messages.
struct EVMExtraArgsV1 {
uint256 gasLimit;
}
Properties
Name | Type | Description |
---|---|---|
gasLimit | uint256 | Gas limit for execution on destination chain |
GenericExtraArgsV2
Structure for V2 extra arguments in cross-chain messages.
struct GenericExtraArgsV2 {
uint256 gasLimit;
bool allowOutOfOrderExecution;
}
Properties
Name | Type | Description |
---|---|---|
gasLimit | uint256 | Gas limit for execution on destination chain |
allowOutOfOrderExecution | bool | Whether messages can be executed in any order |
SVMExtraArgsV1
Structure for V1 extra arguments specific to Solana VM-based chains.
struct SVMExtraArgsV1 {
uint32 computeUnits;
uint64 accountIsWritableBitmap;
bool allowOutOfOrderExecution;
bytes32 tokenReceiver;
bytes32[] accounts;
}
Properties
Name | Type | Description |
---|---|---|
computeUnits | uint32 | Compute units for execution on Solana |
accountIsWritableBitmap | uint64 | Bitmap indicating which accounts are writable |
allowOutOfOrderExecution | bool | Whether messages can be executed in any order |
tokenReceiver | bytes32 | Address of the token receiver |
accounts | bytes32[] | Additional accounts needed for CCIP receiver execution |
EVMTokenAmount
Structure representing token amounts in CCIP messages.
struct EVMTokenAmount {
address token;
uint256 amount;
}
Properties
Name | Type | Description |
---|---|---|
token | address | Token address on the local chain |
amount | uint256 | Amount of tokens to transfer |
State Variables
EVM_EXTRA_ARGS_V1_TAG
bytes4 public constant EVM_EXTRA_ARGS_V1_TAG = 0x97a657c9;
GENERIC_EXTRA_ARGS_V2_TAG
bytes4 public constant GENERIC_EXTRA_ARGS_V2_TAG = 0x181dcf10;
SVM_EXTRA_ARGS_V1_TAG
bytes4 public constant SVM_EXTRA_ARGS_V1_TAG = 0x1f3b3aba;
SVM_EXTRA_ARGS_MAX_ACCOUNTS
uint256 public constant SVM_EXTRA_ARGS_MAX_ACCOUNTS = 64;
SVM_TOKEN_TRANSFER_DATA_OVERHEAD
uint256 public constant SVM_TOKEN_TRANSFER_DATA_OVERHEAD = (4 + 32) // source_pool
+ 32 // token_address
+ 4 // gas_amount
+ 4 // extra_data overhead
+ 32 // amount
+ 32 // size of the token lookup table account
+ 32 // token-related accounts in the lookup table, over-estimated to 32, typically between 11 - 13
+ 32 // token account belonging to the token receiver, e.g ATA, not included in the token lookup table
+ 32 // per-chain token pool config, not included in the token lookup table
+ 32 // per-chain token billing config, not always included in the token lookup table
+ 32; // OffRamp pool signer PDA, not included in the token lookup table
SVM_MESSAGING_ACCOUNTS_OVERHEAD
uint256 public constant SVM_MESSAGING_ACCOUNTS_OVERHEAD = 2;
SVM_ACCOUNT_BYTE_SIZE
uint256 public constant SVM_ACCOUNT_BYTE_SIZE = 32;
Functions
_argsToBytes (V1)
Encodes EVMExtraArgsV1 into bytes for message transmission.
function _argsToBytes(EVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts);
Parameters
Name | Type | Description |
---|---|---|
extraArgs | EVMExtraArgsV1 | The V1 extra arguments to encode |
Returns
Type | Description |
---|---|
bytes | The encoded extra arguments with tag |
_argsToBytes (V2)
Encodes GenericExtraArgsV2 into bytes for message transmission.
function _argsToBytes(GenericExtraArgsV2 memory extraArgs) internal pure returns (bytes memory bts);
Parameters
Name | Type | Description |
---|---|---|
extraArgs | GenericExtraArgsV2 | The V2 generic extra arguments to encode |
Returns
Type | Description |
---|---|
bytes | The encoded extra arguments with tag |
_svmArgsToBytes
Encodes SVMExtraArgsV1 into bytes for message transmission.
function _svmArgsToBytes(SVMExtraArgsV1 memory extraArgs) internal pure returns (bytes memory bts);
Parameters
Name | Type | Description |
---|---|---|
extraArgs | SVMExtraArgsV1 | The SVM extra arguments to encode |
Returns
Type | Description |
---|---|
bytes | The encoded extra arguments with tag |