@circle-fin/provider-cctp-v2 1.3.1 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +98 -14
  3. package/index.cjs +5439 -2119
  4. package/index.d.ts +2139 -148
  5. package/index.mjs +5438 -2120
  6. package/package.json +1 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,39 @@
1
1
  # @circle-fin/provider-cctp-v2
2
2
 
3
+ ## 1.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - More accurate gas fee estimates for CCTP v2 bridge operations.
8
+
9
+ ## 1.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - Add Circle Forwarder support for CCTP v2 bridging.
14
+
15
+ Forwarding is a relay-assisted mode where Circle observes the burn transaction,
16
+ retrieves attestation data, and submits the destination mint on the user's
17
+ behalf. This removes most destination-side orchestration from client code.
18
+
19
+ What this enables:
20
+ - Opt-in forwarding with `useForwarder: true` so Circle handles destination mint
21
+ submission.
22
+ - Forwarder-only destinations (no destination adapter required) using
23
+ `{ recipientAddress, chain, useForwarder: true }`.
24
+ - Forwarding-fee-aware estimation and max-fee calculation when `maxFee` is
25
+ auto-derived.
26
+ - New hook-based burn actions: `cctp.v2.depositForBurnWithHook` and
27
+ `cctp.v2.customBurnWithHook`.
28
+ - New forwarding helpers: `buildForwardingHookData` and
29
+ `buildForwardingHookDataBuffer`.
30
+ - Chain-level forwarding metadata via `cctp.forwarderSupported` for route
31
+ capability checks.
32
+
33
+ Compatibility:
34
+ - Existing non-forwarded bridge flows remain unchanged.
35
+ - If you set `config.maxFee` manually, include any expected forwarding fee.
36
+
3
37
  ## 1.3.1
4
38
 
5
39
  ### Patch Changes
package/README.md CHANGED
@@ -9,7 +9,7 @@
9
9
 
10
10
  **Circle's Cross-Chain Transfer Protocol v2 provider for Bridge Kit**
11
11
 
12
- _Native USDC bridging across 34 chains using Circle's battle-tested protocols._
12
+ _Native USDC bridging across 35 chains using Circle's battle-tested protocols._
13
13
 
14
14
  </div>
15
15
 
@@ -27,25 +27,21 @@ _Native USDC bridging across 34 chains using Circle's battle-tested protocols._
27
27
  - [Supported Chains \& Routes](#supported-chains--routes)
28
28
  - [Mainnet Chains](#mainnet-chains)
29
29
  - [Testnet Chains](#testnet-chains)
30
- - [Usage Examples](#usage-examples)
31
- - [Basic Bridge Operation](#basic-bridge-operation)
32
- - [Route Validation](#route-validation)
33
- - [Bridge Configurations](#bridge-configurations)
34
30
  - [Error Handling](#error-handling)
35
31
  - [Bridge Process](#bridge-process)
32
+ - [Forwarder Integration](#forwarder-integration)
33
+ - [Standard Bridge with Forwarder](#standard-bridge-with-forwarder)
34
+ - [Forwarder-Only Destination](#forwarder-only-destination)
35
+ - [Relay Fee Handling](#relay-fee-handling)
36
36
  - [Integration with Bridge Kit](#integration-with-bridge-kit)
37
- - [API Reference](#api-reference)
38
- - [Core Methods](#core-methods)
39
- - [Transfer Parameters](#transfer-parameters)
40
37
  - [Development](#development)
41
- - [Contributing](#contributing)
42
38
  - [License](#license)
43
39
 
44
40
  ## Overview
45
41
 
46
42
  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 34+ supported blockchain networks.
47
43
 
48
- While primarily designed to power the [Bridge Kit](https://www.npmjs.com/package/@circle-fin/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 Stablecoin Kits framework.
44
+ While primarily designed to power the [Bridge Kit](https://www.npmjs.com/package/@circle-fin/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.
49
45
 
50
46
  ### Why CCTPv2 Provider?
51
47
 
@@ -137,10 +133,12 @@ const result = await provider.bridge({
137
133
  - ✅ **Multi-chain support** - Works across all 34 CCTPv2-supported chains
138
134
  - ✅ **Type safety** - Full TypeScript support with detailed error handling
139
135
  - ✅ **Bridge speeds** - Support for both FAST and SLOW bridge configurations
136
+ - ✅ **Forwarder integration** - Circle's Orbit relayer handles attestation and mint automatically
137
+ - ✅ **Forwarder-only destinations** - No destination adapter required
140
138
 
141
139
  ## Supported Chains & Routes
142
140
 
143
- The provider supports **544 total bridge routes** across these chains:
141
+ The provider supports **578 total bridge routes** across these chains:
144
142
 
145
143
  ### Mainnet Chains
146
144
 
@@ -148,7 +146,7 @@ The provider supports **544 total bridge routes** across these chains:
148
146
 
149
147
  ### Testnet Chains
150
148
 
151
- **Arbitrum Sepolia**, **Avalanche Fuji**, **Base Sepolia**, **Codex Testnet**, **Ethereum Sepolia**, **HyperEVM Testnet**, **Ink Testnet**, **Linea Sepolia**, **OP Sepolia**, **Plume Testnet**, **Polygon PoS Amoy**, **Sei Testnet**, **Solana Devnet**, **Sonic Testnet**, **Unichain Sepolia**, **World Chain Sepolia**, **XDC Apothem**
149
+ **Arc Testnet**, **Arbitrum Sepolia**, **Avalanche Fuji**, **Base Sepolia**, **Codex Testnet**, **Ethereum Sepolia**, **HyperEVM Testnet**, **Ink Testnet**, **Linea Sepolia**, **OP Sepolia**, **Plume Testnet**, **Polygon PoS Amoy**, **Sei Testnet**, **Solana Devnet**, **Sonic Testnet**, **Unichain Sepolia**, **World Chain Sepolia**, **XDC Apothem**
152
150
 
153
151
  ## Error Handling
154
152
 
@@ -163,7 +161,7 @@ const params = {
163
161
  }
164
162
 
165
163
  try {
166
- const result = await kit.bridge(params)
164
+ const result = await provider.bridge(params)
167
165
 
168
166
  if (result.state === 'success') {
169
167
  console.log('Bridge completed successfully!')
@@ -199,6 +197,92 @@ The CCTPv2 provider handles the complete cross-chain bridging flow:
199
197
 
200
198
  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.
201
199
 
200
+ > **With Forwarder**: When `useForwarder: true`, the destination mint submission is handled by
201
+ > Circle's Orbit relayer, and relay fees are deducted from the minted amount.
202
+
203
+ ## Forwarder Integration
204
+
205
+ The CCTPv2 provider supports Circle's Orbit relayer for automated attestation and mint handling.
206
+ When enabled, the relayer automatically fetches the attestation and submits the mint transaction,
207
+ eliminating the need for the user to manage the destination chain transaction.
208
+
209
+ You can check forwarder route support explicitly:
210
+
211
+ ```typescript
212
+ const canForward = provider.supportsRoute(
213
+ 'Ethereum,
214
+ 'Base,
215
+ 'USDC',
216
+ true,
217
+ )
218
+ ```
219
+
220
+ ### Standard Bridge with Forwarder
221
+
222
+ Use `useForwarder: true` when you have adapters for both chains but want Circle to handle the mint:
223
+
224
+ ```typescript
225
+ const result = await kit.bridge({
226
+ from: { adapter: sourceAdapter, chain: 'Ethereum' },
227
+ to: {
228
+ adapter: destAdapter,
229
+ chain: 'Base',
230
+ useForwarder: true, // Circle handles attestation + mint
231
+ },
232
+ amount: '100.50',
233
+ })
234
+ ```
235
+
236
+ ### Forwarder-Only Destination
237
+
238
+ When you don't have access to the destination chain (no wallet/adapter), use forwarder-only mode.
239
+ This is useful for server-side transfers or when users don't have a wallet on the destination chain:
240
+
241
+ ```typescript
242
+ const result = await kit.bridge({
243
+ from: { adapter: sourceAdapter, chain: 'Ethereum' },
244
+ to: {
245
+ recipientAddress: '0x...', // Where to receive USDC
246
+ chain: 'Base',
247
+ useForwarder: true, // Required for forwarder-only
248
+ },
249
+ amount: '100.50',
250
+ })
251
+ ```
252
+
253
+ **Key differences from standard bridging:**
254
+
255
+ - No destination adapter required
256
+ - Mint confirmation via IRIS API (not on-chain receipt)
257
+ - Mint step's `data` field will be `undefined`
258
+
259
+ ### Relay Fee Handling
260
+
261
+ When using the forwarder, a relay fee is automatically included in the `maxFee` estimate:
262
+
263
+ - The relay fee is fetched from Circle's API based on source/destination chains
264
+ - Fee is deducted from the minted USDC at mint time
265
+ - Net received amount = burn amount - relay fee
266
+
267
+ The fee estimation accounts for this automatically:
268
+
269
+ ```typescript
270
+ const estimate = await provider.estimate({
271
+ from: { adapter: sourceAdapter, chain: 'Ethereum' },
272
+ to: {
273
+ recipientAddress: '0x...',
274
+ chain: 'Base',
275
+ useForwarder: true,
276
+ },
277
+ amount: '100.50',
278
+ })
279
+
280
+ console.log(estimate.fees) // Includes both provider and forwarder fee entries
281
+ ```
282
+
283
+ > If you provide `config.maxFee` manually, ensure it already includes any expected
284
+ > forwarder fee for the selected route and speed.
285
+
202
286
  ## Integration with Bridge Kit
203
287
 
204
288
  This provider is designed specifically for the [Bridge Kit](https://www.npmjs.com/package/@circle-fin/bridge-kit):
@@ -248,7 +332,7 @@ const result = await kit.bridge({
248
332
 
249
333
  ## Development
250
334
 
251
- This package is part of the Stablecoin Kits monorepo.
335
+ This package is part of the App Kits monorepo.
252
336
 
253
337
  ```bash
254
338
  # Build