@circle-fin/app-kit 1.2.0 → 1.3.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 +20 -0
- package/README.md +6 -2
- package/chains.cjs +77 -5
- package/chains.d.ts +4 -3
- package/chains.mjs +77 -5
- package/index.cjs +1388 -940
- package/index.d.ts +62 -14
- package/index.mjs +1388 -940
- package/package.json +31 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @circle-fin/app-kit
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add `retryBridge()` method to AppKit for retrying failed or incomplete cross-chain bridge operations.
|
|
8
|
+
- Add Arc Testnet support for swap operations.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Swap slippage and stop-limit failures now return a distinct retryable error instead of fatal "route not found"
|
|
13
|
+
- Bridge operations now automatically retry transient RPC errors with exponential backoff
|
|
14
|
+
- Update HyperEVM mainnet explorer URL to resolve location-restricted access issues
|
|
15
|
+
- Improved search discoverability
|
|
16
|
+
|
|
17
|
+
## 1.2.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Add support for Solana as a forwarder destination
|
|
22
|
+
|
|
3
23
|
## 1.2.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
8
8
|
[](https://discord.com/invite/buildoncircle)
|
|
9
9
|
|
|
10
|
-
**A
|
|
10
|
+
**A one-stop Circle SDK for building stablecoin (e.g. USDC) applications, providing a unified set of on-chain tools for bridging, swapping, and other stablecoin operations.**
|
|
11
11
|
|
|
12
|
-
_Making cross-chain transfers
|
|
12
|
+
_Making cross-chain transfers, same-chain swaps, and token sends as simple as a single function call_
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -72,6 +72,10 @@ The App Kit provides a **unified interface** for both cross-chain transfers and
|
|
|
72
72
|
- **🛡️ Robust error handling**: Graceful partial success recovery
|
|
73
73
|
- **✈️ Pre-flight validation**: Verify operations with cost estimation before execution
|
|
74
74
|
|
|
75
|
+
## Developer Documentation
|
|
76
|
+
|
|
77
|
+
- [App Kit Documentation](https://docs.arc.network/app-kit)
|
|
78
|
+
|
|
75
79
|
## Architecture Flow
|
|
76
80
|
|
|
77
81
|
The App Kit follows a composable architecture that integrates Bridge Kit and Swap Kit:
|
package/chains.cjs
CHANGED
|
@@ -168,8 +168,9 @@ var Blockchain;
|
|
|
168
168
|
/**
|
|
169
169
|
* Enum representing chains that support same-chain swaps through the Swap Kit.
|
|
170
170
|
*
|
|
171
|
-
* Unlike the full {@link Blockchain} enum, SwapChain includes
|
|
172
|
-
* networks
|
|
171
|
+
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
172
|
+
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
173
|
+
* where adapter contracts are deployed (CCTPv2 support).
|
|
173
174
|
*
|
|
174
175
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
175
176
|
* automatically work when adapter contracts and supported tokens are deployed.
|
|
@@ -214,6 +215,8 @@ var SwapChain;
|
|
|
214
215
|
SwapChain["XDC"] = "XDC";
|
|
215
216
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
216
217
|
SwapChain["Monad"] = "Monad";
|
|
218
|
+
// Testnet chains with swap support
|
|
219
|
+
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
217
220
|
})(SwapChain || (SwapChain = {}));
|
|
218
221
|
// -----------------------------------------------------------------------------
|
|
219
222
|
// Bridge Chain Enum (CCTPv2 Supported Chains)
|
|
@@ -310,6 +313,31 @@ var BridgeChain;
|
|
|
310
313
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
311
314
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
312
315
|
})(BridgeChain || (BridgeChain = {}));
|
|
316
|
+
// -----------------------------------------------------------------------------
|
|
317
|
+
// Earn Chain Enum
|
|
318
|
+
// -----------------------------------------------------------------------------
|
|
319
|
+
/**
|
|
320
|
+
* Enumeration of blockchains that support earn (vault deposit/withdraw)
|
|
321
|
+
* operations through the Earn Kit.
|
|
322
|
+
*
|
|
323
|
+
* Currently only Ethereum mainnet is supported. Additional chains
|
|
324
|
+
* will be added as vault protocol support expands.
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* import { EarnChain } from '@core/chains'
|
|
329
|
+
*
|
|
330
|
+
* const result = await earnKit.deposit({
|
|
331
|
+
* from: { adapter, chain: EarnChain.Ethereum },
|
|
332
|
+
* vaultAddress: '0x...',
|
|
333
|
+
* amount: '100',
|
|
334
|
+
* })
|
|
335
|
+
* ```
|
|
336
|
+
*/
|
|
337
|
+
var EarnChain;
|
|
338
|
+
(function (EarnChain) {
|
|
339
|
+
EarnChain["Ethereum"] = "Ethereum";
|
|
340
|
+
})(EarnChain || (EarnChain = {}));
|
|
313
341
|
|
|
314
342
|
/**
|
|
315
343
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -612,6 +640,14 @@ const BRIDGE_CONTRACT_EVM_MAINNET = '0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0'
|
|
|
612
640
|
* on EVM-compatible chains. Use this address for mainnet adapter integrations.
|
|
613
641
|
*/
|
|
614
642
|
const ADAPTER_CONTRACT_EVM_MAINNET = '0x7FB8c7260b63934d8da38aF902f87ae6e284a845';
|
|
643
|
+
/**
|
|
644
|
+
* The adapter contract address for EVM testnet networks.
|
|
645
|
+
*
|
|
646
|
+
* This contract serves as an adapter for integrating with various protocols
|
|
647
|
+
* on EVM-compatible testnet chains. Use this address for testnet adapter
|
|
648
|
+
* integrations (e.g., Arc Testnet).
|
|
649
|
+
*/
|
|
650
|
+
const ADAPTER_CONTRACT_EVM_TESTNET = '0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b';
|
|
615
651
|
|
|
616
652
|
/**
|
|
617
653
|
* Arc Testnet chain definition
|
|
@@ -660,6 +696,7 @@ const ArcTestnet = defineChain({
|
|
|
660
696
|
},
|
|
661
697
|
kitContracts: {
|
|
662
698
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
699
|
+
adapter: ADAPTER_CONTRACT_EVM_TESTNET,
|
|
663
700
|
},
|
|
664
701
|
});
|
|
665
702
|
|
|
@@ -1350,7 +1387,7 @@ const HyperEVM = defineChain({
|
|
|
1350
1387
|
},
|
|
1351
1388
|
chainId: 999,
|
|
1352
1389
|
isTestnet: false,
|
|
1353
|
-
explorerUrl: 'https://
|
|
1390
|
+
explorerUrl: 'https://hyperevmscan.io/tx/{hash}',
|
|
1354
1391
|
rpcEndpoints: ['https://rpc.hyperliquid.xyz/evm'],
|
|
1355
1392
|
eurcAddress: null,
|
|
1356
1393
|
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
@@ -2458,7 +2495,7 @@ const Solana = defineChain({
|
|
|
2458
2495
|
},
|
|
2459
2496
|
forwarderSupported: {
|
|
2460
2497
|
source: true,
|
|
2461
|
-
destination:
|
|
2498
|
+
destination: true,
|
|
2462
2499
|
},
|
|
2463
2500
|
},
|
|
2464
2501
|
kitContracts: {
|
|
@@ -2505,7 +2542,7 @@ const SolanaDevnet = defineChain({
|
|
|
2505
2542
|
},
|
|
2506
2543
|
forwarderSupported: {
|
|
2507
2544
|
source: true,
|
|
2508
|
-
destination:
|
|
2545
|
+
destination: true,
|
|
2509
2546
|
},
|
|
2510
2547
|
},
|
|
2511
2548
|
kitContracts: {
|
|
@@ -3177,6 +3214,41 @@ zod.z.union([
|
|
|
3177
3214
|
message: `Chain "${chainDef.name}" (${chainDef.chain}) is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
3178
3215
|
})),
|
|
3179
3216
|
]);
|
|
3217
|
+
/**
|
|
3218
|
+
* Zod schema for validating earn-specific chain identifiers.
|
|
3219
|
+
*
|
|
3220
|
+
* Validate that the provided chain is supported for earn (vault
|
|
3221
|
+
* deposit/withdraw) operations. Currently only Ethereum is
|
|
3222
|
+
* supported.
|
|
3223
|
+
*
|
|
3224
|
+
* Accept an EarnChain enum value, a matching string literal, or
|
|
3225
|
+
* a ChainDefinition for a supported chain.
|
|
3226
|
+
*
|
|
3227
|
+
* @example
|
|
3228
|
+
* ```typescript
|
|
3229
|
+
* import { earnChainIdentifierSchema } from '@core/chains'
|
|
3230
|
+
* import { EarnChain, Ethereum } from '@core/chains'
|
|
3231
|
+
*
|
|
3232
|
+
* // Valid
|
|
3233
|
+
* earnChainIdentifierSchema.parse(EarnChain.Ethereum)
|
|
3234
|
+
* earnChainIdentifierSchema.parse('Ethereum')
|
|
3235
|
+
* earnChainIdentifierSchema.parse(Ethereum)
|
|
3236
|
+
*
|
|
3237
|
+
* // Invalid (throws ZodError)
|
|
3238
|
+
* earnChainIdentifierSchema.parse('Solana')
|
|
3239
|
+
* ```
|
|
3240
|
+
*/
|
|
3241
|
+
zod.z.union([
|
|
3242
|
+
zod.z.string().refine((val) => val in EarnChain, (val) => ({
|
|
3243
|
+
message: `"${val}" is not a supported earn chain. ` +
|
|
3244
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
3245
|
+
})),
|
|
3246
|
+
zod.z.nativeEnum(EarnChain),
|
|
3247
|
+
chainDefinitionSchema.refine((chain) => chain.chain in EarnChain, (chain) => ({
|
|
3248
|
+
message: `"${chain.chain}" is not a supported earn chain. ` +
|
|
3249
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
3250
|
+
})),
|
|
3251
|
+
]);
|
|
3180
3252
|
|
|
3181
3253
|
/**
|
|
3182
3254
|
* @packageDocumentation
|
package/chains.d.ts
CHANGED
|
@@ -136,6 +136,7 @@ declare const ArcTestnet: {
|
|
|
136
136
|
};
|
|
137
137
|
readonly kitContracts: {
|
|
138
138
|
readonly bridge: "0xC5567a5E3370d4DBfB0540025078e283e36A363d";
|
|
139
|
+
readonly adapter: "0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b";
|
|
139
140
|
};
|
|
140
141
|
};
|
|
141
142
|
|
|
@@ -640,7 +641,7 @@ declare const HyperEVM: {
|
|
|
640
641
|
};
|
|
641
642
|
readonly chainId: 999;
|
|
642
643
|
readonly isTestnet: false;
|
|
643
|
-
readonly explorerUrl: "https://
|
|
644
|
+
readonly explorerUrl: "https://hyperevmscan.io/tx/{hash}";
|
|
644
645
|
readonly rpcEndpoints: readonly ["https://rpc.hyperliquid.xyz/evm"];
|
|
645
646
|
readonly eurcAddress: null;
|
|
646
647
|
readonly usdcAddress: "0xb88339CB7199b77E23DB6E890353E22632Ba630f";
|
|
@@ -1393,7 +1394,7 @@ declare const Solana: {
|
|
|
1393
1394
|
};
|
|
1394
1395
|
readonly forwarderSupported: {
|
|
1395
1396
|
readonly source: true;
|
|
1396
|
-
readonly destination:
|
|
1397
|
+
readonly destination: true;
|
|
1397
1398
|
};
|
|
1398
1399
|
};
|
|
1399
1400
|
readonly kitContracts: {
|
|
@@ -1440,7 +1441,7 @@ declare const SolanaDevnet: {
|
|
|
1440
1441
|
};
|
|
1441
1442
|
readonly forwarderSupported: {
|
|
1442
1443
|
readonly source: true;
|
|
1443
|
-
readonly destination:
|
|
1444
|
+
readonly destination: true;
|
|
1444
1445
|
};
|
|
1445
1446
|
};
|
|
1446
1447
|
readonly kitContracts: {
|
package/chains.mjs
CHANGED
|
@@ -166,8 +166,9 @@ var Blockchain;
|
|
|
166
166
|
/**
|
|
167
167
|
* Enum representing chains that support same-chain swaps through the Swap Kit.
|
|
168
168
|
*
|
|
169
|
-
* Unlike the full {@link Blockchain} enum, SwapChain includes
|
|
170
|
-
* networks
|
|
169
|
+
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
170
|
+
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
171
|
+
* where adapter contracts are deployed (CCTPv2 support).
|
|
171
172
|
*
|
|
172
173
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
173
174
|
* automatically work when adapter contracts and supported tokens are deployed.
|
|
@@ -212,6 +213,8 @@ var SwapChain;
|
|
|
212
213
|
SwapChain["XDC"] = "XDC";
|
|
213
214
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
214
215
|
SwapChain["Monad"] = "Monad";
|
|
216
|
+
// Testnet chains with swap support
|
|
217
|
+
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
215
218
|
})(SwapChain || (SwapChain = {}));
|
|
216
219
|
// -----------------------------------------------------------------------------
|
|
217
220
|
// Bridge Chain Enum (CCTPv2 Supported Chains)
|
|
@@ -308,6 +311,31 @@ var BridgeChain;
|
|
|
308
311
|
BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
|
|
309
312
|
BridgeChain["XDC_Apothem"] = "XDC_Apothem";
|
|
310
313
|
})(BridgeChain || (BridgeChain = {}));
|
|
314
|
+
// -----------------------------------------------------------------------------
|
|
315
|
+
// Earn Chain Enum
|
|
316
|
+
// -----------------------------------------------------------------------------
|
|
317
|
+
/**
|
|
318
|
+
* Enumeration of blockchains that support earn (vault deposit/withdraw)
|
|
319
|
+
* operations through the Earn Kit.
|
|
320
|
+
*
|
|
321
|
+
* Currently only Ethereum mainnet is supported. Additional chains
|
|
322
|
+
* will be added as vault protocol support expands.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* ```typescript
|
|
326
|
+
* import { EarnChain } from '@core/chains'
|
|
327
|
+
*
|
|
328
|
+
* const result = await earnKit.deposit({
|
|
329
|
+
* from: { adapter, chain: EarnChain.Ethereum },
|
|
330
|
+
* vaultAddress: '0x...',
|
|
331
|
+
* amount: '100',
|
|
332
|
+
* })
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
var EarnChain;
|
|
336
|
+
(function (EarnChain) {
|
|
337
|
+
EarnChain["Ethereum"] = "Ethereum";
|
|
338
|
+
})(EarnChain || (EarnChain = {}));
|
|
311
339
|
|
|
312
340
|
/**
|
|
313
341
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -610,6 +638,14 @@ const BRIDGE_CONTRACT_EVM_MAINNET = '0xB3FA262d0fB521cc93bE83d87b322b8A23DAf3F0'
|
|
|
610
638
|
* on EVM-compatible chains. Use this address for mainnet adapter integrations.
|
|
611
639
|
*/
|
|
612
640
|
const ADAPTER_CONTRACT_EVM_MAINNET = '0x7FB8c7260b63934d8da38aF902f87ae6e284a845';
|
|
641
|
+
/**
|
|
642
|
+
* The adapter contract address for EVM testnet networks.
|
|
643
|
+
*
|
|
644
|
+
* This contract serves as an adapter for integrating with various protocols
|
|
645
|
+
* on EVM-compatible testnet chains. Use this address for testnet adapter
|
|
646
|
+
* integrations (e.g., Arc Testnet).
|
|
647
|
+
*/
|
|
648
|
+
const ADAPTER_CONTRACT_EVM_TESTNET = '0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b';
|
|
613
649
|
|
|
614
650
|
/**
|
|
615
651
|
* Arc Testnet chain definition
|
|
@@ -658,6 +694,7 @@ const ArcTestnet = defineChain({
|
|
|
658
694
|
},
|
|
659
695
|
kitContracts: {
|
|
660
696
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
697
|
+
adapter: ADAPTER_CONTRACT_EVM_TESTNET,
|
|
661
698
|
},
|
|
662
699
|
});
|
|
663
700
|
|
|
@@ -1348,7 +1385,7 @@ const HyperEVM = defineChain({
|
|
|
1348
1385
|
},
|
|
1349
1386
|
chainId: 999,
|
|
1350
1387
|
isTestnet: false,
|
|
1351
|
-
explorerUrl: 'https://
|
|
1388
|
+
explorerUrl: 'https://hyperevmscan.io/tx/{hash}',
|
|
1352
1389
|
rpcEndpoints: ['https://rpc.hyperliquid.xyz/evm'],
|
|
1353
1390
|
eurcAddress: null,
|
|
1354
1391
|
usdcAddress: '0xb88339CB7199b77E23DB6E890353E22632Ba630f',
|
|
@@ -2456,7 +2493,7 @@ const Solana = defineChain({
|
|
|
2456
2493
|
},
|
|
2457
2494
|
forwarderSupported: {
|
|
2458
2495
|
source: true,
|
|
2459
|
-
destination:
|
|
2496
|
+
destination: true,
|
|
2460
2497
|
},
|
|
2461
2498
|
},
|
|
2462
2499
|
kitContracts: {
|
|
@@ -2503,7 +2540,7 @@ const SolanaDevnet = defineChain({
|
|
|
2503
2540
|
},
|
|
2504
2541
|
forwarderSupported: {
|
|
2505
2542
|
source: true,
|
|
2506
|
-
destination:
|
|
2543
|
+
destination: true,
|
|
2507
2544
|
},
|
|
2508
2545
|
},
|
|
2509
2546
|
kitContracts: {
|
|
@@ -3175,6 +3212,41 @@ z.union([
|
|
|
3175
3212
|
message: `Chain "${chainDef.name}" (${chainDef.chain}) is not supported for bridging. Only chains in the BridgeChain enum support CCTPv2 bridging.`,
|
|
3176
3213
|
})),
|
|
3177
3214
|
]);
|
|
3215
|
+
/**
|
|
3216
|
+
* Zod schema for validating earn-specific chain identifiers.
|
|
3217
|
+
*
|
|
3218
|
+
* Validate that the provided chain is supported for earn (vault
|
|
3219
|
+
* deposit/withdraw) operations. Currently only Ethereum is
|
|
3220
|
+
* supported.
|
|
3221
|
+
*
|
|
3222
|
+
* Accept an EarnChain enum value, a matching string literal, or
|
|
3223
|
+
* a ChainDefinition for a supported chain.
|
|
3224
|
+
*
|
|
3225
|
+
* @example
|
|
3226
|
+
* ```typescript
|
|
3227
|
+
* import { earnChainIdentifierSchema } from '@core/chains'
|
|
3228
|
+
* import { EarnChain, Ethereum } from '@core/chains'
|
|
3229
|
+
*
|
|
3230
|
+
* // Valid
|
|
3231
|
+
* earnChainIdentifierSchema.parse(EarnChain.Ethereum)
|
|
3232
|
+
* earnChainIdentifierSchema.parse('Ethereum')
|
|
3233
|
+
* earnChainIdentifierSchema.parse(Ethereum)
|
|
3234
|
+
*
|
|
3235
|
+
* // Invalid (throws ZodError)
|
|
3236
|
+
* earnChainIdentifierSchema.parse('Solana')
|
|
3237
|
+
* ```
|
|
3238
|
+
*/
|
|
3239
|
+
z.union([
|
|
3240
|
+
z.string().refine((val) => val in EarnChain, (val) => ({
|
|
3241
|
+
message: `"${val}" is not a supported earn chain. ` +
|
|
3242
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
3243
|
+
})),
|
|
3244
|
+
z.nativeEnum(EarnChain),
|
|
3245
|
+
chainDefinitionSchema.refine((chain) => chain.chain in EarnChain, (chain) => ({
|
|
3246
|
+
message: `"${chain.chain}" is not a supported earn chain. ` +
|
|
3247
|
+
`Supported chains: ${Object.values(EarnChain).join(', ')}`,
|
|
3248
|
+
})),
|
|
3249
|
+
]);
|
|
3178
3250
|
|
|
3179
3251
|
/**
|
|
3180
3252
|
* @packageDocumentation
|