@circle-fin/app-kit 1.15.3 → 1.16.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 +53 -0
- package/README.md +5 -2
- package/borrow.cjs +28028 -0
- package/borrow.cjs.map +1 -0
- package/borrow.d.cts +10723 -0
- package/borrow.d.mts +10723 -0
- package/borrow.d.ts +10723 -0
- package/borrow.mjs +28000 -0
- package/borrow.mjs.map +1 -0
- package/bridge.cjs +1885 -276
- package/bridge.d.cts +86 -12
- package/bridge.d.mts +86 -12
- package/bridge.d.ts +86 -12
- package/bridge.mjs +1885 -276
- package/chains.cjs +70 -3
- package/chains.d.cts +2 -0
- package/chains.d.mts +2 -0
- package/chains.d.ts +2 -0
- package/chains.mjs +70 -3
- package/context.cjs +1 -0
- package/context.d.cts +86 -12
- package/context.d.mts +86 -12
- package/context.d.ts +86 -12
- package/context.mjs +1 -0
- package/earn.cjs +4981 -3314
- package/earn.d.cts +1117 -981
- package/earn.d.mts +1117 -981
- package/earn.d.ts +1117 -981
- package/earn.mjs +4981 -3314
- package/estimateBridge.cjs +1883 -274
- package/estimateBridge.d.cts +86 -12
- package/estimateBridge.d.mts +86 -12
- package/estimateBridge.d.ts +86 -12
- package/estimateBridge.mjs +1883 -274
- package/estimateSwap.cjs +8554 -6931
- package/estimateSwap.d.cts +86 -12
- package/estimateSwap.d.mts +86 -12
- package/estimateSwap.d.ts +86 -12
- package/estimateSwap.mjs +8503 -6880
- package/index.cjs +30943 -18928
- package/index.d.cts +23051 -2742
- package/index.d.mts +23051 -2742
- package/index.d.ts +23051 -2742
- package/index.mjs +30884 -18922
- package/package.json +17 -7
- package/server.cjs +101 -6
- package/server.mjs +101 -6
- package/swap.cjs +8554 -6931
- package/swap.d.cts +86 -12
- package/swap.d.mts +86 -12
- package/swap.d.ts +86 -12
- package/swap.mjs +8503 -6880
- package/unifiedBalance.cjs +457 -128
- package/unifiedBalance.d.cts +108 -11
- package/unifiedBalance.d.mts +108 -11
- package/unifiedBalance.d.ts +108 -11
- package/unifiedBalance.mjs +457 -128
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@circle-fin/app-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "A one-stop Circle SDK solution for building stablecoin (e.g. USDC) applications, with bridging, swapping, and more on-chain operations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"circle",
|
|
@@ -36,12 +36,13 @@
|
|
|
36
36
|
"module": "./index.mjs",
|
|
37
37
|
"types": "./index.d.cts",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@circle-fin/onramp-kit": "1.0.
|
|
40
|
-
"@circle-fin/unified-balance-kit": "1.
|
|
41
|
-
"@circle-fin/provider-gateway-v1": "1.5.
|
|
42
|
-
"@circle-fin/earn-kit": "1.8.
|
|
43
|
-
"@circle-fin/
|
|
44
|
-
"@circle-fin/
|
|
39
|
+
"@circle-fin/onramp-kit": "1.0.3",
|
|
40
|
+
"@circle-fin/unified-balance-kit": "1.8.0",
|
|
41
|
+
"@circle-fin/provider-gateway-v1": "1.5.1",
|
|
42
|
+
"@circle-fin/earn-kit": "1.8.1",
|
|
43
|
+
"@circle-fin/borrow-kit": "1.0.0",
|
|
44
|
+
"@circle-fin/bridge-kit": "1.15.2",
|
|
45
|
+
"@circle-fin/swap-kit": "1.7.1",
|
|
45
46
|
"@coral-xyz/anchor": "^0.31.1",
|
|
46
47
|
"@noble/curves": "1.4.2",
|
|
47
48
|
"bn.js": "^5.2.3",
|
|
@@ -117,6 +118,14 @@
|
|
|
117
118
|
"import": "./earn.mjs",
|
|
118
119
|
"require": "./earn.cjs"
|
|
119
120
|
},
|
|
121
|
+
"./borrow": {
|
|
122
|
+
"types": {
|
|
123
|
+
"import": "./borrow.d.mts",
|
|
124
|
+
"require": "./borrow.d.cts"
|
|
125
|
+
},
|
|
126
|
+
"import": "./borrow.mjs",
|
|
127
|
+
"require": "./borrow.cjs"
|
|
128
|
+
},
|
|
120
129
|
"./estimateSwap": {
|
|
121
130
|
"types": {
|
|
122
131
|
"import": "./estimateSwap.d.mts",
|
|
@@ -152,6 +161,7 @@
|
|
|
152
161
|
"estimateSwap.*",
|
|
153
162
|
"unifiedBalance.*",
|
|
154
163
|
"earn.*",
|
|
164
|
+
"borrow.*",
|
|
155
165
|
"index.*",
|
|
156
166
|
"server.*",
|
|
157
167
|
"README.md",
|
package/server.cjs
CHANGED
|
@@ -639,6 +639,34 @@ class KitError extends Error {
|
|
|
639
639
|
}
|
|
640
640
|
};
|
|
641
641
|
|
|
642
|
+
/**
|
|
643
|
+
* Render an object value for an error message without letting the rendering
|
|
644
|
+
* itself throw.
|
|
645
|
+
*
|
|
646
|
+
* `JSON.stringify` rejects `BigInt` and circular structures, and a rejected
|
|
647
|
+
* value is exactly the kind of thing a validation error is built from: an
|
|
648
|
+
* on-chain read or a receipt log carries `bigint` fields, so serializing one
|
|
649
|
+
* naively replaces the intended error with a `TypeError`.
|
|
650
|
+
*
|
|
651
|
+
* @param value - The value to render.
|
|
652
|
+
* @returns A JSON string with `bigint` fields stringified, or
|
|
653
|
+
* `'[unserializable object]'` if serialization still fails.
|
|
654
|
+
* @throws Never; serialization failures are caught and rendered as a fallback string.
|
|
655
|
+
* @example
|
|
656
|
+
* ```typescript
|
|
657
|
+
* import { describeObjectValue } from '@core/errors'
|
|
658
|
+
*
|
|
659
|
+
* describeObjectValue({ amount: 1n })
|
|
660
|
+
* // '{"amount":"1"}'
|
|
661
|
+
* ```
|
|
662
|
+
*/ function describeObjectValue(value) {
|
|
663
|
+
try {
|
|
664
|
+
return JSON.stringify(value, (_key, entry)=>typeof entry === 'bigint' ? entry.toString() : entry);
|
|
665
|
+
} catch {
|
|
666
|
+
return '[unserializable object]';
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
642
670
|
/**
|
|
643
671
|
* Creates error for general validation failure.
|
|
644
672
|
*
|
|
@@ -661,7 +689,7 @@ class KitError extends Error {
|
|
|
661
689
|
* // Message: "Validation failed for 'chainId': 999 - Unsupported chain ID"
|
|
662
690
|
*
|
|
663
691
|
* throw createValidationFailedError('config', { invalid: true }, 'Missing required properties')
|
|
664
|
-
* // Message: "Validation failed for 'config':
|
|
692
|
+
* // Message: "Validation failed for 'config': {"invalid":true} - Missing required properties"
|
|
665
693
|
* ```
|
|
666
694
|
*/ function createValidationFailedError(field, value, reason) {
|
|
667
695
|
// Convert value to string for display, handling different types appropriately
|
|
@@ -669,7 +697,7 @@ class KitError extends Error {
|
|
|
669
697
|
if (typeof value === 'string') {
|
|
670
698
|
valueString = `'${value}'`;
|
|
671
699
|
} else if (typeof value === 'object' && value !== null) {
|
|
672
|
-
valueString =
|
|
700
|
+
valueString = describeObjectValue(value);
|
|
673
701
|
} else {
|
|
674
702
|
valueString = String(value);
|
|
675
703
|
}
|
|
@@ -1321,6 +1349,11 @@ var EarnChain;
|
|
|
1321
1349
|
"Arc",
|
|
1322
1350
|
"Arc_Testnet"
|
|
1323
1351
|
];
|
|
1352
|
+
var BorrowChain;
|
|
1353
|
+
(function(BorrowChain) {
|
|
1354
|
+
BorrowChain["Arc"] = "Arc";
|
|
1355
|
+
BorrowChain["Arc_Testnet"] = "Arc_Testnet";
|
|
1356
|
+
})(BorrowChain || (BorrowChain = {}));
|
|
1324
1357
|
|
|
1325
1358
|
/**
|
|
1326
1359
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -1663,6 +1696,29 @@ var EarnChain;
|
|
|
1663
1696
|
* on EVM-compatible testnet chains. Use this address for testnet adapter
|
|
1664
1697
|
* integrations (e.g., Arc Testnet).
|
|
1665
1698
|
*/ const ADAPTER_CONTRACT_EVM_TESTNET = '0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b';
|
|
1699
|
+
/**
|
|
1700
|
+
* The sender-preserving batching contract on Arc (`Multicall3From`).
|
|
1701
|
+
*
|
|
1702
|
+
* This predeploy batches calls like the ubiquitous Multicall3, but routes each
|
|
1703
|
+
* subcall through Arc's `CallFrom` precompile
|
|
1704
|
+
* (`0x1800000000000000000000000000000000000003`), which executes on behalf of
|
|
1705
|
+
* the transaction's original sender. Every target therefore sees the calling
|
|
1706
|
+
* EOA as `msg.sender`, which is what makes a plain, un-upgraded EOA capable of
|
|
1707
|
+
* an atomic batch on Arc.
|
|
1708
|
+
*
|
|
1709
|
+
* Deployed at the same address on Arc Testnet and Arc Mainnet.
|
|
1710
|
+
*
|
|
1711
|
+
* @see https://docs.arc.io/arc/concepts/batched-transactions
|
|
1712
|
+
*/ const BATCHER_CONTRACT_ARC_TESTNET = '0x522fAf9A91c41c443c66765030741e4AaCe147D0';
|
|
1713
|
+
/**
|
|
1714
|
+
* The sender-preserving batching contract on Arc Mainnet (`Multicall3From`).
|
|
1715
|
+
*
|
|
1716
|
+
* See {@link BATCHER_CONTRACT_ARC_TESTNET} for how this contract works.
|
|
1717
|
+
* Requires Arc's Zero7 hardfork, which activates the `CallFrom` precompile
|
|
1718
|
+
* this contract depends on.
|
|
1719
|
+
*
|
|
1720
|
+
* @see https://docs.arc.io/arc/concepts/batched-transactions
|
|
1721
|
+
*/ const BATCHER_CONTRACT_ARC_MAINNET = '0x522fAf9A91c41c443c66765030741e4AaCe147D0';
|
|
1666
1722
|
/**
|
|
1667
1723
|
* The GatewayWallet contract address for EVM mainnet networks.
|
|
1668
1724
|
*
|
|
@@ -1802,7 +1858,10 @@ var EarnChain;
|
|
|
1802
1858
|
},
|
|
1803
1859
|
kitContracts: {
|
|
1804
1860
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
1805
|
-
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
1861
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET,
|
|
1862
|
+
// Arc is the only chain with a sender-preserving batcher, because it
|
|
1863
|
+
// takes a precompile rather than an ordinary contract to build one.
|
|
1864
|
+
senderPreservingBatcher: BATCHER_CONTRACT_ARC_MAINNET
|
|
1806
1865
|
},
|
|
1807
1866
|
gateway: {
|
|
1808
1867
|
domain: 26,
|
|
@@ -1873,7 +1932,10 @@ var EarnChain;
|
|
|
1873
1932
|
},
|
|
1874
1933
|
kitContracts: {
|
|
1875
1934
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
1876
|
-
adapter: ADAPTER_CONTRACT_EVM_TESTNET
|
|
1935
|
+
adapter: ADAPTER_CONTRACT_EVM_TESTNET,
|
|
1936
|
+
// Arc is the only chain with a sender-preserving batcher, because it
|
|
1937
|
+
// takes a precompile rather than an ordinary contract to build one.
|
|
1938
|
+
senderPreservingBatcher: BATCHER_CONTRACT_ARC_TESTNET
|
|
1877
1939
|
},
|
|
1878
1940
|
gateway: {
|
|
1879
1941
|
domain: 26,
|
|
@@ -5291,7 +5353,8 @@ var EarnChain;
|
|
|
5291
5353
|
cctpx: zod.z.any().optional(),
|
|
5292
5354
|
kitContracts: zod.z.object({
|
|
5293
5355
|
bridge: zod.z.string().optional(),
|
|
5294
|
-
adapter: zod.z.string().optional()
|
|
5356
|
+
adapter: zod.z.string().optional(),
|
|
5357
|
+
senderPreservingBatcher: zod.z.string().optional()
|
|
5295
5358
|
}).optional(),
|
|
5296
5359
|
gateway: gatewayConfigSchema.optional()
|
|
5297
5360
|
});
|
|
@@ -5487,6 +5550,38 @@ var EarnChain;
|
|
|
5487
5550
|
message: `"${chain.chain}" is not a supported earn chain. ` + `Supported chains: ${Object.values(EarnChain).join(', ')}`
|
|
5488
5551
|
}))
|
|
5489
5552
|
]);
|
|
5553
|
+
/**
|
|
5554
|
+
* Zod schema for validating Borrow-specific chain identifiers.
|
|
5555
|
+
*
|
|
5556
|
+
* Validate that the provided chain is supported for Borrow Kit's loan
|
|
5557
|
+
* operations. Unlike {@link earnChainIdentifierSchema}, this includes Arc
|
|
5558
|
+
* mainnet as well as Arc Testnet.
|
|
5559
|
+
*
|
|
5560
|
+
* Accept a BorrowChain enum value, a matching string literal, or a
|
|
5561
|
+
* ChainDefinition for a supported chain.
|
|
5562
|
+
*
|
|
5563
|
+
* @example
|
|
5564
|
+
* ```typescript
|
|
5565
|
+
* import { borrowChainIdentifierSchema } from '@core/chains'
|
|
5566
|
+
* import { Arc, BorrowChain } from '@core/chains'
|
|
5567
|
+
*
|
|
5568
|
+
* // Valid
|
|
5569
|
+
* borrowChainIdentifierSchema.parse(BorrowChain.Arc)
|
|
5570
|
+
* borrowChainIdentifierSchema.parse('Arc')
|
|
5571
|
+
* borrowChainIdentifierSchema.parse(Arc)
|
|
5572
|
+
*
|
|
5573
|
+
* // Invalid (throws ZodError)
|
|
5574
|
+
* borrowChainIdentifierSchema.parse('Solana')
|
|
5575
|
+
* ```
|
|
5576
|
+
*/ zod.z.union([
|
|
5577
|
+
zod.z.string().refine((val)=>val in BorrowChain, (val)=>({
|
|
5578
|
+
message: `"${val}" is not a supported borrow chain. ` + `Supported chains: ${Object.values(BorrowChain).join(', ')}`
|
|
5579
|
+
})),
|
|
5580
|
+
zod.z.nativeEnum(BorrowChain),
|
|
5581
|
+
chainDefinitionSchema.refine((chain)=>chain.chain in BorrowChain, (chain)=>({
|
|
5582
|
+
message: `"${chain.chain}" is not a supported borrow chain. ` + `Supported chains: ${Object.values(BorrowChain).join(', ')}`
|
|
5583
|
+
}))
|
|
5584
|
+
]);
|
|
5490
5585
|
// Widened views so `.includes()` accepts arbitrary strings under strict TS.
|
|
5491
5586
|
const EARN_BRIDGE_SOURCE_CHAIN_VALUES = EARN_BRIDGE_SOURCE_BLOCKCHAINS;
|
|
5492
5587
|
const EARN_BRIDGE_DESTINATION_CHAIN_VALUES = EARN_BRIDGE_DESTINATION_BLOCKCHAINS;
|
|
@@ -8650,7 +8745,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8650
8745
|
return kit;
|
|
8651
8746
|
}
|
|
8652
8747
|
|
|
8653
|
-
var version = "1.0.
|
|
8748
|
+
var version = "1.0.3";
|
|
8654
8749
|
var pkg = {
|
|
8655
8750
|
version: version};
|
|
8656
8751
|
|
package/server.mjs
CHANGED
|
@@ -633,6 +633,34 @@ class KitError extends Error {
|
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
635
|
|
|
636
|
+
/**
|
|
637
|
+
* Render an object value for an error message without letting the rendering
|
|
638
|
+
* itself throw.
|
|
639
|
+
*
|
|
640
|
+
* `JSON.stringify` rejects `BigInt` and circular structures, and a rejected
|
|
641
|
+
* value is exactly the kind of thing a validation error is built from: an
|
|
642
|
+
* on-chain read or a receipt log carries `bigint` fields, so serializing one
|
|
643
|
+
* naively replaces the intended error with a `TypeError`.
|
|
644
|
+
*
|
|
645
|
+
* @param value - The value to render.
|
|
646
|
+
* @returns A JSON string with `bigint` fields stringified, or
|
|
647
|
+
* `'[unserializable object]'` if serialization still fails.
|
|
648
|
+
* @throws Never; serialization failures are caught and rendered as a fallback string.
|
|
649
|
+
* @example
|
|
650
|
+
* ```typescript
|
|
651
|
+
* import { describeObjectValue } from '@core/errors'
|
|
652
|
+
*
|
|
653
|
+
* describeObjectValue({ amount: 1n })
|
|
654
|
+
* // '{"amount":"1"}'
|
|
655
|
+
* ```
|
|
656
|
+
*/ function describeObjectValue(value) {
|
|
657
|
+
try {
|
|
658
|
+
return JSON.stringify(value, (_key, entry)=>typeof entry === 'bigint' ? entry.toString() : entry);
|
|
659
|
+
} catch {
|
|
660
|
+
return '[unserializable object]';
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
|
|
636
664
|
/**
|
|
637
665
|
* Creates error for general validation failure.
|
|
638
666
|
*
|
|
@@ -655,7 +683,7 @@ class KitError extends Error {
|
|
|
655
683
|
* // Message: "Validation failed for 'chainId': 999 - Unsupported chain ID"
|
|
656
684
|
*
|
|
657
685
|
* throw createValidationFailedError('config', { invalid: true }, 'Missing required properties')
|
|
658
|
-
* // Message: "Validation failed for 'config':
|
|
686
|
+
* // Message: "Validation failed for 'config': {"invalid":true} - Missing required properties"
|
|
659
687
|
* ```
|
|
660
688
|
*/ function createValidationFailedError(field, value, reason) {
|
|
661
689
|
// Convert value to string for display, handling different types appropriately
|
|
@@ -663,7 +691,7 @@ class KitError extends Error {
|
|
|
663
691
|
if (typeof value === 'string') {
|
|
664
692
|
valueString = `'${value}'`;
|
|
665
693
|
} else if (typeof value === 'object' && value !== null) {
|
|
666
|
-
valueString =
|
|
694
|
+
valueString = describeObjectValue(value);
|
|
667
695
|
} else {
|
|
668
696
|
valueString = String(value);
|
|
669
697
|
}
|
|
@@ -1315,6 +1343,11 @@ var EarnChain;
|
|
|
1315
1343
|
"Arc",
|
|
1316
1344
|
"Arc_Testnet"
|
|
1317
1345
|
];
|
|
1346
|
+
var BorrowChain;
|
|
1347
|
+
(function(BorrowChain) {
|
|
1348
|
+
BorrowChain["Arc"] = "Arc";
|
|
1349
|
+
BorrowChain["Arc_Testnet"] = "Arc_Testnet";
|
|
1350
|
+
})(BorrowChain || (BorrowChain = {}));
|
|
1318
1351
|
|
|
1319
1352
|
/**
|
|
1320
1353
|
* Helper function to define a chain with proper TypeScript typing.
|
|
@@ -1657,6 +1690,29 @@ var EarnChain;
|
|
|
1657
1690
|
* on EVM-compatible testnet chains. Use this address for testnet adapter
|
|
1658
1691
|
* integrations (e.g., Arc Testnet).
|
|
1659
1692
|
*/ const ADAPTER_CONTRACT_EVM_TESTNET = '0xBBD70b01a1CAbc96d5b7b129Ae1AAabdf50dd40b';
|
|
1693
|
+
/**
|
|
1694
|
+
* The sender-preserving batching contract on Arc (`Multicall3From`).
|
|
1695
|
+
*
|
|
1696
|
+
* This predeploy batches calls like the ubiquitous Multicall3, but routes each
|
|
1697
|
+
* subcall through Arc's `CallFrom` precompile
|
|
1698
|
+
* (`0x1800000000000000000000000000000000000003`), which executes on behalf of
|
|
1699
|
+
* the transaction's original sender. Every target therefore sees the calling
|
|
1700
|
+
* EOA as `msg.sender`, which is what makes a plain, un-upgraded EOA capable of
|
|
1701
|
+
* an atomic batch on Arc.
|
|
1702
|
+
*
|
|
1703
|
+
* Deployed at the same address on Arc Testnet and Arc Mainnet.
|
|
1704
|
+
*
|
|
1705
|
+
* @see https://docs.arc.io/arc/concepts/batched-transactions
|
|
1706
|
+
*/ const BATCHER_CONTRACT_ARC_TESTNET = '0x522fAf9A91c41c443c66765030741e4AaCe147D0';
|
|
1707
|
+
/**
|
|
1708
|
+
* The sender-preserving batching contract on Arc Mainnet (`Multicall3From`).
|
|
1709
|
+
*
|
|
1710
|
+
* See {@link BATCHER_CONTRACT_ARC_TESTNET} for how this contract works.
|
|
1711
|
+
* Requires Arc's Zero7 hardfork, which activates the `CallFrom` precompile
|
|
1712
|
+
* this contract depends on.
|
|
1713
|
+
*
|
|
1714
|
+
* @see https://docs.arc.io/arc/concepts/batched-transactions
|
|
1715
|
+
*/ const BATCHER_CONTRACT_ARC_MAINNET = '0x522fAf9A91c41c443c66765030741e4AaCe147D0';
|
|
1660
1716
|
/**
|
|
1661
1717
|
* The GatewayWallet contract address for EVM mainnet networks.
|
|
1662
1718
|
*
|
|
@@ -1796,7 +1852,10 @@ var EarnChain;
|
|
|
1796
1852
|
},
|
|
1797
1853
|
kitContracts: {
|
|
1798
1854
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
1799
|
-
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
1855
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET,
|
|
1856
|
+
// Arc is the only chain with a sender-preserving batcher, because it
|
|
1857
|
+
// takes a precompile rather than an ordinary contract to build one.
|
|
1858
|
+
senderPreservingBatcher: BATCHER_CONTRACT_ARC_MAINNET
|
|
1800
1859
|
},
|
|
1801
1860
|
gateway: {
|
|
1802
1861
|
domain: 26,
|
|
@@ -1867,7 +1926,10 @@ var EarnChain;
|
|
|
1867
1926
|
},
|
|
1868
1927
|
kitContracts: {
|
|
1869
1928
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
1870
|
-
adapter: ADAPTER_CONTRACT_EVM_TESTNET
|
|
1929
|
+
adapter: ADAPTER_CONTRACT_EVM_TESTNET,
|
|
1930
|
+
// Arc is the only chain with a sender-preserving batcher, because it
|
|
1931
|
+
// takes a precompile rather than an ordinary contract to build one.
|
|
1932
|
+
senderPreservingBatcher: BATCHER_CONTRACT_ARC_TESTNET
|
|
1871
1933
|
},
|
|
1872
1934
|
gateway: {
|
|
1873
1935
|
domain: 26,
|
|
@@ -5285,7 +5347,8 @@ var EarnChain;
|
|
|
5285
5347
|
cctpx: z.any().optional(),
|
|
5286
5348
|
kitContracts: z.object({
|
|
5287
5349
|
bridge: z.string().optional(),
|
|
5288
|
-
adapter: z.string().optional()
|
|
5350
|
+
adapter: z.string().optional(),
|
|
5351
|
+
senderPreservingBatcher: z.string().optional()
|
|
5289
5352
|
}).optional(),
|
|
5290
5353
|
gateway: gatewayConfigSchema.optional()
|
|
5291
5354
|
});
|
|
@@ -5481,6 +5544,38 @@ var EarnChain;
|
|
|
5481
5544
|
message: `"${chain.chain}" is not a supported earn chain. ` + `Supported chains: ${Object.values(EarnChain).join(', ')}`
|
|
5482
5545
|
}))
|
|
5483
5546
|
]);
|
|
5547
|
+
/**
|
|
5548
|
+
* Zod schema for validating Borrow-specific chain identifiers.
|
|
5549
|
+
*
|
|
5550
|
+
* Validate that the provided chain is supported for Borrow Kit's loan
|
|
5551
|
+
* operations. Unlike {@link earnChainIdentifierSchema}, this includes Arc
|
|
5552
|
+
* mainnet as well as Arc Testnet.
|
|
5553
|
+
*
|
|
5554
|
+
* Accept a BorrowChain enum value, a matching string literal, or a
|
|
5555
|
+
* ChainDefinition for a supported chain.
|
|
5556
|
+
*
|
|
5557
|
+
* @example
|
|
5558
|
+
* ```typescript
|
|
5559
|
+
* import { borrowChainIdentifierSchema } from '@core/chains'
|
|
5560
|
+
* import { Arc, BorrowChain } from '@core/chains'
|
|
5561
|
+
*
|
|
5562
|
+
* // Valid
|
|
5563
|
+
* borrowChainIdentifierSchema.parse(BorrowChain.Arc)
|
|
5564
|
+
* borrowChainIdentifierSchema.parse('Arc')
|
|
5565
|
+
* borrowChainIdentifierSchema.parse(Arc)
|
|
5566
|
+
*
|
|
5567
|
+
* // Invalid (throws ZodError)
|
|
5568
|
+
* borrowChainIdentifierSchema.parse('Solana')
|
|
5569
|
+
* ```
|
|
5570
|
+
*/ z.union([
|
|
5571
|
+
z.string().refine((val)=>val in BorrowChain, (val)=>({
|
|
5572
|
+
message: `"${val}" is not a supported borrow chain. ` + `Supported chains: ${Object.values(BorrowChain).join(', ')}`
|
|
5573
|
+
})),
|
|
5574
|
+
z.nativeEnum(BorrowChain),
|
|
5575
|
+
chainDefinitionSchema.refine((chain)=>chain.chain in BorrowChain, (chain)=>({
|
|
5576
|
+
message: `"${chain.chain}" is not a supported borrow chain. ` + `Supported chains: ${Object.values(BorrowChain).join(', ')}`
|
|
5577
|
+
}))
|
|
5578
|
+
]);
|
|
5484
5579
|
// Widened views so `.includes()` accepts arbitrary strings under strict TS.
|
|
5485
5580
|
const EARN_BRIDGE_SOURCE_CHAIN_VALUES = EARN_BRIDGE_SOURCE_BLOCKCHAINS;
|
|
5486
5581
|
const EARN_BRIDGE_DESTINATION_CHAIN_VALUES = EARN_BRIDGE_DESTINATION_BLOCKCHAINS;
|
|
@@ -8644,7 +8739,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8644
8739
|
return kit;
|
|
8645
8740
|
}
|
|
8646
8741
|
|
|
8647
|
-
var version = "1.0.
|
|
8742
|
+
var version = "1.0.3";
|
|
8648
8743
|
var pkg = {
|
|
8649
8744
|
version: version};
|
|
8650
8745
|
|