@circle-fin/provider-cctp-v2 1.3.0 → 1.4.0
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.
- package/CHANGELOG.md +34 -0
- package/README.md +93 -9
- package/index.cjs +4526 -2150
- package/index.d.ts +1590 -222
- package/index.mjs +4525 -2151
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @circle-fin/provider-cctp-v2
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add Circle Forwarder support for CCTP v2 bridging.
|
|
8
|
+
|
|
9
|
+
Forwarding is a relay-assisted mode where Circle observes the burn transaction,
|
|
10
|
+
retrieves attestation data, and submits the destination mint on the user's
|
|
11
|
+
behalf. This removes most destination-side orchestration from client code.
|
|
12
|
+
|
|
13
|
+
What this enables:
|
|
14
|
+
- Opt-in forwarding with `useForwarder: true` so Circle handles destination mint
|
|
15
|
+
submission.
|
|
16
|
+
- Forwarder-only destinations (no destination adapter required) using
|
|
17
|
+
`{ recipientAddress, chain, useForwarder: true }`.
|
|
18
|
+
- Forwarding-fee-aware estimation and max-fee calculation when `maxFee` is
|
|
19
|
+
auto-derived.
|
|
20
|
+
- New hook-based burn actions: `cctp.v2.depositForBurnWithHook` and
|
|
21
|
+
`cctp.v2.customBurnWithHook`.
|
|
22
|
+
- New forwarding helpers: `buildForwardingHookData` and
|
|
23
|
+
`buildForwardingHookDataBuffer`.
|
|
24
|
+
- Chain-level forwarding metadata via `cctp.forwarderSupported` for route
|
|
25
|
+
capability checks.
|
|
26
|
+
|
|
27
|
+
Compatibility:
|
|
28
|
+
- Existing non-forwarded bridge flows remain unchanged.
|
|
29
|
+
- If you set `config.maxFee` manually, include any expected forwarding fee.
|
|
30
|
+
|
|
31
|
+
## 1.3.1
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Fix for native token balance validation fails for Gas Station–enabled wallets when either the source or destination chain has zero native token balance
|
|
36
|
+
|
|
3
37
|
## 1.3.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -27,18 +27,14 @@ _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
|
|
@@ -137,6 +133,8 @@ 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
|
|
|
@@ -163,7 +161,7 @@ const params = {
|
|
|
163
161
|
}
|
|
164
162
|
|
|
165
163
|
try {
|
|
166
|
-
const result = await
|
|
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):
|