@circle-fin/provider-cctp-v2

中文文档
1.14.6发布于 2026/11/06TypeScriptESM + CJS近 30 天下载 5.7万

Circle's official Cross-Chain Transfer Protocol v2 provider for native USDC bridging

原始使用文档
文档目录20 节
  1. Table of Contents
  2. Overview
  3. Why CCTPv2 Provider?
  4. Installation
  5. Quick Start
  6. Option 1: With Bridge Kit (Recommended)
  7. Option 2: Direct Provider Usage
  8. Features
  9. Supported Chains & Routes
  10. Mainnet Chains
  11. Testnet Chains
  12. Error Handling
  13. Bridge Process
  14. Forwarder Integration
  15. Standard Bridge with Forwarder
  16. Forwarder-Only Destination
  17. Relay Fee Handling
  18. Integration with Bridge Kit
  19. Development
  20. License

CCTPv2 Bridging Provider

npm version TypeScript License Discord

Circle's Cross-Chain Transfer Protocol v2 provider for Bridge Kit

Native USDC bridging across 52 chains using Circle's battle-tested protocols.

Table of Contents

Overview

The CCTPv2 Bridging Provider is a strongly-typed implementation of Circle's Cross-Chain Transfer Protocol (CCTP) version 2 that enables native USDC bridging between 49 supported blockchain networks.

While primarily designed to power the Bridge Kit, this provider can also be used directly in applications that need fine-grained control over the CCTP transfer process or want to integrate CCTP without the full App Kits framework.

Why CCTPv2 Provider?

  • 🔒 Circle's official protocol: Uses Circle's native CCTP infrastructure for maximum security
  • ⚡ 51 chain support: Enables bridging across all CCTPv2-supported networks
  • 🎯 Native USDC: Bridges actual USDC tokens, not wrapped or synthetic versions
  • 🔧 Type-safe operations: Built with TypeScript strict mode and comprehensive validation
  • 🛠️ Direct integration: Use standalone or with custom orchestration logic

Installation

npm install @circle-fin/provider-cctp-v2
# or
yarn add @circle-fin/provider-cctp-v2

Note: This provider is included by default with the Bridge Kit. You can import this provider if you need to do a custom CCTP integration.

Quick Start

import { BridgeKit } from '@circle-fin/bridge-kit'

// Provider included by default
const kit = new BridgeKit()

const result = await kit.bridge({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: { adapter: destAdapter, chain: 'Base' },
  amount: '100.50',
})

Option 2: Direct Provider Usage

import { CCTPV2BridgingProvider } from '@circle-fin/provider-cctp-v2'
import { ViemAdapter } from '@circle-fin/adapter-viem-v2'
import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet, base } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount(process.env.PRIVATE_KEY)
const provider = new CCTPV2BridgingProvider()

// Create adapters
const sourceAdapter = new ViemAdapter({
  publicClient: createPublicClient({ chain: mainnet, transport: http() }),
  walletClient: createWalletClient({
    account,
    chain: mainnet,
    transport: http(),
  }),
})

const destAdapter = new ViemAdapter({
  publicClient: createPublicClient({ chain: base, transport: http() }),
  walletClient: createWalletClient({ account, chain: base, transport: http() }),
})

// Check route support
const isSupported = provider.supportsRoute('Ethereum', 'Base', 'USDC')

// Get bridge estimate
const estimate = await provider.estimate({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: { adapter: destAdapter, chain: 'Base' },
  amount: '100.50',
  config: { transferSpeed: 'FAST' },
})

// Execute bridge operation with custom logic
const result = await provider.bridge({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: { adapter: destAdapter, chain: 'Base' },
  amount: '100.50',
  config: { transferSpeed: 'FAST' },
})

Features

  • ✅ Native USDC bridging - Move real USDC between supported networks
  • ✅ CCTP v2 integration - Direct integration with Circle's CCTP v2 protocol
  • ✅ Comprehensive validation - Route validation and parameter checking
  • ✅ Multi-chain support - Works across all 52 CCTPv2-supported chains
  • ✅ Type safety - Full TypeScript support with detailed error handling
  • ✅ Bridge speeds - Support for both FAST and SLOW bridge configurations
  • ✅ Forwarder integration - Circle's Orbit relayer handles attestation and mint automatically
  • ✅ Forwarder-only destinations - No destination adapter required

Supported Chains & Routes

The provider supports 1300 total bridge routes across these chains:

Mainnet Chains

Arbitrum, Arc, Avalanche, Base, Codex, Cronos, Edge, Ethereum, HyperEVM, Injective, Ink, Linea, Monad, Morph, OP Mainnet, Pharos, Plasma, Plume, Polygon PoS, Sei, Solana, Sonic, Unichain, World Chain, XDC, X Layer

Testnet Chains

Arc Testnet, Arbitrum Sepolia, Avalanche Fuji, Base Sepolia, Codex Testnet, Cronos Testnet, Edge Testnet, Ethereum Sepolia, HyperEVM Testnet, Injective Testnet, Ink Testnet, Linea Sepolia, Monad Testnet, Morph Testnet, OP Sepolia, Pharos Atlantic, Plasma Testnet, Plume Testnet, Polygon PoS Amoy, Sei Testnet, Solana Devnet, Sonic Testnet, Unichain Sepolia, World Chain Sepolia, XDC Apothem, X Layer Testnet

Error Handling

The provider implements thoughtful error handling for different scenarios:

// Using the same kit and adapters from the examples above
const params = {
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: { adapter: destAdapter, chain: 'Base' },
  amount: '100.50',
}

try {
  const result = await provider.bridge(params)

  if (result.state === 'success') {
    console.log('Bridge completed successfully!')

    // Display explorer URLs for each step
    result.steps.forEach((step) => {
      if (step.explorerUrl) {
        console.log(`${step.name}: ${step.explorerUrl}`)
      }
    })
  } else {
    // Handle partial completion
    const successfulSteps = result.steps.filter((s) => s.state === 'success')
    const failedStep = result.steps.find((s) => s.state === 'error')

    console.log('Successful steps:', successfulSteps)
    console.log('Failed at:', failedStep)
  }
} catch (error) {
  // Handle validation or configuration errors
  console.error('Bridge failed:', error.message)
}

Bridge Process

The CCTPv2 provider handles the complete cross-chain bridging flow:

  1. Approval - Approve USDC spending (if needed)
  2. Burn - Burn USDC on source chain via depositForBurn
  3. Attestation - Fetch Circle's attestation for the burn
  4. Mint - Mint USDC on destination chain using attestation

Each step is tracked and can be monitored through the Provider's event system. Transaction details for each step include explorer URLs for easy verification on block explorers.

With Forwarder: When useForwarder: true, the destination mint submission is handled by Circle's Orbit relayer, and relay fees are deducted from the minted amount.

Forwarder Integration

The CCTPv2 provider supports Circle's Orbit relayer for automated attestation and mint handling. When enabled, the relayer automatically fetches the attestation and submits the mint transaction, eliminating the need for the user to manage the destination chain transaction.

You can check forwarder route support explicitly:

const canForward = provider.supportsRoute(
  'Ethereum,
  'Base,
  'USDC',
  true,
)

Standard Bridge with Forwarder

Use useForwarder: true when you have adapters for both chains but want Circle to handle the mint:

const result = await kit.bridge({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: {
    adapter: destAdapter,
    chain: 'Base',
    useForwarder: true, // Circle handles attestation + mint
  },
  amount: '100.50',
})

Forwarder-Only Destination

When you don't have access to the destination chain (no wallet/adapter), use forwarder-only mode. This is useful for server-side transfers or when users don't have a wallet on the destination chain:

const result = await kit.bridge({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: {
    recipientAddress: '0x...', // Where to receive USDC
    chain: 'Base',
    useForwarder: true, // Required for forwarder-only
  },
  amount: '100.50',
})

Key differences from standard bridging:

  • No destination adapter required
  • Mint confirmation via IRIS API (not on-chain receipt)
  • Mint step's data field will be undefined

Relay Fee Handling

When using the forwarder, a relay fee is automatically included in the maxFee estimate:

  • The relay fee is fetched from Circle's API based on source/destination chains
  • Fee is deducted from the minted USDC at mint time
  • Net received amount = burn amount - relay fee

The fee estimation accounts for this automatically:

const estimate = await provider.estimate({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: {
    recipientAddress: '0x...',
    chain: 'Base',
    useForwarder: true,
  },
  amount: '100.50',
})

console.log(estimate.fees) // Includes both provider and forwarder fee entries

If you provide config.maxFee manually, ensure it already includes any expected forwarder fee for the selected route and speed. For Solana destinations, the forwarder fee also covers creating the recipient's USDC token account.

Integration with Bridge Kit

This provider is designed specifically for the Bridge Kit:

import { BridgeKit } from '@circle-fin/bridge-kit'
import { ViemAdapter } from '@circle-fin/adapter-viem-v2'
import { createPublicClient, createWalletClient, http } from 'viem'
import { mainnet, base } from 'viem/chains'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount(process.env.PRIVATE_KEY)

// Provider is included by default
const kit = new BridgeKit()

const sourceAdapter = new ViemAdapter({
  publicClient: createPublicClient({ chain: mainnet, transport: http() }),
  walletClient: createWalletClient({
    account,
    chain: mainnet,
    transport: http(),
  }),
})

const destAdapter = new ViemAdapter({
  publicClient: createPublicClient({ chain: base, transport: http() }),
  walletClient: createWalletClient({ account, chain: base, transport: http() }),
})

// Monitor transfer events
kit.on('*', (event) => console.log('Event:', event)) // subscribe to all events
kit.on('approve', (event) => console.log('Approval:', event.values.txHash))
kit.on('burn', (event) => console.log('Burn:', event.values.txHash))
kit.on('fetchAttestation', (event) =>
  console.log('Attestation:', event.values.data),
)
kit.on('mint', (event) => console.log('Mint:', event.values.txHash))

// Execute transfer
const result = await kit.bridge({
  from: { adapter: sourceAdapter, chain: 'Ethereum' },
  to: { adapter: destAdapter, chain: 'Base' },
  amount: '25.0',
})

Development

This package is part of the App Kits monorepo.

# Build
nx build @circle-fin/provider-cctp-v2

# Test
nx test @circle-fin/provider-cctp-v2

License

This project is licensed under the Apache 2.0 License. Contact support for details.


Ready for cross-chain bridging?

Join Discord • Visit our Help-Desk

Built with ❤️ by Circle

版本与发布记录

@circle-fin/provider-cctp-v2 共发布 40 个版本,首次发布于 2025/08/26;过去 12 个月发布了 35 个版本。

版本发布日期距今
1.14.6latest2026/11/063 天前
1.14.52026/10/3110 天前
1.14.42026/10/2317 天前
1.14.32026/10/2119 天前
1.14.22026/10/1624 天前
1.14.12026/09/301 个月前

其他发布通道:alpha → 0.0.2-alpha.6。

关于 @circle-fin/provider-cctp-v2 的常见问题

@circle-fin/provider-cctp-v2 是什么?

Circle's official Cross-Chain Transfer Protocol v2 provider for native USDC bridging

如何安装 @circle-fin/provider-cctp-v2?

在项目目录运行 npm install @circle-fin/provider-cctp-v2,或使用 pnpm add / yarn add / bun add。

@circle-fin/provider-cctp-v2 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@circle-fin/provider-cctp-v2 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@circle-fin/provider-cctp-v2 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@circle-fin/provider-cctp-v2 可以商用吗?

@circle-fin/provider-cctp-v2 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@circle-fin/provider-cctp-v2 的下载量有多少?

根据 npm 官方下载统计,@circle-fin/provider-cctp-v2 在 2026/10/10 – 2026/11/08 这 30 天内被下载 57,469 次,日均约 1,916 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@circle-fin/provider-cctp-v2 还在维护吗?

最新版本 1.14.6 发布于 2026/11/06(3 天前);至今共发布 40 个版本,其中过去 12 个月发布了 35 个;首次发布于 2025/08/26。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。