@circle-fin/app-kit 1.15.3 → 1.17.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +91 -0
  2. package/README.md +5 -2
  3. package/borrow.cjs +28146 -0
  4. package/borrow.cjs.map +1 -0
  5. package/borrow.d.cts +10752 -0
  6. package/borrow.d.mts +10752 -0
  7. package/borrow.d.ts +10752 -0
  8. package/borrow.mjs +28118 -0
  9. package/borrow.mjs.map +1 -0
  10. package/bridge.cjs +2084 -328
  11. package/bridge.d.cts +121 -18
  12. package/bridge.d.mts +121 -18
  13. package/bridge.d.ts +121 -18
  14. package/bridge.mjs +2084 -328
  15. package/chains.cjs +78 -7
  16. package/chains.d.cts +2 -0
  17. package/chains.d.mts +2 -0
  18. package/chains.d.ts +2 -0
  19. package/chains.mjs +78 -7
  20. package/context.cjs +1 -0
  21. package/context.d.cts +121 -18
  22. package/context.d.mts +121 -18
  23. package/context.d.ts +121 -18
  24. package/context.mjs +1 -0
  25. package/earn.cjs +5322 -3219
  26. package/earn.d.cts +1149 -984
  27. package/earn.d.mts +1149 -984
  28. package/earn.d.ts +1149 -984
  29. package/earn.mjs +5322 -3219
  30. package/estimateBridge.cjs +2082 -326
  31. package/estimateBridge.d.cts +121 -18
  32. package/estimateBridge.d.mts +121 -18
  33. package/estimateBridge.d.ts +121 -18
  34. package/estimateBridge.mjs +2082 -326
  35. package/estimateSwap.cjs +8817 -6974
  36. package/estimateSwap.d.cts +169 -18
  37. package/estimateSwap.d.mts +169 -18
  38. package/estimateSwap.d.ts +169 -18
  39. package/estimateSwap.mjs +8822 -6979
  40. package/index.cjs +33149 -20719
  41. package/index.d.cts +23174 -2736
  42. package/index.d.mts +23174 -2736
  43. package/index.d.ts +23174 -2736
  44. package/index.mjs +33090 -20713
  45. package/package.json +17 -7
  46. package/server.cjs +133 -12
  47. package/server.d.cts +29 -10
  48. package/server.d.mts +29 -10
  49. package/server.d.ts +29 -10
  50. package/server.mjs +133 -12
  51. package/swap.cjs +8817 -6974
  52. package/swap.d.cts +169 -18
  53. package/swap.d.mts +169 -18
  54. package/swap.d.ts +169 -18
  55. package/swap.mjs +8822 -6979
  56. package/unifiedBalance.cjs +528 -138
  57. package/unifiedBalance.d.cts +108 -11
  58. package/unifiedBalance.d.mts +108 -11
  59. package/unifiedBalance.d.ts +108 -11
  60. package/unifiedBalance.mjs +528 -138
package/CHANGELOG.md CHANGED
@@ -1,5 +1,96 @@
1
1
  # @circle-fin/app-kit
2
2
 
3
+ ## 1.17.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add Cronos and Morph as swap networks. Cronos supports the native CRO, USDC,
8
+ EURC, USDT, WETH, DAI, and WBTC aliases. Morph supports the native ETH, USDC,
9
+ USDT, and WETH aliases.
10
+ - Update the Borrow Kit dependency to the release that adds the `@circle-fin/borrow-kit/chains` subpath. No changes are needed for `kit.borrow` calls: `@circle-fin/app-kit/chains` already exports `Arc` and `ArcTestnet`.
11
+ - Show how a swap is routed, and which fees the route charges.
12
+
13
+ - Swap estimates and results include an optional `route`: the provider that routed the swap (for example `lifi` or `circle`) and each swap or bridge step, with its tool, tokens, and amounts. Types: `SwapRoute`, `SwapRouteStep`, `SwapRouteStepEstimate`, `SwapRouteToken`.
14
+ - Treat `route.provider` as an opaque string. New providers can appear without an SDK update.
15
+ - Provider-specific details are on the optional `metadata` field of the route and of each step. For example, Circle CCTP steps include the source and destination domains.
16
+ - Route details are for display only. If the SDK does not recognise a step, `steps` is empty rather than incomplete, and an unrecognised route is omitted. The estimate or swap still succeeds.
17
+ - Each entry in `fees` can include `component`, the provider's name for the fee (for example `FORWARD` or `PRE_FINALITY`), and `chain`, the chain where it is charged.
18
+ - Estimates for direct Circle CCTP routes now show an approximate gas fee instead of zero. The actual gas is still estimated when the swap runs.
19
+ - `getSwapStatus` and `waitForSwap` track Circle-routed swaps with no code changes.
20
+
21
+ - Add `EarnError.SHARES_LOCKED` (`EARN_SHARES_LOCKED`, code 1107). Earn
22
+ operations throw it when a Veda vault rejects the call because the vault
23
+ shares are still inside the share lock period after a deposit. The error is
24
+ not retryable right away: wait for the lock period to end, then try again.
25
+
26
+ Veda vault reverts now give readable messages instead of raw error
27
+ selectors. For example, a revert now says that the vault is paused or that
28
+ the deposit would exceed the vault deposit cap. This works with both the
29
+ default and `/next` adapter entries, and with browser wallets.
30
+
31
+ - Add `batchTransactions` to `SwapConfig`. Swaps that need an ERC-20 approval send the approval and the swap as one atomic batch when the connected wallet supports it, which is the default. Set `config: { batchTransactions: false }` to send them as two transactions instead, approval first. Use this if your wallet rejects batched calls or under-estimates gas on complex routes. Non-boolean values are now rejected with a validation error.
32
+
33
+ ### Patch Changes
34
+
35
+ - Respect Circle's per-route availability for CCTPx. When Circle disables CCTPx for a token on a source or destination chain:
36
+
37
+ - `supportsRoute` returns `false` for that route, so the kit no longer selects CCTPx for a transfer the service would refuse to quote.
38
+ - A quote request for that route throws a `FATAL` `InputError.UNSUPPORTED_ROUTE` instead of a `RETRYABLE` `ServiceError.INTERNAL_ERROR`, so retry loops stop instead of waiting for a recovery that will not come.
39
+ - `CCTPXTokenDeployment` exposes an optional `enabled?: boolean` field, so custom UIs can show whether a deployment is available. Responses that omit the field are treated as enabled.
40
+
41
+ ## 1.16.0
42
+
43
+ ### Minor Changes
44
+
45
+ - Add Borrow Kit to App Kit under `kit.borrow`:
46
+
47
+ ```ts
48
+ import { AppKit, BorrowChain } from "@circle-fin/app-kit";
49
+
50
+ const kit = new AppKit();
51
+
52
+ const result = await kit.borrow.borrow({
53
+ from: { adapter, chain: BorrowChain.Arc },
54
+ marketId: "0x...",
55
+ borrowAmount: "100",
56
+ });
57
+ ```
58
+
59
+ - Every Borrow Kit operation except `getSupportedChains` is available on
60
+ `kit.borrow`, including `retry`, and forwards App Kit's `disableAnalytics`
61
+ and `disableErrorReporting`.
62
+ - List borrow chains with `kit.getSupportedChains('borrow')`. Calling
63
+ `kit.getSupportedChains()` with no operation type now includes them, and
64
+ the standalone operation is exported as `borrowGetSupportedChains`.
65
+ - Borrow step events are namespaced: `kit.on('borrow.execute', handler)` and
66
+ `kit.on('*', handler)` both receive borrow progress.
67
+ - `@circle-fin/app-kit/borrow` exports the same operations as standalone
68
+ functions for tree-shaking.
69
+ - Borrow Kit's types, schemas and standalone operations are re-exported from
70
+ the package root, prefixed with `Borrow` wherever the name does not already
71
+ contain it (for example `BorrowLoanInfo`, `borrowRepay`).
72
+
73
+ - Default the destination of FAST cross-chain deposits to Arc. When `config.transferSpeed` is `'FAST'` and `to` is omitted, `deposit`, `depositFor`, and `estimateDeposit` now credit the Gateway balance on `Arc` for mainnet sources and `Arc_Testnet` for testnet sources instead of throwing. Passing `to` explicitly still selects any other supported fast-finality destination, and `estimateDeposit` echoes the resolved `to` so `deposit({ ...estimate, from })` targets the same chain.
74
+
75
+ Setting `allowanceStrategy` on a FAST deposit now fails with "cannot be set for FAST cross-chain deposits". A STANDARD deposit that sets both `to` and `allowanceStrategy` now reports the invalid `to` instead.
76
+
77
+ ### Patch Changes
78
+
79
+ - Stop replacing a validation error with a `TypeError` when the rejected value
80
+ holds a `bigint`.
81
+
82
+ Building a validation error serializes the offending value into the message.
83
+ `JSON.stringify` refuses `bigint` and circular structures, so a value that
84
+ carried either — an on-chain read, or a transaction receipt log, both of which
85
+ routinely hold `bigint` fields — threw
86
+ `TypeError: Do not know how to serialize a BigInt` from inside the error
87
+ constructor. The real error never surfaced, and callers saw an unrelated crash
88
+ in its place.
89
+
90
+ Such values now render with their `bigint` fields as strings, and a value that
91
+ still cannot be serialized renders as `[unserializable object]`. The error's
92
+ `cause.trace.value` is unchanged and still carries the raw value.
93
+
3
94
  ## 1.15.3
4
95
 
5
96
  ### Patch Changes
package/README.md CHANGED
@@ -266,7 +266,7 @@ console.log(
266
266
  Check which chains support specific operations:
267
267
 
268
268
  ```typescript
269
- // Get all chains (bridge, swap, earn, and unified balance)
269
+ // Get all chains (bridge, swap, earn, borrow, and unified balance)
270
270
  const allChains = kit.getSupportedChains()
271
271
 
272
272
  // Get all chains that support bridging
@@ -278,6 +278,9 @@ const swapChains = kit.getSupportedChains('swap')
278
278
  // Get chains that support earn vault operations
279
279
  const earnChains = kit.getSupportedChains('earn')
280
280
 
281
+ // Get chains that support borrow operations
282
+ const borrowChains = kit.getSupportedChains('borrow')
283
+
281
284
  // Get chains that support unified balance operations
282
285
  const ubChains = kit.getSupportedChains('unifiedBalance')
283
286
  ```
@@ -793,7 +796,7 @@ await kit.bridge({
793
796
  - `kit.getSwapStatus(params)` - Fetch the current status of a swap
794
797
  - `kit.waitForSwap(params)` - Poll until a swap reaches a terminal status
795
798
  - `kit.getTokenRates(params)` - Fetch cached token USD rates
796
- - `kit.getSupportedChains(operationType?)` - Query supported chains by operation type (`'bridge'`, `'swap'`, `'earn'`, `'unifiedBalance'`)
799
+ - `kit.getSupportedChains(operationType?)` - Query supported chains by operation type (`'bridge'`, `'swap'`, `'earn'`, `'borrow'`, `'unifiedBalance'`)
797
800
  - `kit.setCustomFeePolicy(policy)` - Set operation-scoped custom fee policies
798
801
  - `kit.removeCustomFeePolicy(operation)` - Remove an operation-scoped custom fee policy
799
802
  - `kit.on(event, handler)` - Listen to operation events