Skip to content

CCIP Routing

The VoidAI SDK supports Cross-Chain Interoperability Protocol (CCIP) transfers via the routeCcip method. This enables asset movement across EVM chains using Chainlink CCIP — for example, transferring wTAO or wALPHA from Ethereum to Base.

Currently supported destination chains:

  • Base

Planned support:

  • Solana

  1. Call routeCcip to receive the transaction payload.
  2. Approve token spending on the source asset contract.
  3. Send the transaction via your wallet provider.
PropertyTypeRequiredDescription
operationType'CCIP'Must be the literal string 'CCIP'.
originAssetIdnumberSource asset ID (e.g. USDC on Ethereum).
destinationAssetIdnumberDestination asset ID (e.g. USDC on Base).
fromAddressstringSender wallet address.
toAddressstringRecipient address on the destination chain.
amountnumberAmount to transfer.

// Step 1 — Initiate the CCIP transfer
const response = await sdk.bridge.routeCcip({
operationType: 'CCIP',
originAssetId: 1, // Source asset (e.g. wTAO on Ethereum)
destinationAssetId: 5, // Destination asset (e.g. wTAO on Base)
fromAddress: '0xSender...',
toAddress: '0xRecipient...', // Address on the destination chain
amount: 50,
});
// Step 2 — Approve token spending BEFORE sending
if (response.success && response.data) {
const { to, data, value, chainId } = response.data;
const ccipFee = response.ccipFee;
console.log(`CCIP Fee: ${ccipFee}`);
// The `to` address is the CCIP Router contract.
// Approve it to spend your origin asset tokens first.
//
// Example using ethers.js:
// const token = new ethers.Contract(originTokenAddress, ERC20_ABI, signer);
// await (await token.approve(to, amount)).wait();
// Step 3 — Send the CCIP transaction
await window.ethereum.request({
method: 'eth_sendTransaction',
params: [
{
from: '0xSender...',
to,
data,
value, // Includes CCIP fee when native token is used for fees
chainId: `0x${chainId.toString(16)}`,
},
],
});
}

PropertyTypeDescription
successbooleanWhether the routing request was successful.
identifierstringUnique transaction identifier for tracking.
data.tostringCCIP Router contract address — approve this before sending.
data.datastringEncoded calldata for the transaction.
data.valuestringValue to send (may include CCIP fee for native-token fee payments).
data.chainIdnumberChain ID of the source network.
ccipFeestringEstimated CCIP protocol fee.

Use getRouterSwapFeeEstimate to preview fees before initiating a CCIP transfer.

const estimate = await sdk.bridge.getRouterSwapFeeEstimate({
operationType: 'CCIP',
originAssetId: 1,
destinationAssetId: 5,
amount: 50,
toAddress: '0xRecipient...',
});
console.log(`Output amount: ${estimate.swapAmount}`);
console.log(`Total fee: ${estimate.totalFee}`);
console.log(`CCIP fee: ${estimate.ccipFee}`);
console.log(`Platform fee: ${estimate.platformFee}`);
console.log(`Tenant fee: ${estimate.tenantFee}`);

Fee Estimate Response: RouterSwapFeeEstimateResponse

Section titled “Fee Estimate Response: RouterSwapFeeEstimateResponse”
PropertyTypeDescription
swapAmountstringEstimated output amount the recipient will receive.
totalFeestringTotal combined fee.
platformFeestringVoidAI platform fee component.
ccipFeestringChainlink CCIP protocol fee component.
tenantFeestringFee collected by the tenant/integrator.

If a CCIP transaction requires manual confirmation after on-chain finality, use confirmCcipTransaction.

await sdk.bridge.confirmCcipTransaction({
transactionId: 'void-txn-id-...',
txnHash: '0xOnChainHash...',
operationType: 'ccipBridge',
txnStatus: 'CCIP_SOURCE_INITIATED',
});
PropertyTypeDescription
transactionIdstringVoidAI Transaction ID (from the original routeCcip response).
txnHashstringOn-chain transaction hash from the source chain.
operationTypestringOperation type — use 'ccipBridge' for CCIP transfers.
txnStatusstringCurrent status code (e.g. 'CCIP_SOURCE_INITIATED').