@circle-fin/app-kit 1.12.1 → 1.14.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 +115 -0
- package/README.md +31 -12
- package/bridge.cjs +3231 -340
- package/bridge.d.cts +141 -17
- package/bridge.d.mts +141 -17
- package/bridge.d.ts +141 -17
- package/bridge.mjs +3233 -342
- package/chains.cjs +261 -8
- package/chains.d.cts +135 -1
- package/chains.d.mts +135 -1
- package/chains.d.ts +135 -1
- package/chains.mjs +260 -9
- package/context.d.cts +141 -17
- package/context.d.mts +141 -17
- package/context.d.ts +141 -17
- package/earn.cjs +887 -63
- package/earn.d.cts +141 -17
- package/earn.d.mts +141 -17
- package/earn.d.ts +141 -17
- package/earn.mjs +883 -63
- package/estimateBridge.cjs +3231 -340
- package/estimateBridge.d.cts +257 -18
- package/estimateBridge.d.mts +257 -18
- package/estimateBridge.d.ts +257 -18
- package/estimateBridge.mjs +3233 -342
- package/estimateSwap.cjs +988 -146
- package/estimateSwap.d.cts +141 -17
- package/estimateSwap.d.mts +141 -17
- package/estimateSwap.d.ts +141 -17
- package/estimateSwap.mjs +987 -146
- package/index.cjs +6828 -894
- package/index.d.cts +1621 -258
- package/index.d.mts +1621 -258
- package/index.d.ts +1621 -258
- package/index.mjs +6830 -896
- package/package.json +6 -6
- package/swap.cjs +988 -146
- package/swap.d.cts +148 -18
- package/swap.d.mts +148 -18
- package/swap.d.ts +148 -18
- package/swap.mjs +987 -146
- package/unifiedBalance.cjs +22219 -9689
- package/unifiedBalance.d.cts +620 -162
- package/unifiedBalance.d.mts +620 -162
- package/unifiedBalance.d.ts +620 -162
- package/unifiedBalance.mjs +22348 -9819
package/earn.cjs
CHANGED
|
@@ -30,7 +30,7 @@ if (typeof window !== 'undefined' && typeof window.Buffer === 'undefined') {
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
var zod = require('zod');
|
|
33
|
-
require('pino');
|
|
33
|
+
var pino = require('pino');
|
|
34
34
|
require('@ethersproject/bytes');
|
|
35
35
|
require('@ethersproject/abi');
|
|
36
36
|
require('@ethersproject/address');
|
|
@@ -43,6 +43,10 @@ var viem = require('viem');
|
|
|
43
43
|
var units = require('@ethersproject/units');
|
|
44
44
|
var keccak256 = require('@ethersproject/keccak256');
|
|
45
45
|
|
|
46
|
+
function _interopDefault (e) { return e && e.__esModule ? e.default : e; }
|
|
47
|
+
|
|
48
|
+
var pino__default = /*#__PURE__*/_interopDefault(pino);
|
|
49
|
+
|
|
46
50
|
// Import global type declarations
|
|
47
51
|
/**
|
|
48
52
|
* Check whether the current runtime is Node.js.
|
|
@@ -2349,6 +2353,8 @@ function getOptionalString(value) {
|
|
|
2349
2353
|
Blockchain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
2350
2354
|
Blockchain["Pharos"] = "Pharos";
|
|
2351
2355
|
Blockchain["Pharos_Testnet"] = "Pharos_Testnet";
|
|
2356
|
+
Blockchain["Plasma"] = "Plasma";
|
|
2357
|
+
Blockchain["Plasma_Testnet"] = "Plasma_Testnet";
|
|
2352
2358
|
Blockchain["Polkadot_Asset_Hub"] = "Polkadot_Asset_Hub";
|
|
2353
2359
|
Blockchain["Polkadot_Westmint"] = "Polkadot_Westmint";
|
|
2354
2360
|
Blockchain["Plume"] = "Plume";
|
|
@@ -2418,6 +2424,7 @@ var BridgeChain;
|
|
|
2418
2424
|
BridgeChain["Morph"] = "Morph";
|
|
2419
2425
|
BridgeChain["Optimism"] = "Optimism";
|
|
2420
2426
|
BridgeChain["Pharos"] = "Pharos";
|
|
2427
|
+
BridgeChain["Plasma"] = "Plasma";
|
|
2421
2428
|
BridgeChain["Plume"] = "Plume";
|
|
2422
2429
|
BridgeChain["Polygon"] = "Polygon";
|
|
2423
2430
|
BridgeChain["Sei"] = "Sei";
|
|
@@ -2444,6 +2451,7 @@ var BridgeChain;
|
|
|
2444
2451
|
BridgeChain["Morph_Testnet"] = "Morph_Testnet";
|
|
2445
2452
|
BridgeChain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
2446
2453
|
BridgeChain["Pharos_Testnet"] = "Pharos_Testnet";
|
|
2454
|
+
BridgeChain["Plasma_Testnet"] = "Plasma_Testnet";
|
|
2447
2455
|
BridgeChain["Plume_Testnet"] = "Plume_Testnet";
|
|
2448
2456
|
BridgeChain["Polygon_Amoy_Testnet"] = "Polygon_Amoy_Testnet";
|
|
2449
2457
|
BridgeChain["Sei_Testnet"] = "Sei_Testnet";
|
|
@@ -2890,6 +2898,45 @@ var EarnChain;
|
|
|
2890
2898
|
* This program handles minting operations for Gateway transactions
|
|
2891
2899
|
* on Solana devnet.
|
|
2892
2900
|
*/ const GATEWAY_MINTER_SOLANA_DEVNET = 'GATEmKK2ECL1brEngQZWCgMWPbvrEYqsV6u29dAaHavr';
|
|
2901
|
+
/**
|
|
2902
|
+
* The `TokenMessengerWithFees` proxy contract address for EVM mainnet networks
|
|
2903
|
+
* (all chains except Edge).
|
|
2904
|
+
*
|
|
2905
|
+
* Deployed at a CREATE3-derived address; identical across all mainnet EVM
|
|
2906
|
+
* source chains. Present on any chain that supports the prepaid FORWARD path
|
|
2907
|
+
* via `depositForBurnWithHookAndFees`.
|
|
2908
|
+
*/ const TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET = '0x71f54F818671cD0D7ea140Da213e5C8b5C92a408';
|
|
2909
|
+
/**
|
|
2910
|
+
* The `TokenMessengerWithFees` proxy contract address for EVM testnet networks.
|
|
2911
|
+
*
|
|
2912
|
+
* Identical across all testnet EVM source chains. Present on any testnet chain
|
|
2913
|
+
* that supports the prepaid FORWARD path via `depositForBurnWithHookAndFees`.
|
|
2914
|
+
*/ const TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET = '0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A';
|
|
2915
|
+
/**
|
|
2916
|
+
* The `DepositForHandler` proxy contract address for EVM mainnet networks.
|
|
2917
|
+
*
|
|
2918
|
+
* The handler the GenericExecutor calls on a fast-deposit destination chain to
|
|
2919
|
+
* run a cross-chain deposit into the GatewayWallet. Deployed at the same
|
|
2920
|
+
* address across all mainnet EVM destination chains.
|
|
2921
|
+
*/ const DEPOSIT_FOR_HANDLER_EVM_MAINNET = '0x16529813203f77E036576666336554a1210dce4D';
|
|
2922
|
+
/**
|
|
2923
|
+
* The `DepositForHandler` proxy contract address for EVM testnet networks.
|
|
2924
|
+
*
|
|
2925
|
+
* Identical across all testnet EVM destination chains.
|
|
2926
|
+
*/ const DEPOSIT_FOR_HANDLER_EVM_TESTNET = '0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48';
|
|
2927
|
+
/**
|
|
2928
|
+
* The `GenericExecutor` proxy contract address for EVM mainnet networks.
|
|
2929
|
+
*
|
|
2930
|
+
* The GenericExecutor is the `mintRecipient` and `destinationCaller` on the
|
|
2931
|
+
* destination chain for the CCTP v2 prepaid FORWARD path. It receives the CCTP
|
|
2932
|
+
* mint and calls the `DepositForHandler` to complete the fast deposit.
|
|
2933
|
+
* Deployed at the same address across all mainnet EVM destination chains.
|
|
2934
|
+
*/ const GENERIC_EXECUTOR_EVM_MAINNET = '0xFa7be2f04F3Ad4ca969260729c6d45B5625984A7';
|
|
2935
|
+
/**
|
|
2936
|
+
* The `GenericExecutor` proxy contract address for EVM testnet networks.
|
|
2937
|
+
*
|
|
2938
|
+
* Identical across all testnet EVM destination chains.
|
|
2939
|
+
*/ const GENERIC_EXECUTOR_EVM_TESTNET = '0xEdC81040756AcCfF070c21D37b265b9D0b5Ba45e';
|
|
2893
2940
|
|
|
2894
2941
|
/**
|
|
2895
2942
|
* Arc Testnet chain definition
|
|
@@ -2927,6 +2974,7 @@ var EarnChain;
|
|
|
2927
2974
|
v2: {
|
|
2928
2975
|
type: 'split',
|
|
2929
2976
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
2977
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
2930
2978
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
2931
2979
|
confirmations: 1,
|
|
2932
2980
|
fastConfirmations: 1
|
|
@@ -2947,9 +2995,8 @@ var EarnChain;
|
|
|
2947
2995
|
v1: {
|
|
2948
2996
|
wallet: GATEWAY_WALLET_EVM_TESTNET,
|
|
2949
2997
|
minter: GATEWAY_MINTER_EVM_TESTNET,
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
depositForHandler: '0xD05E7D2E7d30b92c5F17d7d0fC575fce231F1A48'
|
|
2998
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_TESTNET,
|
|
2999
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_TESTNET
|
|
2953
3000
|
}
|
|
2954
3001
|
},
|
|
2955
3002
|
forwarderSupported: {
|
|
@@ -2994,6 +3041,7 @@ var EarnChain;
|
|
|
2994
3041
|
v2: {
|
|
2995
3042
|
type: 'split',
|
|
2996
3043
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3044
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
2997
3045
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
2998
3046
|
confirmations: 65,
|
|
2999
3047
|
fastConfirmations: 1
|
|
@@ -3058,6 +3106,7 @@ var EarnChain;
|
|
|
3058
3106
|
v2: {
|
|
3059
3107
|
type: 'split',
|
|
3060
3108
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3109
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3061
3110
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3062
3111
|
confirmations: 65,
|
|
3063
3112
|
fastConfirmations: 1
|
|
@@ -3122,6 +3171,7 @@ var EarnChain;
|
|
|
3122
3171
|
v2: {
|
|
3123
3172
|
type: 'split',
|
|
3124
3173
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3174
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3125
3175
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3126
3176
|
confirmations: 1,
|
|
3127
3177
|
fastConfirmations: 1
|
|
@@ -3141,7 +3191,9 @@ var EarnChain;
|
|
|
3141
3191
|
contracts: {
|
|
3142
3192
|
v1: {
|
|
3143
3193
|
wallet: GATEWAY_WALLET_EVM_MAINNET,
|
|
3144
|
-
minter: GATEWAY_MINTER_EVM_MAINNET
|
|
3194
|
+
minter: GATEWAY_MINTER_EVM_MAINNET,
|
|
3195
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_MAINNET,
|
|
3196
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_MAINNET
|
|
3145
3197
|
}
|
|
3146
3198
|
},
|
|
3147
3199
|
forwarderSupported: {
|
|
@@ -3183,6 +3235,7 @@ var EarnChain;
|
|
|
3183
3235
|
v2: {
|
|
3184
3236
|
type: 'split',
|
|
3185
3237
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3238
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3186
3239
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3187
3240
|
confirmations: 1,
|
|
3188
3241
|
fastConfirmations: 1
|
|
@@ -3204,7 +3257,9 @@ var EarnChain;
|
|
|
3204
3257
|
contracts: {
|
|
3205
3258
|
v1: {
|
|
3206
3259
|
wallet: GATEWAY_WALLET_EVM_TESTNET,
|
|
3207
|
-
minter: GATEWAY_MINTER_EVM_TESTNET
|
|
3260
|
+
minter: GATEWAY_MINTER_EVM_TESTNET,
|
|
3261
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_TESTNET,
|
|
3262
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_TESTNET
|
|
3208
3263
|
}
|
|
3209
3264
|
},
|
|
3210
3265
|
forwarderSupported: {
|
|
@@ -3250,6 +3305,7 @@ var EarnChain;
|
|
|
3250
3305
|
v2: {
|
|
3251
3306
|
type: 'split',
|
|
3252
3307
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3308
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3253
3309
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3254
3310
|
confirmations: 65,
|
|
3255
3311
|
fastConfirmations: 1
|
|
@@ -3314,6 +3370,7 @@ var EarnChain;
|
|
|
3314
3370
|
v2: {
|
|
3315
3371
|
type: 'split',
|
|
3316
3372
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3373
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3317
3374
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3318
3375
|
confirmations: 65,
|
|
3319
3376
|
fastConfirmations: 1
|
|
@@ -3424,6 +3481,7 @@ var EarnChain;
|
|
|
3424
3481
|
v2: {
|
|
3425
3482
|
type: 'split',
|
|
3426
3483
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3484
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3427
3485
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3428
3486
|
confirmations: 65,
|
|
3429
3487
|
fastConfirmations: 1
|
|
@@ -3468,6 +3526,7 @@ var EarnChain;
|
|
|
3468
3526
|
v2: {
|
|
3469
3527
|
type: 'split',
|
|
3470
3528
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3529
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3471
3530
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3472
3531
|
confirmations: 65,
|
|
3473
3532
|
fastConfirmations: 1
|
|
@@ -3513,6 +3572,7 @@ var EarnChain;
|
|
|
3513
3572
|
v2: {
|
|
3514
3573
|
type: 'split',
|
|
3515
3574
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3575
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3516
3576
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3517
3577
|
confirmations: 1,
|
|
3518
3578
|
fastConfirmations: 1
|
|
@@ -3558,6 +3618,7 @@ var EarnChain;
|
|
|
3558
3618
|
v2: {
|
|
3559
3619
|
type: 'split',
|
|
3560
3620
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3621
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3561
3622
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3562
3623
|
confirmations: 1,
|
|
3563
3624
|
fastConfirmations: 1
|
|
@@ -3603,6 +3664,7 @@ var EarnChain;
|
|
|
3603
3664
|
v2: {
|
|
3604
3665
|
type: 'split',
|
|
3605
3666
|
tokenMessenger: '0x98706A006bc632Df31CAdFCBD43F38887ce2ca5c',
|
|
3667
|
+
tokenMessengerWithFees: '0x3Ac96675F9a3E6922713e041645D82f3561d3686',
|
|
3606
3668
|
messageTransmitter: '0x5b61381Fc9e58E70EfC13a4A97516997019198ee',
|
|
3607
3669
|
confirmations: 65,
|
|
3608
3670
|
fastConfirmations: 1
|
|
@@ -3648,6 +3710,7 @@ var EarnChain;
|
|
|
3648
3710
|
v2: {
|
|
3649
3711
|
type: 'split',
|
|
3650
3712
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3713
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3651
3714
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3652
3715
|
confirmations: 65,
|
|
3653
3716
|
fastConfirmations: 1
|
|
@@ -3699,6 +3762,7 @@ var EarnChain;
|
|
|
3699
3762
|
v2: {
|
|
3700
3763
|
type: 'split',
|
|
3701
3764
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3765
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3702
3766
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3703
3767
|
confirmations: 65,
|
|
3704
3768
|
fastConfirmations: 2
|
|
@@ -3763,6 +3827,7 @@ var EarnChain;
|
|
|
3763
3827
|
v2: {
|
|
3764
3828
|
type: 'split',
|
|
3765
3829
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3830
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3766
3831
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3767
3832
|
confirmations: 65,
|
|
3768
3833
|
fastConfirmations: 2
|
|
@@ -3873,6 +3938,7 @@ var EarnChain;
|
|
|
3873
3938
|
v2: {
|
|
3874
3939
|
type: 'split',
|
|
3875
3940
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3941
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3876
3942
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3877
3943
|
confirmations: 1,
|
|
3878
3944
|
fastConfirmations: 1
|
|
@@ -3932,6 +3998,7 @@ var EarnChain;
|
|
|
3932
3998
|
v2: {
|
|
3933
3999
|
type: 'split',
|
|
3934
4000
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4001
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3935
4002
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3936
4003
|
confirmations: 1,
|
|
3937
4004
|
fastConfirmations: 1
|
|
@@ -3992,6 +4059,7 @@ var EarnChain;
|
|
|
3992
4059
|
v2: {
|
|
3993
4060
|
type: 'split',
|
|
3994
4061
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4062
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3995
4063
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3996
4064
|
confirmations: 1,
|
|
3997
4065
|
fastConfirmations: 1
|
|
@@ -4039,6 +4107,7 @@ var EarnChain;
|
|
|
4039
4107
|
v2: {
|
|
4040
4108
|
type: 'split',
|
|
4041
4109
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4110
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4042
4111
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4043
4112
|
confirmations: 1,
|
|
4044
4113
|
fastConfirmations: 1
|
|
@@ -4086,6 +4155,7 @@ var EarnChain;
|
|
|
4086
4155
|
v2: {
|
|
4087
4156
|
type: 'split',
|
|
4088
4157
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4158
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4089
4159
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4090
4160
|
confirmations: 65,
|
|
4091
4161
|
fastConfirmations: 1
|
|
@@ -4133,6 +4203,7 @@ var EarnChain;
|
|
|
4133
4203
|
v2: {
|
|
4134
4204
|
type: 'split',
|
|
4135
4205
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4206
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4136
4207
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4137
4208
|
confirmations: 65,
|
|
4138
4209
|
fastConfirmations: 1
|
|
@@ -4177,6 +4248,7 @@ var EarnChain;
|
|
|
4177
4248
|
v2: {
|
|
4178
4249
|
type: 'split',
|
|
4179
4250
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4251
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4180
4252
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4181
4253
|
confirmations: 1,
|
|
4182
4254
|
fastConfirmations: 1
|
|
@@ -4222,6 +4294,7 @@ var EarnChain;
|
|
|
4222
4294
|
v2: {
|
|
4223
4295
|
type: 'split',
|
|
4224
4296
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
4297
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4225
4298
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
4226
4299
|
confirmations: 1,
|
|
4227
4300
|
fastConfirmations: 1
|
|
@@ -4268,6 +4341,7 @@ var EarnChain;
|
|
|
4268
4341
|
v2: {
|
|
4269
4342
|
type: 'split',
|
|
4270
4343
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4344
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4271
4345
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4272
4346
|
confirmations: 1,
|
|
4273
4347
|
fastConfirmations: 1
|
|
@@ -4315,6 +4389,7 @@ var EarnChain;
|
|
|
4315
4389
|
v2: {
|
|
4316
4390
|
type: 'split',
|
|
4317
4391
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4392
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4318
4393
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4319
4394
|
confirmations: 1,
|
|
4320
4395
|
fastConfirmations: 1
|
|
@@ -4360,6 +4435,7 @@ var EarnChain;
|
|
|
4360
4435
|
v2: {
|
|
4361
4436
|
type: 'split',
|
|
4362
4437
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4438
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4363
4439
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4364
4440
|
confirmations: 64,
|
|
4365
4441
|
fastConfirmations: 1
|
|
@@ -4405,6 +4481,7 @@ var EarnChain;
|
|
|
4405
4481
|
v2: {
|
|
4406
4482
|
type: 'split',
|
|
4407
4483
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4484
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4408
4485
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4409
4486
|
confirmations: 64,
|
|
4410
4487
|
fastConfirmations: 1
|
|
@@ -4581,6 +4658,7 @@ var EarnChain;
|
|
|
4581
4658
|
v2: {
|
|
4582
4659
|
type: 'split',
|
|
4583
4660
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4661
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4584
4662
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4585
4663
|
confirmations: 65,
|
|
4586
4664
|
fastConfirmations: 1
|
|
@@ -4645,6 +4723,7 @@ var EarnChain;
|
|
|
4645
4723
|
v2: {
|
|
4646
4724
|
type: 'split',
|
|
4647
4725
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
4726
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4648
4727
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
4649
4728
|
confirmations: 65,
|
|
4650
4729
|
fastConfirmations: 1
|
|
@@ -4704,6 +4783,7 @@ var EarnChain;
|
|
|
4704
4783
|
v2: {
|
|
4705
4784
|
type: 'split',
|
|
4706
4785
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4786
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4707
4787
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4708
4788
|
confirmations: 1,
|
|
4709
4789
|
fastConfirmations: 1
|
|
@@ -4750,6 +4830,7 @@ var EarnChain;
|
|
|
4750
4830
|
v2: {
|
|
4751
4831
|
type: 'split',
|
|
4752
4832
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4833
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4753
4834
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4754
4835
|
confirmations: 1,
|
|
4755
4836
|
fastConfirmations: 1
|
|
@@ -4765,6 +4846,98 @@ var EarnChain;
|
|
|
4765
4846
|
}
|
|
4766
4847
|
});
|
|
4767
4848
|
|
|
4849
|
+
/**
|
|
4850
|
+
* Plasma Mainnet chain definition
|
|
4851
|
+
* @remarks
|
|
4852
|
+
* This represents the official production network for the Plasma blockchain.
|
|
4853
|
+
* Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
|
|
4854
|
+
* stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
|
|
4855
|
+
*/ const Plasma = defineChain({
|
|
4856
|
+
type: 'evm',
|
|
4857
|
+
chain: Blockchain.Plasma,
|
|
4858
|
+
name: 'Plasma',
|
|
4859
|
+
title: 'Plasma Mainnet',
|
|
4860
|
+
nativeCurrency: {
|
|
4861
|
+
name: 'Plasma',
|
|
4862
|
+
symbol: 'XPL',
|
|
4863
|
+
decimals: 18
|
|
4864
|
+
},
|
|
4865
|
+
chainId: 9745,
|
|
4866
|
+
isTestnet: false,
|
|
4867
|
+
explorerUrl: 'https://plasmascan.to/tx/{hash}',
|
|
4868
|
+
rpcEndpoints: [
|
|
4869
|
+
'https://rpc.plasma.to'
|
|
4870
|
+
],
|
|
4871
|
+
eurcAddress: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
|
|
4872
|
+
usdcAddress: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
|
|
4873
|
+
usdtAddress: null,
|
|
4874
|
+
cctp: {
|
|
4875
|
+
domain: 33,
|
|
4876
|
+
contracts: {
|
|
4877
|
+
v2: {
|
|
4878
|
+
type: 'split',
|
|
4879
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4880
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4881
|
+
confirmations: 3,
|
|
4882
|
+
fastConfirmations: 1
|
|
4883
|
+
}
|
|
4884
|
+
},
|
|
4885
|
+
forwarderSupported: {
|
|
4886
|
+
source: false,
|
|
4887
|
+
destination: false
|
|
4888
|
+
}
|
|
4889
|
+
},
|
|
4890
|
+
kitContracts: {
|
|
4891
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
4892
|
+
}
|
|
4893
|
+
});
|
|
4894
|
+
|
|
4895
|
+
/**
|
|
4896
|
+
* Plasma Testnet chain definition
|
|
4897
|
+
* @remarks
|
|
4898
|
+
* This represents the official test network for the Plasma blockchain.
|
|
4899
|
+
* Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
|
|
4900
|
+
* stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
|
|
4901
|
+
*/ const PlasmaTestnet = defineChain({
|
|
4902
|
+
type: 'evm',
|
|
4903
|
+
chain: Blockchain.Plasma_Testnet,
|
|
4904
|
+
name: 'Plasma Testnet',
|
|
4905
|
+
title: 'Plasma Testnet',
|
|
4906
|
+
nativeCurrency: {
|
|
4907
|
+
name: 'Plasma',
|
|
4908
|
+
symbol: 'XPL',
|
|
4909
|
+
decimals: 18
|
|
4910
|
+
},
|
|
4911
|
+
chainId: 9746,
|
|
4912
|
+
isTestnet: true,
|
|
4913
|
+
explorerUrl: 'https://testnet.plasmascan.to/tx/{hash}',
|
|
4914
|
+
rpcEndpoints: [
|
|
4915
|
+
'https://testnet-rpc.plasma.to'
|
|
4916
|
+
],
|
|
4917
|
+
eurcAddress: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330',
|
|
4918
|
+
usdcAddress: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
|
|
4919
|
+
usdtAddress: null,
|
|
4920
|
+
cctp: {
|
|
4921
|
+
domain: 33,
|
|
4922
|
+
contracts: {
|
|
4923
|
+
v2: {
|
|
4924
|
+
type: 'split',
|
|
4925
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4926
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4927
|
+
confirmations: 3,
|
|
4928
|
+
fastConfirmations: 1
|
|
4929
|
+
}
|
|
4930
|
+
},
|
|
4931
|
+
forwarderSupported: {
|
|
4932
|
+
source: false,
|
|
4933
|
+
destination: false
|
|
4934
|
+
}
|
|
4935
|
+
},
|
|
4936
|
+
kitContracts: {
|
|
4937
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
4938
|
+
}
|
|
4939
|
+
});
|
|
4940
|
+
|
|
4768
4941
|
/**
|
|
4769
4942
|
* Plume Mainnet chain definition
|
|
4770
4943
|
* @remarks
|
|
@@ -4796,6 +4969,7 @@ var EarnChain;
|
|
|
4796
4969
|
v2: {
|
|
4797
4970
|
type: 'split',
|
|
4798
4971
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4972
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4799
4973
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4800
4974
|
confirmations: 65,
|
|
4801
4975
|
fastConfirmations: 1
|
|
@@ -4842,6 +5016,7 @@ var EarnChain;
|
|
|
4842
5016
|
v2: {
|
|
4843
5017
|
type: 'split',
|
|
4844
5018
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5019
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4845
5020
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4846
5021
|
confirmations: 65,
|
|
4847
5022
|
fastConfirmations: 1
|
|
@@ -4943,6 +5118,7 @@ var EarnChain;
|
|
|
4943
5118
|
v2: {
|
|
4944
5119
|
type: 'split',
|
|
4945
5120
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5121
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4946
5122
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4947
5123
|
confirmations: 33,
|
|
4948
5124
|
fastConfirmations: 13
|
|
@@ -4962,7 +5138,9 @@ var EarnChain;
|
|
|
4962
5138
|
contracts: {
|
|
4963
5139
|
v1: {
|
|
4964
5140
|
wallet: GATEWAY_WALLET_EVM_MAINNET,
|
|
4965
|
-
minter: GATEWAY_MINTER_EVM_MAINNET
|
|
5141
|
+
minter: GATEWAY_MINTER_EVM_MAINNET,
|
|
5142
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_MAINNET,
|
|
5143
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_MAINNET
|
|
4966
5144
|
}
|
|
4967
5145
|
},
|
|
4968
5146
|
forwarderSupported: {
|
|
@@ -5008,6 +5186,7 @@ var EarnChain;
|
|
|
5008
5186
|
v2: {
|
|
5009
5187
|
type: 'split',
|
|
5010
5188
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5189
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5011
5190
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5012
5191
|
confirmations: 33,
|
|
5013
5192
|
fastConfirmations: 13
|
|
@@ -5026,7 +5205,9 @@ var EarnChain;
|
|
|
5026
5205
|
contracts: {
|
|
5027
5206
|
v1: {
|
|
5028
5207
|
wallet: GATEWAY_WALLET_EVM_TESTNET,
|
|
5029
|
-
minter: GATEWAY_MINTER_EVM_TESTNET
|
|
5208
|
+
minter: GATEWAY_MINTER_EVM_TESTNET,
|
|
5209
|
+
depositForHandler: DEPOSIT_FOR_HANDLER_EVM_TESTNET,
|
|
5210
|
+
genericExecutor: GENERIC_EXECUTOR_EVM_TESTNET
|
|
5030
5211
|
}
|
|
5031
5212
|
},
|
|
5032
5213
|
forwarderSupported: {
|
|
@@ -5067,6 +5248,7 @@ var EarnChain;
|
|
|
5067
5248
|
v2: {
|
|
5068
5249
|
type: 'split',
|
|
5069
5250
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5251
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5070
5252
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5071
5253
|
confirmations: 1,
|
|
5072
5254
|
fastConfirmations: 1
|
|
@@ -5126,6 +5308,7 @@ var EarnChain;
|
|
|
5126
5308
|
v2: {
|
|
5127
5309
|
type: 'split',
|
|
5128
5310
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5311
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5129
5312
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5130
5313
|
confirmations: 1,
|
|
5131
5314
|
fastConfirmations: 1
|
|
@@ -5183,6 +5366,7 @@ var EarnChain;
|
|
|
5183
5366
|
v2: {
|
|
5184
5367
|
type: 'split',
|
|
5185
5368
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5369
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5186
5370
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5187
5371
|
confirmations: 1,
|
|
5188
5372
|
fastConfirmations: 1
|
|
@@ -5241,6 +5425,7 @@ var EarnChain;
|
|
|
5241
5425
|
v2: {
|
|
5242
5426
|
type: 'split',
|
|
5243
5427
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5428
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5244
5429
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5245
5430
|
confirmations: 1,
|
|
5246
5431
|
fastConfirmations: 1
|
|
@@ -5556,6 +5741,7 @@ var EarnChain;
|
|
|
5556
5741
|
v2: {
|
|
5557
5742
|
type: 'split',
|
|
5558
5743
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5744
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5559
5745
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5560
5746
|
confirmations: 65,
|
|
5561
5747
|
fastConfirmations: 1
|
|
@@ -5620,6 +5806,7 @@ var EarnChain;
|
|
|
5620
5806
|
v2: {
|
|
5621
5807
|
type: 'split',
|
|
5622
5808
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5809
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5623
5810
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5624
5811
|
confirmations: 65,
|
|
5625
5812
|
fastConfirmations: 1
|
|
@@ -5677,6 +5864,7 @@ var EarnChain;
|
|
|
5677
5864
|
v2: {
|
|
5678
5865
|
type: 'split',
|
|
5679
5866
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cF5d',
|
|
5867
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5680
5868
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5681
5869
|
confirmations: 65,
|
|
5682
5870
|
fastConfirmations: 1
|
|
@@ -5736,6 +5924,7 @@ var EarnChain;
|
|
|
5736
5924
|
v2: {
|
|
5737
5925
|
type: 'split',
|
|
5738
5926
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
5927
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5739
5928
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
5740
5929
|
confirmations: 65,
|
|
5741
5930
|
fastConfirmations: 1
|
|
@@ -5796,6 +5985,7 @@ var EarnChain;
|
|
|
5796
5985
|
v2: {
|
|
5797
5986
|
type: 'split',
|
|
5798
5987
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5988
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5799
5989
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5800
5990
|
confirmations: 3,
|
|
5801
5991
|
fastConfirmations: 3
|
|
@@ -5841,6 +6031,7 @@ var EarnChain;
|
|
|
5841
6031
|
v2: {
|
|
5842
6032
|
type: 'split',
|
|
5843
6033
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
6034
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5844
6035
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5845
6036
|
confirmations: 3,
|
|
5846
6037
|
fastConfirmations: 1
|
|
@@ -6051,6 +6242,8 @@ var Chains = {
|
|
|
6051
6242
|
OptimismSepolia: OptimismSepolia,
|
|
6052
6243
|
Pharos: Pharos,
|
|
6053
6244
|
PharosTestnet: PharosTestnet,
|
|
6245
|
+
Plasma: Plasma,
|
|
6246
|
+
PlasmaTestnet: PlasmaTestnet,
|
|
6054
6247
|
Plume: Plume,
|
|
6055
6248
|
PlumeTestnet: PlumeTestnet,
|
|
6056
6249
|
PolkadotAssetHub: PolkadotAssetHub,
|
|
@@ -6100,6 +6293,67 @@ var Chains = {
|
|
|
6100
6293
|
return chain.cctp?.contracts.v2 !== undefined;
|
|
6101
6294
|
}
|
|
6102
6295
|
|
|
6296
|
+
/**
|
|
6297
|
+
* Chains the Fee Service accepts as a SOURCE for source-paid ("receive-exact")
|
|
6298
|
+
* CCTP v2 fees. An explicit allowlist is required because the
|
|
6299
|
+
* `TokenMessengerWithFees` wrapper address is now shared with the fast-deposit
|
|
6300
|
+
* forwarder path, so wrapper presence no longer implies source-fee support.
|
|
6301
|
+
* Keep in sync with backend coverage.
|
|
6302
|
+
*/ new Set([
|
|
6303
|
+
// Mainnet
|
|
6304
|
+
Blockchain.Ethereum,
|
|
6305
|
+
Blockchain.Base,
|
|
6306
|
+
Blockchain.Arbitrum,
|
|
6307
|
+
Blockchain.Unichain,
|
|
6308
|
+
Blockchain.Optimism,
|
|
6309
|
+
Blockchain.Codex,
|
|
6310
|
+
Blockchain.Ink,
|
|
6311
|
+
Blockchain.Plume,
|
|
6312
|
+
Blockchain.Linea,
|
|
6313
|
+
Blockchain.World_Chain,
|
|
6314
|
+
// Testnet counterparts
|
|
6315
|
+
Blockchain.Ethereum_Sepolia,
|
|
6316
|
+
Blockchain.Base_Sepolia,
|
|
6317
|
+
Blockchain.Arbitrum_Sepolia,
|
|
6318
|
+
Blockchain.Unichain_Sepolia,
|
|
6319
|
+
Blockchain.Optimism_Sepolia,
|
|
6320
|
+
Blockchain.Codex_Testnet,
|
|
6321
|
+
Blockchain.Ink_Testnet,
|
|
6322
|
+
Blockchain.Plume_Testnet,
|
|
6323
|
+
Blockchain.Linea_Sepolia,
|
|
6324
|
+
Blockchain.World_Chain_Sepolia
|
|
6325
|
+
]);
|
|
6326
|
+
|
|
6327
|
+
/**
|
|
6328
|
+
* Temporary allowlist of chains permitted to initiate Gateway fast deposits.
|
|
6329
|
+
* Only chains keyed here are eligible; all others are rejected. Using the
|
|
6330
|
+
* {@link Blockchain} enum keeps entries type-safe and catches typos at compile
|
|
6331
|
+
* time. Remove this allowlist once roll-out is complete.
|
|
6332
|
+
*/ new Set([
|
|
6333
|
+
// Mainnet
|
|
6334
|
+
Blockchain.Ethereum,
|
|
6335
|
+
Blockchain.Base,
|
|
6336
|
+
Blockchain.Arbitrum,
|
|
6337
|
+
Blockchain.Unichain,
|
|
6338
|
+
Blockchain.Optimism,
|
|
6339
|
+
Blockchain.Codex,
|
|
6340
|
+
Blockchain.Ink,
|
|
6341
|
+
Blockchain.Plume,
|
|
6342
|
+
Blockchain.Linea,
|
|
6343
|
+
Blockchain.World_Chain,
|
|
6344
|
+
// Testnet counterparts
|
|
6345
|
+
Blockchain.Ethereum_Sepolia,
|
|
6346
|
+
Blockchain.Base_Sepolia,
|
|
6347
|
+
Blockchain.Arbitrum_Sepolia,
|
|
6348
|
+
Blockchain.Unichain_Sepolia,
|
|
6349
|
+
Blockchain.Optimism_Sepolia,
|
|
6350
|
+
Blockchain.Codex_Testnet,
|
|
6351
|
+
Blockchain.Ink_Testnet,
|
|
6352
|
+
Blockchain.Plume_Testnet,
|
|
6353
|
+
Blockchain.Linea_Sepolia,
|
|
6354
|
+
Blockchain.World_Chain_Sepolia
|
|
6355
|
+
]);
|
|
6356
|
+
|
|
6103
6357
|
/**
|
|
6104
6358
|
* Zod schema for validating Gateway v1 contract addresses.
|
|
6105
6359
|
*
|
|
@@ -6121,7 +6375,10 @@ var Chains = {
|
|
|
6121
6375
|
}).min(1, 'Gateway minter address cannot be empty.'),
|
|
6122
6376
|
depositForHandler: zod.z.string({
|
|
6123
6377
|
invalid_type_error: 'Gateway depositForHandler address must be a string.'
|
|
6124
|
-
}).min(1, 'Gateway depositForHandler address cannot be empty.').optional()
|
|
6378
|
+
}).min(1, 'Gateway depositForHandler address cannot be empty.').optional(),
|
|
6379
|
+
genericExecutor: zod.z.string({
|
|
6380
|
+
invalid_type_error: 'Gateway genericExecutor address must be a string.'
|
|
6381
|
+
}).min(1, 'Gateway genericExecutor address cannot be empty.').optional()
|
|
6125
6382
|
}).strict() // Reject any additional properties not defined in the schema
|
|
6126
6383
|
;
|
|
6127
6384
|
/**
|
|
@@ -7507,6 +7764,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7507
7764
|
[Blockchain.Noble]: 'uusdc',
|
|
7508
7765
|
[Blockchain.Optimism]: '0x0b2c639c533813f4aa9d7837caf62653d097ff85',
|
|
7509
7766
|
[Blockchain.Pharos]: '0xC879C018dB60520F4355C26eD1a6D572cdAC1815',
|
|
7767
|
+
[Blockchain.Plasma]: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
|
|
7510
7768
|
[Blockchain.Plume]: '0x222365EF19F7947e5484218551B56bb3965Aa7aF',
|
|
7511
7769
|
[Blockchain.Polkadot_Asset_Hub]: '1337',
|
|
7512
7770
|
[Blockchain.Polygon]: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359',
|
|
@@ -7543,6 +7801,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7543
7801
|
[Blockchain.Noble_Testnet]: 'uusdc',
|
|
7544
7802
|
[Blockchain.Optimism_Sepolia]: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',
|
|
7545
7803
|
[Blockchain.Pharos_Testnet]: '0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B',
|
|
7804
|
+
[Blockchain.Plasma_Testnet]: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
|
|
7546
7805
|
[Blockchain.Plume_Testnet]: '0xcB5f30e335672893c7eb944B374c196392C19D18',
|
|
7547
7806
|
[Blockchain.Polkadot_Westmint]: '31337',
|
|
7548
7807
|
[Blockchain.Polygon_Amoy_Testnet]: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
|
|
@@ -7605,6 +7864,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7605
7864
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
7606
7865
|
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
7607
7866
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
7867
|
+
[Blockchain.Plasma]: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
|
|
7608
7868
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
7609
7869
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
7610
7870
|
// =========================================================================
|
|
@@ -7613,7 +7873,8 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7613
7873
|
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
7614
7874
|
[Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
|
|
7615
7875
|
[Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
7616
|
-
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
|
|
7876
|
+
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4',
|
|
7877
|
+
[Blockchain.Plasma_Testnet]: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330'
|
|
7617
7878
|
}
|
|
7618
7879
|
};
|
|
7619
7880
|
|
|
@@ -8331,7 +8592,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8331
8592
|
* allowlisted {@link ClientLogPayload} fields (and the allowlisted
|
|
8332
8593
|
* sub-fields of `errorDetails` / `clientContext`) are copied across.
|
|
8333
8594
|
* A regressing upstream mapper — or a plain-JS caller that bypasses the
|
|
8334
|
-
* type — therefore cannot exfiltrate stray properties (secrets,
|
|
8595
|
+
* type — therefore cannot exfiltrate stray properties (secrets,
|
|
8335
8596
|
* raw error stacks) through the analytics channel. Optional fields are
|
|
8336
8597
|
* only included when present so the serialised shape matches the
|
|
8337
8598
|
* server's strict schema.
|
|
@@ -8354,6 +8615,9 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8354
8615
|
if (payload.destinationChain !== undefined) safe['destinationChain'] = payload.destinationChain;
|
|
8355
8616
|
if (payload.tokenIn !== undefined) safe['tokenIn'] = payload.tokenIn;
|
|
8356
8617
|
if (payload.tokenOut !== undefined) safe['tokenOut'] = payload.tokenOut;
|
|
8618
|
+
if (payload.amountIn !== undefined) safe['amountIn'] = payload.amountIn;
|
|
8619
|
+
if (payload.durationMs !== undefined) safe['durationMs'] = payload.durationMs;
|
|
8620
|
+
if (payload.sourceAddress !== undefined) safe['sourceAddress'] = payload.sourceAddress;
|
|
8357
8621
|
if (payload.txHash !== undefined) safe['txHash'] = payload.txHash;
|
|
8358
8622
|
if (payload.correlationId !== undefined) safe['correlationId'] = payload.correlationId;
|
|
8359
8623
|
if (payload.errorDetails !== undefined) {
|
|
@@ -8550,14 +8814,28 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8550
8814
|
}
|
|
8551
8815
|
|
|
8552
8816
|
/**
|
|
8553
|
-
*
|
|
8554
|
-
*
|
|
8817
|
+
* Emit a stable console warning when building or emitting a telemetry payload
|
|
8818
|
+
* throws — for example, a buggy `TelemetryContextResolver`, a regression in
|
|
8555
8819
|
* `extractErrorDetails`, or a synchronous failure inside `emitAnalyticsLog`
|
|
8556
|
-
* before it could swallow the error itself.
|
|
8557
|
-
*
|
|
8558
|
-
*
|
|
8820
|
+
* before it could swallow the error itself. Uses a stable prefix so the
|
|
8821
|
+
* drop is discoverable via grep. Never re-throws: the caller's original
|
|
8822
|
+
* operation error must always win.
|
|
8559
8823
|
*
|
|
8560
8824
|
* @internal
|
|
8825
|
+
*
|
|
8826
|
+
* @param eventType - The telemetry event type that was being emitted.
|
|
8827
|
+
* @param cause - The error or value that caused the drop.
|
|
8828
|
+
*
|
|
8829
|
+
* @example
|
|
8830
|
+
* ```typescript
|
|
8831
|
+
* import { warnTelemetryDrop } from '@core/utils'
|
|
8832
|
+
*
|
|
8833
|
+
* try {
|
|
8834
|
+
* void emitAnalyticsLog(payload)
|
|
8835
|
+
* } catch (err) {
|
|
8836
|
+
* warnTelemetryDrop('my_event', err)
|
|
8837
|
+
* }
|
|
8838
|
+
* ```
|
|
8561
8839
|
*/ function warnTelemetryDrop(eventType, cause) {
|
|
8562
8840
|
try {
|
|
8563
8841
|
// Pass `cause` as the second console.warn argument rather than
|
|
@@ -8597,6 +8875,9 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8597
8875
|
...context?.tokenOut != null && {
|
|
8598
8876
|
tokenOut: context.tokenOut
|
|
8599
8877
|
},
|
|
8878
|
+
...context?.amountIn != null && {
|
|
8879
|
+
amountIn: context.amountIn
|
|
8880
|
+
},
|
|
8600
8881
|
...context?.txHash != null && {
|
|
8601
8882
|
txHash: context.txHash
|
|
8602
8883
|
},
|
|
@@ -8696,7 +8977,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8696
8977
|
}
|
|
8697
8978
|
|
|
8698
8979
|
var name$3 = "@circle-fin/bridge-kit";
|
|
8699
|
-
var version$3 = "1.
|
|
8980
|
+
var version$3 = "1.14.1";
|
|
8700
8981
|
var pkg$3 = {
|
|
8701
8982
|
name: name$3,
|
|
8702
8983
|
version: version$3};
|
|
@@ -8971,7 +9252,7 @@ const READ_ACTION_KEY_SET = new Set(READ_ACTION_KEYS);
|
|
|
8971
9252
|
* const result = evmAddressSchema.safeParse(validAddress)
|
|
8972
9253
|
* console.log(result.success) // true
|
|
8973
9254
|
* ```
|
|
8974
|
-
*/ const evmAddressSchema = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
|
|
9255
|
+
*/ const evmAddressSchema$1 = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
|
|
8975
9256
|
/**
|
|
8976
9257
|
* Schema for validating transaction hashes.
|
|
8977
9258
|
*
|
|
@@ -9508,6 +9789,10 @@ var TransferSpeed;
|
|
|
9508
9789
|
token: zod.z.literal('USDC').optional(),
|
|
9509
9790
|
config: zod.z.object({
|
|
9510
9791
|
transferSpeed: zod.z.nativeEnum(TransferSpeed).optional(),
|
|
9792
|
+
feePayment: zod.z.enum([
|
|
9793
|
+
'source',
|
|
9794
|
+
'destination'
|
|
9795
|
+
]).optional(),
|
|
9511
9796
|
maxFee: zod.z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
9512
9797
|
allowZero: true,
|
|
9513
9798
|
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
@@ -9515,7 +9800,8 @@ var TransferSpeed;
|
|
|
9515
9800
|
maxDecimals: 6
|
|
9516
9801
|
})(zod.z.string())).optional(),
|
|
9517
9802
|
customFee: customFeeSchema.optional()
|
|
9518
|
-
}).optional()
|
|
9803
|
+
}).optional(),
|
|
9804
|
+
quote: zod.z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex').optional()
|
|
9519
9805
|
});
|
|
9520
9806
|
|
|
9521
9807
|
// ============================================================================
|
|
@@ -9623,6 +9909,241 @@ var TransferSpeed;
|
|
|
9623
9909
|
message: 'Invalid metrics'
|
|
9624
9910
|
});
|
|
9625
9911
|
|
|
9912
|
+
/**
|
|
9913
|
+
* Omit undefined values from an object.
|
|
9914
|
+
*
|
|
9915
|
+
* @param obj - The object to process.
|
|
9916
|
+
* @returns A new object with undefined values removed.
|
|
9917
|
+
*
|
|
9918
|
+
* @internal
|
|
9919
|
+
* @remarks
|
|
9920
|
+
* Used by both production and mock loggers to ensure consistent behavior.
|
|
9921
|
+
* This prevents undefined values from being serialized in log output,
|
|
9922
|
+
* which can cause issues with some log transports.
|
|
9923
|
+
*/ function omitUndefined(obj) {
|
|
9924
|
+
const result = {};
|
|
9925
|
+
for (const [key, value] of Object.entries(obj)){
|
|
9926
|
+
if (value !== undefined) {
|
|
9927
|
+
result[key] = value;
|
|
9928
|
+
}
|
|
9929
|
+
}
|
|
9930
|
+
return result;
|
|
9931
|
+
}
|
|
9932
|
+
|
|
9933
|
+
/**
|
|
9934
|
+
* Default redaction paths for web3/blockchain SDKs.
|
|
9935
|
+
*
|
|
9936
|
+
* @remarks
|
|
9937
|
+
* These paths target common sensitive fields in blockchain applications.
|
|
9938
|
+
* All user fields are nested under `context`, so paths start with `context.`.
|
|
9939
|
+
* Wildcard `*` matches any key at that level.
|
|
9940
|
+
*/ const DEFAULT_REDACT_PATHS = [
|
|
9941
|
+
// Generic Credentials
|
|
9942
|
+
'context.password',
|
|
9943
|
+
'context.passphrase',
|
|
9944
|
+
'context.secret',
|
|
9945
|
+
'context.token',
|
|
9946
|
+
'context.*.password',
|
|
9947
|
+
'context.*.passphrase',
|
|
9948
|
+
'context.*.secret',
|
|
9949
|
+
'context.*.token',
|
|
9950
|
+
// API Keys & Auth Tokens
|
|
9951
|
+
'context.apiKey',
|
|
9952
|
+
'context.apiSecret',
|
|
9953
|
+
'context.accessToken',
|
|
9954
|
+
'context.refreshToken',
|
|
9955
|
+
'context.jwt',
|
|
9956
|
+
'context.bearerToken',
|
|
9957
|
+
'context.sessionId',
|
|
9958
|
+
'context.authorization',
|
|
9959
|
+
'context.cookie',
|
|
9960
|
+
'context.*.apiKey',
|
|
9961
|
+
'context.*.apiSecret',
|
|
9962
|
+
'context.*.accessToken',
|
|
9963
|
+
'context.*.refreshToken',
|
|
9964
|
+
'context.*.jwt',
|
|
9965
|
+
'context.*.bearerToken',
|
|
9966
|
+
'context.*.sessionId',
|
|
9967
|
+
'context.*.authorization',
|
|
9968
|
+
'context.*.cookie',
|
|
9969
|
+
// Web3 / Crypto Keys
|
|
9970
|
+
'context.privateKey',
|
|
9971
|
+
'context.secretKey',
|
|
9972
|
+
'context.signingKey',
|
|
9973
|
+
'context.encryptionKey',
|
|
9974
|
+
'context.*.privateKey',
|
|
9975
|
+
'context.*.secretKey',
|
|
9976
|
+
'context.*.signingKey',
|
|
9977
|
+
'context.*.encryptionKey',
|
|
9978
|
+
// Web3 / Crypto Mnemonics and Seeds
|
|
9979
|
+
'context.mnemonic',
|
|
9980
|
+
'context.seed',
|
|
9981
|
+
'context.seedPhrase',
|
|
9982
|
+
'context.*.mnemonic',
|
|
9983
|
+
'context.*.seed',
|
|
9984
|
+
'context.*.seedPhrase',
|
|
9985
|
+
// OTP / Verification Codes
|
|
9986
|
+
'context.otp',
|
|
9987
|
+
'context.verificationCode',
|
|
9988
|
+
'context.*.otp',
|
|
9989
|
+
'context.*.verificationCode',
|
|
9990
|
+
// Payment Information
|
|
9991
|
+
'context.cardNumber',
|
|
9992
|
+
'context.cvv',
|
|
9993
|
+
'context.accountNumber',
|
|
9994
|
+
'context.*.cardNumber',
|
|
9995
|
+
'context.*.cvv',
|
|
9996
|
+
'context.*.accountNumber'
|
|
9997
|
+
];
|
|
9998
|
+
/**
|
|
9999
|
+
* Wrap user fields under `context` to prevent collision with pino internals.
|
|
10000
|
+
*
|
|
10001
|
+
* @param fields - User-provided log fields.
|
|
10002
|
+
* @returns Object with fields nested under `context`, or undefined if empty.
|
|
10003
|
+
*
|
|
10004
|
+
* @remarks
|
|
10005
|
+
* This function handles edge cases by returning undefined for null, undefined,
|
|
10006
|
+
* or empty objects to avoid unnecessary wrapping in log output.
|
|
10007
|
+
* Undefined values are cleaned before wrapping.
|
|
10008
|
+
*/ function wrapInContext(fields) {
|
|
10009
|
+
if (!fields) return undefined;
|
|
10010
|
+
// Clean undefined values for consistency and transport compatibility
|
|
10011
|
+
const cleaned = omitUndefined(fields);
|
|
10012
|
+
// Handle edge case: all values were undefined, resulting in empty object
|
|
10013
|
+
const keys = Object.keys(cleaned);
|
|
10014
|
+
if (keys.length === 0) return undefined;
|
|
10015
|
+
return {
|
|
10016
|
+
context: cleaned
|
|
10017
|
+
};
|
|
10018
|
+
}
|
|
10019
|
+
/**
|
|
10020
|
+
* Wrap a pino instance to conform to our Logger interface.
|
|
10021
|
+
*
|
|
10022
|
+
* @param pinoInstance - The pino logger instance to wrap.
|
|
10023
|
+
* @returns A Logger instance conforming to our stable interface.
|
|
10024
|
+
*/ function wrapPino(pinoInstance) {
|
|
10025
|
+
return {
|
|
10026
|
+
debug (message, fields) {
|
|
10027
|
+
const wrapped = wrapInContext(fields);
|
|
10028
|
+
if (wrapped) {
|
|
10029
|
+
pinoInstance.debug(wrapped, message);
|
|
10030
|
+
} else {
|
|
10031
|
+
pinoInstance.debug(message);
|
|
10032
|
+
}
|
|
10033
|
+
},
|
|
10034
|
+
info (message, fields) {
|
|
10035
|
+
const wrapped = wrapInContext(fields);
|
|
10036
|
+
if (wrapped) {
|
|
10037
|
+
pinoInstance.info(wrapped, message);
|
|
10038
|
+
} else {
|
|
10039
|
+
pinoInstance.info(message);
|
|
10040
|
+
}
|
|
10041
|
+
},
|
|
10042
|
+
warn (message, fields) {
|
|
10043
|
+
const wrapped = wrapInContext(fields);
|
|
10044
|
+
if (wrapped) {
|
|
10045
|
+
pinoInstance.warn(wrapped, message);
|
|
10046
|
+
} else {
|
|
10047
|
+
pinoInstance.warn(message);
|
|
10048
|
+
}
|
|
10049
|
+
},
|
|
10050
|
+
error (message, fields) {
|
|
10051
|
+
const wrapped = wrapInContext(fields);
|
|
10052
|
+
if (wrapped) {
|
|
10053
|
+
pinoInstance.error(wrapped, message);
|
|
10054
|
+
} else {
|
|
10055
|
+
pinoInstance.error(message);
|
|
10056
|
+
}
|
|
10057
|
+
},
|
|
10058
|
+
child (tags) {
|
|
10059
|
+
// Child bindings stay flat (not wrapped) - they're part of logger's base context
|
|
10060
|
+
const cleaned = omitUndefined(tags);
|
|
10061
|
+
return wrapPino(pinoInstance.child(cleaned));
|
|
10062
|
+
}
|
|
10063
|
+
};
|
|
10064
|
+
}
|
|
10065
|
+
/**
|
|
10066
|
+
* Build pino redact configuration from our simplified options.
|
|
10067
|
+
*
|
|
10068
|
+
* @param redact - The redact configuration option.
|
|
10069
|
+
* @returns Pino-compatible redact configuration or undefined.
|
|
10070
|
+
*/ function buildRedactConfig(redact) {
|
|
10071
|
+
// Explicitly disabled
|
|
10072
|
+
if (redact === false) {
|
|
10073
|
+
return undefined;
|
|
10074
|
+
}
|
|
10075
|
+
// Custom paths provided
|
|
10076
|
+
if (Array.isArray(redact)) {
|
|
10077
|
+
return redact.length > 0 ? {
|
|
10078
|
+
paths: redact,
|
|
10079
|
+
censor: '[REDACTED]'
|
|
10080
|
+
} : undefined;
|
|
10081
|
+
}
|
|
10082
|
+
// Default: use web3 sensible defaults
|
|
10083
|
+
return {
|
|
10084
|
+
paths: [
|
|
10085
|
+
...DEFAULT_REDACT_PATHS
|
|
10086
|
+
],
|
|
10087
|
+
censor: '[REDACTED]'
|
|
10088
|
+
};
|
|
10089
|
+
}
|
|
10090
|
+
/**
|
|
10091
|
+
* Create a logger backed by pino.
|
|
10092
|
+
*
|
|
10093
|
+
* @param options - Logger options (optional).
|
|
10094
|
+
* @param stream - Destination stream (optional).
|
|
10095
|
+
* @returns A Logger instance.
|
|
10096
|
+
* @throws Error if invalid pino options are provided.
|
|
10097
|
+
*
|
|
10098
|
+
* @remarks
|
|
10099
|
+
* This is a thin wrapper around pino that exposes our stable Logger interface.
|
|
10100
|
+
* Pino handles all transport concerns: JSON, pretty printing, file, remote, browser, etc.
|
|
10101
|
+
*
|
|
10102
|
+
* **Security**: By default, sensitive web3 fields (privateKey, mnemonic, apiKey, etc.)
|
|
10103
|
+
* are automatically redacted from log output. Use `redact: false` to disable.
|
|
10104
|
+
*
|
|
10105
|
+
* @example
|
|
10106
|
+
* ```typescript
|
|
10107
|
+
* import { createLogger } from '@core/runtime'
|
|
10108
|
+
*
|
|
10109
|
+
* // Default: web3 sensitive fields are redacted
|
|
10110
|
+
* const logger = createLogger({ level: 'info' })
|
|
10111
|
+
* logger.info('Signing', { privateKey: '0x123...' })
|
|
10112
|
+
* // Output: { context: { privateKey: '[REDACTED]' }, msg: 'Signing' }
|
|
10113
|
+
*
|
|
10114
|
+
* // Disable redaction (use with caution)
|
|
10115
|
+
* const unsafeLogger = createLogger({ level: 'debug', redact: false })
|
|
10116
|
+
*
|
|
10117
|
+
* // Custom redaction paths
|
|
10118
|
+
* const customLogger = createLogger({
|
|
10119
|
+
* level: 'info',
|
|
10120
|
+
* redact: ['context.mySecret', 'context.*.credentials']
|
|
10121
|
+
* })
|
|
10122
|
+
*
|
|
10123
|
+
* // Pretty output for development
|
|
10124
|
+
* const devLogger = createLogger({
|
|
10125
|
+
* level: 'debug',
|
|
10126
|
+
* transport: { target: 'pino-pretty' }
|
|
10127
|
+
* })
|
|
10128
|
+
*
|
|
10129
|
+
* // Browser logger
|
|
10130
|
+
* const browserLogger = createLogger({
|
|
10131
|
+
* browser: { asObject: true }
|
|
10132
|
+
* })
|
|
10133
|
+
* ```
|
|
10134
|
+
*/ function createLogger(options, stream) {
|
|
10135
|
+
const { redact, ...pinoOptions } = options ?? {};
|
|
10136
|
+
// Build redaction config
|
|
10137
|
+
const redactConfig = buildRedactConfig(redact);
|
|
10138
|
+
// Build final pino options, only include redact if defined
|
|
10139
|
+
const finalOptions = redactConfig ? {
|
|
10140
|
+
...pinoOptions,
|
|
10141
|
+
redact: redactConfig
|
|
10142
|
+
} : pinoOptions;
|
|
10143
|
+
const pinoInstance = pino__default(finalOptions);
|
|
10144
|
+
return wrapPino(pinoInstance);
|
|
10145
|
+
}
|
|
10146
|
+
|
|
9626
10147
|
// ============================================================================
|
|
9627
10148
|
// Validation Schema
|
|
9628
10149
|
// ============================================================================
|
|
@@ -9730,6 +10251,9 @@ var TransferSpeed;
|
|
|
9730
10251
|
[TransferSpeed.SLOW]: 2000
|
|
9731
10252
|
});
|
|
9732
10253
|
|
|
10254
|
+
createLogger({
|
|
10255
|
+
name: 'provider-cctp-v2'
|
|
10256
|
+
});
|
|
9733
10257
|
/**
|
|
9734
10258
|
* All chains that are supported by the CCTP v2 provider.
|
|
9735
10259
|
*
|
|
@@ -9739,13 +10263,206 @@ var TransferSpeed;
|
|
|
9739
10263
|
* @internal
|
|
9740
10264
|
*/ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
|
|
9741
10265
|
|
|
10266
|
+
/**
|
|
10267
|
+
* Decimal string in token minor units, constrained to be strictly positive.
|
|
10268
|
+
*
|
|
10269
|
+
* @internal
|
|
10270
|
+
*/ const positiveAmountSchema = zod.z.string().regex(/^\d+$/, 'must be a non-negative integer string')// Re-check the digit shape here: zod still runs this refinement when the
|
|
10271
|
+
// regex check above fails ("dirty"), so guard BigInt() against throwing on a
|
|
10272
|
+
// non-numeric value before comparing.
|
|
10273
|
+
.refine((value)=>/^\d+$/.test(value) && BigInt(value) > 0n, 'must be greater than zero');
|
|
10274
|
+
/**
|
|
10275
|
+
* A 20-byte EVM address in `0x` hex.
|
|
10276
|
+
*
|
|
10277
|
+
* The MVP prepaid-`FORWARD` `burn/usdc` path targets EVM contracts
|
|
10278
|
+
* (`TokenMessengerWithFees` / `GenericExecutor`), so `feeToken` and
|
|
10279
|
+
* `destinationCaller` are constrained to EVM addresses by design. This is an
|
|
10280
|
+
* intentional scope limit, not a permanent one: it can be widened to other
|
|
10281
|
+
* address formats as the fee service expands to more chains.
|
|
10282
|
+
*/ const evmAddressSchema = zod.z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 20-byte 0x address');
|
|
10283
|
+
/** Even-length `0x` hex (the empty `0x` is allowed). */ const hexSchema = zod.z.string().regex(/^0x([a-fA-F0-9]{2})*$/, 'must be even-length 0x hex');
|
|
10284
|
+
/** Non-empty, even-length `0x` hex. */ const nonEmptyHexSchema = zod.z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex');
|
|
10285
|
+
/** A 32-byte `0x` hex hash. */ const bytes32Schema = zod.z.string().regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 32-byte 0x hash');
|
|
10286
|
+
/** Decimal string in minor units, allowing zero. */ const numericStringSchema = zod.z.string().regex(/^\d+$/, 'must be a non-negative integer string');
|
|
10287
|
+
/** An `https:` URL, used for the optional base-URL override. */ const httpsUrlSchema = zod.z.string().refine((value)=>{
|
|
10288
|
+
try {
|
|
10289
|
+
return new URL(value).protocol === 'https:';
|
|
10290
|
+
} catch {
|
|
10291
|
+
return false;
|
|
10292
|
+
}
|
|
10293
|
+
}, 'must be an https URL');
|
|
10294
|
+
const forwardParamsSchema = zod.z.object({
|
|
10295
|
+
hookData: hexSchema.optional(),
|
|
10296
|
+
destinationCaller: evmAddressSchema.optional()
|
|
10297
|
+
}).strict();
|
|
10298
|
+
const forwardRequestSchema = zod.z.object({
|
|
10299
|
+
type: zod.z.literal('FORWARD'),
|
|
10300
|
+
params: forwardParamsSchema.optional()
|
|
10301
|
+
}).strict();
|
|
10302
|
+
const preFinalityRequestSchema = zod.z.object({
|
|
10303
|
+
type: zod.z.literal('PRE_FINALITY')
|
|
10304
|
+
}).strict();
|
|
10305
|
+
/**
|
|
10306
|
+
* A single quote request item (`FORWARD` or `PRE_FINALITY`).
|
|
10307
|
+
*
|
|
10308
|
+
* @internal
|
|
10309
|
+
*/ const feeQuoteRequestSchema = zod.z.discriminatedUnion('type', [
|
|
10310
|
+
forwardRequestSchema,
|
|
10311
|
+
preFinalityRequestSchema
|
|
10312
|
+
]);
|
|
10313
|
+
/**
|
|
10314
|
+
* A non-empty list of quote request items with unique types.
|
|
10315
|
+
*
|
|
10316
|
+
* @internal
|
|
10317
|
+
*/ const feeQuoteRequestsSchema = zod.z.array(feeQuoteRequestSchema).min(1, 'at least one request item is required').refine((items)=>new Set(items.map((item)=>item.type)).size === items.length, 'request item types must be unique');
|
|
10318
|
+
/**
|
|
10319
|
+
* A structured `Partial<ApiPollingConfig>` polling override.
|
|
10320
|
+
*
|
|
10321
|
+
* Validates the field types callers actually set, so a plain-JS caller passing
|
|
10322
|
+
* `{ timeout: 'soon' }` is rejected at the boundary rather than failing opaquely
|
|
10323
|
+
* inside the transport. Unknown keys pass through so a future `ApiPollingConfig`
|
|
10324
|
+
* field is forwarded rather than silently dropped.
|
|
10325
|
+
*/ const apiPollingConfigSchema = zod.z.object({
|
|
10326
|
+
timeout: zod.z.number().int().positive().optional(),
|
|
10327
|
+
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
10328
|
+
retryDelay: zod.z.number().int().nonnegative().optional(),
|
|
10329
|
+
backoff: zod.z.enum([
|
|
10330
|
+
'fixed',
|
|
10331
|
+
'exponential'
|
|
10332
|
+
]).optional(),
|
|
10333
|
+
maxRetryDelayMs: zod.z.number().int().positive().optional(),
|
|
10334
|
+
headers: zod.z.record(zod.z.string()).optional()
|
|
10335
|
+
}).passthrough();
|
|
10336
|
+
/**
|
|
10337
|
+
* The validatable input for {@link fetchFeeQuote}.
|
|
10338
|
+
*
|
|
10339
|
+
* This is the single source of truth for input validation, including the CCTP
|
|
10340
|
+
* domains and the `isTestnet` environment flag. Validating `isTestnet` at
|
|
10341
|
+
* runtime matters because a plain-JS caller who omits it would otherwise leave
|
|
10342
|
+
* it `undefined`, which is falsy and silently selects the production base URL.
|
|
10343
|
+
* (`buildFeeQuoteUrl` independently re-validates the domains for standalone
|
|
10344
|
+
* callers.)
|
|
10345
|
+
*
|
|
10346
|
+
* @internal
|
|
10347
|
+
*/ zod.z.object({
|
|
10348
|
+
sourceDomain: zod.z.number().int().nonnegative(),
|
|
10349
|
+
destinationDomain: zod.z.number().int().nonnegative(),
|
|
10350
|
+
amount: positiveAmountSchema,
|
|
10351
|
+
feeToken: evmAddressSchema.optional(),
|
|
10352
|
+
requests: feeQuoteRequestsSchema,
|
|
10353
|
+
isTestnet: zod.z.boolean(),
|
|
10354
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
10355
|
+
config: apiPollingConfigSchema.optional()
|
|
10356
|
+
}).strict();
|
|
10357
|
+
const feeQuoteItemSchema = zod.z.object({
|
|
10358
|
+
type: zod.z.string().min(1),
|
|
10359
|
+
amount: numericStringSchema,
|
|
10360
|
+
args: zod.z.array(zod.z.string()),
|
|
10361
|
+
argsHash: bytes32Schema
|
|
10362
|
+
}).passthrough();
|
|
10363
|
+
const exchangeRatesSchema = zod.z.object({
|
|
10364
|
+
feeTokenUsd: zod.z.string(),
|
|
10365
|
+
destinationTokenUsd: zod.z.string()
|
|
10366
|
+
}).passthrough();
|
|
10367
|
+
const metadataSchema = zod.z.object({
|
|
10368
|
+
destinationGasPrice: zod.z.string().optional(),
|
|
10369
|
+
exchangeRates: exchangeRatesSchema.optional()
|
|
10370
|
+
}).passthrough();
|
|
10371
|
+
/** The `expiry` object the Quote API nests the quote TTL under. */ const expirySchema = zod.z.discriminatedUnion('mode', [
|
|
10372
|
+
zod.z.object({
|
|
10373
|
+
mode: zod.z.literal('TIMESTAMP'),
|
|
10374
|
+
expiresAt: zod.z.number().int().nonnegative()
|
|
10375
|
+
}).passthrough(),
|
|
10376
|
+
zod.z.object({
|
|
10377
|
+
mode: zod.z.literal('BLOCK_NUMBER'),
|
|
10378
|
+
expiresAtBlock: zod.z.number().int().nonnegative(),
|
|
10379
|
+
blockEstimatedAt: zod.z.number().int().nonnegative().optional()
|
|
10380
|
+
}).passthrough()
|
|
10381
|
+
]);
|
|
10382
|
+
/**
|
|
10383
|
+
* Schema for a signed fee quote returned by the Quote API.
|
|
10384
|
+
*
|
|
10385
|
+
* @internal
|
|
10386
|
+
*/ zod.z.object({
|
|
10387
|
+
// The runtime YAML spec maps signedQuote to a looser `hex` (which allows
|
|
10388
|
+
// an empty `0x`); we keep the stricter non-empty form. Do not relax
|
|
10389
|
+
// without a reason.
|
|
10390
|
+
signedQuote: nonEmptyHexSchema,
|
|
10391
|
+
issuedAt: zod.z.number().int().nonnegative(),
|
|
10392
|
+
// The API returns a mode-specific timestamp or source-block deadline.
|
|
10393
|
+
expiry: expirySchema,
|
|
10394
|
+
feeTotalAmount: numericStringSchema,
|
|
10395
|
+
feeToken: evmAddressSchema,
|
|
10396
|
+
nonce: numericStringSchema,
|
|
10397
|
+
items: zod.z.array(feeQuoteItemSchema),
|
|
10398
|
+
metadata: metadataSchema.optional()
|
|
10399
|
+
}).passthrough();
|
|
10400
|
+
/**
|
|
10401
|
+
* Validates input to {@link validateQuote}.
|
|
10402
|
+
*
|
|
10403
|
+
* @internal
|
|
10404
|
+
*/ zod.z.object({
|
|
10405
|
+
sourceDomain: zod.z.number().int().nonnegative(),
|
|
10406
|
+
abiSignature: zod.z.string().min(1),
|
|
10407
|
+
args: zod.z.array(zod.z.union([
|
|
10408
|
+
zod.z.string(),
|
|
10409
|
+
zod.z.array(zod.z.string())
|
|
10410
|
+
])),
|
|
10411
|
+
isTestnet: zod.z.boolean(),
|
|
10412
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
10413
|
+
config: apiPollingConfigSchema.optional()
|
|
10414
|
+
}).strict();
|
|
10415
|
+
const quoteExpiryStatusSchema = zod.z.discriminatedUnion('mode', [
|
|
10416
|
+
zod.z.object({
|
|
10417
|
+
mode: zod.z.literal('TIMESTAMP'),
|
|
10418
|
+
expired: zod.z.boolean(),
|
|
10419
|
+
secondsRemaining: zod.z.number().int().nonnegative(),
|
|
10420
|
+
expiresAt: zod.z.number().int().nonnegative()
|
|
10421
|
+
}).passthrough(),
|
|
10422
|
+
zod.z.object({
|
|
10423
|
+
mode: zod.z.literal('BLOCK_NUMBER'),
|
|
10424
|
+
expired: zod.z.boolean(),
|
|
10425
|
+
secondsRemaining: zod.z.number().int().nonnegative(),
|
|
10426
|
+
expiresAtBlock: zod.z.number().int().nonnegative(),
|
|
10427
|
+
blockEstimatedAt: zod.z.number().int().nonnegative().optional()
|
|
10428
|
+
}).passthrough()
|
|
10429
|
+
]);
|
|
10430
|
+
const validateQuoteItemSchema = zod.z.object({
|
|
10431
|
+
type: zod.z.string().min(1),
|
|
10432
|
+
argsMatch: zod.z.boolean(),
|
|
10433
|
+
amount: numericStringSchema.optional(),
|
|
10434
|
+
args: zod.z.array(zod.z.string()).optional(),
|
|
10435
|
+
argsHash: bytes32Schema.optional(),
|
|
10436
|
+
computedArgsHash: bytes32Schema.optional()
|
|
10437
|
+
}).passthrough();
|
|
10438
|
+
/**
|
|
10439
|
+
* Schema for a validate-quote result returned by the Iris `/validate/usdc/:sourceDomain` endpoint.
|
|
10440
|
+
*
|
|
10441
|
+
* The endpoint takes the source domain as a URL path parameter and does not
|
|
10442
|
+
* return it in the response body, so `sourceDomain` is intentionally not part
|
|
10443
|
+
* of this schema.
|
|
10444
|
+
*
|
|
10445
|
+
* @internal
|
|
10446
|
+
*/ zod.z.object({
|
|
10447
|
+
signedQuote: nonEmptyHexSchema,
|
|
10448
|
+
expiry: quoteExpiryStatusSchema,
|
|
10449
|
+
feeTotalAmount: numericStringSchema,
|
|
10450
|
+
feeToken: evmAddressSchema,
|
|
10451
|
+
nonce: numericStringSchema,
|
|
10452
|
+
claimable: zod.z.boolean(),
|
|
10453
|
+
// Preserve newly introduced server-side reasons as opaque strings rather
|
|
10454
|
+
// than rejecting the entire safety response before the SDK is updated.
|
|
10455
|
+
failedChecks: zod.z.array(zod.z.string().min(1)),
|
|
10456
|
+
items: zod.z.array(validateQuoteItemSchema)
|
|
10457
|
+
}).passthrough();
|
|
10458
|
+
|
|
9742
10459
|
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$3.name);
|
|
9743
10460
|
|
|
9744
10461
|
// Auto-register this kit for user agent tracking
|
|
9745
10462
|
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
9746
10463
|
|
|
9747
10464
|
var name$2 = "@circle-fin/swap-kit";
|
|
9748
|
-
var version$2 = "1.
|
|
10465
|
+
var version$2 = "1.6.1";
|
|
9749
10466
|
var pkg$2 = {
|
|
9750
10467
|
name: name$2,
|
|
9751
10468
|
version: version$2};
|
|
@@ -9759,7 +10476,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9759
10476
|
* Catches obviously malformed addresses at parse time; chain-specific validation
|
|
9760
10477
|
* is performed in buildServiceParams.
|
|
9761
10478
|
*/ const destinationAddressSchema = zod.z.union([
|
|
9762
|
-
evmAddressSchema,
|
|
10479
|
+
evmAddressSchema$1,
|
|
9763
10480
|
solanaAddressSchema
|
|
9764
10481
|
]);
|
|
9765
10482
|
/**
|
|
@@ -9805,9 +10522,16 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9805
10522
|
message: 'stopLimit must be greater than 0'
|
|
9806
10523
|
}).optional(),
|
|
9807
10524
|
customFee: serviceSwapCustomFeeSchema.optional(),
|
|
10525
|
+
apiKey: zod.z.string({
|
|
10526
|
+
invalid_type_error: 'apiKey must be a string'
|
|
10527
|
+
})// Tolerate '' so the `process.env.CIRCLE_API_KEY ?? ''` idiom falls back to
|
|
10528
|
+
// kitKey via resolveApiKey instead of being rejected here.
|
|
10529
|
+
.optional(),
|
|
9808
10530
|
kitKey: zod.z.string({
|
|
9809
10531
|
invalid_type_error: 'kitKey must be a string'
|
|
9810
|
-
})
|
|
10532
|
+
})// Tolerate '' so an unset kit-key env var yields the permissionless path,
|
|
10533
|
+
// matching buildServiceParams (which already omits an empty credential).
|
|
10534
|
+
.optional(),
|
|
9811
10535
|
provider: zod.z.string({
|
|
9812
10536
|
invalid_type_error: 'provider must be a string'
|
|
9813
10537
|
}).min(1, 'provider must be a non-empty string').optional(),
|
|
@@ -9980,6 +10704,41 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9980
10704
|
*
|
|
9981
10705
|
* @internal
|
|
9982
10706
|
*/ const MAX_RATE_ADDRESSES_PER_REQUEST = 100;
|
|
10707
|
+
/**
|
|
10708
|
+
* Environment prefixes carried by Circle platform API keys.
|
|
10709
|
+
*
|
|
10710
|
+
* A Circle API key is `<ENV>_API_KEY:<keyId>:<keySecret>`, where `<ENV>` is one
|
|
10711
|
+
* of these prefixes.
|
|
10712
|
+
*
|
|
10713
|
+
* @internal
|
|
10714
|
+
*/ const API_KEY_ENV_PREFIXES = [
|
|
10715
|
+
'TEST',
|
|
10716
|
+
'LIVE',
|
|
10717
|
+
'SAND',
|
|
10718
|
+
'SANDBOX',
|
|
10719
|
+
'SMOK',
|
|
10720
|
+
'PROD',
|
|
10721
|
+
'STAG',
|
|
10722
|
+
'DEV'
|
|
10723
|
+
];
|
|
10724
|
+
/**
|
|
10725
|
+
* Accepted credential formats for Stablecoin Service authentication.
|
|
10726
|
+
*
|
|
10727
|
+
* Matches a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
|
|
10728
|
+
* the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`). API keys are the
|
|
10729
|
+
* recommended credential; kit keys remain accepted as the legacy path.
|
|
10730
|
+
*
|
|
10731
|
+
* @remarks
|
|
10732
|
+
* This is a local pre-flight check, not the authority — the Stablecoin Service
|
|
10733
|
+
* validates the credential and answers 401 when it rejects one. The prefix list
|
|
10734
|
+
* is therefore deliberately permissive: a valid key carrying a prefix this SDK
|
|
10735
|
+
* has not been taught about should reach the service and be judged there rather
|
|
10736
|
+
* than be refused locally, since refusing locally is indistinguishable from an
|
|
10737
|
+
* outage to the caller. Kept as the single source of truth so the pattern is
|
|
10738
|
+
* not restated per call site.
|
|
10739
|
+
*
|
|
10740
|
+
* @internal
|
|
10741
|
+
*/ const API_KEY_PATTERN = new RegExp(`^(?:KIT_KEY|(?:${API_KEY_ENV_PREFIXES.join('|')})_API_KEY)` + ':[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$');
|
|
9983
10742
|
|
|
9984
10743
|
/**
|
|
9985
10744
|
* Zod schema for validating stop limits.
|
|
@@ -10048,13 +10807,14 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
10048
10807
|
/**
|
|
10049
10808
|
* Zod schema for validating API keys.
|
|
10050
10809
|
*
|
|
10051
|
-
*
|
|
10810
|
+
* Accepts a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
|
|
10811
|
+
* the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`).
|
|
10052
10812
|
*
|
|
10053
10813
|
* @example
|
|
10054
10814
|
* ```typescript
|
|
10055
10815
|
* import { apiKeySchema } from '@core/service-client'
|
|
10056
10816
|
*
|
|
10057
|
-
* const result = apiKeySchema.safeParse('
|
|
10817
|
+
* const result = apiKeySchema.safeParse('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
|
|
10058
10818
|
* if (!result.success) {
|
|
10059
10819
|
* console.error('Invalid API key format:', result.error.issues)
|
|
10060
10820
|
* }
|
|
@@ -10062,7 +10822,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
10062
10822
|
*/ const apiKeySchema = zod.z.string({
|
|
10063
10823
|
required_error: 'API key is required',
|
|
10064
10824
|
invalid_type_error: 'Invalid API key format'
|
|
10065
|
-
}).regex(
|
|
10825
|
+
}).regex(API_KEY_PATTERN, 'Invalid API key format');
|
|
10066
10826
|
/**
|
|
10067
10827
|
* Zod schema for platform fees configuration.
|
|
10068
10828
|
*
|
|
@@ -10505,8 +11265,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10505
11265
|
* Validates that an API key is properly formatted for Circle Stablecoin Service.
|
|
10506
11266
|
*
|
|
10507
11267
|
* This function performs validation on API keys to ensure they conform to the
|
|
10508
|
-
* expected format before making API requests. The key must follow the structure
|
|
10509
|
-
* `KIT_KEY:keyId:keySecret
|
|
11268
|
+
* expected format before making API requests. The key must follow the structure
|
|
11269
|
+
* `<ENV>_API_KEY:keyId:keySecret`, or the legacy `KIT_KEY:keyId:keySecret`.
|
|
10510
11270
|
*
|
|
10511
11271
|
* @param apiKey - The API key to validate (can be any type for graceful handling).
|
|
10512
11272
|
* @returns True if the API key is valid, false otherwise.
|
|
@@ -10514,7 +11274,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10514
11274
|
* @remarks
|
|
10515
11275
|
* This function handles invalid inputs gracefully by returning false rather than
|
|
10516
11276
|
* throwing errors. It validates:
|
|
10517
|
-
* - The key
|
|
11277
|
+
* - The key carries a recognized prefix — `<ENV>_API_KEY:` for a Circle platform
|
|
11278
|
+
* API key, or `KIT_KEY:` for the legacy kit key
|
|
10518
11279
|
* - Contains exactly three colon-separated parts
|
|
10519
11280
|
* - keyId and keySecret contain only valid characters (alphanumeric, `-`, `_`, `.`)
|
|
10520
11281
|
* - keyId and keySecret are non-empty
|
|
@@ -10522,23 +11283,62 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10522
11283
|
*
|
|
10523
11284
|
* Valid characters in keyId and keySecret: `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
|
|
10524
11285
|
*
|
|
11286
|
+
* Format is checked locally only so an obviously malformed credential fails
|
|
11287
|
+
* before a request is made. The Stablecoin Service remains the authority on
|
|
11288
|
+
* whether a well-formed key is actually accepted.
|
|
11289
|
+
*
|
|
10525
11290
|
* @example
|
|
10526
11291
|
* ```typescript
|
|
10527
11292
|
* import { isValidApiKey } from '@core/service-client'
|
|
10528
11293
|
*
|
|
10529
11294
|
* // Valid API key
|
|
10530
|
-
* const isValid = isValidApiKey('
|
|
11295
|
+
* const isValid = isValidApiKey('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
|
|
10531
11296
|
* console.log(isValid) // true
|
|
10532
11297
|
*
|
|
11298
|
+
* // Legacy kit keys remain valid
|
|
11299
|
+
* console.log(isValidApiKey('KIT_KEY:my-key-id:my-key-secret')) // true
|
|
11300
|
+
*
|
|
10533
11301
|
* ```
|
|
10534
11302
|
*/ const isValidApiKey = (apiKey)=>{
|
|
10535
11303
|
// Handle invalid input types
|
|
10536
11304
|
if (typeof apiKey !== 'string') {
|
|
10537
11305
|
return false;
|
|
10538
11306
|
}
|
|
10539
|
-
const apiKeyPattern = /^KIT_KEY:[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$/;
|
|
10540
11307
|
// Validate without trimming - any whitespace will cause validation to fail
|
|
10541
|
-
return
|
|
11308
|
+
return API_KEY_PATTERN.test(apiKey);
|
|
11309
|
+
};
|
|
11310
|
+
/**
|
|
11311
|
+
* Resolve the credential to authenticate a Stablecoin Service request with.
|
|
11312
|
+
*
|
|
11313
|
+
* `apiKey` is the supported field; `kitKey` is the deprecated alias kept for
|
|
11314
|
+
* existing integrations. When both are supplied `apiKey` wins, so a caller
|
|
11315
|
+
* migrating field-by-field cannot be silently pinned to a stale credential.
|
|
11316
|
+
*
|
|
11317
|
+
* An empty-string value is treated as absent on either field. Without this, the
|
|
11318
|
+
* common `process.env.CIRCLE_API_KEY ?? ''` idiom (which yields `''` when the
|
|
11319
|
+
* variable is unset) would either shadow a working `kitKey` or, on a bare
|
|
11320
|
+
* `kitKey: ''`, reach downstream validation as an invalid credential instead of
|
|
11321
|
+
* falling through to the permissionless path.
|
|
11322
|
+
*
|
|
11323
|
+
* @param source - Object carrying either credential field, or neither.
|
|
11324
|
+
* @returns The credential to use, or `undefined` for the permissionless
|
|
11325
|
+
* (keyless) path.
|
|
11326
|
+
*
|
|
11327
|
+
* @example
|
|
11328
|
+
* ```typescript
|
|
11329
|
+
* import { resolveApiKey } from '@core/service-client'
|
|
11330
|
+
*
|
|
11331
|
+
* resolveApiKey({ apiKey: 'TEST_API_KEY:id:secret' }) // 'TEST_API_KEY:id:secret'
|
|
11332
|
+
* resolveApiKey({ kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
|
|
11333
|
+
* resolveApiKey({ apiKey: '', kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
|
|
11334
|
+
* resolveApiKey({ kitKey: '' }) // undefined
|
|
11335
|
+
* resolveApiKey({}) // undefined
|
|
11336
|
+
* ```
|
|
11337
|
+
*/ const resolveApiKey = (source)=>{
|
|
11338
|
+
// Treat an empty-string value as absent on either field so the
|
|
11339
|
+
// `env ?? ''` idiom falls through to the next credential (or permissionless).
|
|
11340
|
+
const normalize = (value)=>value !== undefined && value !== '' ? value : undefined;
|
|
11341
|
+
return normalize(source.apiKey) ?? normalize(source.kitKey);
|
|
10542
11342
|
};
|
|
10543
11343
|
|
|
10544
11344
|
/**
|
|
@@ -11275,7 +12075,7 @@ const abiParameterSchema = zod.z.object({
|
|
|
11275
12075
|
*/ zod.z.object({
|
|
11276
12076
|
type: zod.z.literal('evm'),
|
|
11277
12077
|
abi: abiSchema,
|
|
11278
|
-
address: evmAddressSchema,
|
|
12078
|
+
address: evmAddressSchema$1,
|
|
11279
12079
|
functionName: zod.z.string({
|
|
11280
12080
|
required_error: 'Function name is required',
|
|
11281
12081
|
invalid_type_error: 'Function name must be a string'
|
|
@@ -11312,7 +12112,7 @@ const abiParameterSchema = zod.z.object({
|
|
|
11312
12112
|
* }
|
|
11313
12113
|
* ```
|
|
11314
12114
|
*/ zod.z.object({
|
|
11315
|
-
address: evmAddressSchema,
|
|
12115
|
+
address: evmAddressSchema$1,
|
|
11316
12116
|
value: zod.z.bigint({
|
|
11317
12117
|
required_error: 'Value is required for native transfers',
|
|
11318
12118
|
invalid_type_error: 'Value must be a bigint'
|
|
@@ -11480,7 +12280,7 @@ zod.z.object({
|
|
|
11480
12280
|
signature: evmSignatureSchema,
|
|
11481
12281
|
tokenInputs: zod.z.array(zod.z.object({
|
|
11482
12282
|
permitType: zod.z.nativeEnum(PermitType),
|
|
11483
|
-
token: evmAddressSchema,
|
|
12283
|
+
token: evmAddressSchema$1,
|
|
11484
12284
|
amount: zod.z.bigint().refine((value)=>value >= 0n, {
|
|
11485
12285
|
message: 'amount must be a non-negative bigint'
|
|
11486
12286
|
}),
|
|
@@ -11900,7 +12700,7 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11900
12700
|
/**
|
|
11901
12701
|
* Fee recipient address (required).
|
|
11902
12702
|
* Must be a valid EVM address or Solana address.
|
|
11903
|
-
*/ recipientAddress: zod.z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
12703
|
+
*/ recipientAddress: zod.z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
11904
12704
|
message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
|
|
11905
12705
|
})
|
|
11906
12706
|
}).strict();
|
|
@@ -11912,7 +12712,8 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11912
12712
|
* - slippageBps: Optional positive number for slippage tolerance
|
|
11913
12713
|
* - stopLimit: Optional decimal string for minimum output
|
|
11914
12714
|
* - customFee: Optional fee configuration
|
|
11915
|
-
* -
|
|
12715
|
+
* - apiKey: Optional credential string
|
|
12716
|
+
* - kitKey: Optional credential string (deprecated alias for apiKey)
|
|
11916
12717
|
*/ const swapConfigSchema = zod.z.object({
|
|
11917
12718
|
allowanceStrategy: allowanceStrategySchema.optional(),
|
|
11918
12719
|
slippageBps: zod.z.number().int().min(0).optional(),
|
|
@@ -11922,11 +12723,12 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11922
12723
|
attributeName: 'stopLimit'
|
|
11923
12724
|
})(zod.z.string())).optional(),
|
|
11924
12725
|
customFee: swapCustomFeeSchema.optional(),
|
|
12726
|
+
apiKey: zod.z.string().optional(),
|
|
11925
12727
|
kitKey: zod.z.string().optional()
|
|
11926
12728
|
});
|
|
11927
12729
|
const swapDestinationSchema = zod.z.object({
|
|
11928
12730
|
chain: optionalSwapChainIdentifierField,
|
|
11929
|
-
recipientAddress: zod.z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
12731
|
+
recipientAddress: zod.z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
11930
12732
|
message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
|
|
11931
12733
|
}).optional()
|
|
11932
12734
|
}).strict();
|
|
@@ -13359,7 +14161,7 @@ new Set(Object.values(Blockchain));
|
|
|
13359
14161
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
13360
14162
|
|
|
13361
14163
|
var name$1 = "@circle-fin/earn-kit";
|
|
13362
|
-
var version$1 = "1.
|
|
14164
|
+
var version$1 = "1.6.1";
|
|
13363
14165
|
var pkg$1 = {
|
|
13364
14166
|
name: name$1,
|
|
13365
14167
|
version: version$1};
|
|
@@ -13575,7 +14377,7 @@ function toSdkChain(chain) {
|
|
|
13575
14377
|
*
|
|
13576
14378
|
* @internal
|
|
13577
14379
|
*/ function assertHexAddress(field, value, message = `${field} must be a 0x-prefixed 20-byte hex address`) {
|
|
13578
|
-
const result = evmAddressSchema.safeParse(value);
|
|
14380
|
+
const result = evmAddressSchema$1.safeParse(value);
|
|
13579
14381
|
if (!result.success) {
|
|
13580
14382
|
throw createValidationFailedError(field, value, message);
|
|
13581
14383
|
}
|
|
@@ -15223,7 +16025,7 @@ const EARN_OPERATIONS = new Set([
|
|
|
15223
16025
|
// Store the original service params non-enumerably. `retry()` reads them by
|
|
15224
16026
|
// direct property access (`trace.params`), but JSON.stringify, console.log,
|
|
15225
16027
|
// and telemetry serializers skip non-enumerable properties — so a
|
|
15226
|
-
// permissioned call's `config.
|
|
16028
|
+
// permissioned call's `config.apiKey` (a credential value) and
|
|
15227
16029
|
// the in-memory adapter never leak through a logged error. defineProperty
|
|
15228
16030
|
// also redefines any enumerable `params` an upstream trace may have carried.
|
|
15229
16031
|
Object.defineProperty(trace, 'params', {
|
|
@@ -15294,7 +16096,7 @@ function isNonNegativeBigIntLike(value) {
|
|
|
15294
16096
|
}
|
|
15295
16097
|
}
|
|
15296
16098
|
const hexSignatureSchema = evmSignatureSchema;
|
|
15297
|
-
const hexAddressSchema = evmAddressSchema;
|
|
16099
|
+
const hexAddressSchema = evmAddressSchema$1;
|
|
15298
16100
|
// '0x' prefix + 32 bytes * 2 hex chars.
|
|
15299
16101
|
const BYTES32_HEX_LENGTH = 66;
|
|
15300
16102
|
const bridgeFeeTokenSchema = hexAddressSchema;
|
|
@@ -16263,7 +17065,7 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
16263
17065
|
}
|
|
16264
17066
|
|
|
16265
17067
|
var name = "@circle-fin/provider-earn-service";
|
|
16266
|
-
var version = "1.
|
|
17068
|
+
var version = "1.5.1";
|
|
16267
17069
|
var pkg = {
|
|
16268
17070
|
name: name,
|
|
16269
17071
|
version: version};
|
|
@@ -16325,10 +17127,12 @@ var pkg = {
|
|
|
16325
17127
|
*
|
|
16326
17128
|
* @internal
|
|
16327
17129
|
*/ function buildConfig(serviceConfig) {
|
|
16328
|
-
|
|
16329
|
-
//
|
|
16330
|
-
|
|
16331
|
-
|
|
17130
|
+
const apiKey = resolveApiKey(serviceConfig ?? {});
|
|
17131
|
+
// The credential is a server-only secret. Reject it in the browser so it
|
|
17132
|
+
// cannot leak into a client bundle (no-op in Node.js). Keyless usage stays
|
|
17133
|
+
// allowed.
|
|
17134
|
+
if (apiKey !== undefined && isBrowserEnvironment()) {
|
|
17135
|
+
throw createValidationFailedError('apiKey', '[redacted]', 'apiKey must not be provided in a browser environment — it is a server-only secret. Run EarnKit operations that use an API key on your server, or omit apiKey (and the legacy kitKey) to use the permissionless (keyless) client path');
|
|
16332
17136
|
}
|
|
16333
17137
|
const baseUrl = serviceConfig?.baseUrl ?? EARN_SERVICE_BASE_URL;
|
|
16334
17138
|
// The API CORS policy does not allow this custom header. Keep the existing
|
|
@@ -16337,7 +17141,7 @@ var pkg = {
|
|
|
16337
17141
|
const sdkVersionHeader = isNodeEnvironment() ? {
|
|
16338
17142
|
[SDK_VERSION_HEADER]: resolveSdkVersionHeader()
|
|
16339
17143
|
} : {};
|
|
16340
|
-
if (
|
|
17144
|
+
if (apiKey === undefined) {
|
|
16341
17145
|
return {
|
|
16342
17146
|
pollingConfig: {
|
|
16343
17147
|
...DEFAULT_CONFIG,
|
|
@@ -16349,11 +17153,11 @@ var pkg = {
|
|
|
16349
17153
|
baseUrl
|
|
16350
17154
|
};
|
|
16351
17155
|
}
|
|
16352
|
-
if (!isValidApiKey(
|
|
17156
|
+
if (!isValidApiKey(apiKey)) {
|
|
16353
17157
|
throw new KitError({
|
|
16354
17158
|
...InputError.VALIDATION_FAILED,
|
|
16355
17159
|
recoverability: 'FATAL',
|
|
16356
|
-
message: 'Invalid
|
|
17160
|
+
message: 'Invalid apiKey format. Expected <ENV>_API_KEY:<keyId>:<keySecret> (for example TEST_API_KEY:...), or a legacy KIT_KEY:<keyId>:<keySecret>.'
|
|
16357
17161
|
});
|
|
16358
17162
|
}
|
|
16359
17163
|
return {
|
|
@@ -16362,7 +17166,7 @@ var pkg = {
|
|
|
16362
17166
|
headers: {
|
|
16363
17167
|
...DEFAULT_CONFIG.headers,
|
|
16364
17168
|
...sdkVersionHeader,
|
|
16365
|
-
Authorization: `Bearer ${
|
|
17169
|
+
Authorization: `Bearer ${apiKey}`
|
|
16366
17170
|
}
|
|
16367
17171
|
},
|
|
16368
17172
|
baseUrl
|
|
@@ -17669,9 +18473,9 @@ function finishElapsedWait(lastStatus, lastError) {
|
|
|
17669
18473
|
* // Permissionless mode
|
|
17670
18474
|
* const provider = new EarnServiceProvider()
|
|
17671
18475
|
*
|
|
17672
|
-
* // Permissioned mode with
|
|
18476
|
+
* // Permissioned mode with an API key
|
|
17673
18477
|
* const provider = new EarnServiceProvider({
|
|
17674
|
-
*
|
|
18478
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
17675
18479
|
* })
|
|
17676
18480
|
*
|
|
17677
18481
|
* // Custom base URL for testing
|
|
@@ -18898,7 +19702,7 @@ function findProvider(context, chain, operation = 'earn') {
|
|
|
18898
19702
|
* fast instead of round-tripping to the service.
|
|
18899
19703
|
*
|
|
18900
19704
|
* @internal
|
|
18901
|
-
*/ const recipientEvmAddressSchema = evmAddressSchema.refine((address)=>!ZERO_EVM_ADDRESS_REGEX.test(address), 'address must not be the zero address').refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19705
|
+
*/ const recipientEvmAddressSchema = evmAddressSchema$1.refine((address)=>!ZERO_EVM_ADDRESS_REGEX.test(address), 'address must not be the zero address').refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
18902
19706
|
/**
|
|
18903
19707
|
* Schema for the adapter context within earn operations.
|
|
18904
19708
|
*
|
|
@@ -18930,19 +19734,39 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
18930
19734
|
/**
|
|
18931
19735
|
* Schema for the EarnConfig options.
|
|
18932
19736
|
*
|
|
18933
|
-
* Validate the
|
|
18934
|
-
*
|
|
18935
|
-
*
|
|
18936
|
-
*
|
|
18937
|
-
*
|
|
18938
|
-
*
|
|
19737
|
+
* Validate the *resolved* credential using the standard `apiKeySchema` format
|
|
19738
|
+
* (`<ENV>_API_KEY:<keyId>:<keySecret>`, or a legacy
|
|
19739
|
+
* `KIT_KEY:<keyId>:<keySecret>`). `apiKey` takes precedence over the deprecated
|
|
19740
|
+
* `kitKey`, so a malformed `kitKey` that is being ignored must not fail a config
|
|
19741
|
+
* that supplies a valid `apiKey` (and vice versa) — only the credential that
|
|
19742
|
+
* would actually be sent is format-checked. When neither is supplied the SDK
|
|
19743
|
+
* operates in permissionless mode. `baseUrl` overrides the Earn Service endpoint
|
|
19744
|
+
* (e.g. staging); `batchTransactions: false` opts out of atomic batched
|
|
19745
|
+
* execution. All are forwarded to the provider, so this `.strict()` schema must
|
|
19746
|
+
* accept them or a valid config object is rejected.
|
|
18939
19747
|
*
|
|
18940
19748
|
* @internal
|
|
18941
19749
|
*/ const earnConfigSchema = zod.z.object({
|
|
18942
|
-
|
|
19750
|
+
apiKey: zod.z.string().optional(),
|
|
19751
|
+
kitKey: zod.z.string().optional(),
|
|
18943
19752
|
baseUrl: zod.z.string().optional(),
|
|
18944
19753
|
batchTransactions: zod.z.boolean().optional()
|
|
18945
|
-
}).strict()
|
|
19754
|
+
}).strict().superRefine((config, ctx)=>{
|
|
19755
|
+
const credential = resolveApiKey(config);
|
|
19756
|
+
if (credential === undefined) {
|
|
19757
|
+
return;
|
|
19758
|
+
}
|
|
19759
|
+
const result = apiKeySchema.safeParse(credential);
|
|
19760
|
+
if (!result.success) {
|
|
19761
|
+
ctx.addIssue({
|
|
19762
|
+
code: zod.z.ZodIssueCode.custom,
|
|
19763
|
+
path: [
|
|
19764
|
+
credential === config.apiKey ? 'apiKey' : 'kitKey'
|
|
19765
|
+
],
|
|
19766
|
+
message: result.error.issues[0]?.message ?? 'Invalid API key format'
|
|
19767
|
+
});
|
|
19768
|
+
}
|
|
19769
|
+
});
|
|
18946
19770
|
/**
|
|
18947
19771
|
* Canonical decimal form: a leading digit with no leading zeros (a single
|
|
18948
19772
|
* '0' is only allowed immediately before the decimal point). Rejects the
|
|
@@ -19014,7 +19838,7 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
19014
19838
|
* currently supports EVM vault addresses on Arc Testnet.
|
|
19015
19839
|
*
|
|
19016
19840
|
* @internal
|
|
19017
|
-
*/ const vaultAddressSchema = evmAddressSchema.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19841
|
+
*/ const vaultAddressSchema = evmAddressSchema$1.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19018
19842
|
/**
|
|
19019
19843
|
* Validation schema for VaultQuery.
|
|
19020
19844
|
*
|
|
@@ -19289,7 +20113,7 @@ const sameChainGetDepositQuoteParamsSchema = zod.z.object({
|
|
|
19289
20113
|
const crossChainGetDepositQuoteParamsSchema = zod.z.object({
|
|
19290
20114
|
from: sourceAdapterContextSchema,
|
|
19291
20115
|
chain: earnBridgeDestinationChainIdentifierSchema,
|
|
19292
|
-
address: evmAddressSchema,
|
|
20116
|
+
address: evmAddressSchema$1,
|
|
19293
20117
|
vaultAddress: vaultAddressSchema,
|
|
19294
20118
|
amount: amountSchema,
|
|
19295
20119
|
transferSpeed: zod.z.enum([
|