CCIP Routing
CCIP Routing
Section titled “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
Execute a CCIP Transfer
Section titled “Execute a CCIP Transfer”- Call
routeCcipto receive the transaction payload. - Approve token spending on the source asset contract.
- Send the transaction via your wallet provider.
Request Type: RouteCcipRequest
Section titled “Request Type: RouteCcipRequest”| Property | Type | Required | Description |
|---|---|---|---|
operationType | 'CCIP' | ✅ | Must be the literal string 'CCIP'. |
originAssetId | number | ✅ | Source asset ID (e.g. USDC on Ethereum). |
destinationAssetId | number | ✅ | Destination asset ID (e.g. USDC on Base). |
fromAddress | string | ✅ | Sender wallet address. |
toAddress | string | ✅ | Recipient address on the destination chain. |
amount | number | ✅ | Amount to transfer. |
Full Example
Section titled “Full Example”// Step 1 — Initiate the CCIP transferconst 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 sendingif (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)}`, }, ], });}Response: RouteTransactionResponse
Section titled “Response: RouteTransactionResponse”| Property | Type | Description |
|---|---|---|
success | boolean | Whether the routing request was successful. |
identifier | string | Unique transaction identifier for tracking. |
data.to | string | CCIP Router contract address — approve this before sending. |
data.data | string | Encoded calldata for the transaction. |
data.value | string | Value to send (may include CCIP fee for native-token fee payments). |
data.chainId | number | Chain ID of the source network. |
ccipFee | string | Estimated CCIP protocol fee. |
Fee Estimation
Section titled “Fee Estimation”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”| Property | Type | Description |
|---|---|---|
swapAmount | string | Estimated output amount the recipient will receive. |
totalFee | string | Total combined fee. |
platformFee | string | VoidAI platform fee component. |
ccipFee | string | Chainlink CCIP protocol fee component. |
tenantFee | string | Fee collected by the tenant/integrator. |
Manual Confirmation
Section titled “Manual Confirmation”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',});Request Type: CcipTxConfirmationRequest
Section titled “Request Type: CcipTxConfirmationRequest”| Property | Type | Description |
|---|---|---|
transactionId | string | VoidAI Transaction ID (from the original routeCcip response). |
txnHash | string | On-chain transaction hash from the source chain. |
operationType | string | Operation type — use 'ccipBridge' for CCIP transfers. |
txnStatus | string | Current status code (e.g. 'CCIP_SOURCE_INITIATED'). |