@circle-fin/app-kit 1.8.1 → 1.9.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 CHANGED
@@ -1,5 +1,38 @@
1
1
  # @circle-fin/app-kit
2
2
 
3
+ ## 1.9.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add support for bridging USDC to and from Cronos (mainnet and testnet) via CCTP v2.
8
+ - Support `token: 'EURC'` in App Kit `send()` and `estimateSend()`.
9
+
10
+ `EURC` is now a recognized token alias alongside `USDC`, `USDT`, and `NATIVE`.
11
+ On chains where EURC is deployed (the chain definition's `eurcAddress` is set,
12
+ e.g. Arc Testnet), `send({ token: 'EURC', ... })` resolves the EURC contract
13
+ address and routes the transfer through the generic token transfer action with
14
+ 6 decimals. On chains without an `eurcAddress`, `EURC` is rejected with an
15
+ `INPUT_UNSUPPORTED_TOKEN` error.
16
+
17
+ Previously `send()` rejected `token: 'EURC'` outright — even on chains where
18
+ EURC was configured — because `EURC` was not in the send token alias list.
19
+
20
+ - Add a `headers` config option to forward custom HTTP headers with CCTP
21
+ attestation API requests.
22
+
23
+ `CCTPV2Config`, `BridgeKitConfig`, and the AppKit context now accept an optional
24
+ `headers` map. The headers are sent with every Circle attestation (Iris) API
25
+ request the CCTP v2 provider makes — attestation fetch, re-attestation, and
26
+ relayer mint status polling — and are merged on top of the SDK defaults (such
27
+ as `Content-Type`) rather than replacing them.
28
+
29
+ ### Patch Changes
30
+
31
+ - Fix withdrawal fee metadata being dropped, and correctly surface errors for pending profit-and-loss (PnL) calculations.
32
+ - Fix a missing runtime dependency (`@coral-xyz/anchor`, `@noble/curves`, `bn.js`,
33
+ `@ethersproject/keccak256`, and `pino`) that could cause `Could not find package`
34
+ errors under strict module resolvers (Deno, Supabase Edge Runtime, pnpm).
35
+
3
36
  ## 1.8.1
4
37
 
5
38
  ### Patch Changes
@@ -68,6 +101,7 @@
68
101
 
69
102
  - Enable Circle's Forwarding Service as a destination for Solana (mainnet and devnet). A Gateway `spend` with `useForwarder: true` to a Solana destination is now accepted instead of being rejected.
70
103
  - Add cross-chain swap support to SwapKit, AppKit, and the Stablecoin Service swap provider.
104
+
71
105
  - `swap` and `estimate` can now route the output token to another supported chain with `to.chain`.
72
106
  - Cross-chain swaps can send the output to a recipient on the destination chain with `to.recipientAddress`.
73
107
  - `getSwapStatus` and `waitForSwap` can now track cross-chain swaps until they finish, including progress details for source and destination activity.
@@ -75,6 +109,7 @@
75
109
  - Invalid transaction hashes or unsupported chain values are reported as structured validation errors before a status request is sent.
76
110
 
77
111
  - Add `getTokenRates` to SwapKit and AppKit for fetching USD rates for tokens on a chain.
112
+
78
113
  - Look up rates by registered token symbol, native token alias (`NATIVE`, `ETH`, `POL`, etc.), raw EVM token address, or Solana mint.
79
114
  - Token symbols are resolved through the kit token registry for the requested chain.
80
115
  - Native tokens are normalized to the service native-token address before the request is sent.
@@ -88,6 +123,7 @@
88
123
  | Code | Name | Type | Recoverability |
89
124
  | ------ | ------------- | --------- | -------------- |
90
125
  | `8104` | `EARN_PAUSED` | `SERVICE` | `RETRYABLE` |
126
+
91
127
  - `@circle-fin/earn-kit` / `@circle-fin/app-kit`: the publicly re-exported
92
128
  `EarnError` registry now includes `EARN_PAUSED`. Consumers that branch on
93
129
  `EarnError` (or on `recoverability`) gain this value and can detect the
@@ -133,6 +169,7 @@
133
169
  A cross-chain `deposit()` returns an `execId` while the bridge (source burn ->
134
170
  CCTP attestation -> destination mint) is still settling. Two new kit methods let
135
171
  you follow it:
172
+
136
173
  - `kit.getCrossChainDepositStatus({ execId })` - read the deposit's current
137
174
  bridge status (source, CCTP, and destination hops) once.
138
175
  - `kit.waitForCrossChainDeposit({ execId, pollIntervalMs?, maxWaitMs?, signal? })`
@@ -150,6 +187,7 @@
150
187
  - Surface the source-collected bridge fees in cross-chain Earn deposit quotes, and let callers pick the CCTP transfer speed.
151
188
 
152
189
  New:
190
+
153
191
  - `getDepositQuote` now accepts a cross-chain variant: pass a destination `chain` and `address` that differ from `from.chain` (same `SameChain` / `CrossChain` discriminator pattern as `deposit()`). Same-chain quotes are unchanged.
154
192
  - Cross-chain quotes return the source-collected bridge fees in `EarnDepositQuoteInfo.fees` as one entry per fee item. Each entry carries its own `type` (e.g. `'FORWARD'`, `'PRE_FINALITY'`) and `status` (e.g. `'estimated'` for a pre-sign estimate). Same-chain quotes return `fees: []`.
155
193
  - Cross-chain `deposit()` and `getDepositQuote()` accept an optional `transferSpeed` (`'FAST'` | `'SLOW'`), forwarded to the bridge prepare request so the quote prices — and the deposit burns — the chosen CCTP finality path.
@@ -159,6 +197,7 @@
159
197
  - The cross-chain pre-sign value guard is now fee-aware: the prepared bundle's `feeQuote` (`feeToken` + `items[]`) is parsed, the fee token is pinned to the source token contract, and the signed authorization `value` is checked against `principal + sum(feeQuote.items[].amount)` rather than the principal alone, so fee-bearing deposits are accepted while any other value tampering is still rejected before signing.
160
198
 
161
199
  Notes:
200
+
162
201
  - The cross-chain fees are pre-sign **estimates** sourced from the bridge prepare path; the value shown at quote time may differ from the amount locked at deposit/sign. This is signalled per fee via `status: 'estimated'`.
163
202
  - Existing same-chain `getDepositQuote` callers are unaffected — the response shape is unchanged for same-chain quotes.
164
203
 
@@ -167,6 +206,7 @@
167
206
  Cross-chain deposits use the same nested `from`/`to` input shape as the other kits: `from: { adapter, chain }` is the source signer and `to: { chain, recipientAddress }` is the Earn destination. `from.chain` and `to.chain` are constrained at compile time to the supported route (Ethereum Sepolia, Arbitrum Sepolia, or Base Sepolia as sources; Arc Testnet as the destination), the source adapter must support `signTypedData`, and amounts accept at most 6 decimal places (USDC precision). Cross-chain results report the bridge `execId`, an API-defined bridge lifecycle `status`, `sourceChain`/`destinationChain`, and the prepared bundle expiry.
168
207
 
169
208
  Every published name keeps its existing shape; cross-chain support lands under new names:
209
+
170
210
  - `EarnDepositOutcome` is the new union of `EarnSameChainDepositResult | EarnCrossChainDepositResult`. Narrow with `result.kind === 'cross-chain'` — `kind` is always set at runtime, but optional on the same-chain member so the pre-cross-chain result shape remains assignable.
171
211
  - `AnyDepositParams` (kit) and `AnyDepositServiceParams` (provider) are the new param unions of the same-chain and cross-chain variants; `anyDepositParamsSchema` is the matching validation schema.
172
212
  - `deposit()` gains overloads: same-chain params resolve to `EarnSameChainDepositResult`, cross-chain params to `EarnCrossChainDepositResult`, so existing same-chain call sites keep their narrow result type.
@@ -174,11 +214,13 @@
174
214
  - `EarningProvider` gains an **optional** `supportsCrossChainDeposit(source, destination)` method (mirroring swap-kit's route-aware `supportsRoute`). The kit only routes cross-chain deposits to providers that implement it and return `true`; existing provider implementations keep compiling and never receive cross-chain params.
175
215
 
176
216
  Deprecations (existing aliases keep working):
217
+
177
218
  - `EarnDepositResult` — use `EarnSameChainDepositResult`, or `EarnDepositOutcome` for cross-chain-aware code. This alias may repoint to `EarnDepositOutcome` in the next major.
178
219
  - `DepositParams` / `DepositServiceParams` — use `SameChainDepositParams` / `SameChainDepositServiceParams`, or the `Any*` unions for cross-chain-aware code.
179
220
  - `depositParamsSchema` — use `anyDepositParamsSchema`, which also accepts cross-chain deposit params.
180
221
 
181
222
  Type changes (diagnostic types only):
223
+
182
224
  - `EarnErrorTrace`: the deposit variant's `params` is now `AnyDepositServiceParams`, and `steps` may include `EarnBridgeDepositStep` entries for cross-chain deposits.
183
225
  - `EarningProvider.retry()` and `EarnKit.retry()` may now resolve to `EarnCrossChainDepositResult` when resuming a cross-chain deposit.
184
226
  - `EarnActionName` gains `'crossChainDeposit'`.
@@ -192,6 +234,7 @@
192
234
  - EarnKit now validates amount precision and format locally to match the Earn
193
235
  Service, so malformed amounts fail fast with a clear SDK error instead of a
194
236
  server round-trip.
237
+
195
238
  - Same-chain deposit/withdraw/quote amounts are now capped at 6 decimal places
196
239
  (USDC/EURC), matching the server and the existing cross-chain amount schema.
197
240
  Previously up to 18 decimal places passed local validation and only the
@@ -329,6 +372,7 @@
329
372
  ### Major Changes
330
373
 
331
374
  - Introducing AppKit — a unified SDK for stablecoin operations combining bridging, swapping, and token transfers in one interface.
375
+
332
376
  - `kit.bridge()` — cross-chain USDC transfers via CCTP v2 across 35+ supported chains
333
377
  - `kit.swap()` — same-chain token swaps with smart routing across DEX liquidity sources
334
378
  - `kit.send()` — same-chain transfers for USDC, USDT, native tokens, and any ERC-20/SPL token by contract address
@@ -336,6 +380,7 @@
336
380
  Each operation has a corresponding estimate method (`estimateBridge`, `estimateSwap`, `estimateSend`) to preview fees and output amounts before executing.
337
381
 
338
382
  Additional features:
383
+
339
384
  - Unified developer fee configuration across all operations
340
385
  - Action event system for monitoring operation lifecycle
341
386
  - Tree-shakeable subpath imports (`/bridge`, `/swap`, `/chains`, `/context`)
package/README.md CHANGED
@@ -65,9 +65,9 @@ The App Kit provides a **unified interface** for cross-chain transfers, same-cha
65
65
  - **🔧 Bring your own infrastructure**: Seamlessly integrate with your existing setup when needed
66
66
  - **🔒 Production-ready security**: Leverages Circle's CCTPv2 for bridging and trusted swap providers
67
67
  - **🚀 Developer experience**: Complete TypeScript support, comprehensive validation, and instant connectivity
68
- - **🌍 Multi-chain support**: Bridge across **45 chains** with **968 total bridge routes** through Circle's CCTPv2
69
- - **Mainnet (22 chains)**: Arbitrum, Avalanche, Base, Codex, Edge, Ethereum, HyperEVM, Injective, Ink, Linea, Monad, Morph, OP Mainnet, Pharos, Plume, Polygon PoS, Sei, Solana, Sonic, Unichain, World Chain, XDC
70
- - **Testnet (23 chains)**: Arc Testnet, Arbitrum Sepolia, Avalanche Fuji, Base Sepolia, Codex Testnet, Edge Testnet, Ethereum Sepolia, HyperEVM Testnet, Injective Testnet, Ink Testnet, Linea Sepolia, Monad Testnet, Morph Testnet, OP Sepolia, Pharos Atlantic, Plume Testnet, Polygon PoS Amoy, Sei Testnet, Solana Devnet, Sonic Testnet, Unichain Sepolia, World Chain Sepolia, XDC Apothem
68
+ - **🌍 Multi-chain support**: Bridge across **47 chains** with **1058 total bridge routes** through Circle's CCTPv2
69
+ - **Mainnet (23 chains)**: Arbitrum, Avalanche, Base, Codex, Cronos, Edge, Ethereum, HyperEVM, Injective, Ink, Linea, Monad, Morph, OP Mainnet, Pharos, Plume, Polygon PoS, Sei, Solana, Sonic, Unichain, World Chain, XDC
70
+ - **Testnet (24 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, Plume Testnet, Polygon PoS Amoy, Sei Testnet, Solana Devnet, Sonic Testnet, Unichain Sepolia, World Chain Sepolia, XDC Apothem
71
71
  - **🔄 Swap support**: Same-chain token swaps powered by Circle's Stablecoin Service
72
72
  - **🏦 Earn support**: DeFi lending vault deposits, withdrawals, and reward claims via `kit.earn`
73
73
  - **🎯 Flexible adapters**: Supporting EVM (Viem, Ethers) and Solana (@solana/web3)