@circle-fin/app-kit 1.16.0 → 1.18.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 +79 -0
- package/borrow.cjs +150 -32
- package/borrow.d.cts +38 -9
- package/borrow.d.mts +38 -9
- package/borrow.d.ts +38 -9
- package/borrow.mjs +150 -32
- package/bridge.cjs +454 -53
- package/bridge.d.cts +38 -9
- package/bridge.d.mts +38 -9
- package/bridge.d.ts +38 -9
- package/bridge.mjs +454 -53
- package/chains.cjs +10 -6
- package/chains.d.cts +1 -1
- package/chains.d.mts +1 -1
- package/chains.d.ts +1 -1
- package/chains.mjs +10 -6
- package/context.d.cts +38 -9
- package/context.d.mts +38 -9
- package/context.d.ts +38 -9
- package/earn.cjs +830 -43
- package/earn.d.cts +38 -9
- package/earn.d.mts +38 -9
- package/earn.d.ts +38 -9
- package/earn.mjs +830 -43
- package/estimateBridge.cjs +454 -53
- package/estimateBridge.d.cts +38 -9
- package/estimateBridge.d.mts +38 -9
- package/estimateBridge.d.ts +38 -9
- package/estimateBridge.mjs +454 -53
- package/estimateSwap.cjs +265 -45
- package/estimateSwap.d.cts +86 -9
- package/estimateSwap.d.mts +86 -9
- package/estimateSwap.d.ts +86 -9
- package/estimateSwap.mjs +265 -45
- package/index.cjs +1019 -73
- package/index.d.cts +373 -210
- package/index.d.mts +373 -210
- package/index.d.ts +373 -210
- package/index.mjs +1019 -73
- package/package.json +8 -8
- package/server.cjs +35 -9
- package/server.d.cts +29 -10
- package/server.d.mts +29 -10
- package/server.d.ts +29 -10
- package/server.mjs +35 -9
- package/swap.cjs +265 -45
- package/swap.d.cts +86 -9
- package/swap.d.mts +86 -9
- package/swap.d.ts +86 -9
- package/swap.mjs +265 -45
- package/unifiedBalance.cjs +139 -20
- package/unifiedBalance.mjs +139 -20
package/borrow.d.ts
CHANGED
|
@@ -899,10 +899,10 @@ declare enum Blockchain {
|
|
|
899
899
|
*
|
|
900
900
|
* Unlike the full {@link Blockchain} enum, SwapChain includes mainnet
|
|
901
901
|
* networks and explicitly whitelisted testnets (e.g., {@link Arc_Testnet})
|
|
902
|
-
* where
|
|
902
|
+
* where Adapter contracts are deployed.
|
|
903
903
|
*
|
|
904
904
|
* Dynamic validation via {@link isSwapSupportedChain} ensures chains
|
|
905
|
-
* automatically work when
|
|
905
|
+
* automatically work when Adapter contracts and supported tokens are deployed.
|
|
906
906
|
*
|
|
907
907
|
* @example
|
|
908
908
|
* ```typescript
|
|
@@ -942,20 +942,22 @@ declare enum SwapChain {
|
|
|
942
942
|
HyperEVM = "HyperEVM",
|
|
943
943
|
Monad = "Monad",
|
|
944
944
|
Arc = "Arc",
|
|
945
|
+
Cronos = "Cronos",
|
|
946
|
+
Morph = "Morph",
|
|
945
947
|
Arc_Testnet = "Arc_Testnet"
|
|
946
948
|
}
|
|
947
949
|
/**
|
|
948
950
|
* Chain definition that supports swap operations.
|
|
949
951
|
*
|
|
950
952
|
* @remarks
|
|
951
|
-
* Expanded from 4 to
|
|
952
|
-
* -
|
|
953
|
+
* Expanded from 4 to supported mainnets and whitelisted testnets based on:
|
|
954
|
+
* - A deployed Adapter contract, configured directly or through CCTP v2
|
|
953
955
|
* - Mainnet chains plus whitelisted testnets (e.g., Arc Testnet)
|
|
954
956
|
*
|
|
955
957
|
* Use `isSwapSupportedChain()` for runtime validation.
|
|
956
958
|
*/
|
|
957
959
|
type SwapChainDefinition = ChainDefinition & {
|
|
958
|
-
chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Arc_Testnet;
|
|
960
|
+
chain: Blockchain.Ethereum | Blockchain.Base | Blockchain.Polygon | Blockchain.Solana | Blockchain.Arbitrum | Blockchain.Optimism | Blockchain.Avalanche | Blockchain.Linea | Blockchain.Ink | Blockchain.World_Chain | Blockchain.Unichain | Blockchain.Plume | Blockchain.Sei | Blockchain.Sonic | Blockchain.XDC | Blockchain.HyperEVM | Blockchain.Monad | Blockchain.Arc | Blockchain.Cronos | Blockchain.Morph | Blockchain.Arc_Testnet;
|
|
959
961
|
};
|
|
960
962
|
/**
|
|
961
963
|
* Chain identifier accepted by swap operations.
|
|
@@ -8667,7 +8669,7 @@ interface ServiceSwapConfig {
|
|
|
8667
8669
|
*
|
|
8668
8670
|
* @defaultValue true
|
|
8669
8671
|
*/
|
|
8670
|
-
batchTransactions?: boolean;
|
|
8672
|
+
batchTransactions?: boolean | undefined;
|
|
8671
8673
|
}
|
|
8672
8674
|
/**
|
|
8673
8675
|
* Parameters for initiating a swap operation through the Stablecoin Service.
|
|
@@ -9131,6 +9133,33 @@ interface SwapConfig {
|
|
|
9131
9133
|
* `apiKey` is omitted, and `apiKey` takes precedence when both are set.
|
|
9132
9134
|
*/
|
|
9133
9135
|
kitKey?: string;
|
|
9136
|
+
/**
|
|
9137
|
+
* Enable or disable atomic batched execution of the approval and swap.
|
|
9138
|
+
*
|
|
9139
|
+
* When `true` (or omitted), an EVM swap that needs an on-chain ERC-20
|
|
9140
|
+
* approval submits the approval and the swap as one atomic batch if the
|
|
9141
|
+
* connected wallet supports it (EIP-5792, or a signing strategy that
|
|
9142
|
+
* declares atomic batching). Set to `false` to force the sequential
|
|
9143
|
+
* approve-then-swap flow.
|
|
9144
|
+
*
|
|
9145
|
+
* @remarks
|
|
9146
|
+
* Has no effect on the gasless permit path, native-token swaps, or Solana,
|
|
9147
|
+
* which already execute as a single transaction. USDT input always uses the
|
|
9148
|
+
* sequential path because its allowance must be reset to zero first. The
|
|
9149
|
+
* batched path relies on the wallet's own gas estimation for the swap call;
|
|
9150
|
+
* set `false` if your wallet under-estimates gas for complex routes or
|
|
9151
|
+
* rejects batched calls.
|
|
9152
|
+
*
|
|
9153
|
+
* @defaultValue `undefined` (batching attempted when the wallet supports it)
|
|
9154
|
+
*
|
|
9155
|
+
* @example
|
|
9156
|
+
* ```typescript
|
|
9157
|
+
* const config: SwapConfig = {
|
|
9158
|
+
* batchTransactions: false, // force sequential approve → swap
|
|
9159
|
+
* }
|
|
9160
|
+
* ```
|
|
9161
|
+
*/
|
|
9162
|
+
batchTransactions?: boolean | undefined;
|
|
9134
9163
|
}
|
|
9135
9164
|
/**
|
|
9136
9165
|
* Resolved parameters for swap operations after validation and normalization.
|
|
@@ -10117,11 +10146,11 @@ interface AppKitContext {
|
|
|
10117
10146
|
*/
|
|
10118
10147
|
actions: Record<'bridge' | 'earn' | 'borrow', Record<string, ((payload: unknown) => void)[]>>;
|
|
10119
10148
|
/**
|
|
10120
|
-
* Disable success analytics for the underlying EarnKit, SwapKit,
|
|
10149
|
+
* Disable success analytics for the underlying BridgeKit, EarnKit, SwapKit,
|
|
10121
10150
|
* BorrowKit, and UnifiedBalanceKit.
|
|
10122
10151
|
*
|
|
10123
|
-
* When `true`, completed earn, swap, borrow, and unified balance
|
|
10124
|
-
* will not POST analytics events. This does not disable error reporting; use
|
|
10152
|
+
* When `true`, completed bridge, earn, swap, borrow, and unified balance
|
|
10153
|
+
* operations will not POST analytics events. This does not disable error reporting; use
|
|
10125
10154
|
* {@link AppKitContext.disableErrorReporting} for that. Defaults to `false`.
|
|
10126
10155
|
*
|
|
10127
10156
|
* @defaultValue false
|
package/borrow.mjs
CHANGED
|
@@ -3175,6 +3175,8 @@ var SwapChain;
|
|
|
3175
3175
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
3176
3176
|
SwapChain["Monad"] = "Monad";
|
|
3177
3177
|
SwapChain["Arc"] = "Arc";
|
|
3178
|
+
SwapChain["Cronos"] = "Cronos";
|
|
3179
|
+
SwapChain["Morph"] = "Morph";
|
|
3178
3180
|
// Testnet chains with swap support
|
|
3179
3181
|
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
3180
3182
|
})(SwapChain || (SwapChain = {}));
|
|
@@ -3855,14 +3857,14 @@ var BorrowChain;
|
|
|
3855
3857
|
symbol: 'USDC',
|
|
3856
3858
|
// Arc uses native USDC with 18 decimals for gas payments (EVM standard).
|
|
3857
3859
|
// Note: The ERC-20 USDC contract at usdcAddress uses 6 decimals.
|
|
3858
|
-
// See: https://docs.arc.
|
|
3860
|
+
// See: https://docs.arc.io/arc/references/contract-addresses
|
|
3859
3861
|
decimals: 18
|
|
3860
3862
|
},
|
|
3861
3863
|
chainId: 5042002,
|
|
3862
3864
|
isTestnet: true,
|
|
3863
3865
|
explorerUrl: 'https://testnet.arcscan.app/tx/{hash}',
|
|
3864
3866
|
rpcEndpoints: [
|
|
3865
|
-
'https://rpc.testnet.arc.
|
|
3867
|
+
'https://rpc.testnet.arc.io'
|
|
3866
3868
|
],
|
|
3867
3869
|
eurcAddress: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
3868
3870
|
usdcAddress: '0x3600000000000000000000000000000000000000',
|
|
@@ -4507,7 +4509,8 @@ var BorrowChain;
|
|
|
4507
4509
|
}
|
|
4508
4510
|
},
|
|
4509
4511
|
kitContracts: {
|
|
4510
|
-
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
4512
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
4513
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
4511
4514
|
}
|
|
4512
4515
|
});
|
|
4513
4516
|
|
|
@@ -5376,7 +5379,8 @@ var BorrowChain;
|
|
|
5376
5379
|
}
|
|
5377
5380
|
},
|
|
5378
5381
|
kitContracts: {
|
|
5379
|
-
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
5382
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
5383
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
5380
5384
|
}
|
|
5381
5385
|
});
|
|
5382
5386
|
|
|
@@ -7266,6 +7270,56 @@ var Chains = /*#__PURE__*/Object.freeze({
|
|
|
7266
7270
|
Blockchain.World_Chain_Sepolia
|
|
7267
7271
|
]);
|
|
7268
7272
|
|
|
7273
|
+
/**
|
|
7274
|
+
* Check if a chain supports a specific type of custom smart contract logic.
|
|
7275
|
+
*
|
|
7276
|
+
* This function examines a chain definition to determine if it has a specific
|
|
7277
|
+
* contract type configured. When a chain has custom contract support, it can
|
|
7278
|
+
* use enhanced features and custom business logic in addition to the standard
|
|
7279
|
+
* CCTP approve/burn/mint flow.
|
|
7280
|
+
*
|
|
7281
|
+
* @param chain - The chain definition to examine for custom contract support.
|
|
7282
|
+
* @param contractType - The type of contract to check for (e.g., 'bridge').
|
|
7283
|
+
* @returns True if the chain supports the specified contract type with a valid address configured.
|
|
7284
|
+
*
|
|
7285
|
+
* @example
|
|
7286
|
+
* ```typescript
|
|
7287
|
+
* import { hasCustomContractSupport, Ethereum } from '@core/chains'
|
|
7288
|
+
*
|
|
7289
|
+
* // Check if a chain supports bridge contracts
|
|
7290
|
+
* if (hasCustomContractSupport(Ethereum, 'bridge')) {
|
|
7291
|
+
* // Runtime validation confirmed kitContracts.bridge exists
|
|
7292
|
+
* console.log('Bridge contract:', Ethereum.kitContracts?.bridge)
|
|
7293
|
+
* return executeCustomFlow(Ethereum.kitContracts?.bridge!, params)
|
|
7294
|
+
* } else {
|
|
7295
|
+
* console.log('Using standard CCTP flow')
|
|
7296
|
+
* return executeStandardFlow(params)
|
|
7297
|
+
* }
|
|
7298
|
+
* ```
|
|
7299
|
+
*
|
|
7300
|
+
* @example
|
|
7301
|
+
* ```typescript
|
|
7302
|
+
* // Usage in flow determination
|
|
7303
|
+
* function determineBridgingFlow(chain: ChainDefinition, params: BridgeParams) {
|
|
7304
|
+
* if (hasCustomContractSupport(chain, 'bridge')) {
|
|
7305
|
+
* return 'custom'
|
|
7306
|
+
* } else if (isCCTPV2Supported(chain)) {
|
|
7307
|
+
* return 'standard'
|
|
7308
|
+
* } else {
|
|
7309
|
+
* throw new Error(`Chain ${chain.name} is not supported for bridging`)
|
|
7310
|
+
* }
|
|
7311
|
+
* }
|
|
7312
|
+
*
|
|
7313
|
+
* // Future usage with other contract types (when added to KitContractType)
|
|
7314
|
+
* // if (hasCustomContractSupport(someChain, 'customType')) {
|
|
7315
|
+
* // console.log('Custom contract:', someChain.kitContracts?.customType)
|
|
7316
|
+
* // }
|
|
7317
|
+
* ```
|
|
7318
|
+
*/ function hasCustomContractSupport(chain, contractType) {
|
|
7319
|
+
const contractAddress = chain.kitContracts?.[contractType];
|
|
7320
|
+
return typeof contractAddress === 'string' && contractAddress.trim().length > 0;
|
|
7321
|
+
}
|
|
7322
|
+
|
|
7269
7323
|
/**
|
|
7270
7324
|
* Temporary allowlist of chains permitted to initiate Gateway fast deposits.
|
|
7271
7325
|
* Only chains keyed here are eligible; all others are rejected. Using the
|
|
@@ -7519,8 +7573,8 @@ var Chains = /*#__PURE__*/Object.freeze({
|
|
|
7519
7573
|
* Zod schema for validating swap-specific chain identifiers.
|
|
7520
7574
|
*
|
|
7521
7575
|
* Validates chains based on:
|
|
7522
|
-
* -
|
|
7523
|
-
* - Mainnet
|
|
7576
|
+
* - Membership in the SwapChain enum
|
|
7577
|
+
* - Mainnet or explicitly allowlisted testnet
|
|
7524
7578
|
* - At least one supported token available
|
|
7525
7579
|
*
|
|
7526
7580
|
*/ const swapChainIdentifierSchema = z.union([
|
|
@@ -7925,7 +7979,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7925
7979
|
*
|
|
7926
7980
|
* A chain supports swaps if ALL conditions are met:
|
|
7927
7981
|
* 1. Is a member of the {@link SwapChain} enum
|
|
7928
|
-
* 2. Has
|
|
7982
|
+
* 2. Has an Adapter contract configured directly or through CCTP v2
|
|
7929
7983
|
*
|
|
7930
7984
|
* Testnets are allowed only when explicitly listed in the
|
|
7931
7985
|
* {@link SwapChain} enum (e.g., Arc_Testnet).
|
|
@@ -7946,14 +8000,14 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7946
8000
|
* @remarks
|
|
7947
8001
|
* Chains automatically become swap-enabled when:
|
|
7948
8002
|
* - Added to the {@link SwapChain} enum
|
|
7949
|
-
* - Adapter contract is deployed
|
|
8003
|
+
* - An Adapter contract is deployed and configured
|
|
7950
8004
|
*
|
|
7951
8005
|
* No code changes needed when new chains are added!
|
|
7952
8006
|
*/ function isSwapSupportedChain(chain) {
|
|
7953
8007
|
if (!(chain.chain in SwapChain)) {
|
|
7954
8008
|
return false;
|
|
7955
8009
|
}
|
|
7956
|
-
if (!isCCTPV2Supported(chain)) {
|
|
8010
|
+
if (!isCCTPV2Supported(chain) && !hasCustomContractSupport(chain, 'adapter')) {
|
|
7957
8011
|
return false;
|
|
7958
8012
|
}
|
|
7959
8013
|
return true;
|
|
@@ -7964,7 +8018,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7964
8018
|
*
|
|
7965
8019
|
* Dynamically filter chain definitions to include only those that:
|
|
7966
8020
|
* - Are members of the {@link SwapChain} enum
|
|
7967
|
-
* - Have
|
|
8021
|
+
* - Have an Adapter contract configured directly or through CCTP v2
|
|
7968
8022
|
*
|
|
7969
8023
|
* This function is pure and accepts chains as parameter to avoid
|
|
7970
8024
|
* circular dependencies.
|
|
@@ -8899,11 +8953,13 @@ function parseOrThrow(value, schema, context) {
|
|
|
8899
8953
|
[Blockchain.Arbitrum]: '0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9',
|
|
8900
8954
|
[Blockchain.Avalanche]: '0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7',
|
|
8901
8955
|
[Blockchain.Celo]: '0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e',
|
|
8956
|
+
[Blockchain.Cronos]: '0x66e428c3f67a68878562e79A0234c1F83c208770',
|
|
8902
8957
|
[Blockchain.Ethereum]: '0xdAC17F958D2ee523a2206206994597C13D831ec7',
|
|
8903
8958
|
[Blockchain.HyperEVM]: '0xb8ce59fc3717ada4c02eadf9682a9e934f625ebb',
|
|
8904
8959
|
[Blockchain.Ink]: '0x0200C29006150606B650577BBE7B6248F58470c1',
|
|
8905
8960
|
[Blockchain.Linea]: '0xA219439258ca9da29E9Cc4cE5596924745e12B93',
|
|
8906
8961
|
[Blockchain.Monad]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
8962
|
+
[Blockchain.Morph]: '0xe7cd86e13AC4309349F30B3435a9d337750fC82D',
|
|
8907
8963
|
[Blockchain.NEAR]: 'usdt.tether-token.near',
|
|
8908
8964
|
[Blockchain.Optimism]: '0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
|
|
8909
8965
|
[Blockchain.Polkadot_Asset_Hub]: '1984',
|
|
@@ -8962,6 +9018,7 @@ function parseOrThrow(value, schema, context) {
|
|
|
8962
9018
|
[Blockchain.Arbitrum]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
8963
9019
|
[Blockchain.Avalanche]: '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70',
|
|
8964
9020
|
[Blockchain.Base]: '0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb',
|
|
9021
|
+
[Blockchain.Cronos]: '0xF2001B145b43032AAF5Ee2884e456CCd805F677D',
|
|
8965
9022
|
[Blockchain.Ethereum]: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
8966
9023
|
[Blockchain.Linea]: '0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5',
|
|
8967
9024
|
[Blockchain.Optimism]: '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1',
|
|
@@ -9024,7 +9081,9 @@ function parseOrThrow(value, schema, context) {
|
|
|
9024
9081
|
[Blockchain.Arbitrum]: '0x82aF49447D8a07e3bd95BD0d56f35241523fBab1',
|
|
9025
9082
|
[Blockchain.Avalanche]: '0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB',
|
|
9026
9083
|
[Blockchain.Base]: '0x4200000000000000000000000000000000000006',
|
|
9084
|
+
[Blockchain.Cronos]: '0xe44Fd7fCb2b1581822D0c862B68222998a0c299a',
|
|
9027
9085
|
[Blockchain.Ethereum]: '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
|
|
9086
|
+
[Blockchain.Morph]: '0x5300000000000000000000000000000000000011',
|
|
9028
9087
|
[Blockchain.Optimism]: '0x4200000000000000000000000000000000000006',
|
|
9029
9088
|
[Blockchain.Polygon]: '0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619',
|
|
9030
9089
|
[Blockchain.Solana]: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs'
|
|
@@ -9043,6 +9102,7 @@ function parseOrThrow(value, schema, context) {
|
|
|
9043
9102
|
locators: {
|
|
9044
9103
|
[Blockchain.Ethereum]: '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599',
|
|
9045
9104
|
[Blockchain.Arbitrum]: '0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f',
|
|
9105
|
+
[Blockchain.Cronos]: '0x062E66477Faf219F25D27dCED647BF57C3107d52',
|
|
9046
9106
|
[Blockchain.Avalanche]: '0x50b7545627a5162F82A992c33b87aDc75187B218'
|
|
9047
9107
|
}
|
|
9048
9108
|
};
|
|
@@ -10139,7 +10199,7 @@ function resolveOptions(options) {
|
|
|
10139
10199
|
}
|
|
10140
10200
|
|
|
10141
10201
|
var name$3 = "@circle-fin/bridge-kit";
|
|
10142
|
-
var version$3 = "1.
|
|
10202
|
+
var version$3 = "1.16.0";
|
|
10143
10203
|
var pkg$3 = {
|
|
10144
10204
|
name: name$3,
|
|
10145
10205
|
version: version$3};
|
|
@@ -12218,7 +12278,7 @@ const validateQuoteItemSchema = z.object({
|
|
|
12218
12278
|
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
12219
12279
|
|
|
12220
12280
|
var name$2 = "@circle-fin/swap-kit";
|
|
12221
|
-
var version$2 = "1.
|
|
12281
|
+
var version$2 = "1.8.1";
|
|
12222
12282
|
var pkg$2 = {
|
|
12223
12283
|
name: name$2,
|
|
12224
12284
|
version: version$2};
|
|
@@ -12560,6 +12620,64 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
12560
12620
|
}, {
|
|
12561
12621
|
message: 'fee amount must be non-negative (>= 0)'
|
|
12562
12622
|
});
|
|
12623
|
+
/**
|
|
12624
|
+
* Parses a display-only field leniently: a value `schema` rejects is replaced
|
|
12625
|
+
* with `fallback` instead of failing the response that carries it.
|
|
12626
|
+
* Implemented with `preprocess` rather than Zod's `.catch()` because static
|
|
12627
|
+
* analysis misreads `.catch` on the schema chain as an unhandled Promise
|
|
12628
|
+
* (S7785).
|
|
12629
|
+
*/ const withFallback = (schema, fallback)=>z.preprocess((value)=>schema.safeParse(value).success ? value : fallback, schema);
|
|
12630
|
+
const swapRouteTokenSchema = z.object({
|
|
12631
|
+
symbol: z.string(),
|
|
12632
|
+
address: z.string(),
|
|
12633
|
+
decimals: z.number()
|
|
12634
|
+
});
|
|
12635
|
+
const swapRouteMetadataSchema = z.record(z.unknown()).optional();
|
|
12636
|
+
const swapRouteStepSchema = z.object({
|
|
12637
|
+
type: z.string(),
|
|
12638
|
+
tool: z.string(),
|
|
12639
|
+
toolName: z.string(),
|
|
12640
|
+
fromToken: swapRouteTokenSchema,
|
|
12641
|
+
toToken: swapRouteTokenSchema,
|
|
12642
|
+
estimate: z.object({
|
|
12643
|
+
fromAmount: z.string(),
|
|
12644
|
+
toAmount: z.string(),
|
|
12645
|
+
gasCostUSD: z.string().optional()
|
|
12646
|
+
}),
|
|
12647
|
+
metadata: swapRouteMetadataSchema
|
|
12648
|
+
});
|
|
12649
|
+
/**
|
|
12650
|
+
* Strict schema for a `SwapRoute`. Module-private: service responses
|
|
12651
|
+
* parse routes leniently through {@link responseSwapRouteSchema}.
|
|
12652
|
+
*/ const swapRouteSchema = z.object({
|
|
12653
|
+
provider: z.string().min(1, 'provider must be a non-empty string'),
|
|
12654
|
+
steps: z.array(swapRouteStepSchema),
|
|
12655
|
+
metadata: swapRouteMetadataSchema
|
|
12656
|
+
});
|
|
12657
|
+
/**
|
|
12658
|
+
* Route details are display-only, so service responses parse them leniently:
|
|
12659
|
+
* steps or metadata in a shape the SDK does not know are dropped rather than
|
|
12660
|
+
* failing the quote or swap they describe. Steps are all-or-nothing: if any
|
|
12661
|
+
* step is malformed, `steps` is empty, so a route never silently loses a hop.
|
|
12662
|
+
*/ const responseSwapRouteSchema = swapRouteSchema.extend({
|
|
12663
|
+
steps: withFallback(swapRouteSchema.shape.steps, []),
|
|
12664
|
+
metadata: withFallback(swapRouteMetadataSchema, undefined)
|
|
12665
|
+
});
|
|
12666
|
+
const createSwapFeeItemSchema = z.object({
|
|
12667
|
+
token: z.string({
|
|
12668
|
+
required_error: 'fee token is required',
|
|
12669
|
+
invalid_type_error: 'fee token must be a string'
|
|
12670
|
+
}).min(1, 'fee token must be a non-empty string'),
|
|
12671
|
+
amount: feeAmountSchema,
|
|
12672
|
+
decimals: z.number().int('fee token decimals must be an integer').nonnegative('fee token decimals must be a non-negative integer').optional(),
|
|
12673
|
+
symbol: z.string({
|
|
12674
|
+
invalid_type_error: 'fee token symbol must be a string'
|
|
12675
|
+
}).min(1, 'fee token symbol must be a non-empty string').optional(),
|
|
12676
|
+
// Descriptive metadata: a value the SDK cannot use is dropped rather than
|
|
12677
|
+
// failing the response that carries the fee.
|
|
12678
|
+
type: withFallback(z.string().min(1).optional(), undefined),
|
|
12679
|
+
chain: withFallback(z.string().min(1).optional(), undefined)
|
|
12680
|
+
});
|
|
12563
12681
|
/**
|
|
12564
12682
|
* Zod schema for validating API keys.
|
|
12565
12683
|
*
|
|
@@ -12645,10 +12763,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
12645
12763
|
/** Quote information with estimated amounts and route */ quote: z.object({
|
|
12646
12764
|
/** Estimated output amount (base units) */ estimatedAmount: z.string().min(1, 'estimatedAmount must be a non-empty string').regex(/^\d+$/, 'estimatedAmount must be a numeric string'),
|
|
12647
12765
|
/** Guaranteed minimum output amount (base units) */ minAmount: z.string().min(1, 'minAmount must be a non-empty string').regex(/^\d+$/, 'minAmount must be a numeric string'),
|
|
12648
|
-
/** Route information from DEX aggregator */ route:
|
|
12649
|
-
provider: z.string().min(1, 'provider must be a non-empty string'),
|
|
12650
|
-
steps: z.array(z.unknown())
|
|
12651
|
-
})
|
|
12766
|
+
/** Route information from DEX aggregator */ route: responseSwapRouteSchema
|
|
12652
12767
|
}),
|
|
12653
12768
|
/** Fee context indicating where fees should be collected */ feeContext: quoteFeeContextSchema
|
|
12654
12769
|
});
|
|
@@ -12864,19 +12979,6 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
12864
12979
|
}).min(1, 'toChain must be a non-empty string if provided').optional(),
|
|
12865
12980
|
apiKey: apiKeySchema.optional()
|
|
12866
12981
|
});
|
|
12867
|
-
/**
|
|
12868
|
-
* Zod schema for validating CreateSwapResponse payloads.
|
|
12869
|
-
*/ const createSwapFeeItemSchema = z.object({
|
|
12870
|
-
token: z.string({
|
|
12871
|
-
required_error: 'fee token is required',
|
|
12872
|
-
invalid_type_error: 'fee token must be a string'
|
|
12873
|
-
}).min(1, 'fee token must be a non-empty string'),
|
|
12874
|
-
amount: feeAmountSchema,
|
|
12875
|
-
decimals: z.number().int('fee token decimals must be an integer').nonnegative('fee token decimals must be a non-negative integer').optional(),
|
|
12876
|
-
symbol: z.string({
|
|
12877
|
-
invalid_type_error: 'fee token symbol must be a string'
|
|
12878
|
-
}).min(1, 'fee token symbol must be a non-empty string').optional()
|
|
12879
|
-
});
|
|
12880
12982
|
/**
|
|
12881
12983
|
* Developer fee item schema with basis field.
|
|
12882
12984
|
*/ const createSwapDeveloperFeeItemSchema = createSwapFeeItemSchema.extend({
|
|
@@ -13014,6 +13116,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
13014
13116
|
correlationId: z.preprocess((value)=>z.string().uuid().safeParse(value).success ? value : undefined, z.string().optional()),
|
|
13015
13117
|
config: createSwapRequestBaseSchema.shape.config.optional(),
|
|
13016
13118
|
fees: createSwapFeesSchema.optional(),
|
|
13119
|
+
// A route the SDK cannot parse is dropped instead of failing the swap.
|
|
13120
|
+
route: withFallback(responseSwapRouteSchema.optional(), undefined),
|
|
13017
13121
|
transaction: createSwapTransactionSchema
|
|
13018
13122
|
});
|
|
13019
13123
|
|
|
@@ -16256,6 +16360,16 @@ createTokenRegistry();
|
|
|
16256
16360
|
name: 'USDC',
|
|
16257
16361
|
version: '2'
|
|
16258
16362
|
},
|
|
16363
|
+
Cronos: {
|
|
16364
|
+
chainId: Cronos.chainId,
|
|
16365
|
+
name: 'USDC',
|
|
16366
|
+
version: '2'
|
|
16367
|
+
},
|
|
16368
|
+
Morph: {
|
|
16369
|
+
chainId: Morph.chainId,
|
|
16370
|
+
name: 'USDC',
|
|
16371
|
+
version: '2'
|
|
16372
|
+
},
|
|
16259
16373
|
Arc_Testnet: {
|
|
16260
16374
|
chainId: ArcTestnet.chainId,
|
|
16261
16375
|
name: 'USDC',
|
|
@@ -16344,6 +16458,7 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
16344
16458
|
* - customFee: Optional fee configuration
|
|
16345
16459
|
* - apiKey: Optional credential string
|
|
16346
16460
|
* - kitKey: Optional credential string (deprecated alias for apiKey)
|
|
16461
|
+
* - batchTransactions: Optional boolean to opt out of atomic batching
|
|
16347
16462
|
*/ const swapConfigSchema = z.object({
|
|
16348
16463
|
allowanceStrategy: allowanceStrategySchema.optional(),
|
|
16349
16464
|
slippageBps: z.number().int().min(0).optional(),
|
|
@@ -16354,7 +16469,10 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
16354
16469
|
})(z.string())).optional(),
|
|
16355
16470
|
customFee: swapCustomFeeSchema.optional(),
|
|
16356
16471
|
apiKey: z.string().optional(),
|
|
16357
|
-
kitKey: z.string().optional()
|
|
16472
|
+
kitKey: z.string().optional(),
|
|
16473
|
+
batchTransactions: z.boolean({
|
|
16474
|
+
invalid_type_error: 'batchTransactions must be a boolean'
|
|
16475
|
+
}).optional()
|
|
16358
16476
|
});
|
|
16359
16477
|
const swapDestinationSchema = z.object({
|
|
16360
16478
|
chain: optionalSwapChainIdentifierField,
|
|
@@ -16547,7 +16665,7 @@ new Set(Object.values(Blockchain));
|
|
|
16547
16665
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
16548
16666
|
|
|
16549
16667
|
var name$1 = "@circle-fin/earn-kit";
|
|
16550
|
-
var version$1 = "1.
|
|
16668
|
+
var version$1 = "1.10.0";
|
|
16551
16669
|
var pkg$1 = {
|
|
16552
16670
|
name: name$1,
|
|
16553
16671
|
version: version$1};
|
|
@@ -18051,7 +18169,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
|
|
|
18051
18169
|
};
|
|
18052
18170
|
|
|
18053
18171
|
var name = "@circle-fin/borrow-kit";
|
|
18054
|
-
var version = "1.
|
|
18172
|
+
var version = "1.1.1";
|
|
18055
18173
|
var pkg = {
|
|
18056
18174
|
name: name,
|
|
18057
18175
|
version: version};
|