@circle-fin/bridge-kit 1.5.0 → 1.6.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.
- package/CHANGELOG.md +34 -0
- package/QUICKSTART.md +6 -6
- package/README.md +110 -13
- package/chains.cjs +544 -4
- package/chains.d.ts +205 -4
- package/chains.mjs +544 -4
- package/index.cjs +4578 -1649
- package/index.d.ts +5112 -2352
- package/index.mjs +4533 -1654
- package/package.json +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @circle-fin/bridge-kit
|
|
2
2
|
|
|
3
|
+
## 1.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- New error handling utilities for detecting rate-limit and service errors (`isRateLimitError`, `isServiceError`). Chain definitions now available via `@circle-fin/bridge-kit/chains` subpath import.
|
|
8
|
+
|
|
9
|
+
## 1.6.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.5.0
|
|
4
38
|
|
|
5
39
|
### Minor Changes
|
package/QUICKSTART.md
CHANGED
|
@@ -4,7 +4,7 @@ Welcome to the Bridge Kit! This guide will help you understand the ecosystem and
|
|
|
4
4
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
|
-
- [What is the
|
|
7
|
+
- [What is the App Kit Ecosystem?](#what-is-the-app-kit-ecosystem)
|
|
8
8
|
- [Bring Your Own Infrastructure](#bring-your-own-infrastructure)
|
|
9
9
|
- [Architecture Overview](#architecture-overview)
|
|
10
10
|
- [Quick Setup](#quick-setup)
|
|
@@ -18,9 +18,9 @@ Welcome to the Bridge Kit! This guide will help you understand the ecosystem and
|
|
|
18
18
|
- [Best Practices](#best-practices)
|
|
19
19
|
- [Next Steps](#next-steps)
|
|
20
20
|
|
|
21
|
-
## What is the
|
|
21
|
+
## What is the App Kit Ecosystem?
|
|
22
22
|
|
|
23
|
-
The
|
|
23
|
+
The App Kit ecosystem is Circle's open-source initiative to streamline stablecoin development. Our SDKs are designed to be easy to use correctly and hard to misuse, with cross-framework compatibility (viem, ethers, solana-web3 etc.) that integrates cleanly into any stack. While opinionated with sensible defaults, they provide escape hatches when you need full control. The pluggable architecture ensures flexible implementation, and all kits are interoperable—allowing you to compose them together for a wide range of use cases.
|
|
24
24
|
|
|
25
25
|
**This Bridge Kit specifically focuses on cross-chain stablecoin bridging.** Its goal is to abstract away the complexity of cross-chain bridging while maintaining security, type safety, and developer experience.
|
|
26
26
|
|
|
@@ -876,7 +876,7 @@ kit.on('mint', (event) => {
|
|
|
876
876
|
|
|
877
877
|
## Supported Chains
|
|
878
878
|
|
|
879
|
-
The Bridge Kit supports chains through Circle's Cross-Chain Transfer Protocol v2 (CCTPv2), enabling **
|
|
879
|
+
The Bridge Kit supports chains through Circle's Cross-Chain Transfer Protocol v2 (CCTPv2), enabling **578 total bridge routes** across networks:
|
|
880
880
|
|
|
881
881
|
### Mainnet Chains (17 chains = 272 routes)
|
|
882
882
|
|
|
@@ -884,9 +884,9 @@ The Bridge Kit supports chains through Circle's Cross-Chain Transfer Protocol v2
|
|
|
884
884
|
|
|
885
885
|
**Arbitrum**, **Avalanche**, **Base**, **Codex**, **Ethereum**, **HyperEVM**, **Ink**, **Linea**, **OP Mainnet**, **Plume**, **Polygon PoS**, **Sei**, **Solana**, **Sonic**, **Unichain**, **World Chain**, **XDC**
|
|
886
886
|
|
|
887
|
-
### Testnet Chains (
|
|
887
|
+
### Testnet Chains (18 chains = 306 routes)
|
|
888
888
|
|
|
889
|
-
**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**
|
|
889
|
+
**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**
|
|
890
890
|
|
|
891
891
|
## Error Handling
|
|
892
892
|
|
package/README.md
CHANGED
|
@@ -34,19 +34,22 @@ _Making cross-chain stablecoin (USDC, and soon more tokens) transfers as simple
|
|
|
34
34
|
- [1. **AdapterContext** - Your Transfer Endpoint](#1-adaptercontext---your-transfer-endpoint)
|
|
35
35
|
- [2. **BridgeDestination** - Where Funds Go](#2-bridgedestination---where-funds-go)
|
|
36
36
|
- [3. **BridgeConfig** - Transfer Settings](#3-bridgeconfig---transfer-settings)
|
|
37
|
-
- [Complete Example with All Options](#complete-example-with-all-options)
|
|
38
37
|
- [Bridge Speed Configuration](#bridge-speed-configuration)
|
|
39
38
|
- [Custom Fees](#custom-fees)
|
|
40
39
|
- [How Custom Fees Work](#how-custom-fees-work)
|
|
41
|
-
- [
|
|
40
|
+
- [1,000 USDC Transfer Example](#1000-usdc-transfer-example)
|
|
42
41
|
- [Kit-Level Fee Policies](#kit-level-fee-policies)
|
|
43
42
|
- [Error Handling](#error-handling)
|
|
44
43
|
- [Retrying Failed Transfers](#retrying-failed-transfers)
|
|
45
|
-
|
|
46
|
-
- [Basic
|
|
47
|
-
- [
|
|
48
|
-
- [
|
|
49
|
-
- [
|
|
44
|
+
- [Method signature](#method-signature)
|
|
45
|
+
- [Basic usage (EVM → EVM)](#basic-usage-evm--evm)
|
|
46
|
+
- [When to retry vs manual intervention](#when-to-retry-vs-manual-intervention)
|
|
47
|
+
- [Limitations](#limitations)
|
|
48
|
+
- [Performance and best practices](#performance-and-best-practices)
|
|
49
|
+
- [Troubleshooting](#troubleshooting)
|
|
50
|
+
- [Forwarder Integration](#forwarder-integration)
|
|
51
|
+
- [Standard Bridge with Forwarder](#standard-bridge-with-forwarder)
|
|
52
|
+
- [Forwarder-Only Destination (No Destination Adapter)](#forwarder-only-destination-no-destination-adapter)
|
|
50
53
|
- [API Reference](#api-reference)
|
|
51
54
|
- [Core Methods](#core-methods)
|
|
52
55
|
- [Bridge Parameters](#bridge-parameters)
|
|
@@ -54,14 +57,12 @@ _Making cross-chain stablecoin (USDC, and soon more tokens) transfers as simple
|
|
|
54
57
|
- [Building](#building)
|
|
55
58
|
- [Testing](#testing)
|
|
56
59
|
- [Local Development](#local-development)
|
|
57
|
-
- [Contributing](#contributing)
|
|
58
|
-
- [Quick Contribution Steps](#quick-contribution-steps)
|
|
59
60
|
- [Community \& Support](#community--support)
|
|
60
61
|
- [License](#license)
|
|
61
62
|
|
|
62
63
|
## Overview
|
|
63
64
|
|
|
64
|
-
The
|
|
65
|
+
The App Kit ecosystem is Circle’s open-source effort to streamline stablecoin development with SDKs that are easy to use correctly and hard to misuse. Kits are cross-framework (viem, ethers, @solana/web3) and integrate cleanly into any stack. They’re opinionated with sensible defaults, but offer escape hatches for full control. A pluggable architecture makes implementation flexible, and all kits are interoperable, so they can be composed to suit a wide range of use cases.
|
|
65
66
|
|
|
66
67
|
The Bridge Kit enables cross-chain stablecoin transfers via a type-safe, developer-friendly interface with robust runtime validation. The Kit can have any bridging provider plugged in, by implementing your own BridgingProvider, but comes by default with full CCTPv2 support
|
|
67
68
|
|
|
@@ -80,6 +81,8 @@ The Bridge Kit enables cross-chain stablecoin transfers via a type-safe, develop
|
|
|
80
81
|
- **📡 Real-time event monitoring**: Track progress throughout the transfer lifecycle
|
|
81
82
|
- **🛡️ Robust error handling**: Graceful partial success recovery
|
|
82
83
|
- **✈️ Pre-flight validation**: Verify transfers with cost estimation before execution
|
|
84
|
+
- **🤖 Forwarder integration**: Circle's Orbit relayer handles attestation and mint automatically
|
|
85
|
+
- **📭 Forwarder-only destinations**: No destination adapter required - just provide recipient address
|
|
83
86
|
|
|
84
87
|
## Architecture Flow
|
|
85
88
|
|
|
@@ -122,9 +125,9 @@ npm install @circle-fin/adapter-ethers-v6
|
|
|
122
125
|
yarn add @circle-fin/adapter-ethers-v6
|
|
123
126
|
|
|
124
127
|
# For Solana
|
|
125
|
-
npm install @circle-fin/adapter-solana @solana/web3.js
|
|
128
|
+
npm install @circle-fin/adapter-solana @solana/web3.js
|
|
126
129
|
# or
|
|
127
|
-
yarn add @circle-fin/adapter-solana @solana/web3.js
|
|
130
|
+
yarn add @circle-fin/adapter-solana @solana/web3.js
|
|
128
131
|
```
|
|
129
132
|
|
|
130
133
|
## Quick Start
|
|
@@ -615,6 +618,93 @@ if (result.state === 'error') {
|
|
|
615
618
|
|
|
616
619
|
> See a runnable example at `examples/basic-usdc-transfer/src/retry.ts` (script: `yarn start:retry`).
|
|
617
620
|
|
|
621
|
+
## Forwarder Integration
|
|
622
|
+
|
|
623
|
+
The Bridge Kit supports Circle's Orbit relayer for automated attestation and mint handling.
|
|
624
|
+
When enabled, the relayer automatically fetches the attestation and submits the mint transaction on the destination chain, simplifying the bridging process.
|
|
625
|
+
|
|
626
|
+
### Standard Bridge with Forwarder
|
|
627
|
+
|
|
628
|
+
Use `useForwarder: true` when you have adapters for both chains but want Circle to handle the mint transaction:
|
|
629
|
+
|
|
630
|
+
```typescript
|
|
631
|
+
import { BridgeKit } from '@circle-fin/bridge-kit'
|
|
632
|
+
import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2'
|
|
633
|
+
|
|
634
|
+
const kit = new BridgeKit()
|
|
635
|
+
const adapter = createViemAdapterFromPrivateKey({
|
|
636
|
+
privateKey: process.env.PRIVATE_KEY as `0x${string}`,
|
|
637
|
+
})
|
|
638
|
+
|
|
639
|
+
const result = await kit.bridge({
|
|
640
|
+
from: { adapter, chain: 'Ethereum' },
|
|
641
|
+
to: {
|
|
642
|
+
adapter,
|
|
643
|
+
chain: 'Base',
|
|
644
|
+
useForwarder: true, // Circle handles attestation + mint
|
|
645
|
+
},
|
|
646
|
+
amount: '100.50',
|
|
647
|
+
})
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
**Benefits:**
|
|
651
|
+
|
|
652
|
+
- No manual attestation polling or destination mint submission
|
|
653
|
+
- Relayer handles destination mint transaction automatically
|
|
654
|
+
- Simplified flow with fewer client-side operations
|
|
655
|
+
|
|
656
|
+
### Forwarder-Only Destination (No Destination Adapter)
|
|
657
|
+
|
|
658
|
+
When you don't have access to a wallet on the destination chain, use forwarder-only mode.
|
|
659
|
+
This is ideal for server-side transfers, custodial services, or when users don't have a wallet on the destination chain:
|
|
660
|
+
|
|
661
|
+
```typescript
|
|
662
|
+
const result = await kit.bridge({
|
|
663
|
+
from: { adapter, chain: 'Ethereum' },
|
|
664
|
+
to: {
|
|
665
|
+
recipientAddress: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e', // Recipient on destination
|
|
666
|
+
chain: 'Base',
|
|
667
|
+
useForwarder: true, // Required for forwarder-only
|
|
668
|
+
},
|
|
669
|
+
amount: '100.50',
|
|
670
|
+
})
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**Key differences from standard bridging:**
|
|
674
|
+
|
|
675
|
+
- No destination adapter required
|
|
676
|
+
- Mint confirmation is based on IRIS API response (not on-chain receipt)
|
|
677
|
+
- Mint step's `data` field will be `undefined`
|
|
678
|
+
|
|
679
|
+
**Relay fee handling:**
|
|
680
|
+
|
|
681
|
+
- Relay fee is automatically included in `maxFee` estimate
|
|
682
|
+
- Fee is deducted from the minted USDC at mint time
|
|
683
|
+
- Net received = burn amount - relay fee
|
|
684
|
+
|
|
685
|
+
```typescript
|
|
686
|
+
// Estimate includes relay fee when forwarder is enabled
|
|
687
|
+
const estimate = await kit.estimate({
|
|
688
|
+
from: { adapter, chain: 'Ethereum' },
|
|
689
|
+
to: {
|
|
690
|
+
recipientAddress: '0x...',
|
|
691
|
+
chain: 'Base',
|
|
692
|
+
useForwarder: true,
|
|
693
|
+
},
|
|
694
|
+
amount: '100.50',
|
|
695
|
+
})
|
|
696
|
+
|
|
697
|
+
console.log(estimate.maxFee) // Includes both burn fee and relay fee
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
> If you provide `config.maxFee` manually, include forwarder fees yourself.
|
|
701
|
+
> Auto-inclusion applies when the kit computes fees from route/speed.
|
|
702
|
+
>
|
|
703
|
+
> You can discover forwarder-capable chains with
|
|
704
|
+
> `kit.getSupportedChains({ forwarderSupported: true })`.
|
|
705
|
+
>
|
|
706
|
+
> See runnable examples at `examples/basic-usdc-transfer/src/forwarder-*.ts`.
|
|
707
|
+
|
|
618
708
|
## API Reference
|
|
619
709
|
|
|
620
710
|
### Core Methods
|
|
@@ -650,7 +740,14 @@ type BridgeDestination =
|
|
|
650
740
|
| {
|
|
651
741
|
adapter: Adapter // Adapter for the destination chain
|
|
652
742
|
chain: ChainIdentifier // Chain identifier
|
|
653
|
-
recipientAddress
|
|
743
|
+
recipientAddress?: string // Custom recipient address
|
|
744
|
+
useForwarder?: boolean // Enable Circle's Orbit relayer
|
|
745
|
+
}
|
|
746
|
+
| {
|
|
747
|
+
// Forwarder-only destination (no adapter required)
|
|
748
|
+
recipientAddress: string // Required: where to receive USDC
|
|
749
|
+
chain: ChainIdentifier // Chain identifier
|
|
750
|
+
useForwarder: true // Required: must be true
|
|
654
751
|
}
|
|
655
752
|
```
|
|
656
753
|
|