@circle-fin/app-kit 1.5.1 → 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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @circle-fin/app-kit
2
2
 
3
+ ## 1.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Add a "coming soon" disclosure to the Earn Kit product entry in the README, and replace placeholder vault addresses with the mock testnet vault address (`0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88`) in all examples.
8
+
9
+ ## 1.6.0
10
+
11
+ ### Minor Changes
12
+
13
+ - AppKit now exposes Earn operations through `kit.earn`, including supported-chain discovery and re-exports of Earn-related types.
14
+
3
15
  ## 1.5.1
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -28,6 +28,7 @@ _Making cross-chain transfers, same-chain swaps, unified balance management, and
28
28
  - [📊 Estimate Operations](#-estimate-operations)
29
29
  - [🔍 Query Supported Chains](#-query-supported-chains)
30
30
  - [💰 Unified Balance](#-unified-balance)
31
+ - [🏦 Earn](#-earn)
31
32
  - [Configuration](#configuration)
32
33
  - [Send Parameters](#send-parameters)
33
34
  - [Swap Parameters](#swap-parameters)
@@ -54,11 +55,11 @@ _Making cross-chain transfers, same-chain swaps, unified balance management, and
54
55
 
55
56
  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.
56
57
 
57
- The App Kit provides a **unified interface** for cross-chain transfers, same-chain swaps, and unified balance management, abstracting away the complexity of choosing between operations. It combines the power of Bridge Kit, Swap Kit, and Unified Balance Kit into a single, cohesive API.
58
+ The App Kit provides a **unified interface** for cross-chain transfers, same-chain swaps, earn vault operations, and unified balance management, abstracting away the complexity of choosing between operations. It combines the power of Bridge Kit, Swap Kit, Earn Kit, and Unified Balance Kit into a single, cohesive API.
58
59
 
59
60
  ### Why App Kit?
60
61
 
61
- - **🎯 Unified interface**: Single API for bridge, swap, and unified balance operations
62
+ - **🎯 Unified interface**: Single API for bridge, swap, earn, and unified balance operations
62
63
  - **🤖 Smart routing**: Automatically selects the appropriate operation (bridge vs swap)
63
64
  - **⚡ Zero-config defaults**: Built-in reliable RPC endpoints - start building right away
64
65
  - **🔧 Bring your own infrastructure**: Seamlessly integrate with your existing setup when needed
@@ -68,6 +69,7 @@ The App Kit provides a **unified interface** for cross-chain transfers, same-cha
68
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
69
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
70
71
  - **🔄 Swap support**: Same-chain token swaps powered by Circle's Stablecoin Service
72
+ - **🏦 Earn support**: DeFi lending vault deposits, withdrawals, and reward claims via `kit.earn`
71
73
  - **🎯 Flexible adapters**: Supporting EVM (Viem, Ethers) and Solana (@solana/web3)
72
74
  - **📡 Real-time event monitoring**: Track progress throughout the operation lifecycle
73
75
  - **🛡️ Robust error handling**: Graceful partial success recovery
@@ -79,40 +81,40 @@ The App Kit provides a **unified interface** for cross-chain transfers, same-cha
79
81
 
80
82
  ## Architecture Flow
81
83
 
82
- The App Kit follows a composable architecture that integrates Bridge Kit, Swap Kit, and Unified Balance Kit:
84
+ The App Kit follows a composable architecture that integrates Bridge Kit, Swap Kit, Unified Balance Kit, and Earn Kit:
83
85
 
84
86
  ```text
85
- ┌─────────────────────────────────────────────────────────────┐
86
- App Kit
87
- (Unified Interface)
88
- └────────────────────────────┬────────────────────────────────┘
89
-
90
- ┌────────────┼─────────────┐
91
-
92
-
93
- ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────────┐
94
- Bridge Kit │ │ Swap Kit │ │ Unified Balance Kit
95
- │ (Cross-Chain) │ │ (Same-Chain) │ │ (Cross-Chain)
96
- └────────┬────────┘ └────────┬────────┘ └──────────┬──────────┘
97
-
98
-
99
- ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────────┐
100
- Provider │ │ Provider │ │ Provider
101
- (CCTPv2) │ │ (Service) │ │ (Gateway v1)
102
- └────────┬────────┘ └────────┬────────┘ └──────────┬──────────┘
103
-
104
- └───────────────────┼─────────────────────┘
105
-
106
-
107
- ┌─────────────────┐
108
- │ Adapter │
109
- │ (Blockchain) │
110
- └─────────────────┘
87
+ ┌──────────────────────────────────────────────────────────────────────────┐
88
+ App Kit
89
+ (Unified Interface)
90
+ └───────────────────────────────────┬──────────────────────────────────────┘
91
+
92
+ ┌────────────────┬───────────┴──────┬──────────────────┐
93
+
94
+
95
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ ┌──────────────┐
96
+ Bridge Kit │ │ Swap Kit │ │ Unified Balance │ Earn Kit
97
+ │ (Cross-Chain)│ │ (Same-Chain) │ │ Kit │ │ (Vaults)
98
+ └──────┬───────┘ └──────┬───────┘ └────────┬─────────┘ └──────┬───────┘
99
+
100
+
101
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────────┐ ┌──────────────┐
102
+ Provider │ │ Provider │ │ Provider │ │ Provider
103
+ (CCTPv2) │ │ (Service) │ │ (Gateway v1) │ (Earn) │
104
+ └──────┬───────┘ └──────┬───────┘ └────────┬─────────┘ └──────┬───────┘
105
+
106
+ └────────────────┴───────────┬──────┴──────────────────┘
107
+
108
+
109
+ ┌─────────────────┐
110
+ │ Adapter │
111
+ │ (Blockchain) │
112
+ └─────────────────┘
111
113
  ```
112
114
 
113
115
  1. **Adapter**: Handles blockchain-specific operations (wallets, transactions, gas)
114
- 2. **Provider**: Implements protocols (CCTPv2 for bridging, Circle Service for swaps, Gateway for unified balance)
115
- 3. **Bridge/Swap/Unified Balance Kit**: Specialized kits for each operation type
116
+ 2. **Provider**: Implements protocols (CCTPv2 for bridging, Circle Service for swaps, Gateway for unified balance, Earn for vaults)
117
+ 3. **Bridge/Swap/Unified Balance/Earn Kit**: Specialized kits for each operation type
116
118
  4. **App Kit**: Unified orchestration layer providing a consistent API
117
119
 
118
120
  This separation ensures that each component has a single responsibility while maintaining seamless integration across the entire stablecoin operation lifecycle.
@@ -264,7 +266,7 @@ console.log(
264
266
  Check which chains support specific operations:
265
267
 
266
268
  ```typescript
267
- // Get all chains (bridge, swap, and unified balance)
269
+ // Get all chains (bridge, swap, earn, and unified balance)
268
270
  const allChains = kit.getSupportedChains()
269
271
 
270
272
  // Get all chains that support bridging
@@ -273,6 +275,9 @@ const bridgeChains = kit.getSupportedChains('bridge')
273
275
  // Get all chains that support swapping
274
276
  const swapChains = kit.getSupportedChains('swap')
275
277
 
278
+ // Get chains that support earn vault operations
279
+ const earnChains = kit.getSupportedChains('earn')
280
+
276
281
  // Get chains that support unified balance operations
277
282
  const ubChains = kit.getSupportedChains('unifiedBalance')
278
283
  ```
@@ -333,6 +338,50 @@ kit.on('unifiedBalance.gateway.spend.succeeded', (payload) => {
333
338
 
334
339
  For the full Unified Balance API, see the [`@circle-fin/unified-balance-kit` README](../unified-balance-kit/README.md).
335
340
 
341
+ ### 🏦 Earn
342
+
343
+ > **Note:** Earn Kit is coming soon. The APIs documented here are published for early integration and feedback; vault availability and production readiness will be announced ahead of general availability.
344
+
345
+ Deposit into and withdraw from DeFi lending vaults, claim rewards, and query positions:
346
+
347
+ ```typescript
348
+ import { AppKit, EarnChain } from '@circle-fin/app-kit'
349
+ import { createViemAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2'
350
+
351
+ const kit = new AppKit()
352
+ const adapter = createViemAdapterFromPrivateKey({
353
+ privateKey: process.env.PRIVATE_KEY as string,
354
+ })
355
+
356
+ // Preview a deposit
357
+ const quote = await kit.earn.getDepositQuote({
358
+ from: { adapter, chain: EarnChain.Arc_Testnet },
359
+ vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
360
+ amount: '100.50',
361
+ })
362
+
363
+ // Execute the deposit
364
+ await kit.earn.deposit({
365
+ from: { adapter, chain: EarnChain.Arc_Testnet },
366
+ vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
367
+ amount: '100.50',
368
+ })
369
+
370
+ // Query a vault position
371
+ const position = await kit.earn.getPosition({
372
+ from: { adapter, chain: EarnChain.Arc_Testnet },
373
+ vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
374
+ })
375
+
376
+ // Claim accrued rewards
377
+ await kit.earn.claimRewards({
378
+ from: { adapter, chain: EarnChain.Arc_Testnet },
379
+ vaultAddress: '0xAabbeF1D3971c710276ed41eC791BbE14CdB8E88',
380
+ })
381
+ ```
382
+
383
+ For the full Earn API, see the [`@circle-fin/earn-kit` README](../earn-kit/README.md).
384
+
336
385
  ## Configuration
337
386
 
338
387
  ### Send Parameters
@@ -672,11 +721,12 @@ await kit.bridge({
672
721
  - `kit.estimateBridge(params)` - Get cost estimates for bridging
673
722
  - `kit.estimateSwap(params)` - Get cost estimates for swapping
674
723
  - `kit.estimateSend(params)` - Get cost estimates for send operation
675
- - `kit.getSupportedChains(operationType?)` - Query supported chains by operation type (`'bridge'`, `'swap'`, `'unifiedBalance'`)
724
+ - `kit.getSupportedChains(operationType?)` - Query supported chains by operation type (`'bridge'`, `'swap'`, `'earn'`, `'unifiedBalance'`)
676
725
  - `kit.setCustomFeePolicy(policy)` - Set kit-level custom fee policy
677
726
  - `kit.on(event, handler)` - Listen to operation events
678
727
  - `kit.off(event, handler)` - Remove event listener
679
728
  - `kit.unifiedBalance.*` - Unified balance operations (deposit, spend, getBalances, estimateSpend, delegates, and more). See the [`@circle-fin/unified-balance-kit` README](../unified-balance-kit/README.md) for the full API.
729
+ - `kit.earn.*` - Earn vault operations (deposit, withdraw, claimRewards, getVaults, getPosition, and quote helpers). See the [`@circle-fin/earn-kit` README](../earn-kit/README.md) for the full API.
680
730
 
681
731
  ## Development
682
732
 
package/chains.cjs CHANGED
@@ -379,23 +379,21 @@ var UnifiedBalanceChain;
379
379
  * Enumeration of blockchains that support earn (vault deposit/withdraw)
380
380
  * operations through the Earn Kit.
381
381
  *
382
- * Currently only Ethereum mainnet is supported. Additional chains
383
- * will be added as vault protocol support expands.
384
- *
385
382
  * @example
386
383
  * ```typescript
387
384
  * import { EarnChain } from '@core/chains'
388
385
  *
389
386
  * const result = await earnKit.deposit({
390
- * from: { adapter, chain: EarnChain.Ethereum },
387
+ * from: { adapter, chain: EarnChain.Arc_Testnet },
391
388
  * vaultAddress: '0x...',
392
389
  * amount: '100',
393
390
  * })
394
391
  * ```
395
392
  */
393
+ // Values must match Blockchain enum members exactly.
396
394
  var EarnChain;
397
395
  (function (EarnChain) {
398
- EarnChain["Ethereum"] = "Ethereum";
396
+ EarnChain["Arc_Testnet"] = "Arc_Testnet";
399
397
  })(EarnChain || (EarnChain = {}));
400
398
 
401
399
  /**
@@ -3931,7 +3929,7 @@ zod.z.union([
3931
3929
  * Zod schema for validating earn-specific chain identifiers.
3932
3930
  *
3933
3931
  * Validate that the provided chain is supported for earn (vault
3934
- * deposit/withdraw) operations. Currently only Ethereum is
3932
+ * deposit/withdraw) operations. Currently only Arc Testnet is
3935
3933
  * supported.
3936
3934
  *
3937
3935
  * Accept an EarnChain enum value, a matching string literal, or
@@ -3940,12 +3938,12 @@ zod.z.union([
3940
3938
  * @example
3941
3939
  * ```typescript
3942
3940
  * import { earnChainIdentifierSchema } from '@core/chains'
3943
- * import { EarnChain, Ethereum } from '@core/chains'
3941
+ * import { ArcTestnet, EarnChain } from '@core/chains'
3944
3942
  *
3945
3943
  * // Valid
3946
- * earnChainIdentifierSchema.parse(EarnChain.Ethereum)
3947
- * earnChainIdentifierSchema.parse('Ethereum')
3948
- * earnChainIdentifierSchema.parse(Ethereum)
3944
+ * earnChainIdentifierSchema.parse(EarnChain.Arc_Testnet)
3945
+ * earnChainIdentifierSchema.parse('Arc_Testnet')
3946
+ * earnChainIdentifierSchema.parse(ArcTestnet)
3949
3947
  *
3950
3948
  * // Invalid (throws ZodError)
3951
3949
  * earnChainIdentifierSchema.parse('Solana')
package/chains.mjs CHANGED
@@ -377,23 +377,21 @@ var UnifiedBalanceChain;
377
377
  * Enumeration of blockchains that support earn (vault deposit/withdraw)
378
378
  * operations through the Earn Kit.
379
379
  *
380
- * Currently only Ethereum mainnet is supported. Additional chains
381
- * will be added as vault protocol support expands.
382
- *
383
380
  * @example
384
381
  * ```typescript
385
382
  * import { EarnChain } from '@core/chains'
386
383
  *
387
384
  * const result = await earnKit.deposit({
388
- * from: { adapter, chain: EarnChain.Ethereum },
385
+ * from: { adapter, chain: EarnChain.Arc_Testnet },
389
386
  * vaultAddress: '0x...',
390
387
  * amount: '100',
391
388
  * })
392
389
  * ```
393
390
  */
391
+ // Values must match Blockchain enum members exactly.
394
392
  var EarnChain;
395
393
  (function (EarnChain) {
396
- EarnChain["Ethereum"] = "Ethereum";
394
+ EarnChain["Arc_Testnet"] = "Arc_Testnet";
397
395
  })(EarnChain || (EarnChain = {}));
398
396
 
399
397
  /**
@@ -3929,7 +3927,7 @@ z.union([
3929
3927
  * Zod schema for validating earn-specific chain identifiers.
3930
3928
  *
3931
3929
  * Validate that the provided chain is supported for earn (vault
3932
- * deposit/withdraw) operations. Currently only Ethereum is
3930
+ * deposit/withdraw) operations. Currently only Arc Testnet is
3933
3931
  * supported.
3934
3932
  *
3935
3933
  * Accept an EarnChain enum value, a matching string literal, or
@@ -3938,12 +3936,12 @@ z.union([
3938
3936
  * @example
3939
3937
  * ```typescript
3940
3938
  * import { earnChainIdentifierSchema } from '@core/chains'
3941
- * import { EarnChain, Ethereum } from '@core/chains'
3939
+ * import { ArcTestnet, EarnChain } from '@core/chains'
3942
3940
  *
3943
3941
  * // Valid
3944
- * earnChainIdentifierSchema.parse(EarnChain.Ethereum)
3945
- * earnChainIdentifierSchema.parse('Ethereum')
3946
- * earnChainIdentifierSchema.parse(Ethereum)
3942
+ * earnChainIdentifierSchema.parse(EarnChain.Arc_Testnet)
3943
+ * earnChainIdentifierSchema.parse('Arc_Testnet')
3944
+ * earnChainIdentifierSchema.parse(ArcTestnet)
3947
3945
  *
3948
3946
  * // Invalid (throws ZodError)
3949
3947
  * earnChainIdentifierSchema.parse('Solana')