@circle-fin/provider-cctp-v2 1.0.0 → 1.0.2
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 +100 -0
- package/README.md +4 -2
- package/{index.cjs.js → index.cjs} +432 -203
- package/index.cjs.map +1 -0
- package/index.d.ts +167 -30
- package/index.mjs +430 -202
- package/package.json +7 -3
- package/index.cjs.js.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# @circle-fin/provider-cctp-v2
|
|
2
|
+
|
|
3
|
+
## 1.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix CommonJS compatibility by correcting file extensions and package exports. This resolves a "ReferenceError: require is not defined" error that occurred when using packages in CommonJS projects with ts-node.
|
|
8
|
+
|
|
9
|
+
- Fixes a bug where custom recipient addresses were not respected in cross-chain USDC transfers. Previously, when using `recipientAddress` to specify a different destination address than the signer (common in custody solutions or when bridging to third-party addresses), the provider would incorrectly use the signer's address as the mint recipient, causing transfers to fail or mint to the wrong address.
|
|
10
|
+
|
|
11
|
+
With this fix, the provider now correctly uses `recipientAddress` when provided, while still using the signer's address for transaction authorization. This enables:
|
|
12
|
+
- **Third-party transfers**: Bridge USDC to any address without requiring them to sign
|
|
13
|
+
- **Custody integrations**: Separate signing authority from fund destination
|
|
14
|
+
- **Developer-controlled flows**: API-based signers can bridge to user-specified recipients
|
|
15
|
+
|
|
16
|
+
**No changes required** for existing code - the fix is backward compatible. If you don't provide `recipientAddress`, transfers work exactly as before. If you were previously experiencing failures when specifying a custom recipient, this update resolves those issues.
|
|
17
|
+
|
|
18
|
+
- Improves static gas estimate values for contract calls. Updates adapters' `prepare()` method so that transaction simulation is now performed only during `execute()`, not during `estimate()`. Adds an optional fallback parameter to `estimate()` for cases where gas estimation fails.
|
|
19
|
+
|
|
20
|
+
## 1.0.1
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Standardize `maxFee` parameter to accept human-readable values. The `maxFee` parameter in `BridgeConfig` now correctly accepts human-readable token amounts (e.g., `"1"` for 1 USDC, `"0.5"` for 0.5 USDC), matching the behavior of `customFee.value`. This resolves an undocumented inconsistency in the API. If you were previously passing values in smallest units, update to human-readable format: use `"1"` instead of `"1000000"` for 1 USDC.
|
|
25
|
+
- Add support for Arc Testnet chain definition. Arc is Circle's EVM-compatible Layer-1 blockchain designed for stablecoin finance and asset
|
|
26
|
+
tokenization, featuring USDC as the native gas token and sub-second finality via the Malachite BFT consensus engine.
|
|
27
|
+
- Fix bridge event dispatching in retry flow to include complete step metadata. The retry flow was incorrectly dispatching only step.data instead of the full step object, causing retry events to miss critical metadata like txHash, explorerUrl, name, and state. This change also introduces a shared dispatchStepEvent utility to eliminate code duplication between bridge and retry flows.
|
|
28
|
+
- These changes standardize and clarifiy error handling across bridge steps, make all bridge steps only need 1 blockchain confirmation when waiting for the step transaction, refactor burn transfer speed logic for simplicity, and improve polling configuration for slow attestation fetches.
|
|
29
|
+
- Update Sonic Testnet chain definition to canonical network. The `SonicTestnet` chain definition now points to the official Sonic Testnet (chainId: 14601) instead of the deprecated Sonic Blaze Testnet (chainId: 57054). The RPC endpoint has been updated to `https://rpc.testnet.soniclabs.com`, the display name simplified to "Sonic Testnet", and the USDC contract address updated to the new deployment.
|
|
30
|
+
|
|
31
|
+
**Breaking Changes:**
|
|
32
|
+
- **Chain ID:** 57054 → 14601
|
|
33
|
+
- **RPC Endpoint:** `https://rpc.blaze.soniclabs.com` → `https://rpc.testnet.soniclabs.com`
|
|
34
|
+
- **USDC Address:** `0xA4879Fed32Ecbef99399e5cbC247E533421C4eC6` → `0x0BA304580ee7c9a980CF72e55f5Ed2E9fd30Bc51`
|
|
35
|
+
|
|
36
|
+
**Migration:** If you were using `SonicTestnet`, your application will automatically connect to the new network upon upgrading. Any accounts, contracts, or transactions on the old Blaze testnet (chainId: 57054) will need to be recreated on the new testnet.
|
|
37
|
+
|
|
38
|
+
## 1.0.0
|
|
39
|
+
|
|
40
|
+
### Major Changes
|
|
41
|
+
|
|
42
|
+
- # CCTP v2 Provider 1.0.0 Release 🎉
|
|
43
|
+
|
|
44
|
+
Circle's Cross-Chain Transfer Protocol (CCTP) v2 integration - the primary transport layer for secure, native USDC transfers across supported blockchain networks.
|
|
45
|
+
|
|
46
|
+
## 🚀 Core CCTP Features
|
|
47
|
+
- **Native USDC Bridging**: Direct integration with Circle's official CCTP v2 protocol
|
|
48
|
+
- **Multi-chain Support**: Seamless transfers between EVM chains and Solana
|
|
49
|
+
- **Attestation Management**: Automatic handling of Circle's attestation service
|
|
50
|
+
|
|
51
|
+
## ⚡ Transfer Speed Options
|
|
52
|
+
|
|
53
|
+
**FAST Transfers**
|
|
54
|
+
- Optimized for speed with Circle's fast liquidity network
|
|
55
|
+
- Dynamic fee calculation based on transfer amount and network conditions
|
|
56
|
+
- Automatic fee estimation with 10% buffer for fluctuations
|
|
57
|
+
- Typical completion time: ~1 minute
|
|
58
|
+
|
|
59
|
+
**SLOW Transfers**
|
|
60
|
+
- Zero protocol fees for cost-optimized transfers
|
|
61
|
+
- Standard CCTP attestation flow
|
|
62
|
+
- Typical completion time: 10-20 minutes
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
// Fast transfer with automatic fee calculation
|
|
66
|
+
const result = await provider.bridge({
|
|
67
|
+
source: { adapter: sourceAdapter, chain: 'Ethereum' },
|
|
68
|
+
destination: { adapter: destAdapter, chain: 'Base' },
|
|
69
|
+
amount: '10.0',
|
|
70
|
+
config: { transferSpeed: 'FAST' },
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
// Slow transfer with zero fees
|
|
74
|
+
const result = await provider.bridge({
|
|
75
|
+
source: { adapter: sourceAdapter, chain: 'Ethereum' },
|
|
76
|
+
destination: { adapter: destAdapter, chain: 'Base' },
|
|
77
|
+
amount: '10.0',
|
|
78
|
+
config: { transferSpeed: 'SLOW' },
|
|
79
|
+
})
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## 🔄 Advanced Retry Support
|
|
83
|
+
- **Step-by-step Recovery**: Resume from burn, attestation, or mint phases
|
|
84
|
+
- **Automatic State Analysis**: Intelligent detection of completion status
|
|
85
|
+
- **Network Resilience**: Handle temporary API and RPC failures
|
|
86
|
+
- **Transaction Resubmission**: Retry failed blockchain transactions
|
|
87
|
+
|
|
88
|
+
## 💰 Fee Management
|
|
89
|
+
- **Dynamic Fee Calculation**: Real-time fee estimation from Circle's API
|
|
90
|
+
- **Custom Fee Limits**: Set maximum fees to control costs
|
|
91
|
+
- **Protocol Fee Transparency**: Clear breakdown of all fees involved
|
|
92
|
+
- **Multi-chain Fee Support**: Different fee structures per chain pair
|
|
93
|
+
|
|
94
|
+
## 🛡️ Security & Reliability
|
|
95
|
+
- **No Custom Cryptography**: Uses only Circle's audited smart contracts
|
|
96
|
+
- **Deterministic Operations**: Predictable outcomes and gas estimation
|
|
97
|
+
- **Comprehensive Validation**: Runtime parameter validation and type safety
|
|
98
|
+
- **Production Ready**: Battle-tested protocol with institutional adoption
|
|
99
|
+
|
|
100
|
+
This provider implements Circle's official CCTP v2 specification, ensuring maximum security and compatibility with the broader USDC ecosystem.
|
package/README.md
CHANGED
|
@@ -232,8 +232,10 @@ const destAdapter = new ViemAdapter({
|
|
|
232
232
|
// Monitor transfer events
|
|
233
233
|
kit.on('*', (event) => console.log('Event:', event)) // subscribe to all events
|
|
234
234
|
kit.on('approve', (event) => console.log('Approval:', event.values.txHash))
|
|
235
|
-
kit.on('
|
|
236
|
-
kit.on('
|
|
235
|
+
kit.on('burn', (event) => console.log('Burn:', event.values.txHash))
|
|
236
|
+
kit.on('fetchAttestation', (event) =>
|
|
237
|
+
console.log('Attestation:', event.values.data),
|
|
238
|
+
)
|
|
237
239
|
kit.on('mint', (event) => console.log('Mint:', event.values.txHash))
|
|
238
240
|
|
|
239
241
|
// Execute transfer
|