@circle-fin/app-kit 1.1.0 → 1.2.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 +43 -0
- package/README.md +30 -5
- package/chains.cjs +8 -8
- package/chains.d.ts +8 -8
- package/chains.mjs +8 -8
- package/index.cjs +289 -46
- package/index.d.ts +108 -27
- package/index.mjs +289 -46
- package/package.json +4 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @circle-fin/app-kit
|
|
2
|
+
|
|
3
|
+
## 1.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Enable forwarder destination support for Codex, Plume, and XDC chains on both mainnet and testnet
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Update HyperEVM explorer URLs to use the official Hyperliquid explorer
|
|
12
|
+
|
|
13
|
+
## 1.1.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- Add support for bridging USDC to and from Edge and Morph networks. Both mainnet and testnet chains are now available as source and destination options in Bridge Kit.
|
|
18
|
+
|
|
19
|
+
## 1.0.1
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Fix package installation failure where `npm install @circle-fin/app-kit` would error with unresolvable dependencies.
|
|
24
|
+
|
|
25
|
+
## 1.0.0
|
|
26
|
+
|
|
27
|
+
### Major Changes
|
|
28
|
+
|
|
29
|
+
- Introducing AppKit — a unified SDK for stablecoin operations combining bridging, swapping, and token transfers in one interface.
|
|
30
|
+
- `kit.bridge()` — cross-chain USDC transfers via CCTP v2 across 35+ supported chains
|
|
31
|
+
- `kit.swap()` — same-chain token swaps with smart routing across DEX liquidity sources
|
|
32
|
+
- `kit.send()` — same-chain transfers for USDC, USDT, native tokens, and any ERC-20/SPL token by contract address
|
|
33
|
+
|
|
34
|
+
Each operation has a corresponding estimate method (`estimateBridge`, `estimateSwap`, `estimateSend`) to preview fees and output amounts before executing.
|
|
35
|
+
|
|
36
|
+
Additional features:
|
|
37
|
+
- Unified developer fee configuration across all operations
|
|
38
|
+
- Action event system for monitoring operation lifecycle
|
|
39
|
+
- Tree-shakeable subpath imports (`/bridge`, `/swap`, `/chains`, `/context`)
|
|
40
|
+
- Full error hierarchy with type guards (`isRetryableError`, `isBalanceError`, `isRpcError`, etc.)
|
|
41
|
+
- Chain definitions available via `@circle-fin/app-kit/chains`
|
|
42
|
+
|
|
43
|
+
Configure your adapters once, then use bridge, swap, and send through a single API.
|
package/README.md
CHANGED
|
@@ -130,9 +130,9 @@ npm install @circle-fin/adapter-viem-v2 viem
|
|
|
130
130
|
yarn add @circle-fin/adapter-viem-v2 viem
|
|
131
131
|
|
|
132
132
|
# For EVM chains using Ethers.js
|
|
133
|
-
npm install @circle-fin/adapter-ethers-v6
|
|
133
|
+
npm install @circle-fin/adapter-ethers-v6 ethers
|
|
134
134
|
# or
|
|
135
|
-
yarn add @circle-fin/adapter-ethers-v6
|
|
135
|
+
yarn add @circle-fin/adapter-ethers-v6 ethers
|
|
136
136
|
|
|
137
137
|
# For Solana
|
|
138
138
|
npm install @circle-fin/adapter-solana @solana/web3.js @solana/spl-token
|
|
@@ -194,6 +194,9 @@ const result = await kit.swap({
|
|
|
194
194
|
tokenIn: 'USDC',
|
|
195
195
|
tokenOut: 'USDT',
|
|
196
196
|
amountIn: '100.0',
|
|
197
|
+
config: {
|
|
198
|
+
kitKey: process.env.KIT_KEY,
|
|
199
|
+
},
|
|
197
200
|
})
|
|
198
201
|
|
|
199
202
|
// Swap DAI to USDC (18 decimals handled automatically)
|
|
@@ -202,6 +205,9 @@ const daiSwap = await kit.swap({
|
|
|
202
205
|
tokenIn: 'DAI',
|
|
203
206
|
tokenOut: 'USDC',
|
|
204
207
|
amountIn: '500.0',
|
|
208
|
+
config: {
|
|
209
|
+
kitKey: process.env.KIT_KEY,
|
|
210
|
+
},
|
|
205
211
|
})
|
|
206
212
|
|
|
207
213
|
// Swap native ETH to stablecoin
|
|
@@ -210,6 +216,9 @@ const nativeSwap = await kit.swap({
|
|
|
210
216
|
tokenIn: 'NATIVE', // ETH on Ethereum
|
|
211
217
|
tokenOut: 'USDC',
|
|
212
218
|
amountIn: '1.5',
|
|
219
|
+
config: {
|
|
220
|
+
kitKey: process.env.KIT_KEY,
|
|
221
|
+
},
|
|
213
222
|
})
|
|
214
223
|
```
|
|
215
224
|
|
|
@@ -231,6 +240,9 @@ const swapEstimate = await kit.estimateSwap({
|
|
|
231
240
|
tokenIn: 'USDC',
|
|
232
241
|
tokenOut: 'USDT',
|
|
233
242
|
amountIn: '100.0',
|
|
243
|
+
config: {
|
|
244
|
+
kitKey: process.env.KIT_KEY,
|
|
245
|
+
},
|
|
234
246
|
})
|
|
235
247
|
|
|
236
248
|
console.log('Bridge fees:', bridgeEstimate.fees)
|
|
@@ -260,7 +272,7 @@ const allChains = kit.getSupportedChains()
|
|
|
260
272
|
|
|
261
273
|
### Send Parameters
|
|
262
274
|
|
|
263
|
-
The `send()` method
|
|
275
|
+
The `send()` method transfers tokens on the same chain from the source adapter to a recipient address or adapter:
|
|
264
276
|
|
|
265
277
|
```typescript
|
|
266
278
|
interface SendParams {
|
|
@@ -361,6 +373,9 @@ await kit.swap({
|
|
|
361
373
|
tokenIn: 'EURC',
|
|
362
374
|
tokenOut: 'USDC',
|
|
363
375
|
amountIn: '100.0',
|
|
376
|
+
config: {
|
|
377
|
+
kitKey: process.env.KIT_KEY,
|
|
378
|
+
},
|
|
364
379
|
})
|
|
365
380
|
|
|
366
381
|
// Swap DAI (18 decimals) to USDT
|
|
@@ -369,6 +384,9 @@ await kit.swap({
|
|
|
369
384
|
tokenIn: 'DAI',
|
|
370
385
|
tokenOut: 'USDT',
|
|
371
386
|
amountIn: '500.0', // SDK automatically handles 18-decimal precision
|
|
387
|
+
config: {
|
|
388
|
+
kitKey: process.env.KIT_KEY,
|
|
389
|
+
},
|
|
372
390
|
})
|
|
373
391
|
|
|
374
392
|
// Swap native token to stablecoin
|
|
@@ -377,6 +395,9 @@ await kit.swap({
|
|
|
377
395
|
tokenIn: 'NATIVE', // ETH on Ethereum
|
|
378
396
|
tokenOut: 'USDC',
|
|
379
397
|
amountIn: '2.5',
|
|
398
|
+
config: {
|
|
399
|
+
kitKey: process.env.KIT_KEY,
|
|
400
|
+
},
|
|
380
401
|
})
|
|
381
402
|
```
|
|
382
403
|
|
|
@@ -423,6 +444,7 @@ await kit.swap({
|
|
|
423
444
|
tokenOut: 'USDT',
|
|
424
445
|
amountIn: '1000',
|
|
425
446
|
config: {
|
|
447
|
+
kitKey: process.env.KIT_KEY,
|
|
426
448
|
customFee: {
|
|
427
449
|
value: '10',
|
|
428
450
|
recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0',
|
|
@@ -530,6 +552,9 @@ const result = await kit.swap({
|
|
|
530
552
|
tokenIn: 'USDC',
|
|
531
553
|
tokenOut: 'USDT',
|
|
532
554
|
amountIn: '100.0',
|
|
555
|
+
config: {
|
|
556
|
+
kitKey: process.env.KIT_KEY,
|
|
557
|
+
},
|
|
533
558
|
})
|
|
534
559
|
|
|
535
560
|
console.log('Swap result:', result)
|
|
@@ -538,7 +563,7 @@ console.log('Swap result:', result)
|
|
|
538
563
|
### Send to Different Address
|
|
539
564
|
|
|
540
565
|
```typescript
|
|
541
|
-
// Send to a different address
|
|
566
|
+
// Send to a different address on the same chain
|
|
542
567
|
const result = await kit.send({
|
|
543
568
|
from: { adapter, chain: 'Ethereum' },
|
|
544
569
|
to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
|
|
@@ -576,7 +601,7 @@ await kit.bridge({
|
|
|
576
601
|
|
|
577
602
|
### Core Methods
|
|
578
603
|
|
|
579
|
-
- `kit.send(params)` -
|
|
604
|
+
- `kit.send(params)` - Send tokens to a recipient on the same chain
|
|
580
605
|
- `kit.bridge(params)` - Execute cross-chain bridge operation
|
|
581
606
|
- `kit.swap(params)` - Execute same-chain swap operation
|
|
582
607
|
- `kit.estimateBridge(params)` - Get cost estimates for bridging
|
package/chains.cjs
CHANGED
|
@@ -1045,7 +1045,7 @@ const Codex = defineChain({
|
|
|
1045
1045
|
},
|
|
1046
1046
|
forwarderSupported: {
|
|
1047
1047
|
source: true,
|
|
1048
|
-
destination:
|
|
1048
|
+
destination: true,
|
|
1049
1049
|
},
|
|
1050
1050
|
},
|
|
1051
1051
|
kitContracts: {
|
|
@@ -1088,7 +1088,7 @@ const CodexTestnet = defineChain({
|
|
|
1088
1088
|
},
|
|
1089
1089
|
forwarderSupported: {
|
|
1090
1090
|
source: true,
|
|
1091
|
-
destination:
|
|
1091
|
+
destination: true,
|
|
1092
1092
|
},
|
|
1093
1093
|
},
|
|
1094
1094
|
kitContracts: {
|
|
@@ -1350,7 +1350,7 @@ const HyperEVM = defineChain({
|
|
|
1350
1350
|
},
|
|
1351
1351
|
chainId: 999,
|
|
1352
1352
|
isTestnet: false,
|
|
1353
|
-
explorerUrl: 'https://
|
|
1353
|
+
explorerUrl: 'https://app.hyperliquid.xyz/explorer/tx/{hash}',
|
|
1354
1354
|
rpcEndpoints: ['https://rpc.hyperliquid.xyz/evm'],
|
|
1355
1355
|
eurcAddress: null,
|
|
1356
1356
|
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
@@ -1395,7 +1395,7 @@ const HyperEVMTestnet = defineChain({
|
|
|
1395
1395
|
},
|
|
1396
1396
|
chainId: 998,
|
|
1397
1397
|
isTestnet: true,
|
|
1398
|
-
explorerUrl: 'https://
|
|
1398
|
+
explorerUrl: 'https://app.hyperliquid-testnet.xyz/explorer/tx/{hash}',
|
|
1399
1399
|
rpcEndpoints: ['https://rpc.hyperliquid-testnet.xyz/evm'],
|
|
1400
1400
|
eurcAddress: null,
|
|
1401
1401
|
usdcAddress: '0x2B3370eE501B4a559b57D449569354196457D8Ab',
|
|
@@ -2041,7 +2041,7 @@ const Plume = defineChain({
|
|
|
2041
2041
|
},
|
|
2042
2042
|
forwarderSupported: {
|
|
2043
2043
|
source: true,
|
|
2044
|
-
destination:
|
|
2044
|
+
destination: true,
|
|
2045
2045
|
},
|
|
2046
2046
|
},
|
|
2047
2047
|
kitContracts: {
|
|
@@ -2086,7 +2086,7 @@ const PlumeTestnet = defineChain({
|
|
|
2086
2086
|
},
|
|
2087
2087
|
forwarderSupported: {
|
|
2088
2088
|
source: true,
|
|
2089
|
-
destination:
|
|
2089
|
+
destination: true,
|
|
2090
2090
|
},
|
|
2091
2091
|
},
|
|
2092
2092
|
kitContracts: {
|
|
@@ -2864,7 +2864,7 @@ const XDC = defineChain({
|
|
|
2864
2864
|
},
|
|
2865
2865
|
forwarderSupported: {
|
|
2866
2866
|
source: true,
|
|
2867
|
-
destination:
|
|
2867
|
+
destination: true,
|
|
2868
2868
|
},
|
|
2869
2869
|
},
|
|
2870
2870
|
kitContracts: {
|
|
@@ -2908,7 +2908,7 @@ const XDCApothem = defineChain({
|
|
|
2908
2908
|
},
|
|
2909
2909
|
forwarderSupported: {
|
|
2910
2910
|
source: true,
|
|
2911
|
-
destination:
|
|
2911
|
+
destination: true,
|
|
2912
2912
|
},
|
|
2913
2913
|
},
|
|
2914
2914
|
kitContracts: {
|
package/chains.d.ts
CHANGED
|
@@ -471,7 +471,7 @@ declare const Codex: {
|
|
|
471
471
|
};
|
|
472
472
|
readonly forwarderSupported: {
|
|
473
473
|
readonly source: true;
|
|
474
|
-
readonly destination:
|
|
474
|
+
readonly destination: true;
|
|
475
475
|
};
|
|
476
476
|
};
|
|
477
477
|
readonly kitContracts: {
|
|
@@ -514,7 +514,7 @@ declare const CodexTestnet: {
|
|
|
514
514
|
};
|
|
515
515
|
readonly forwarderSupported: {
|
|
516
516
|
readonly source: true;
|
|
517
|
-
readonly destination:
|
|
517
|
+
readonly destination: true;
|
|
518
518
|
};
|
|
519
519
|
};
|
|
520
520
|
readonly kitContracts: {
|
|
@@ -640,7 +640,7 @@ declare const HyperEVM: {
|
|
|
640
640
|
};
|
|
641
641
|
readonly chainId: 999;
|
|
642
642
|
readonly isTestnet: false;
|
|
643
|
-
readonly explorerUrl: "https://
|
|
643
|
+
readonly explorerUrl: "https://app.hyperliquid.xyz/explorer/tx/{hash}";
|
|
644
644
|
readonly rpcEndpoints: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
645
645
|
readonly eurcAddress: null;
|
|
646
646
|
readonly usdcAddress: "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
@@ -685,7 +685,7 @@ declare const HyperEVMTestnet: {
|
|
|
685
685
|
};
|
|
686
686
|
readonly chainId: 998;
|
|
687
687
|
readonly isTestnet: true;
|
|
688
|
-
readonly explorerUrl: "https://
|
|
688
|
+
readonly explorerUrl: "https://app.hyperliquid-testnet.xyz/explorer/tx/{hash}";
|
|
689
689
|
readonly rpcEndpoints: readonly ["https://rpc.hyperliquid-testnet.xyz/evm"];
|
|
690
690
|
readonly eurcAddress: null;
|
|
691
691
|
readonly usdcAddress: "0x2B3370eE501B4a559b57D449569354196457D8Ab";
|
|
@@ -1024,7 +1024,7 @@ declare const Plume: {
|
|
|
1024
1024
|
};
|
|
1025
1025
|
readonly forwarderSupported: {
|
|
1026
1026
|
readonly source: true;
|
|
1027
|
-
readonly destination:
|
|
1027
|
+
readonly destination: true;
|
|
1028
1028
|
};
|
|
1029
1029
|
};
|
|
1030
1030
|
readonly kitContracts: {
|
|
@@ -1069,7 +1069,7 @@ declare const PlumeTestnet: {
|
|
|
1069
1069
|
};
|
|
1070
1070
|
readonly forwarderSupported: {
|
|
1071
1071
|
readonly source: true;
|
|
1072
|
-
readonly destination:
|
|
1072
|
+
readonly destination: true;
|
|
1073
1073
|
};
|
|
1074
1074
|
};
|
|
1075
1075
|
readonly kitContracts: {
|
|
@@ -1672,7 +1672,7 @@ declare const XDC: {
|
|
|
1672
1672
|
};
|
|
1673
1673
|
readonly forwarderSupported: {
|
|
1674
1674
|
readonly source: true;
|
|
1675
|
-
readonly destination:
|
|
1675
|
+
readonly destination: true;
|
|
1676
1676
|
};
|
|
1677
1677
|
};
|
|
1678
1678
|
readonly kitContracts: {
|
|
@@ -1716,7 +1716,7 @@ declare const XDCApothem: {
|
|
|
1716
1716
|
};
|
|
1717
1717
|
readonly forwarderSupported: {
|
|
1718
1718
|
readonly source: true;
|
|
1719
|
-
readonly destination:
|
|
1719
|
+
readonly destination: true;
|
|
1720
1720
|
};
|
|
1721
1721
|
};
|
|
1722
1722
|
readonly kitContracts: {
|
package/chains.mjs
CHANGED
|
@@ -1043,7 +1043,7 @@ const Codex = defineChain({
|
|
|
1043
1043
|
},
|
|
1044
1044
|
forwarderSupported: {
|
|
1045
1045
|
source: true,
|
|
1046
|
-
destination:
|
|
1046
|
+
destination: true,
|
|
1047
1047
|
},
|
|
1048
1048
|
},
|
|
1049
1049
|
kitContracts: {
|
|
@@ -1086,7 +1086,7 @@ const CodexTestnet = defineChain({
|
|
|
1086
1086
|
},
|
|
1087
1087
|
forwarderSupported: {
|
|
1088
1088
|
source: true,
|
|
1089
|
-
destination:
|
|
1089
|
+
destination: true,
|
|
1090
1090
|
},
|
|
1091
1091
|
},
|
|
1092
1092
|
kitContracts: {
|
|
@@ -1348,7 +1348,7 @@ const HyperEVM = defineChain({
|
|
|
1348
1348
|
},
|
|
1349
1349
|
chainId: 999,
|
|
1350
1350
|
isTestnet: false,
|
|
1351
|
-
explorerUrl: 'https://
|
|
1351
|
+
explorerUrl: 'https://app.hyperliquid.xyz/explorer/tx/{hash}',
|
|
1352
1352
|
rpcEndpoints: ['https://rpc.hyperliquid.xyz/evm'],
|
|
1353
1353
|
eurcAddress: null,
|
|
1354
1354
|
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
@@ -1393,7 +1393,7 @@ const HyperEVMTestnet = defineChain({
|
|
|
1393
1393
|
},
|
|
1394
1394
|
chainId: 998,
|
|
1395
1395
|
isTestnet: true,
|
|
1396
|
-
explorerUrl: 'https://
|
|
1396
|
+
explorerUrl: 'https://app.hyperliquid-testnet.xyz/explorer/tx/{hash}',
|
|
1397
1397
|
rpcEndpoints: ['https://rpc.hyperliquid-testnet.xyz/evm'],
|
|
1398
1398
|
eurcAddress: null,
|
|
1399
1399
|
usdcAddress: '0x2B3370eE501B4a559b57D449569354196457D8Ab',
|
|
@@ -2039,7 +2039,7 @@ const Plume = defineChain({
|
|
|
2039
2039
|
},
|
|
2040
2040
|
forwarderSupported: {
|
|
2041
2041
|
source: true,
|
|
2042
|
-
destination:
|
|
2042
|
+
destination: true,
|
|
2043
2043
|
},
|
|
2044
2044
|
},
|
|
2045
2045
|
kitContracts: {
|
|
@@ -2084,7 +2084,7 @@ const PlumeTestnet = defineChain({
|
|
|
2084
2084
|
},
|
|
2085
2085
|
forwarderSupported: {
|
|
2086
2086
|
source: true,
|
|
2087
|
-
destination:
|
|
2087
|
+
destination: true,
|
|
2088
2088
|
},
|
|
2089
2089
|
},
|
|
2090
2090
|
kitContracts: {
|
|
@@ -2862,7 +2862,7 @@ const XDC = defineChain({
|
|
|
2862
2862
|
},
|
|
2863
2863
|
forwarderSupported: {
|
|
2864
2864
|
source: true,
|
|
2865
|
-
destination:
|
|
2865
|
+
destination: true,
|
|
2866
2866
|
},
|
|
2867
2867
|
},
|
|
2868
2868
|
kitContracts: {
|
|
@@ -2906,7 +2906,7 @@ const XDCApothem = defineChain({
|
|
|
2906
2906
|
},
|
|
2907
2907
|
forwarderSupported: {
|
|
2908
2908
|
source: true,
|
|
2909
|
-
destination:
|
|
2909
|
+
destination: true,
|
|
2910
2910
|
},
|
|
2911
2911
|
},
|
|
2912
2912
|
kitContracts: {
|