@circle-fin/app-kit 1.14.0 → 1.15.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 +72 -0
- package/README.md +3 -3
- package/bridge.cjs +7464 -454
- package/bridge.d.cts +585 -61
- package/bridge.d.mts +585 -61
- package/bridge.d.ts +585 -61
- package/bridge.mjs +7464 -454
- package/chains.cjs +146 -5
- package/chains.d.cts +108 -2
- package/chains.d.mts +108 -2
- package/chains.d.ts +108 -2
- package/chains.mjs +146 -6
- package/context.d.cts +522 -57
- package/context.d.mts +522 -57
- package/context.d.ts +522 -57
- package/earn.cjs +478 -181
- package/earn.d.cts +522 -57
- package/earn.d.mts +522 -57
- package/earn.d.ts +522 -57
- package/earn.mjs +478 -181
- package/estimateBridge.cjs +7464 -457
- package/estimateBridge.d.cts +643 -82
- package/estimateBridge.d.mts +643 -82
- package/estimateBridge.d.ts +643 -82
- package/estimateBridge.mjs +7464 -457
- package/estimateSwap.cjs +528 -185
- package/estimateSwap.d.cts +522 -57
- package/estimateSwap.d.mts +522 -57
- package/estimateSwap.d.ts +522 -57
- package/estimateSwap.mjs +528 -185
- package/index.cjs +11548 -2936
- package/index.d.cts +5073 -1738
- package/index.d.mts +5073 -1738
- package/index.d.ts +5073 -1738
- package/index.mjs +11547 -2937
- package/package.json +17 -6
- package/server.cjs +10040 -0
- package/server.cjs.map +1 -0
- package/server.d.cts +2467 -0
- package/server.d.mts +2467 -0
- package/server.d.ts +2467 -0
- package/server.mjs +10028 -0
- package/server.mjs.map +1 -0
- package/swap.cjs +528 -185
- package/swap.d.cts +522 -57
- package/swap.d.mts +522 -57
- package/swap.d.ts +522 -57
- package/swap.mjs +528 -185
- package/unifiedBalance.cjs +742 -44
- package/unifiedBalance.d.cts +223 -1
- package/unifiedBalance.d.mts +223 -1
- package/unifiedBalance.d.ts +223 -1
- package/unifiedBalance.mjs +742 -44
package/earn.cjs
CHANGED
|
@@ -865,8 +865,7 @@ class KitError extends Error {
|
|
|
865
865
|
code: 8002,
|
|
866
866
|
name: 'SERVICE_UNKNOWN_ERROR',
|
|
867
867
|
type: 'SERVICE'
|
|
868
|
-
}
|
|
869
|
-
};
|
|
868
|
+
}};
|
|
870
869
|
|
|
871
870
|
/**
|
|
872
871
|
* Creates error for network type mismatch between source and destination.
|
|
@@ -1053,7 +1052,7 @@ class KitError extends Error {
|
|
|
1053
1052
|
* import { createValidationErrorFromZod } from '@core/errors'
|
|
1054
1053
|
*
|
|
1055
1054
|
* function validateBridgeParams(params: unknown): asserts params is BridgeParams {
|
|
1056
|
-
* const result =
|
|
1055
|
+
* const result = usdcBridgeParamsSchema.safeParse(params)
|
|
1057
1056
|
* if (!result.success) {
|
|
1058
1057
|
* throw createValidationErrorFromZod(result.error, 'bridge parameters')
|
|
1059
1058
|
* }
|
|
@@ -2314,9 +2313,10 @@ function getOptionalString(value) {
|
|
|
2314
2313
|
Blockchain["Algorand_Testnet"] = "Algorand_Testnet";
|
|
2315
2314
|
Blockchain["Aptos"] = "Aptos";
|
|
2316
2315
|
Blockchain["Aptos_Testnet"] = "Aptos_Testnet";
|
|
2317
|
-
Blockchain["Arc_Testnet"] = "Arc_Testnet";
|
|
2318
2316
|
Blockchain["Arbitrum"] = "Arbitrum";
|
|
2319
2317
|
Blockchain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
|
|
2318
|
+
Blockchain["Arc"] = "Arc";
|
|
2319
|
+
Blockchain["Arc_Testnet"] = "Arc_Testnet";
|
|
2320
2320
|
Blockchain["Avalanche"] = "Avalanche";
|
|
2321
2321
|
Blockchain["Avalanche_Fuji"] = "Avalanche_Fuji";
|
|
2322
2322
|
Blockchain["Base"] = "Base";
|
|
@@ -2403,6 +2403,7 @@ var SwapChain;
|
|
|
2403
2403
|
SwapChain["XDC"] = "XDC";
|
|
2404
2404
|
SwapChain["HyperEVM"] = "HyperEVM";
|
|
2405
2405
|
SwapChain["Monad"] = "Monad";
|
|
2406
|
+
SwapChain["Arc"] = "Arc";
|
|
2406
2407
|
// Testnet chains with swap support
|
|
2407
2408
|
SwapChain["Arc_Testnet"] = "Arc_Testnet";
|
|
2408
2409
|
})(SwapChain || (SwapChain = {}));
|
|
@@ -2410,6 +2411,7 @@ var BridgeChain;
|
|
|
2410
2411
|
(function(BridgeChain) {
|
|
2411
2412
|
// Mainnet chains with CCTPv2 support
|
|
2412
2413
|
BridgeChain["Arbitrum"] = "Arbitrum";
|
|
2414
|
+
BridgeChain["Arc"] = "Arc";
|
|
2413
2415
|
BridgeChain["Avalanche"] = "Avalanche";
|
|
2414
2416
|
BridgeChain["Base"] = "Base";
|
|
2415
2417
|
BridgeChain["Codex"] = "Codex";
|
|
@@ -2465,6 +2467,7 @@ var BridgeChain;
|
|
|
2465
2467
|
var UnifiedBalanceChain;
|
|
2466
2468
|
(function(UnifiedBalanceChain) {
|
|
2467
2469
|
// Mainnet chains with Gateway V1 support
|
|
2470
|
+
UnifiedBalanceChain["Arc"] = "Arc";
|
|
2468
2471
|
UnifiedBalanceChain["Arbitrum"] = "Arbitrum";
|
|
2469
2472
|
UnifiedBalanceChain["Avalanche"] = "Avalanche";
|
|
2470
2473
|
UnifiedBalanceChain["Base"] = "Base";
|
|
@@ -2494,6 +2497,7 @@ var UnifiedBalanceChain;
|
|
|
2494
2497
|
})(UnifiedBalanceChain || (UnifiedBalanceChain = {}));
|
|
2495
2498
|
var EarnChain;
|
|
2496
2499
|
(function(EarnChain) {
|
|
2500
|
+
EarnChain["Arc"] = "Arc";
|
|
2497
2501
|
EarnChain["Arc_Testnet"] = "Arc_Testnet";
|
|
2498
2502
|
})(EarnChain || (EarnChain = {}));
|
|
2499
2503
|
/**
|
|
@@ -2510,8 +2514,11 @@ var EarnChain;
|
|
|
2510
2514
|
* console.log(EARN_BRIDGE_SOURCE_BLOCKCHAINS.join(', '))
|
|
2511
2515
|
* ```
|
|
2512
2516
|
*/ const EARN_BRIDGE_SOURCE_BLOCKCHAINS = [
|
|
2517
|
+
"Arbitrum",
|
|
2513
2518
|
"Arbitrum_Sepolia",
|
|
2519
|
+
"Base",
|
|
2514
2520
|
"Base_Sepolia",
|
|
2521
|
+
"Ethereum",
|
|
2515
2522
|
"Ethereum_Sepolia"
|
|
2516
2523
|
];
|
|
2517
2524
|
/**
|
|
@@ -2525,6 +2532,7 @@ var EarnChain;
|
|
|
2525
2532
|
* console.log(EARN_BRIDGE_DESTINATION_BLOCKCHAINS.join(', '))
|
|
2526
2533
|
* ```
|
|
2527
2534
|
*/ const EARN_BRIDGE_DESTINATION_BLOCKCHAINS = [
|
|
2535
|
+
"Arc",
|
|
2528
2536
|
"Arc_Testnet"
|
|
2529
2537
|
];
|
|
2530
2538
|
|
|
@@ -2830,6 +2838,25 @@ var EarnChain;
|
|
|
2830
2838
|
* EVM-compatible chains. Use this address when deploying or testing
|
|
2831
2839
|
* cross-chain USDC transfers on test networks.
|
|
2832
2840
|
*/ const BRIDGE_CONTRACT_EVM_TESTNET = '0xC5567a5E3370d4DBfB0540025078e283e36A363d';
|
|
2841
|
+
/**
|
|
2842
|
+
* The CrossChainTokenService (CCTPx) service address for EVM testnet networks.
|
|
2843
|
+
*
|
|
2844
|
+
* This service coordinates CCTPx cross-chain token operations on testnet
|
|
2845
|
+
* environments and is shared by every EVM test network CCTPx supports. Read the
|
|
2846
|
+
* chain definitions via `isCCTPXSupported` rather than trusting a list here,
|
|
2847
|
+
* which goes stale as deployments land.
|
|
2848
|
+
*/ const CCTPX_SERVICE_ADDRESS_EVM_TESTNET = '0x63753E722bd2C2A5DF6EE19C5106662208B81077';
|
|
2849
|
+
/**
|
|
2850
|
+
* CrossChainTokenService (CCTS) proxy address for CCTPx on EVM **mainnet**.
|
|
2851
|
+
*
|
|
2852
|
+
* @remarks
|
|
2853
|
+
* A distinct deployment from {@link CCTPX_SERVICE_ADDRESS_EVM_TESTNET}, shared
|
|
2854
|
+
* by every EVM mainnet chain that CCTPx supports. A chain becomes
|
|
2855
|
+
* CCTPx-eligible only once its definition carries this as
|
|
2856
|
+
* `cctpx.serviceAddress`, and a route additionally needs both of its endpoints
|
|
2857
|
+
* eligible — so adding a chain here is the deliberate, reviewable step that
|
|
2858
|
+
* opens mainnet CCTPx for it.
|
|
2859
|
+
*/ const CCTPX_SERVICE_ADDRESS_EVM_MAINNET = '0x431871229103b780868f8C6BB820cd16ECf942BC';
|
|
2833
2860
|
/**
|
|
2834
2861
|
* The bridge contract address for EVM mainnet networks.
|
|
2835
2862
|
*
|
|
@@ -2938,6 +2965,76 @@ var EarnChain;
|
|
|
2938
2965
|
* Identical across all testnet EVM destination chains.
|
|
2939
2966
|
*/ const GENERIC_EXECUTOR_EVM_TESTNET = '0xEdC81040756AcCfF070c21D37b265b9D0b5Ba45e';
|
|
2940
2967
|
|
|
2968
|
+
/**
|
|
2969
|
+
* Arc Mainnet chain definition
|
|
2970
|
+
* @remarks
|
|
2971
|
+
* This represents the official production network for the Arc blockchain,
|
|
2972
|
+
* Circle's EVM-compatible Layer-1 designed for stablecoin finance
|
|
2973
|
+
* and asset tokenization. Arc uses USDC as the native gas token and
|
|
2974
|
+
* features the Malachite Byzantine Fault Tolerant (BFT) consensus
|
|
2975
|
+
* engine for sub-second finality.
|
|
2976
|
+
*/ const Arc = defineChain({
|
|
2977
|
+
type: 'evm',
|
|
2978
|
+
chain: Blockchain.Arc,
|
|
2979
|
+
name: 'Arc',
|
|
2980
|
+
title: 'Arc Mainnet',
|
|
2981
|
+
nativeCurrency: {
|
|
2982
|
+
name: 'USDC',
|
|
2983
|
+
symbol: 'USDC',
|
|
2984
|
+
// Arc uses native USDC with 18 decimals for gas payments (EVM standard).
|
|
2985
|
+
// Note: The ERC-20 USDC contract at usdcAddress uses 6 decimals.
|
|
2986
|
+
// See: https://docs.arc.network/arc/references/contract-addresses
|
|
2987
|
+
decimals: 18
|
|
2988
|
+
},
|
|
2989
|
+
chainId: 5042,
|
|
2990
|
+
isTestnet: false,
|
|
2991
|
+
explorerUrl: 'https://explorer.arc.io/tx/{hash}',
|
|
2992
|
+
rpcEndpoints: [
|
|
2993
|
+
'https://rpc.mainnet.arc.io/'
|
|
2994
|
+
],
|
|
2995
|
+
eurcAddress: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',
|
|
2996
|
+
usdcAddress: '0x3600000000000000000000000000000000000000',
|
|
2997
|
+
usdtAddress: null,
|
|
2998
|
+
cctp: {
|
|
2999
|
+
domain: 26,
|
|
3000
|
+
contracts: {
|
|
3001
|
+
v2: {
|
|
3002
|
+
type: 'split',
|
|
3003
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3004
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3005
|
+
confirmations: 1,
|
|
3006
|
+
fastConfirmations: 1
|
|
3007
|
+
}
|
|
3008
|
+
},
|
|
3009
|
+
forwarderSupported: {
|
|
3010
|
+
source: false,
|
|
3011
|
+
destination: true
|
|
3012
|
+
}
|
|
3013
|
+
},
|
|
3014
|
+
cctpx: {
|
|
3015
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
3016
|
+
},
|
|
3017
|
+
kitContracts: {
|
|
3018
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3019
|
+
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
3020
|
+
},
|
|
3021
|
+
gateway: {
|
|
3022
|
+
domain: 26,
|
|
3023
|
+
contracts: {
|
|
3024
|
+
v1: {
|
|
3025
|
+
wallet: GATEWAY_WALLET_EVM_MAINNET,
|
|
3026
|
+
minter: GATEWAY_MINTER_EVM_MAINNET,
|
|
3027
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_MAINNET,
|
|
3028
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_MAINNET
|
|
3029
|
+
}
|
|
3030
|
+
},
|
|
3031
|
+
forwarderSupported: {
|
|
3032
|
+
source: true,
|
|
3033
|
+
destination: true
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
});
|
|
3037
|
+
|
|
2941
3038
|
/**
|
|
2942
3039
|
* Arc Testnet chain definition
|
|
2943
3040
|
* @remarks
|
|
@@ -2985,6 +3082,9 @@ var EarnChain;
|
|
|
2985
3082
|
destination: true
|
|
2986
3083
|
}
|
|
2987
3084
|
},
|
|
3085
|
+
cctpx: {
|
|
3086
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
3087
|
+
},
|
|
2988
3088
|
kitContracts: {
|
|
2989
3089
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
2990
3090
|
adapter: ADAPTER_CONTRACT_EVM_TESTNET
|
|
@@ -3052,6 +3152,9 @@ var EarnChain;
|
|
|
3052
3152
|
destination: true
|
|
3053
3153
|
}
|
|
3054
3154
|
},
|
|
3155
|
+
cctpx: {
|
|
3156
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
3157
|
+
},
|
|
3055
3158
|
kitContracts: {
|
|
3056
3159
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3057
3160
|
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
@@ -3117,6 +3220,9 @@ var EarnChain;
|
|
|
3117
3220
|
destination: true
|
|
3118
3221
|
}
|
|
3119
3222
|
},
|
|
3223
|
+
cctpx: {
|
|
3224
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
3225
|
+
},
|
|
3120
3226
|
kitContracts: {
|
|
3121
3227
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
3122
3228
|
adapter: ADAPTER_CONTRACT_EVM_TESTNET
|
|
@@ -3182,6 +3288,9 @@ var EarnChain;
|
|
|
3182
3288
|
destination: true
|
|
3183
3289
|
}
|
|
3184
3290
|
},
|
|
3291
|
+
cctpx: {
|
|
3292
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
3293
|
+
},
|
|
3185
3294
|
kitContracts: {
|
|
3186
3295
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3187
3296
|
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
@@ -3249,6 +3358,9 @@ var EarnChain;
|
|
|
3249
3358
|
rpcEndpoints: [
|
|
3250
3359
|
'https://api.avax-test.network/ext/bc/C/rpc'
|
|
3251
3360
|
],
|
|
3361
|
+
cctpx: {
|
|
3362
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
3363
|
+
},
|
|
3252
3364
|
kitContracts: {
|
|
3253
3365
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
3254
3366
|
},
|
|
@@ -3316,6 +3428,9 @@ var EarnChain;
|
|
|
3316
3428
|
destination: true
|
|
3317
3429
|
}
|
|
3318
3430
|
},
|
|
3431
|
+
cctpx: {
|
|
3432
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
3433
|
+
},
|
|
3319
3434
|
kitContracts: {
|
|
3320
3435
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3321
3436
|
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
@@ -3381,6 +3496,9 @@ var EarnChain;
|
|
|
3381
3496
|
destination: true
|
|
3382
3497
|
}
|
|
3383
3498
|
},
|
|
3499
|
+
cctpx: {
|
|
3500
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
3501
|
+
},
|
|
3384
3502
|
kitContracts: {
|
|
3385
3503
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
3386
3504
|
adapter: ADAPTER_CONTRACT_EVM_TESTNET
|
|
@@ -3773,6 +3891,9 @@ var EarnChain;
|
|
|
3773
3891
|
destination: true
|
|
3774
3892
|
}
|
|
3775
3893
|
},
|
|
3894
|
+
cctpx: {
|
|
3895
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
3896
|
+
},
|
|
3776
3897
|
kitContracts: {
|
|
3777
3898
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
3778
3899
|
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
@@ -3838,6 +3959,9 @@ var EarnChain;
|
|
|
3838
3959
|
destination: true
|
|
3839
3960
|
}
|
|
3840
3961
|
},
|
|
3962
|
+
cctpx: {
|
|
3963
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
3964
|
+
},
|
|
3841
3965
|
kitContracts: {
|
|
3842
3966
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET,
|
|
3843
3967
|
adapter: ADAPTER_CONTRACT_EVM_TESTNET
|
|
@@ -4669,6 +4793,9 @@ var EarnChain;
|
|
|
4669
4793
|
destination: true
|
|
4670
4794
|
}
|
|
4671
4795
|
},
|
|
4796
|
+
cctpx: {
|
|
4797
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
4798
|
+
},
|
|
4672
4799
|
kitContracts: {
|
|
4673
4800
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
4674
4801
|
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
@@ -4734,6 +4861,9 @@ var EarnChain;
|
|
|
4734
4861
|
destination: true
|
|
4735
4862
|
}
|
|
4736
4863
|
},
|
|
4864
|
+
cctpx: {
|
|
4865
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
4866
|
+
},
|
|
4737
4867
|
kitContracts: {
|
|
4738
4868
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
4739
4869
|
},
|
|
@@ -5129,6 +5259,9 @@ var EarnChain;
|
|
|
5129
5259
|
destination: true
|
|
5130
5260
|
}
|
|
5131
5261
|
},
|
|
5262
|
+
cctpx: {
|
|
5263
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_MAINNET
|
|
5264
|
+
},
|
|
5132
5265
|
kitContracts: {
|
|
5133
5266
|
bridge: BRIDGE_CONTRACT_EVM_MAINNET,
|
|
5134
5267
|
adapter: ADAPTER_CONTRACT_EVM_MAINNET
|
|
@@ -5197,6 +5330,9 @@ var EarnChain;
|
|
|
5197
5330
|
destination: true
|
|
5198
5331
|
}
|
|
5199
5332
|
},
|
|
5333
|
+
cctpx: {
|
|
5334
|
+
serviceAddress: CCTPX_SERVICE_ADDRESS_EVM_TESTNET
|
|
5335
|
+
},
|
|
5200
5336
|
kitContracts: {
|
|
5201
5337
|
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
5202
5338
|
},
|
|
@@ -6205,6 +6341,7 @@ var Chains = {
|
|
|
6205
6341
|
AptosTestnet: AptosTestnet,
|
|
6206
6342
|
Arbitrum: Arbitrum,
|
|
6207
6343
|
ArbitrumSepolia: ArbitrumSepolia,
|
|
6344
|
+
Arc: Arc,
|
|
6208
6345
|
ArcTestnet: ArcTestnet,
|
|
6209
6346
|
Avalanche: Avalanche,
|
|
6210
6347
|
AvalancheFuji: AvalancheFuji,
|
|
@@ -6462,6 +6599,7 @@ var Chains = {
|
|
|
6462
6599
|
usdcAddress: zod.z.string().nullable(),
|
|
6463
6600
|
usdtAddress: zod.z.string().nullable(),
|
|
6464
6601
|
cctp: zod.z.any().nullable(),
|
|
6602
|
+
cctpx: zod.z.any().optional(),
|
|
6465
6603
|
kitContracts: zod.z.object({
|
|
6466
6604
|
bridge: zod.z.string().optional(),
|
|
6467
6605
|
adapter: zod.z.string().optional()
|
|
@@ -6667,14 +6805,15 @@ const EARN_BRIDGE_DESTINATION_CHAIN_VALUES = EARN_BRIDGE_DESTINATION_BLOCKCHAINS
|
|
|
6667
6805
|
* Zod schema for validating the source chain of a cross-chain Earn deposit.
|
|
6668
6806
|
*
|
|
6669
6807
|
* Accept a supported source Blockchain value, a matching string literal, or a
|
|
6670
|
-
* ChainDefinition for a supported source chain. Source chains are Ethereum
|
|
6671
|
-
*
|
|
6808
|
+
* ChainDefinition for a supported source chain. Source chains are Ethereum,
|
|
6809
|
+
* Arbitrum, and Base (mainnet and testnet).
|
|
6672
6810
|
*
|
|
6673
6811
|
* @example
|
|
6674
6812
|
* ```typescript
|
|
6675
6813
|
* import { earnBridgeSourceChainIdentifierSchema } from '@core/chains'
|
|
6676
6814
|
*
|
|
6677
6815
|
* // Valid
|
|
6816
|
+
* earnBridgeSourceChainIdentifierSchema.parse('Ethereum')
|
|
6678
6817
|
* earnBridgeSourceChainIdentifierSchema.parse('Ethereum_Sepolia')
|
|
6679
6818
|
*
|
|
6680
6819
|
* // Invalid (throws ZodError)
|
|
@@ -6693,14 +6832,15 @@ const EARN_BRIDGE_DESTINATION_CHAIN_VALUES = EARN_BRIDGE_DESTINATION_BLOCKCHAINS
|
|
|
6693
6832
|
* deposit.
|
|
6694
6833
|
*
|
|
6695
6834
|
* Accept a supported destination Blockchain value, a matching string literal,
|
|
6696
|
-
* or a ChainDefinition for a supported destination chain.
|
|
6697
|
-
* Testnet
|
|
6835
|
+
* or a ChainDefinition for a supported destination chain. Arc (mainnet) and
|
|
6836
|
+
* Arc Testnet are supported.
|
|
6698
6837
|
*
|
|
6699
6838
|
* @example
|
|
6700
6839
|
* ```typescript
|
|
6701
6840
|
* import { earnBridgeDestinationChainIdentifierSchema } from '@core/chains'
|
|
6702
6841
|
*
|
|
6703
6842
|
* // Valid
|
|
6843
|
+
* earnBridgeDestinationChainIdentifierSchema.parse('Arc')
|
|
6704
6844
|
* earnBridgeDestinationChainIdentifierSchema.parse('Arc_Testnet')
|
|
6705
6845
|
*
|
|
6706
6846
|
* // Invalid (throws ZodError)
|
|
@@ -7746,6 +7886,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7746
7886
|
// Mainnets (alphabetically sorted)
|
|
7747
7887
|
// =========================================================================
|
|
7748
7888
|
[Blockchain.Arbitrum]: '0xaf88d065e77c8cC2239327C5EDb3A432268e5831',
|
|
7889
|
+
[Blockchain.Arc]: '0x3600000000000000000000000000000000000000',
|
|
7749
7890
|
[Blockchain.Avalanche]: '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
|
|
7750
7891
|
[Blockchain.Base]: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
|
|
7751
7892
|
[Blockchain.Celo]: '0xcebA9300f2b948710d2653dD7B07f33A8B32118C',
|
|
@@ -7860,6 +8001,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7860
8001
|
// =========================================================================
|
|
7861
8002
|
// Mainnets
|
|
7862
8003
|
// =========================================================================
|
|
8004
|
+
[Blockchain.Arc]: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',
|
|
7863
8005
|
[Blockchain.Avalanche]: '0xc891EB4cbdEFf6e073e859e987815Ed1505c2ACD',
|
|
7864
8006
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
7865
8007
|
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
@@ -8103,6 +8245,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8103
8245
|
// =========================================================================
|
|
8104
8246
|
// Mainnets
|
|
8105
8247
|
// =========================================================================
|
|
8248
|
+
[Blockchain.Arc]: '0x171A4217b86A807A64eB94757Db6849fb4bDbAA0',
|
|
8106
8249
|
[Blockchain.Ethereum]: '0x72DFB2E44f59C5AD2bAFE84314E5b99a7cd5075E',
|
|
8107
8250
|
// =========================================================================
|
|
8108
8251
|
// Testnets
|
|
@@ -8195,13 +8338,28 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8195
8338
|
}
|
|
8196
8339
|
|
|
8197
8340
|
/**
|
|
8198
|
-
*
|
|
8341
|
+
* Type guard: narrows a {@link TokenSelector} to a {@link RawTokenSelector}.
|
|
8199
8342
|
*
|
|
8200
8343
|
* @param selector - The token selector to check.
|
|
8201
|
-
* @returns
|
|
8344
|
+
* @returns `true` if `selector` is a raw token selector (object with `locator`).
|
|
8345
|
+
*
|
|
8346
|
+
* @example
|
|
8347
|
+
* ```typescript
|
|
8348
|
+
* if (isRawSelector(selector)) {
|
|
8349
|
+
* console.log(selector.locator)
|
|
8350
|
+
* }
|
|
8351
|
+
* ```
|
|
8202
8352
|
*/ function isRawSelector(selector) {
|
|
8203
|
-
|
|
8353
|
+
// `typeof null === 'object'` (a JS quirk) and `'locator' in null`
|
|
8354
|
+
// throws, so the explicit `null` check is required at this exported
|
|
8355
|
+
// guard for JS consumers passing nullish values. The lint rule sees
|
|
8356
|
+
// the parameter typed as `TokenSelector` (no null) and flags the
|
|
8357
|
+
// check as unnecessary — disabled because the check IS necessary at
|
|
8358
|
+
// runtime even though TypeScript can prove it dead statically.
|
|
8359
|
+
return typeof selector === 'object' && // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
8360
|
+
selector !== null && 'locator' in selector;
|
|
8204
8361
|
}
|
|
8362
|
+
|
|
8205
8363
|
/**
|
|
8206
8364
|
* Normalize a symbol to uppercase for case-insensitive lookup.
|
|
8207
8365
|
*
|
|
@@ -8389,7 +8547,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8389
8547
|
if (typeof selector === 'string') {
|
|
8390
8548
|
return resolveSymbol(selector, chainId);
|
|
8391
8549
|
}
|
|
8392
|
-
throw createTokenResolutionError(`Invalid selector type: ${typeof selector}. Expected
|
|
8550
|
+
throw createTokenResolutionError(`Invalid selector type: ${typeof selector}. Expected a token symbol or a raw selector (with locator).`, selector, chainId);
|
|
8393
8551
|
},
|
|
8394
8552
|
resolveByAddress (address, chainId) {
|
|
8395
8553
|
if (!address || typeof address !== 'string') {
|
|
@@ -8977,7 +9135,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8977
9135
|
}
|
|
8978
9136
|
|
|
8979
9137
|
var name$3 = "@circle-fin/bridge-kit";
|
|
8980
|
-
var version$3 = "1.
|
|
9138
|
+
var version$3 = "1.15.0";
|
|
8981
9139
|
var pkg$3 = {
|
|
8982
9140
|
name: name$3,
|
|
8983
9141
|
version: version$3};
|
|
@@ -9597,7 +9755,72 @@ var TransferSpeed;
|
|
|
9597
9755
|
*/ recipientAddress: zod.z.string().trim().min(1, 'Fee recipient must be a non-empty string').optional()
|
|
9598
9756
|
}).strict();
|
|
9599
9757
|
/**
|
|
9600
|
-
*
|
|
9758
|
+
* Factory for the bridge-params Zod schema, parameterized by the token
|
|
9759
|
+
* validator. The base schema enforces all non-token fields (amount,
|
|
9760
|
+
* source, destination, config); callers supply the Zod schema for the
|
|
9761
|
+
* `token` field, allowing each provider to validate the token type it
|
|
9762
|
+
* accepts.
|
|
9763
|
+
*
|
|
9764
|
+
* @param tokenSchema - Zod schema applied to the `token` field. Pass
|
|
9765
|
+
* `z.literal('USDC')` for USDC-only validation, or any
|
|
9766
|
+
* provider-specific schema (e.g. a `0x`-prefixed hex regex) for
|
|
9767
|
+
* providers that accept a different token type.
|
|
9768
|
+
* @param config - Required. `maxDecimals` caps the decimal precision
|
|
9769
|
+
* permitted in `amount` and `config.maxFee`. Pass the widest value
|
|
9770
|
+
* any of the provider's tokens require — `6` for USDC-only, `18`
|
|
9771
|
+
* for an ERC-20 family that includes wETH, etc. The schema is a
|
|
9772
|
+
* coarse syntactic gate; narrower per-token precision is enforced
|
|
9773
|
+
* by the provider downstream.
|
|
9774
|
+
* @returns A Zod object schema whose `token` field is validated by
|
|
9775
|
+
* `tokenSchema` and whose other fields (`amount`, `source`,
|
|
9776
|
+
* `destination`, `config`) are validated against the shared bridge
|
|
9777
|
+
* contract. Use `.safeParse` / `.parse` directly, or feed the schema
|
|
9778
|
+
* to {@link parseOrThrow} from `@core/utils` to surface validation
|
|
9779
|
+
* failures as `KitError` with the canonical
|
|
9780
|
+
* `INPUT_VALIDATION_FAILED` code.
|
|
9781
|
+
*
|
|
9782
|
+
* @example
|
|
9783
|
+
* ```typescript
|
|
9784
|
+
* import { createBridgeParamsSchema, z } from '@core/provider'
|
|
9785
|
+
*
|
|
9786
|
+
* const usdcSchema = createBridgeParamsSchema(z.literal('USDC'), { maxDecimals: 6 })
|
|
9787
|
+
* const hexSchema = createBridgeParamsSchema(
|
|
9788
|
+
* z.string().regex(/^0x[0-9a-fA-F]{64}$/),
|
|
9789
|
+
* { maxDecimals: 18 },
|
|
9790
|
+
* )
|
|
9791
|
+
* ```
|
|
9792
|
+
*/ // The full inferred return type of `z.object({...})` here is
|
|
9793
|
+
// effectively impossible to spell out by hand without re-stating every
|
|
9794
|
+
// field's schema. TypeScript infers it from the body — callers receive
|
|
9795
|
+
// a precise Zod schema type via inference, and the explicit-return
|
|
9796
|
+
// rules are disabled for that reason.
|
|
9797
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types
|
|
9798
|
+
function createBridgeParamsSchema(tokenSchema, config) {
|
|
9799
|
+
const { maxDecimals } = config;
|
|
9800
|
+
return zod.z.object({
|
|
9801
|
+
amount: zod.z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
9802
|
+
allowZero: false,
|
|
9803
|
+
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
9804
|
+
attributeName: 'amount',
|
|
9805
|
+
maxDecimals
|
|
9806
|
+
})(zod.z.string())),
|
|
9807
|
+
source: walletContextSchema,
|
|
9808
|
+
destination: bridgeDestinationSchema$1,
|
|
9809
|
+
token: tokenSchema,
|
|
9810
|
+
config: zod.z.object({
|
|
9811
|
+
transferSpeed: zod.z.nativeEnum(TransferSpeed).optional(),
|
|
9812
|
+
maxFee: zod.z.string().pipe(createDecimalStringValidator({
|
|
9813
|
+
allowZero: true,
|
|
9814
|
+
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
9815
|
+
attributeName: 'maxFee',
|
|
9816
|
+
maxDecimals
|
|
9817
|
+
})(zod.z.string())).optional(),
|
|
9818
|
+
customFee: customFeeSchema.optional()
|
|
9819
|
+
})
|
|
9820
|
+
});
|
|
9821
|
+
}
|
|
9822
|
+
/**
|
|
9823
|
+
* Schema for validating bridge parameters with USDC as the token.
|
|
9601
9824
|
* This ensures all required fields are present and properly typed.
|
|
9602
9825
|
* A bridge must include:
|
|
9603
9826
|
* - A valid amount (non-empty numeric string \> 0)
|
|
@@ -9605,11 +9828,15 @@ var TransferSpeed;
|
|
|
9605
9828
|
* - USDC as the token
|
|
9606
9829
|
* - Optional config with transfer speed and max fee settings
|
|
9607
9830
|
*
|
|
9831
|
+
* Providers that accept a non-USDC token type should call
|
|
9832
|
+
* {@link createBridgeParamsSchema} with their own token schema rather
|
|
9833
|
+
* than reusing this constant.
|
|
9834
|
+
*
|
|
9608
9835
|
* @throws KitError if validation fails
|
|
9609
9836
|
*
|
|
9610
9837
|
* @example
|
|
9611
9838
|
* ```typescript
|
|
9612
|
-
* import {
|
|
9839
|
+
* import { usdcBridgeParamsSchema } from '@core/provider'
|
|
9613
9840
|
*
|
|
9614
9841
|
* const validBridge = {
|
|
9615
9842
|
* amount: '100.50',
|
|
@@ -9634,175 +9861,43 @@ var TransferSpeed;
|
|
|
9634
9861
|
* }
|
|
9635
9862
|
* }
|
|
9636
9863
|
*
|
|
9637
|
-
* const result =
|
|
9864
|
+
* const result = usdcBridgeParamsSchema.safeParse(validBridge)
|
|
9638
9865
|
* console.log(result.success) // true
|
|
9639
9866
|
* ```
|
|
9640
|
-
*/ zod.z.
|
|
9641
|
-
|
|
9642
|
-
allowZero: false,
|
|
9643
|
-
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
9644
|
-
attributeName: 'amount',
|
|
9645
|
-
maxDecimals: 6
|
|
9646
|
-
})(zod.z.string())),
|
|
9647
|
-
source: walletContextSchema,
|
|
9648
|
-
destination: bridgeDestinationSchema$1,
|
|
9649
|
-
token: zod.z.literal('USDC'),
|
|
9650
|
-
config: zod.z.object({
|
|
9651
|
-
transferSpeed: zod.z.nativeEnum(TransferSpeed).optional(),
|
|
9652
|
-
maxFee: zod.z.string().pipe(createDecimalStringValidator({
|
|
9653
|
-
allowZero: true,
|
|
9654
|
-
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
9655
|
-
attributeName: 'maxFee',
|
|
9656
|
-
maxDecimals: 6
|
|
9657
|
-
})(zod.z.string())).optional(),
|
|
9658
|
-
customFee: customFeeSchema.optional()
|
|
9659
|
-
})
|
|
9867
|
+
*/ createBridgeParamsSchema(zod.z.literal('USDC'), {
|
|
9868
|
+
maxDecimals: 6
|
|
9660
9869
|
});
|
|
9661
9870
|
|
|
9662
|
-
|
|
9663
|
-
|
|
9664
|
-
|
|
9665
|
-
|
|
9666
|
-
|
|
9667
|
-
|
|
9668
|
-
|
|
9669
|
-
|
|
9670
|
-
|
|
9671
|
-
|
|
9672
|
-
|
|
9673
|
-
|
|
9674
|
-
|
|
9675
|
-
|
|
9676
|
-
|
|
9677
|
-
|
|
9678
|
-
|
|
9679
|
-
|
|
9680
|
-
|
|
9681
|
-
|
|
9682
|
-
}
|
|
9683
|
-
};
|
|
9684
|
-
}
|
|
9685
|
-
/**
|
|
9686
|
-
* Schema for validating AdapterContext for bridge operations.
|
|
9687
|
-
* Must always contain both adapter and chain explicitly.
|
|
9688
|
-
*
|
|
9689
|
-
* Optionally includes address for developer-controlled adapters.
|
|
9690
|
-
*/ const adapterContextSchema$3 = zod.z.object({
|
|
9691
|
-
adapter: adapterSchema,
|
|
9692
|
-
chain: bridgeChainIdentifierSchema,
|
|
9693
|
-
address: zod.z.string().optional()
|
|
9694
|
-
});
|
|
9695
|
-
/**
|
|
9696
|
-
* Schema for validating BridgeDestinationWithAddress objects.
|
|
9697
|
-
* Contains an explicit recipientAddress along with adapter and chain.
|
|
9698
|
-
* The address format is validated based on the chain type (EVM or Solana).
|
|
9699
|
-
*/ const bridgeDestinationWithAddressSchema = adapterContextSchema$3.extend({
|
|
9700
|
-
recipientAddress: zod.z.string().min(1, 'Recipient address is required'),
|
|
9701
|
-
useForwarder: zod.z.boolean().optional()
|
|
9702
|
-
}).superRefine(createRecipientAddressValidator());
|
|
9703
|
-
/**
|
|
9704
|
-
* Schema for validating AdapterContext with optional useForwarder.
|
|
9705
|
-
* Extends adapterContextSchema with the useForwarder flag.
|
|
9706
|
-
*/ const adapterContextWithForwarderSchema = adapterContextSchema$3.extend({
|
|
9707
|
-
useForwarder: zod.z.boolean().optional()
|
|
9708
|
-
});
|
|
9709
|
-
/**
|
|
9710
|
-
* Schema for validating ForwarderDestination objects.
|
|
9711
|
-
* Used when useForwarder is true and no adapter is provided.
|
|
9712
|
-
* Requires chain, recipientAddress, and useForwarder: true.
|
|
9713
|
-
*
|
|
9714
|
-
* When using this destination type:
|
|
9715
|
-
* - The mint step completes when the IRIS API confirms forwardState === 'CONFIRMED'
|
|
9716
|
-
* - No on-chain transaction confirmation is performed (no adapter available)
|
|
9717
|
-
* - The mint step's data field will be undefined (no transaction receipt)
|
|
9718
|
-
*/ const forwarderDestinationSchema = zod.z.object({
|
|
9719
|
-
chain: bridgeChainIdentifierSchema,
|
|
9720
|
-
recipientAddress: zod.z.string().min(1, 'Recipient address is required'),
|
|
9721
|
-
useForwarder: zod.z.literal(true)
|
|
9722
|
-
}).strict().superRefine(createRecipientAddressValidator());
|
|
9723
|
-
/**
|
|
9724
|
-
* Schema for validating BridgeDestination union type.
|
|
9725
|
-
* Supports three destination configurations:
|
|
9726
|
-
* - BridgeDestinationWithAddress (adapter with explicit recipient)
|
|
9727
|
-
* - ForwarderDestination (no adapter, requires useForwarder: true and recipientAddress)
|
|
9728
|
-
* - AdapterContext with optional useForwarder (adapter for default recipient)
|
|
9729
|
-
*
|
|
9730
|
-
* When using ForwarderDestination (no adapter):
|
|
9731
|
-
* - The mint step completes when the IRIS API confirms forwardState === 'CONFIRMED'
|
|
9732
|
-
* - No on-chain transaction confirmation is performed
|
|
9733
|
-
*
|
|
9734
|
-
* The order matters: we check the more specific schemas first.
|
|
9735
|
-
* This ensures that objects with specific fields are matched correctly.
|
|
9736
|
-
*/ const bridgeDestinationSchema = zod.z.union([
|
|
9737
|
-
bridgeDestinationWithAddressSchema,
|
|
9738
|
-
forwarderDestinationSchema,
|
|
9739
|
-
adapterContextWithForwarderSchema.strict()
|
|
9740
|
-
]);
|
|
9741
|
-
/**
|
|
9742
|
-
* Schema for validating bridge parameters with chain identifiers.
|
|
9743
|
-
* This extends the core provider's schema but adapts it for the bridge kit's
|
|
9744
|
-
* more flexible interface that accepts chain identifiers.
|
|
9745
|
-
*
|
|
9746
|
-
* The schema validates:
|
|
9747
|
-
* - From adapter context (must always include both adapter and chain)
|
|
9748
|
-
* - To bridge destination (AdapterContext or BridgeDestinationWithAddress)
|
|
9749
|
-
* - Amount is a non-empty numeric string \> 0
|
|
9750
|
-
* - Token is optional and defaults to 'USDC'
|
|
9751
|
-
* - Optional config parameters (transfer speed, max fee)
|
|
9871
|
+
// ----------------------------------------------------------------------------
|
|
9872
|
+
// IRIS API base URLs
|
|
9873
|
+
// ----------------------------------------------------------------------------
|
|
9874
|
+
// ----------------------------------------------------------------------------
|
|
9875
|
+
// Known token symbols (DX convenience)
|
|
9876
|
+
// ----------------------------------------------------------------------------
|
|
9877
|
+
//
|
|
9878
|
+
// These constants back symbol -> id resolution as a convenience: a caller may
|
|
9879
|
+
// pass a known symbol instead of a raw bytes32 id. They do NOT gate
|
|
9880
|
+
// routability.
|
|
9881
|
+
/**
|
|
9882
|
+
* Display symbols the provider recognizes as a convenience for callers.
|
|
9883
|
+
*
|
|
9884
|
+
* A consumer may pass one of these symbols instead of a raw bytes32 token
|
|
9885
|
+
* id; the provider resolves it to the symbol's canonical bytes32 id via
|
|
9886
|
+
* {@link KNOWN_TOKEN_IDS_BY_NETWORK} (a symbol can map to more than one
|
|
9887
|
+
* bridge, so the map pins the canonical one). This list does NOT gate
|
|
9888
|
+
* routability: any token the IRIS registry lists with deployments on both
|
|
9889
|
+
* endpoints routes when passed by its bytes32 id, whether listed here or
|
|
9890
|
+
* not.
|
|
9752
9891
|
*
|
|
9753
9892
|
* @example
|
|
9754
9893
|
* ```typescript
|
|
9755
|
-
*
|
|
9756
|
-
*
|
|
9757
|
-
* const params = {
|
|
9758
|
-
* from: {
|
|
9759
|
-
* adapter: sourceAdapter,
|
|
9760
|
-
* chain: 'Ethereum'
|
|
9761
|
-
* },
|
|
9762
|
-
* to: {
|
|
9763
|
-
* adapter: destAdapter,
|
|
9764
|
-
* chain: 'Base'
|
|
9765
|
-
* },
|
|
9766
|
-
* amount: '100.50',
|
|
9767
|
-
* token: 'USDC',
|
|
9768
|
-
* config: {
|
|
9769
|
-
* transferSpeed: 'FAST'
|
|
9770
|
-
* }
|
|
9771
|
-
* }
|
|
9772
|
-
*
|
|
9773
|
-
* const result = bridgeParamsWithChainIdentifierSchema.safeParse(params)
|
|
9774
|
-
* if (result.success) {
|
|
9775
|
-
* console.log('Parameters are valid')
|
|
9776
|
-
* } else {
|
|
9777
|
-
* console.error('Validation failed:', result.error)
|
|
9778
|
-
* }
|
|
9894
|
+
* for (const symbol of KNOWN_TOKEN_SYMBOLS) console.log(symbol)
|
|
9779
9895
|
* ```
|
|
9780
|
-
*/
|
|
9781
|
-
|
|
9782
|
-
|
|
9783
|
-
|
|
9784
|
-
|
|
9785
|
-
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
9786
|
-
attributeName: 'amount',
|
|
9787
|
-
maxDecimals: 6
|
|
9788
|
-
})(zod.z.string())),
|
|
9789
|
-
token: zod.z.literal('USDC').optional(),
|
|
9790
|
-
config: zod.z.object({
|
|
9791
|
-
transferSpeed: zod.z.nativeEnum(TransferSpeed).optional(),
|
|
9792
|
-
feePayment: zod.z.enum([
|
|
9793
|
-
'source',
|
|
9794
|
-
'destination'
|
|
9795
|
-
]).optional(),
|
|
9796
|
-
maxFee: zod.z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
9797
|
-
allowZero: true,
|
|
9798
|
-
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
9799
|
-
attributeName: 'maxFee',
|
|
9800
|
-
maxDecimals: 6
|
|
9801
|
-
})(zod.z.string())).optional(),
|
|
9802
|
-
customFee: customFeeSchema.optional()
|
|
9803
|
-
}).optional(),
|
|
9804
|
-
quote: zod.z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex').optional()
|
|
9805
|
-
});
|
|
9896
|
+
*/ const KNOWN_TOKEN_SYMBOLS = [
|
|
9897
|
+
'cirBTC',
|
|
9898
|
+
'wETH',
|
|
9899
|
+
'EURC'
|
|
9900
|
+
];
|
|
9806
9901
|
|
|
9807
9902
|
// ============================================================================
|
|
9808
9903
|
// Crypto Utilities (Internal)
|
|
@@ -10223,6 +10318,186 @@ var TransferSpeed;
|
|
|
10223
10318
|
clock: zod.z.any().optional()
|
|
10224
10319
|
}).passthrough();
|
|
10225
10320
|
|
|
10321
|
+
/**
|
|
10322
|
+
* Creates a Zod superRefine validator for recipient address format validation.
|
|
10323
|
+
* Validates that the address format matches the expected format for the chain type.
|
|
10324
|
+
*
|
|
10325
|
+
* @returns A superRefine function that validates recipientAddress against chain type
|
|
10326
|
+
*/ function createRecipientAddressValidator() {
|
|
10327
|
+
return (data, ctx)=>{
|
|
10328
|
+
const chain = data.chain;
|
|
10329
|
+
if (chain === null) {
|
|
10330
|
+
return;
|
|
10331
|
+
}
|
|
10332
|
+
if (!isValidAddressForChain(data.recipientAddress, chain)) {
|
|
10333
|
+
const chainInfo = extractChainInfo(chain);
|
|
10334
|
+
ctx.addIssue({
|
|
10335
|
+
code: zod.z.ZodIssueCode.custom,
|
|
10336
|
+
path: [
|
|
10337
|
+
'recipientAddress'
|
|
10338
|
+
],
|
|
10339
|
+
message: `Invalid address format for ${String(chainInfo.name)}. Expected ${chainInfo.expectedAddressFormat}, but received: ${data.recipientAddress}`
|
|
10340
|
+
});
|
|
10341
|
+
}
|
|
10342
|
+
};
|
|
10343
|
+
}
|
|
10344
|
+
/**
|
|
10345
|
+
* Schema for `BridgeParams.token`.
|
|
10346
|
+
*
|
|
10347
|
+
* Accept `'USDC'`, a symbol from {@link KNOWN_TOKEN_SYMBOLS}, or a bytes32 id
|
|
10348
|
+
* (`0x` plus exactly 64 hex characters). Reject unknown symbols, malformed ids,
|
|
10349
|
+
* and `{ provider, id }` objects. A custom extra provider cannot introduce a
|
|
10350
|
+
* new symbol through this field — only a bytes32 id.
|
|
10351
|
+
*
|
|
10352
|
+
* Omit the field to default to `'USDC'`.
|
|
10353
|
+
*/ const bridgeTokenSchema = zod.z.union([
|
|
10354
|
+
zod.z.enum([
|
|
10355
|
+
'USDC',
|
|
10356
|
+
...KNOWN_TOKEN_SYMBOLS
|
|
10357
|
+
]),
|
|
10358
|
+
zod.z.string().regex(/^0x[0-9a-fA-F]{64}$/, 'Token id must be a bytes32 (0x-prefixed, 64 hex chars)')
|
|
10359
|
+
]);
|
|
10360
|
+
/**
|
|
10361
|
+
* Schema for validating AdapterContext for bridge operations.
|
|
10362
|
+
* Must always contain both adapter and chain explicitly.
|
|
10363
|
+
*
|
|
10364
|
+
* Optionally includes address for developer-controlled adapters.
|
|
10365
|
+
*/ const adapterContextSchema$3 = zod.z.object({
|
|
10366
|
+
adapter: adapterSchema,
|
|
10367
|
+
chain: bridgeChainIdentifierSchema,
|
|
10368
|
+
address: zod.z.string().optional()
|
|
10369
|
+
});
|
|
10370
|
+
/**
|
|
10371
|
+
* Schema for validating BridgeDestinationWithAddress objects.
|
|
10372
|
+
* Contains an explicit recipientAddress along with adapter and chain.
|
|
10373
|
+
* The address format is validated based on the chain type (EVM or Solana).
|
|
10374
|
+
*/ const bridgeDestinationWithAddressSchema = adapterContextSchema$3.extend({
|
|
10375
|
+
recipientAddress: zod.z.string().min(1, 'Recipient address is required'),
|
|
10376
|
+
useForwarder: zod.z.boolean().optional()
|
|
10377
|
+
}).superRefine(createRecipientAddressValidator());
|
|
10378
|
+
/**
|
|
10379
|
+
* Schema for validating AdapterContext with optional useForwarder.
|
|
10380
|
+
* Extends adapterContextSchema with the useForwarder flag.
|
|
10381
|
+
*/ const adapterContextWithForwarderSchema = adapterContextSchema$3.extend({
|
|
10382
|
+
useForwarder: zod.z.boolean().optional()
|
|
10383
|
+
});
|
|
10384
|
+
/**
|
|
10385
|
+
* Schema for validating ForwarderDestination objects.
|
|
10386
|
+
* Used when useForwarder is true and no adapter is provided.
|
|
10387
|
+
* Requires chain, recipientAddress, and useForwarder: true.
|
|
10388
|
+
*
|
|
10389
|
+
* When using this destination type:
|
|
10390
|
+
* - The mint step completes when the IRIS API confirms forwardState === 'CONFIRMED'
|
|
10391
|
+
* - No on-chain transaction confirmation is performed (no adapter available)
|
|
10392
|
+
* - The mint step's data field will be undefined (no transaction receipt)
|
|
10393
|
+
*/ const forwarderDestinationSchema = zod.z.object({
|
|
10394
|
+
chain: bridgeChainIdentifierSchema,
|
|
10395
|
+
recipientAddress: zod.z.string().min(1, 'Recipient address is required'),
|
|
10396
|
+
useForwarder: zod.z.literal(true)
|
|
10397
|
+
}).strict().superRefine(createRecipientAddressValidator());
|
|
10398
|
+
/**
|
|
10399
|
+
* Schema for validating BridgeDestination union type.
|
|
10400
|
+
* Supports three destination configurations:
|
|
10401
|
+
* - BridgeDestinationWithAddress (adapter with explicit recipient)
|
|
10402
|
+
* - ForwarderDestination (no adapter, requires useForwarder: true and recipientAddress)
|
|
10403
|
+
* - AdapterContext with optional useForwarder (adapter for default recipient)
|
|
10404
|
+
*
|
|
10405
|
+
* When using ForwarderDestination (no adapter):
|
|
10406
|
+
* - The mint step completes when the IRIS API confirms forwardState === 'CONFIRMED'
|
|
10407
|
+
* - No on-chain transaction confirmation is performed
|
|
10408
|
+
*
|
|
10409
|
+
* The order matters: we check the more specific schemas first.
|
|
10410
|
+
* This ensures that objects with specific fields are matched correctly.
|
|
10411
|
+
*/ const bridgeDestinationSchema = zod.z.union([
|
|
10412
|
+
bridgeDestinationWithAddressSchema,
|
|
10413
|
+
forwarderDestinationSchema,
|
|
10414
|
+
adapterContextWithForwarderSchema.strict()
|
|
10415
|
+
]);
|
|
10416
|
+
/**
|
|
10417
|
+
* Schema for validating bridge parameters with chain identifiers.
|
|
10418
|
+
* This extends the core provider's schema but adapts it for the bridge kit's
|
|
10419
|
+
* more flexible interface that accepts chain identifiers.
|
|
10420
|
+
*
|
|
10421
|
+
* The schema validates:
|
|
10422
|
+
* - From adapter context (must always include both adapter and chain)
|
|
10423
|
+
* - To bridge destination (AdapterContext or BridgeDestinationWithAddress)
|
|
10424
|
+
* - Amount is a non-empty numeric string \> 0
|
|
10425
|
+
* - Token is optional and defaults to 'USDC'
|
|
10426
|
+
* - Optional config parameters (transfer speed, max fee)
|
|
10427
|
+
*
|
|
10428
|
+
* @example
|
|
10429
|
+
* ```typescript
|
|
10430
|
+
* import { bridgeParamsWithChainIdentifierSchema } from '@circle-fin/bridge-kit'
|
|
10431
|
+
*
|
|
10432
|
+
* const params = {
|
|
10433
|
+
* from: {
|
|
10434
|
+
* adapter: sourceAdapter,
|
|
10435
|
+
* chain: 'Ethereum'
|
|
10436
|
+
* },
|
|
10437
|
+
* to: {
|
|
10438
|
+
* adapter: destAdapter,
|
|
10439
|
+
* chain: 'Base'
|
|
10440
|
+
* },
|
|
10441
|
+
* amount: '100.50',
|
|
10442
|
+
* token: 'USDC',
|
|
10443
|
+
* config: {
|
|
10444
|
+
* transferSpeed: 'FAST'
|
|
10445
|
+
* }
|
|
10446
|
+
* }
|
|
10447
|
+
*
|
|
10448
|
+
* const result = bridgeParamsWithChainIdentifierSchema.safeParse(params)
|
|
10449
|
+
* if (result.success) {
|
|
10450
|
+
* console.log('Parameters are valid')
|
|
10451
|
+
* } else {
|
|
10452
|
+
* console.error('Validation failed:', result.error)
|
|
10453
|
+
* }
|
|
10454
|
+
* ```
|
|
10455
|
+
*/ zod.z.object({
|
|
10456
|
+
from: adapterContextSchema$3.strict(),
|
|
10457
|
+
to: bridgeDestinationSchema,
|
|
10458
|
+
amount: zod.z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
10459
|
+
allowZero: false,
|
|
10460
|
+
regexMessage: AMOUNT_FORMAT_ERROR_MESSAGE,
|
|
10461
|
+
attributeName: 'amount',
|
|
10462
|
+
// Widest precision any routable token needs (wETH = 18). This gate is
|
|
10463
|
+
// token-agnostic and runs before the route provider is known, so it
|
|
10464
|
+
// can only cap coarsely; the token's exact precision is enforced later
|
|
10465
|
+
// at the scaling boundary (`BridgeKit.scaleResolvedAmount`). USDC (6)
|
|
10466
|
+
// and every narrower token stay valid.
|
|
10467
|
+
maxDecimals: 18
|
|
10468
|
+
})(zod.z.string())),
|
|
10469
|
+
token: bridgeTokenSchema.optional(),
|
|
10470
|
+
config: zod.z.object({
|
|
10471
|
+
transferSpeed: zod.z.nativeEnum(TransferSpeed).optional(),
|
|
10472
|
+
feePayment: zod.z.enum([
|
|
10473
|
+
'source',
|
|
10474
|
+
'destination'
|
|
10475
|
+
]).optional(),
|
|
10476
|
+
maxFee: zod.z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
10477
|
+
allowZero: true,
|
|
10478
|
+
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
10479
|
+
attributeName: 'maxFee',
|
|
10480
|
+
// See `amount` above: widest routable precision (18); the exact
|
|
10481
|
+
// per-token precision is enforced at the scaling boundary.
|
|
10482
|
+
maxDecimals: 18
|
|
10483
|
+
})(zod.z.string())).optional(),
|
|
10484
|
+
customFee: customFeeSchema.optional()
|
|
10485
|
+
}).optional(),
|
|
10486
|
+
// Top-level (not nested under `config`) to mirror `BridgeParams.quote`.
|
|
10487
|
+
//
|
|
10488
|
+
// `z.unknown()` rather than a shape: the quote belongs to whichever provider
|
|
10489
|
+
// issued it, and a route is matched to a provider only after these
|
|
10490
|
+
// parameters are validated, so there is no one shape to check here.
|
|
10491
|
+
//
|
|
10492
|
+
// It also keeps the value intact. This object strips unknown keys, so a
|
|
10493
|
+
// nested `z.object()` would clone the quote and drop every key not listed —
|
|
10494
|
+
// losing a field the issuing provider added, between `estimate` and
|
|
10495
|
+
// `bridge`. Shape is checked where the quote is consumed instead: CCTPx
|
|
10496
|
+
// against its own envelope schema, and the receive-exact path in
|
|
10497
|
+
// `sourceFees.ts` before it calls the Fee Service.
|
|
10498
|
+
quote: zod.z.unknown().optional()
|
|
10499
|
+
});
|
|
10500
|
+
|
|
10226
10501
|
/**
|
|
10227
10502
|
* The ASCII "cctp-forward" magic, hex-encoded (no `0x`), that a forward-friendly
|
|
10228
10503
|
* hookData must start with.
|
|
@@ -10462,7 +10737,7 @@ const validateQuoteItemSchema = zod.z.object({
|
|
|
10462
10737
|
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
10463
10738
|
|
|
10464
10739
|
var name$2 = "@circle-fin/swap-kit";
|
|
10465
|
-
var version$2 = "1.
|
|
10740
|
+
var version$2 = "1.7.0";
|
|
10466
10741
|
var pkg$2 = {
|
|
10467
10742
|
name: name$2,
|
|
10468
10743
|
version: version$2};
|
|
@@ -12626,6 +12901,11 @@ createTokenRegistry();
|
|
|
12626
12901
|
name: 'USDC',
|
|
12627
12902
|
version: '2'
|
|
12628
12903
|
},
|
|
12904
|
+
Arc: {
|
|
12905
|
+
chainId: Arc.chainId,
|
|
12906
|
+
name: 'USDC',
|
|
12907
|
+
version: '2'
|
|
12908
|
+
},
|
|
12629
12909
|
Arc_Testnet: {
|
|
12630
12910
|
chainId: ArcTestnet.chainId,
|
|
12631
12911
|
name: 'USDC',
|
|
@@ -14161,7 +14441,7 @@ new Set(Object.values(Blockchain));
|
|
|
14161
14441
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
14162
14442
|
|
|
14163
14443
|
var name$1 = "@circle-fin/earn-kit";
|
|
14164
|
-
var version$1 = "1.
|
|
14444
|
+
var version$1 = "1.7.0";
|
|
14165
14445
|
var pkg$1 = {
|
|
14166
14446
|
name: name$1,
|
|
14167
14447
|
version: version$1};
|
|
@@ -14189,18 +14469,22 @@ const EARN_BRIDGE_ERC3009_TOKEN_SYMBOLS = [
|
|
|
14189
14469
|
*
|
|
14190
14470
|
* @internal
|
|
14191
14471
|
*/ const CHAIN_TO_API = {
|
|
14472
|
+
[Blockchain.Arc]: 'ARC',
|
|
14192
14473
|
[Blockchain.Arc_Testnet]: 'ARC-TESTNET'
|
|
14193
14474
|
};
|
|
14194
14475
|
/**
|
|
14195
14476
|
* Map SDK source chain identifiers to bridge source-chain strings.
|
|
14196
14477
|
*
|
|
14197
|
-
* Cross-chain Earn deposits
|
|
14198
|
-
*
|
|
14478
|
+
* Cross-chain Earn deposits support Ethereum, Arbitrum, and Base (mainnet
|
|
14479
|
+
* and testnet) as source chains.
|
|
14199
14480
|
*
|
|
14200
14481
|
* @internal
|
|
14201
14482
|
*/ const EARN_BRIDGE_SOURCE_CHAIN_TO_API = {
|
|
14483
|
+
[Blockchain.Arbitrum]: 'ARB',
|
|
14202
14484
|
[Blockchain.Arbitrum_Sepolia]: 'ARB-SEPOLIA',
|
|
14485
|
+
[Blockchain.Base]: 'BASE',
|
|
14203
14486
|
[Blockchain.Base_Sepolia]: 'BASE-SEPOLIA',
|
|
14487
|
+
[Blockchain.Ethereum]: 'ETH',
|
|
14204
14488
|
[Blockchain.Ethereum_Sepolia]: 'ETH-SEPOLIA'
|
|
14205
14489
|
};
|
|
14206
14490
|
/**
|
|
@@ -14211,17 +14495,30 @@ const EARN_BRIDGE_ERC3009_TOKEN_SYMBOLS = [
|
|
|
14211
14495
|
*
|
|
14212
14496
|
* @internal
|
|
14213
14497
|
*/ const EARN_BRIDGE_DESTINATION_CHAIN_TO_API = {
|
|
14498
|
+
[Blockchain.Arc]: CHAIN_TO_API[Blockchain.Arc],
|
|
14214
14499
|
[Blockchain.Arc_Testnet]: CHAIN_TO_API[Blockchain.Arc_Testnet]
|
|
14215
14500
|
};
|
|
14216
14501
|
const EARN_BRIDGE_USDC_ERC3009_DOMAINS = {
|
|
14502
|
+
[Blockchain.Arbitrum]: {
|
|
14503
|
+
name: 'USD Coin',
|
|
14504
|
+
version: '2'
|
|
14505
|
+
},
|
|
14217
14506
|
[Blockchain.Arbitrum_Sepolia]: {
|
|
14218
14507
|
name: 'USD Coin',
|
|
14219
14508
|
version: '2'
|
|
14220
14509
|
},
|
|
14510
|
+
[Blockchain.Base]: {
|
|
14511
|
+
name: 'USD Coin',
|
|
14512
|
+
version: '2'
|
|
14513
|
+
},
|
|
14221
14514
|
[Blockchain.Base_Sepolia]: {
|
|
14222
14515
|
name: 'USDC',
|
|
14223
14516
|
version: '2'
|
|
14224
14517
|
},
|
|
14518
|
+
[Blockchain.Ethereum]: {
|
|
14519
|
+
name: 'USD Coin',
|
|
14520
|
+
version: '2'
|
|
14521
|
+
},
|
|
14225
14522
|
[Blockchain.Ethereum_Sepolia]: {
|
|
14226
14523
|
name: 'USDC',
|
|
14227
14524
|
version: '2'
|
|
@@ -17065,7 +17362,7 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
17065
17362
|
}
|
|
17066
17363
|
|
|
17067
17364
|
var name = "@circle-fin/provider-earn-service";
|
|
17068
|
-
var version = "1.
|
|
17365
|
+
var version = "1.6.0";
|
|
17069
17366
|
var pkg = {
|
|
17070
17367
|
name: name,
|
|
17071
17368
|
version: version};
|