bridge
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBridge - Complete API Reference
跨链桥 - 完整API参考
Transfer tokens across chains using Wormhole and Circle CCTP protocols.
使用Wormhole和Circle CCTP协议实现跨链代币转账。
Supported Chains
支持的链
| Chain | Wormhole | CCTP (USDC) |
|---|---|---|
| Solana | Yes | Yes |
| Ethereum | Yes | Yes |
| Polygon | Yes | Yes |
| Arbitrum | Yes | Yes |
| Optimism | Yes | Yes |
| Avalanche | Yes | Yes |
| Base | Yes | Yes |
| 链 | Wormhole | CCTP (USDC) |
|---|---|---|
| Solana | Yes | Yes |
| Ethereum | Yes | Yes |
| Polygon | Yes | Yes |
| Arbitrum | Yes | Yes |
| Optimism | Yes | Yes |
| Avalanche | Yes | Yes |
| Base | Yes | Yes |
Chat Commands
聊天命令
Quote
报价查询
/bridge quote 100 USDC sol to eth # Quote 100 USDC Solana → Ethereum
/bridge quote 1000 USDC arb to base # Quote Arbitrum → Base
/bridge quote 50 USDC eth to sol # Quote Ethereum → Solana/bridge quote 100 USDC sol to eth # Quote 100 USDC Solana → Ethereum
/bridge quote 1000 USDC arb to base # Quote Arbitrum → Base
/bridge quote 50 USDC eth to sol # Quote Ethereum → SolanaExecute Transfer
执行转账
/bridge send 100 USDC sol to eth # Send 100 USDC Solana → Ethereum
/bridge send 1000 USDC arb to base # Send Arbitrum → Base
/bridge send 50 USDC eth to sol --address <dest> # To specific address/bridge send 100 USDC sol to eth # Send 100 USDC Solana → Ethereum
/bridge send 1000 USDC arb to base # Send Arbitrum → Base
/bridge send 50 USDC eth to sol --address <dest> # To specific addressRedeem (Claim)
赎回(领取)
/bridge redeem <tx-hash> # Claim transferred tokens
/bridge pending # List pending redemptions/bridge redeem <tx-hash> # Claim transferred tokens
/bridge pending # List pending redemptionsStatus
状态查询
/bridge status <tx-hash> # Check transfer status
/bridge history # View transfer history/bridge status <tx-hash> # Check transfer status
/bridge history # View transfer historyTypeScript API Reference
TypeScript API参考
Wormhole Bridge
Wormhole跨链桥
typescript
import { executeWormholeBridge, executeWormholeRedeem } from 'clodds/bridge/wormhole';
// Get quote
const quote = await getWormholeQuote({
sourceChain: 'solana',
destChain: 'ethereum',
token: 'USDC',
amount: 100,
});
console.log(`Transfer 100 USDC: Solana → Ethereum`);
console.log(`Fee: $${quote.fee}`);
console.log(`Est. time: ${quote.estimatedTime} seconds`);
// Execute transfer
const transfer = await executeWormholeBridge({
sourceChain: 'solana',
destChain: 'ethereum',
token: 'USDC',
amount: 100,
// Source wallet
sourcePrivateKey: process.env.SOLANA_PRIVATE_KEY,
// Destination address (optional, defaults to your address)
destAddress: '0x1234...',
});
console.log(`Transfer initiated: ${transfer.txHash}`);
console.log(`VAA: ${transfer.vaa}`);
console.log(`Status: ${transfer.status}`);
// Redeem on destination chain
const redeem = await executeWormholeRedeem({
destChain: 'ethereum',
vaa: transfer.vaa,
destPrivateKey: process.env.EVM_PRIVATE_KEY,
});
console.log(`Redeemed: ${redeem.txHash}`);
console.log(`Amount received: ${redeem.amount} USDC`);typescript
import { executeWormholeBridge, executeWormholeRedeem } from 'clodds/bridge/wormhole';
// Get quote
const quote = await getWormholeQuote({
sourceChain: 'solana',
destChain: 'ethereum',
token: 'USDC',
amount: 100,
});
console.log(`Transfer 100 USDC: Solana → Ethereum`);
console.log(`Fee: $${quote.fee}`);
console.log(`Est. time: ${quote.estimatedTime} seconds`);
// Execute transfer
const transfer = await executeWormholeBridge({
sourceChain: 'solana',
destChain: 'ethereum',
token: 'USDC',
amount: 100,
// Source wallet
sourcePrivateKey: process.env.SOLANA_PRIVATE_KEY,
// Destination address (optional, defaults to your address)
destAddress: '0x1234...',
});
console.log(`Transfer initiated: ${transfer.txHash}`);
console.log(`VAA: ${transfer.vaa}`);
console.log(`Status: ${transfer.status}`);
// Redeem on destination chain
const redeem = await executeWormholeRedeem({
destChain: 'ethereum',
vaa: transfer.vaa,
destPrivateKey: process.env.EVM_PRIVATE_KEY,
});
console.log(`Redeemed: ${redeem.txHash}`);
console.log(`Amount received: ${redeem.amount} USDC`);CCTP (Circle) Bridge
CCTP (Circle)跨链桥
typescript
import { executeCCTPBridge, redeemCCTP } from 'clodds/bridge/cctp';
// CCTP is optimized for USDC transfers
const transfer = await executeCCTPBridge({
sourceChain: 'arbitrum',
destChain: 'base',
amount: 1000, // USDC
sourcePrivateKey: process.env.EVM_PRIVATE_KEY,
destAddress: '0x1234...',
});
console.log(`CCTP transfer: ${transfer.txHash}`);
console.log(`Message: ${transfer.messageHash}`);
// Wait for attestation (usually ~15 minutes)
await waitForAttestation(transfer.messageHash);
// Redeem
const redeem = await redeemCCTP({
destChain: 'base',
messageHash: transfer.messageHash,
destPrivateKey: process.env.EVM_PRIVATE_KEY,
});typescript
import { executeCCTPBridge, redeemCCTP } from 'clodds/bridge/cctp';
// CCTP is optimized for USDC transfers
const transfer = await executeCCTPBridge({
sourceChain: 'arbitrum',
destChain: 'base',
amount: 1000, // USDC
sourcePrivateKey: process.env.EVM_PRIVATE_KEY,
destAddress: '0x1234...',
});
console.log(`CCTP transfer: ${transfer.txHash}`);
console.log(`Message: ${transfer.messageHash}`);
// Wait for attestation (usually ~15 minutes)
await waitForAttestation(transfer.messageHash);
// Redeem
const redeem = await redeemCCTP({
destChain: 'base',
messageHash: transfer.messageHash,
destPrivateKey: process.env.EVM_PRIVATE_KEY,
});Check Status
状态查询
typescript
import { getTransferStatus } from 'clodds/bridge';
const status = await getTransferStatus(txHash);
console.log(`Status: ${status.status}`);
// 'pending' | 'confirming' | 'attesting' | 'redeemable' | 'completed' | 'failed'
console.log(`Source confirmations: ${status.sourceConfirmations}`);
console.log(`VAA status: ${status.vaaStatus}`);
console.log(`Redeemed: ${status.redeemed}`);
if (status.status === 'redeemable') {
console.log(`Ready to redeem! VAA: ${status.vaa}`);
}typescript
import { getTransferStatus } from 'clodds/bridge';
const status = await getTransferStatus(txHash);
console.log(`Status: ${status.status}`);
// 'pending' | 'confirming' | 'attesting' | 'redeemable' | 'completed' | 'failed'
console.log(`Source confirmations: ${status.sourceConfirmations}`);
console.log(`VAA status: ${status.vaaStatus}`);
console.log(`Redeemed: ${status.redeemed}`);
if (status.status === 'redeemable') {
console.log(`Ready to redeem! VAA: ${status.vaa}`);
}Get Pending Redemptions
获取待处理赎回记录
typescript
import { getPendingRedemptions } from 'clodds/bridge';
const pending = await getPendingRedemptions({
chains: ['ethereum', 'solana', 'arbitrum'],
address: myAddress,
});
for (const p of pending) {
console.log(`${p.sourceChain} → ${p.destChain}`);
console.log(` Amount: ${p.amount} ${p.token}`);
console.log(` Status: ${p.status}`);
console.log(` Age: ${p.age} minutes`);
}typescript
import { getPendingRedemptions } from 'clodds/bridge';
const pending = await getPendingRedemptions({
chains: ['ethereum', 'solana', 'arbitrum'],
address: myAddress,
});
for (const p of pending) {
console.log(`${p.sourceChain} → ${p.destChain}`);
console.log(` Amount: ${p.amount} ${p.token}`);
console.log(` Status: ${p.status}`);
console.log(` Age: ${p.age} minutes`);
}Transfer Flow
转账流程
Wormhole
Wormhole
- Lock tokens on source chain
- Wait for confirmations (varies by chain)
- Guardian attestation (VAA generation)
- Redeem on destination chain
- 在源链锁定代币
- 等待确认(时间因链而异)
- 守护者认证(生成VAA)
- 在目标链赎回代币
CCTP
CCTP
- Burn USDC on source chain
- Wait for attestation (~15 min)
- Mint USDC on destination chain
- 在源链销毁USDC
- 等待认证(约15分钟)
- 在目标链铸造USDC
Fees & Times
费用与耗时
| Route | Fee | Time |
|---|---|---|
| Solana → Ethereum | ~$5 | 15-20 min |
| Ethereum → Solana | ~$20 | 15-20 min |
| Arbitrum → Base (CCTP) | ~$0.50 | 15-20 min |
| Polygon → Arbitrum | ~$1 | 15-20 min |
| 转账路线 | 费用 | 耗时 |
|---|---|---|
| Solana → Ethereum | ~$5 | 15-20分钟 |
| Ethereum → Solana | ~$20 | 15-20分钟 |
| Arbitrum → Base (CCTP) | ~$0.50 | 15-20分钟 |
| Polygon → Arbitrum | ~$1 | 15-20分钟 |
Best Practices
最佳实践
- Use CCTP for USDC - Faster and cheaper
- Check gas prices - High gas can increase costs
- Save VAA/message hash - Needed for redemption
- Monitor pending transfers - Don't forget to redeem
- Start with small amounts - Test before large transfers
- Verify destination address - Double-check before sending
- USDC转账优先使用CCTP - 更快更便宜
- 查看Gas价格 - 高Gas费会增加转账成本
- 保存VAA/消息哈希 - 赎回时必须使用
- 监控待处理转账 - 不要忘记完成赎回
- 从小额开始测试 - 大额转账前先进行测试
- 验证目标地址 - 发送前务必仔细核对