@circle-fin/app-kit 1.12.1 → 1.13.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 +59 -0
- package/README.md +31 -12
- package/bridge.cjs +2214 -186
- package/bridge.d.cts +86 -17
- package/bridge.d.mts +86 -17
- package/bridge.d.ts +86 -17
- package/bridge.mjs +2216 -188
- package/chains.cjs +134 -0
- package/chains.d.cts +126 -1
- package/chains.d.mts +126 -1
- package/chains.d.ts +126 -1
- package/chains.mjs +133 -1
- package/context.d.cts +86 -17
- package/context.d.mts +86 -17
- package/context.d.ts +86 -17
- package/earn.cjs +467 -48
- package/earn.d.cts +86 -17
- package/earn.d.mts +86 -17
- package/earn.d.ts +86 -17
- package/earn.mjs +467 -48
- package/estimateBridge.cjs +2214 -186
- package/estimateBridge.d.cts +196 -18
- package/estimateBridge.d.mts +196 -18
- package/estimateBridge.d.ts +196 -18
- package/estimateBridge.mjs +2216 -188
- package/estimateSwap.cjs +571 -131
- package/estimateSwap.d.cts +86 -17
- package/estimateSwap.d.mts +86 -17
- package/estimateSwap.d.ts +86 -17
- package/estimateSwap.mjs +571 -131
- package/index.cjs +2101 -434
- package/index.d.cts +949 -147
- package/index.d.mts +949 -147
- package/index.d.ts +949 -147
- package/index.mjs +2103 -436
- package/package.json +6 -6
- package/swap.cjs +571 -131
- package/swap.d.cts +93 -18
- package/swap.d.mts +93 -18
- package/swap.d.ts +93 -18
- package/swap.mjs +571 -131
- package/unifiedBalance.cjs +384 -67
- package/unifiedBalance.d.cts +76 -2
- package/unifiedBalance.d.mts +76 -2
- package/unifiedBalance.d.ts +76 -2
- package/unifiedBalance.mjs +384 -67
package/earn.cjs
CHANGED
|
@@ -2349,6 +2349,8 @@ function getOptionalString(value) {
|
|
|
2349
2349
|
Blockchain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
2350
2350
|
Blockchain["Pharos"] = "Pharos";
|
|
2351
2351
|
Blockchain["Pharos_Testnet"] = "Pharos_Testnet";
|
|
2352
|
+
Blockchain["Plasma"] = "Plasma";
|
|
2353
|
+
Blockchain["Plasma_Testnet"] = "Plasma_Testnet";
|
|
2352
2354
|
Blockchain["Polkadot_Asset_Hub"] = "Polkadot_Asset_Hub";
|
|
2353
2355
|
Blockchain["Polkadot_Westmint"] = "Polkadot_Westmint";
|
|
2354
2356
|
Blockchain["Plume"] = "Plume";
|
|
@@ -2418,6 +2420,7 @@ var BridgeChain;
|
|
|
2418
2420
|
BridgeChain["Morph"] = "Morph";
|
|
2419
2421
|
BridgeChain["Optimism"] = "Optimism";
|
|
2420
2422
|
BridgeChain["Pharos"] = "Pharos";
|
|
2423
|
+
BridgeChain["Plasma"] = "Plasma";
|
|
2421
2424
|
BridgeChain["Plume"] = "Plume";
|
|
2422
2425
|
BridgeChain["Polygon"] = "Polygon";
|
|
2423
2426
|
BridgeChain["Sei"] = "Sei";
|
|
@@ -2444,6 +2447,7 @@ var BridgeChain;
|
|
|
2444
2447
|
BridgeChain["Morph_Testnet"] = "Morph_Testnet";
|
|
2445
2448
|
BridgeChain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
2446
2449
|
BridgeChain["Pharos_Testnet"] = "Pharos_Testnet";
|
|
2450
|
+
BridgeChain["Plasma_Testnet"] = "Plasma_Testnet";
|
|
2447
2451
|
BridgeChain["Plume_Testnet"] = "Plume_Testnet";
|
|
2448
2452
|
BridgeChain["Polygon_Amoy_Testnet"] = "Polygon_Amoy_Testnet";
|
|
2449
2453
|
BridgeChain["Sei_Testnet"] = "Sei_Testnet";
|
|
@@ -2890,6 +2894,8 @@ var EarnChain;
|
|
|
2890
2894
|
* This program handles minting operations for Gateway transactions
|
|
2891
2895
|
* on Solana devnet.
|
|
2892
2896
|
*/ const GATEWAY_MINTER_SOLANA_DEVNET = 'GATEmKK2ECL1brEngQZWCgMWPbvrEYqsV6u29dAaHavr';
|
|
2897
|
+
/** TokenMessengerWithFees address shared by enabled EVM mainnet sources. */ const TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET = '0x71f54F818671cD0D7ea140Da213e5C8b5C92a408';
|
|
2898
|
+
/** TokenMessengerWithFees address shared by enabled EVM testnet sources. */ const TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET = '0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A';
|
|
2893
2899
|
|
|
2894
2900
|
/**
|
|
2895
2901
|
* Arc Testnet chain definition
|
|
@@ -2927,6 +2933,7 @@ var EarnChain;
|
|
|
2927
2933
|
v2: {
|
|
2928
2934
|
type: 'split',
|
|
2929
2935
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
2936
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
2930
2937
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
2931
2938
|
confirmations: 1,
|
|
2932
2939
|
fastConfirmations: 1
|
|
@@ -2994,6 +3001,7 @@ var EarnChain;
|
|
|
2994
3001
|
v2: {
|
|
2995
3002
|
type: 'split',
|
|
2996
3003
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3004
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
2997
3005
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
2998
3006
|
confirmations: 65,
|
|
2999
3007
|
fastConfirmations: 1
|
|
@@ -3058,6 +3066,7 @@ var EarnChain;
|
|
|
3058
3066
|
v2: {
|
|
3059
3067
|
type: 'split',
|
|
3060
3068
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3069
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3061
3070
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3062
3071
|
confirmations: 65,
|
|
3063
3072
|
fastConfirmations: 1
|
|
@@ -3122,6 +3131,7 @@ var EarnChain;
|
|
|
3122
3131
|
v2: {
|
|
3123
3132
|
type: 'split',
|
|
3124
3133
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3134
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3125
3135
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3126
3136
|
confirmations: 1,
|
|
3127
3137
|
fastConfirmations: 1
|
|
@@ -3183,6 +3193,7 @@ var EarnChain;
|
|
|
3183
3193
|
v2: {
|
|
3184
3194
|
type: 'split',
|
|
3185
3195
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3196
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3186
3197
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3187
3198
|
confirmations: 1,
|
|
3188
3199
|
fastConfirmations: 1
|
|
@@ -3250,6 +3261,7 @@ var EarnChain;
|
|
|
3250
3261
|
v2: {
|
|
3251
3262
|
type: 'split',
|
|
3252
3263
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3264
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3253
3265
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3254
3266
|
confirmations: 65,
|
|
3255
3267
|
fastConfirmations: 1
|
|
@@ -3314,6 +3326,7 @@ var EarnChain;
|
|
|
3314
3326
|
v2: {
|
|
3315
3327
|
type: 'split',
|
|
3316
3328
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3329
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3317
3330
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3318
3331
|
confirmations: 65,
|
|
3319
3332
|
fastConfirmations: 1
|
|
@@ -3424,6 +3437,7 @@ var EarnChain;
|
|
|
3424
3437
|
v2: {
|
|
3425
3438
|
type: 'split',
|
|
3426
3439
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3440
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3427
3441
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3428
3442
|
confirmations: 65,
|
|
3429
3443
|
fastConfirmations: 1
|
|
@@ -3468,6 +3482,7 @@ var EarnChain;
|
|
|
3468
3482
|
v2: {
|
|
3469
3483
|
type: 'split',
|
|
3470
3484
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3485
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3471
3486
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3472
3487
|
confirmations: 65,
|
|
3473
3488
|
fastConfirmations: 1
|
|
@@ -3699,6 +3714,7 @@ var EarnChain;
|
|
|
3699
3714
|
v2: {
|
|
3700
3715
|
type: 'split',
|
|
3701
3716
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3717
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3702
3718
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3703
3719
|
confirmations: 65,
|
|
3704
3720
|
fastConfirmations: 2
|
|
@@ -3763,6 +3779,7 @@ var EarnChain;
|
|
|
3763
3779
|
v2: {
|
|
3764
3780
|
type: 'split',
|
|
3765
3781
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3782
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3766
3783
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3767
3784
|
confirmations: 65,
|
|
3768
3785
|
fastConfirmations: 2
|
|
@@ -3873,6 +3890,7 @@ var EarnChain;
|
|
|
3873
3890
|
v2: {
|
|
3874
3891
|
type: 'split',
|
|
3875
3892
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3893
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3876
3894
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3877
3895
|
confirmations: 1,
|
|
3878
3896
|
fastConfirmations: 1
|
|
@@ -3932,6 +3950,7 @@ var EarnChain;
|
|
|
3932
3950
|
v2: {
|
|
3933
3951
|
type: 'split',
|
|
3934
3952
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3953
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3935
3954
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3936
3955
|
confirmations: 1,
|
|
3937
3956
|
fastConfirmations: 1
|
|
@@ -4086,6 +4105,7 @@ var EarnChain;
|
|
|
4086
4105
|
v2: {
|
|
4087
4106
|
type: 'split',
|
|
4088
4107
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4108
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4089
4109
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4090
4110
|
confirmations: 65,
|
|
4091
4111
|
fastConfirmations: 1
|
|
@@ -4133,6 +4153,7 @@ var EarnChain;
|
|
|
4133
4153
|
v2: {
|
|
4134
4154
|
type: 'split',
|
|
4135
4155
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4156
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4136
4157
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4137
4158
|
confirmations: 65,
|
|
4138
4159
|
fastConfirmations: 1
|
|
@@ -4177,6 +4198,7 @@ var EarnChain;
|
|
|
4177
4198
|
v2: {
|
|
4178
4199
|
type: 'split',
|
|
4179
4200
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4201
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4180
4202
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4181
4203
|
confirmations: 1,
|
|
4182
4204
|
fastConfirmations: 1
|
|
@@ -4222,6 +4244,7 @@ var EarnChain;
|
|
|
4222
4244
|
v2: {
|
|
4223
4245
|
type: 'split',
|
|
4224
4246
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
4247
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4225
4248
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
4226
4249
|
confirmations: 1,
|
|
4227
4250
|
fastConfirmations: 1
|
|
@@ -4268,6 +4291,7 @@ var EarnChain;
|
|
|
4268
4291
|
v2: {
|
|
4269
4292
|
type: 'split',
|
|
4270
4293
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4294
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4271
4295
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4272
4296
|
confirmations: 1,
|
|
4273
4297
|
fastConfirmations: 1
|
|
@@ -4581,6 +4605,7 @@ var EarnChain;
|
|
|
4581
4605
|
v2: {
|
|
4582
4606
|
type: 'split',
|
|
4583
4607
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4608
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4584
4609
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4585
4610
|
confirmations: 65,
|
|
4586
4611
|
fastConfirmations: 1
|
|
@@ -4645,6 +4670,7 @@ var EarnChain;
|
|
|
4645
4670
|
v2: {
|
|
4646
4671
|
type: 'split',
|
|
4647
4672
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
4673
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4648
4674
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
4649
4675
|
confirmations: 65,
|
|
4650
4676
|
fastConfirmations: 1
|
|
@@ -4765,6 +4791,98 @@ var EarnChain;
|
|
|
4765
4791
|
}
|
|
4766
4792
|
});
|
|
4767
4793
|
|
|
4794
|
+
/**
|
|
4795
|
+
* Plasma Mainnet chain definition
|
|
4796
|
+
* @remarks
|
|
4797
|
+
* This represents the official production network for the Plasma blockchain.
|
|
4798
|
+
* Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
|
|
4799
|
+
* stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
|
|
4800
|
+
*/ const Plasma = defineChain({
|
|
4801
|
+
type: 'evm',
|
|
4802
|
+
chain: Blockchain.Plasma,
|
|
4803
|
+
name: 'Plasma',
|
|
4804
|
+
title: 'Plasma Mainnet',
|
|
4805
|
+
nativeCurrency: {
|
|
4806
|
+
name: 'Plasma',
|
|
4807
|
+
symbol: 'XPL',
|
|
4808
|
+
decimals: 18
|
|
4809
|
+
},
|
|
4810
|
+
chainId: 9745,
|
|
4811
|
+
isTestnet: false,
|
|
4812
|
+
explorerUrl: 'https://plasmascan.to/tx/{hash}',
|
|
4813
|
+
rpcEndpoints: [
|
|
4814
|
+
'https://rpc.plasma.to'
|
|
4815
|
+
],
|
|
4816
|
+
eurcAddress: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
|
|
4817
|
+
usdcAddress: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
|
|
4818
|
+
usdtAddress: null,
|
|
4819
|
+
cctp: {
|
|
4820
|
+
domain: 33,
|
|
4821
|
+
contracts: {
|
|
4822
|
+
v2: {
|
|
4823
|
+
type: 'split',
|
|
4824
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4825
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4826
|
+
confirmations: 3,
|
|
4827
|
+
fastConfirmations: 1
|
|
4828
|
+
}
|
|
4829
|
+
},
|
|
4830
|
+
forwarderSupported: {
|
|
4831
|
+
source: false,
|
|
4832
|
+
destination: false
|
|
4833
|
+
}
|
|
4834
|
+
},
|
|
4835
|
+
kitContracts: {
|
|
4836
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
4837
|
+
}
|
|
4838
|
+
});
|
|
4839
|
+
|
|
4840
|
+
/**
|
|
4841
|
+
* Plasma Testnet chain definition
|
|
4842
|
+
* @remarks
|
|
4843
|
+
* This represents the official test network for the Plasma blockchain.
|
|
4844
|
+
* Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
|
|
4845
|
+
* stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
|
|
4846
|
+
*/ const PlasmaTestnet = defineChain({
|
|
4847
|
+
type: 'evm',
|
|
4848
|
+
chain: Blockchain.Plasma_Testnet,
|
|
4849
|
+
name: 'Plasma Testnet',
|
|
4850
|
+
title: 'Plasma Testnet',
|
|
4851
|
+
nativeCurrency: {
|
|
4852
|
+
name: 'Plasma',
|
|
4853
|
+
symbol: 'XPL',
|
|
4854
|
+
decimals: 18
|
|
4855
|
+
},
|
|
4856
|
+
chainId: 9746,
|
|
4857
|
+
isTestnet: true,
|
|
4858
|
+
explorerUrl: 'https://testnet.plasmascan.to/tx/{hash}',
|
|
4859
|
+
rpcEndpoints: [
|
|
4860
|
+
'https://testnet-rpc.plasma.to'
|
|
4861
|
+
],
|
|
4862
|
+
eurcAddress: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330',
|
|
4863
|
+
usdcAddress: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
|
|
4864
|
+
usdtAddress: null,
|
|
4865
|
+
cctp: {
|
|
4866
|
+
domain: 33,
|
|
4867
|
+
contracts: {
|
|
4868
|
+
v2: {
|
|
4869
|
+
type: 'split',
|
|
4870
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4871
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4872
|
+
confirmations: 3,
|
|
4873
|
+
fastConfirmations: 1
|
|
4874
|
+
}
|
|
4875
|
+
},
|
|
4876
|
+
forwarderSupported: {
|
|
4877
|
+
source: false,
|
|
4878
|
+
destination: false
|
|
4879
|
+
}
|
|
4880
|
+
},
|
|
4881
|
+
kitContracts: {
|
|
4882
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
4883
|
+
}
|
|
4884
|
+
});
|
|
4885
|
+
|
|
4768
4886
|
/**
|
|
4769
4887
|
* Plume Mainnet chain definition
|
|
4770
4888
|
* @remarks
|
|
@@ -4796,6 +4914,7 @@ var EarnChain;
|
|
|
4796
4914
|
v2: {
|
|
4797
4915
|
type: 'split',
|
|
4798
4916
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4917
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4799
4918
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4800
4919
|
confirmations: 65,
|
|
4801
4920
|
fastConfirmations: 1
|
|
@@ -4842,6 +4961,7 @@ var EarnChain;
|
|
|
4842
4961
|
v2: {
|
|
4843
4962
|
type: 'split',
|
|
4844
4963
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4964
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4845
4965
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4846
4966
|
confirmations: 65,
|
|
4847
4967
|
fastConfirmations: 1
|
|
@@ -4943,6 +5063,7 @@ var EarnChain;
|
|
|
4943
5063
|
v2: {
|
|
4944
5064
|
type: 'split',
|
|
4945
5065
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5066
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4946
5067
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4947
5068
|
confirmations: 33,
|
|
4948
5069
|
fastConfirmations: 13
|
|
@@ -5008,6 +5129,7 @@ var EarnChain;
|
|
|
5008
5129
|
v2: {
|
|
5009
5130
|
type: 'split',
|
|
5010
5131
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5132
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5011
5133
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5012
5134
|
confirmations: 33,
|
|
5013
5135
|
fastConfirmations: 13
|
|
@@ -5067,6 +5189,7 @@ var EarnChain;
|
|
|
5067
5189
|
v2: {
|
|
5068
5190
|
type: 'split',
|
|
5069
5191
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5192
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5070
5193
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5071
5194
|
confirmations: 1,
|
|
5072
5195
|
fastConfirmations: 1
|
|
@@ -5126,6 +5249,7 @@ var EarnChain;
|
|
|
5126
5249
|
v2: {
|
|
5127
5250
|
type: 'split',
|
|
5128
5251
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5252
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5129
5253
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5130
5254
|
confirmations: 1,
|
|
5131
5255
|
fastConfirmations: 1
|
|
@@ -5183,6 +5307,7 @@ var EarnChain;
|
|
|
5183
5307
|
v2: {
|
|
5184
5308
|
type: 'split',
|
|
5185
5309
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5310
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5186
5311
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5187
5312
|
confirmations: 1,
|
|
5188
5313
|
fastConfirmations: 1
|
|
@@ -5241,6 +5366,7 @@ var EarnChain;
|
|
|
5241
5366
|
v2: {
|
|
5242
5367
|
type: 'split',
|
|
5243
5368
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5369
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5244
5370
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5245
5371
|
confirmations: 1,
|
|
5246
5372
|
fastConfirmations: 1
|
|
@@ -5556,6 +5682,7 @@ var EarnChain;
|
|
|
5556
5682
|
v2: {
|
|
5557
5683
|
type: 'split',
|
|
5558
5684
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5685
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5559
5686
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5560
5687
|
confirmations: 65,
|
|
5561
5688
|
fastConfirmations: 1
|
|
@@ -5620,6 +5747,7 @@ var EarnChain;
|
|
|
5620
5747
|
v2: {
|
|
5621
5748
|
type: 'split',
|
|
5622
5749
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5750
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5623
5751
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5624
5752
|
confirmations: 65,
|
|
5625
5753
|
fastConfirmations: 1
|
|
@@ -5677,6 +5805,7 @@ var EarnChain;
|
|
|
5677
5805
|
v2: {
|
|
5678
5806
|
type: 'split',
|
|
5679
5807
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cF5d',
|
|
5808
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5680
5809
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5681
5810
|
confirmations: 65,
|
|
5682
5811
|
fastConfirmations: 1
|
|
@@ -5736,6 +5865,7 @@ var EarnChain;
|
|
|
5736
5865
|
v2: {
|
|
5737
5866
|
type: 'split',
|
|
5738
5867
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
5868
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5739
5869
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
5740
5870
|
confirmations: 65,
|
|
5741
5871
|
fastConfirmations: 1
|
|
@@ -5796,6 +5926,7 @@ var EarnChain;
|
|
|
5796
5926
|
v2: {
|
|
5797
5927
|
type: 'split',
|
|
5798
5928
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5929
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5799
5930
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5800
5931
|
confirmations: 3,
|
|
5801
5932
|
fastConfirmations: 3
|
|
@@ -5841,6 +5972,7 @@ var EarnChain;
|
|
|
5841
5972
|
v2: {
|
|
5842
5973
|
type: 'split',
|
|
5843
5974
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5975
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5844
5976
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5845
5977
|
confirmations: 3,
|
|
5846
5978
|
fastConfirmations: 1
|
|
@@ -6051,6 +6183,8 @@ var Chains = {
|
|
|
6051
6183
|
OptimismSepolia: OptimismSepolia,
|
|
6052
6184
|
Pharos: Pharos,
|
|
6053
6185
|
PharosTestnet: PharosTestnet,
|
|
6186
|
+
Plasma: Plasma,
|
|
6187
|
+
PlasmaTestnet: PlasmaTestnet,
|
|
6054
6188
|
Plume: Plume,
|
|
6055
6189
|
PlumeTestnet: PlumeTestnet,
|
|
6056
6190
|
PolkadotAssetHub: PolkadotAssetHub,
|
|
@@ -7507,6 +7641,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7507
7641
|
[Blockchain.Noble]: 'uusdc',
|
|
7508
7642
|
[Blockchain.Optimism]: '0x0b2c639c533813f4aa9d7837caf62653d097ff85',
|
|
7509
7643
|
[Blockchain.Pharos]: '0xC879C018dB60520F4355C26eD1a6D572cdAC1815',
|
|
7644
|
+
[Blockchain.Plasma]: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
|
|
7510
7645
|
[Blockchain.Plume]: '0x222365EF19F7947e5484218551B56bb3965Aa7aF',
|
|
7511
7646
|
[Blockchain.Polkadot_Asset_Hub]: '1337',
|
|
7512
7647
|
[Blockchain.Polygon]: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359',
|
|
@@ -7543,6 +7678,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7543
7678
|
[Blockchain.Noble_Testnet]: 'uusdc',
|
|
7544
7679
|
[Blockchain.Optimism_Sepolia]: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',
|
|
7545
7680
|
[Blockchain.Pharos_Testnet]: '0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B',
|
|
7681
|
+
[Blockchain.Plasma_Testnet]: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
|
|
7546
7682
|
[Blockchain.Plume_Testnet]: '0xcB5f30e335672893c7eb944B374c196392C19D18',
|
|
7547
7683
|
[Blockchain.Polkadot_Westmint]: '31337',
|
|
7548
7684
|
[Blockchain.Polygon_Amoy_Testnet]: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
|
|
@@ -7605,6 +7741,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7605
7741
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
7606
7742
|
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
7607
7743
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
7744
|
+
[Blockchain.Plasma]: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
|
|
7608
7745
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
7609
7746
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
7610
7747
|
// =========================================================================
|
|
@@ -7613,7 +7750,8 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
7613
7750
|
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
7614
7751
|
[Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
|
|
7615
7752
|
[Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
7616
|
-
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
|
|
7753
|
+
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4',
|
|
7754
|
+
[Blockchain.Plasma_Testnet]: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330'
|
|
7617
7755
|
}
|
|
7618
7756
|
};
|
|
7619
7757
|
|
|
@@ -8696,7 +8834,7 @@ const swapTokenEnumSchema = zod.z.enum([
|
|
|
8696
8834
|
}
|
|
8697
8835
|
|
|
8698
8836
|
var name$3 = "@circle-fin/bridge-kit";
|
|
8699
|
-
var version$3 = "1.
|
|
8837
|
+
var version$3 = "1.14.0";
|
|
8700
8838
|
var pkg$3 = {
|
|
8701
8839
|
name: name$3,
|
|
8702
8840
|
version: version$3};
|
|
@@ -8971,7 +9109,7 @@ const READ_ACTION_KEY_SET = new Set(READ_ACTION_KEYS);
|
|
|
8971
9109
|
* const result = evmAddressSchema.safeParse(validAddress)
|
|
8972
9110
|
* console.log(result.success) // true
|
|
8973
9111
|
* ```
|
|
8974
|
-
*/ const evmAddressSchema = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
|
|
9112
|
+
*/ 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
9113
|
/**
|
|
8976
9114
|
* Schema for validating transaction hashes.
|
|
8977
9115
|
*
|
|
@@ -9508,6 +9646,10 @@ var TransferSpeed;
|
|
|
9508
9646
|
token: zod.z.literal('USDC').optional(),
|
|
9509
9647
|
config: zod.z.object({
|
|
9510
9648
|
transferSpeed: zod.z.nativeEnum(TransferSpeed).optional(),
|
|
9649
|
+
feePayment: zod.z.enum([
|
|
9650
|
+
'source',
|
|
9651
|
+
'destination'
|
|
9652
|
+
]).optional(),
|
|
9511
9653
|
maxFee: zod.z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
9512
9654
|
allowZero: true,
|
|
9513
9655
|
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
@@ -9515,7 +9657,8 @@ var TransferSpeed;
|
|
|
9515
9657
|
maxDecimals: 6
|
|
9516
9658
|
})(zod.z.string())).optional(),
|
|
9517
9659
|
customFee: customFeeSchema.optional()
|
|
9518
|
-
}).optional()
|
|
9660
|
+
}).optional(),
|
|
9661
|
+
quote: zod.z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex').optional()
|
|
9519
9662
|
});
|
|
9520
9663
|
|
|
9521
9664
|
// ============================================================================
|
|
@@ -9739,13 +9882,182 @@ var TransferSpeed;
|
|
|
9739
9882
|
* @internal
|
|
9740
9883
|
*/ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
|
|
9741
9884
|
|
|
9885
|
+
/** Decimal string in token minor units, constrained to be strictly positive. */ 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
|
|
9886
|
+
// regex check above fails ("dirty"), so guard BigInt() against throwing on a
|
|
9887
|
+
// non-numeric value before comparing.
|
|
9888
|
+
.refine((value)=>/^\d+$/.test(value) && BigInt(value) > 0n, 'must be greater than zero');
|
|
9889
|
+
/**
|
|
9890
|
+
* A 20-byte EVM address in `0x` hex.
|
|
9891
|
+
*
|
|
9892
|
+
* The MVP prepaid-`FORWARD` `burn/usdc` path targets EVM contracts
|
|
9893
|
+
* (`TokenMessengerWithFees` / `GenericExecutor`), so `feeToken` and
|
|
9894
|
+
* `destinationCaller` are constrained to EVM addresses by design. This is an
|
|
9895
|
+
* intentional scope limit, not a permanent one: it can be widened to other
|
|
9896
|
+
* address formats as the fee service expands to more chains.
|
|
9897
|
+
*/ const evmAddressSchema = zod.z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 20-byte 0x address');
|
|
9898
|
+
/** 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');
|
|
9899
|
+
/** Non-empty, even-length `0x` hex. */ const nonEmptyHexSchema = zod.z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex');
|
|
9900
|
+
/** 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');
|
|
9901
|
+
/** Decimal string in minor units, allowing zero. */ const numericStringSchema = zod.z.string().regex(/^\d+$/, 'must be a non-negative integer string');
|
|
9902
|
+
/** An `https:` URL, used for the optional base-URL override. */ const httpsUrlSchema = zod.z.string().refine((value)=>{
|
|
9903
|
+
try {
|
|
9904
|
+
return new URL(value).protocol === 'https:';
|
|
9905
|
+
} catch {
|
|
9906
|
+
return false;
|
|
9907
|
+
}
|
|
9908
|
+
}, 'must be an https URL');
|
|
9909
|
+
const forwardParamsSchema = zod.z.object({
|
|
9910
|
+
hookData: hexSchema.optional(),
|
|
9911
|
+
destinationCaller: evmAddressSchema.optional()
|
|
9912
|
+
}).strict();
|
|
9913
|
+
const forwardRequestSchema = zod.z.object({
|
|
9914
|
+
type: zod.z.literal('FORWARD'),
|
|
9915
|
+
params: forwardParamsSchema.optional()
|
|
9916
|
+
}).strict();
|
|
9917
|
+
const preFinalityRequestSchema = zod.z.object({
|
|
9918
|
+
type: zod.z.literal('PRE_FINALITY')
|
|
9919
|
+
}).strict();
|
|
9920
|
+
/** A single quote request item (`FORWARD` or `PRE_FINALITY`). */ const feeQuoteRequestSchema = zod.z.discriminatedUnion('type', [
|
|
9921
|
+
forwardRequestSchema,
|
|
9922
|
+
preFinalityRequestSchema
|
|
9923
|
+
]);
|
|
9924
|
+
/** A non-empty list of quote request items with unique types. */ 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');
|
|
9925
|
+
/**
|
|
9926
|
+
* A structured `Partial<ApiPollingConfig>` polling override.
|
|
9927
|
+
*
|
|
9928
|
+
* Validates the field types callers actually set, so a plain-JS caller passing
|
|
9929
|
+
* `{ timeout: 'soon' }` is rejected at the boundary rather than failing opaquely
|
|
9930
|
+
* inside the transport. Unknown keys pass through so a future `ApiPollingConfig`
|
|
9931
|
+
* field is forwarded rather than silently dropped.
|
|
9932
|
+
*/ const apiPollingConfigSchema = zod.z.object({
|
|
9933
|
+
timeout: zod.z.number().int().positive().optional(),
|
|
9934
|
+
maxRetries: zod.z.number().int().nonnegative().optional(),
|
|
9935
|
+
retryDelay: zod.z.number().int().nonnegative().optional(),
|
|
9936
|
+
backoff: zod.z.enum([
|
|
9937
|
+
'fixed',
|
|
9938
|
+
'exponential'
|
|
9939
|
+
]).optional(),
|
|
9940
|
+
maxRetryDelayMs: zod.z.number().int().positive().optional(),
|
|
9941
|
+
headers: zod.z.record(zod.z.string()).optional()
|
|
9942
|
+
}).passthrough();
|
|
9943
|
+
/**
|
|
9944
|
+
* The validatable input for {@link fetchFeeQuote}.
|
|
9945
|
+
*
|
|
9946
|
+
* This is the single source of truth for input validation, including the CCTP
|
|
9947
|
+
* domains and the `isTestnet` environment flag. Validating `isTestnet` at
|
|
9948
|
+
* runtime matters because a plain-JS caller who omits it would otherwise leave
|
|
9949
|
+
* it `undefined`, which is falsy and silently selects the production base URL.
|
|
9950
|
+
* (`buildFeeQuoteUrl` independently re-validates the domains for standalone
|
|
9951
|
+
* callers.)
|
|
9952
|
+
*/ zod.z.object({
|
|
9953
|
+
sourceDomain: zod.z.number().int().nonnegative(),
|
|
9954
|
+
destinationDomain: zod.z.number().int().nonnegative(),
|
|
9955
|
+
amount: positiveAmountSchema,
|
|
9956
|
+
feeToken: evmAddressSchema.optional(),
|
|
9957
|
+
requests: feeQuoteRequestsSchema,
|
|
9958
|
+
isTestnet: zod.z.boolean(),
|
|
9959
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
9960
|
+
config: apiPollingConfigSchema.optional()
|
|
9961
|
+
}).strict();
|
|
9962
|
+
const feeQuoteItemSchema = zod.z.object({
|
|
9963
|
+
type: zod.z.string().min(1),
|
|
9964
|
+
amount: numericStringSchema,
|
|
9965
|
+
args: zod.z.array(zod.z.string()),
|
|
9966
|
+
argsHash: bytes32Schema
|
|
9967
|
+
}).passthrough();
|
|
9968
|
+
const exchangeRatesSchema = zod.z.object({
|
|
9969
|
+
feeTokenUsd: zod.z.string(),
|
|
9970
|
+
destinationTokenUsd: zod.z.string()
|
|
9971
|
+
}).passthrough();
|
|
9972
|
+
const metadataSchema = zod.z.object({
|
|
9973
|
+
destinationGasPrice: zod.z.string().optional(),
|
|
9974
|
+
exchangeRates: exchangeRatesSchema.optional()
|
|
9975
|
+
}).passthrough();
|
|
9976
|
+
/** The `expiry` object the Quote API nests the quote TTL under. */ const expirySchema = zod.z.discriminatedUnion('mode', [
|
|
9977
|
+
zod.z.object({
|
|
9978
|
+
mode: zod.z.literal('TIMESTAMP'),
|
|
9979
|
+
expiresAt: zod.z.number().int().nonnegative()
|
|
9980
|
+
}).passthrough(),
|
|
9981
|
+
zod.z.object({
|
|
9982
|
+
mode: zod.z.literal('BLOCK_NUMBER'),
|
|
9983
|
+
expiresAtBlock: zod.z.number().int().nonnegative(),
|
|
9984
|
+
blockEstimatedAt: zod.z.number().int().nonnegative().optional()
|
|
9985
|
+
}).passthrough()
|
|
9986
|
+
]);
|
|
9987
|
+
/** Schema for a signed fee quote returned by the Quote API. */ zod.z.object({
|
|
9988
|
+
// The runtime YAML spec maps signedQuote to a looser `hex` (which allows
|
|
9989
|
+
// an empty `0x`); we keep the stricter non-empty form. Do not relax
|
|
9990
|
+
// without a reason.
|
|
9991
|
+
signedQuote: nonEmptyHexSchema,
|
|
9992
|
+
issuedAt: zod.z.number().int().nonnegative(),
|
|
9993
|
+
// The API returns a mode-specific timestamp or source-block deadline.
|
|
9994
|
+
expiry: expirySchema,
|
|
9995
|
+
feeTotalAmount: numericStringSchema,
|
|
9996
|
+
feeToken: evmAddressSchema,
|
|
9997
|
+
nonce: numericStringSchema,
|
|
9998
|
+
items: zod.z.array(feeQuoteItemSchema),
|
|
9999
|
+
metadata: metadataSchema.optional()
|
|
10000
|
+
}).passthrough();
|
|
10001
|
+
/** Validate input to {@link validateQuote}. */ zod.z.object({
|
|
10002
|
+
sourceDomain: zod.z.number().int().nonnegative(),
|
|
10003
|
+
abiSignature: zod.z.string().min(1),
|
|
10004
|
+
args: zod.z.array(zod.z.union([
|
|
10005
|
+
zod.z.string(),
|
|
10006
|
+
zod.z.array(zod.z.string())
|
|
10007
|
+
])),
|
|
10008
|
+
isTestnet: zod.z.boolean(),
|
|
10009
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
10010
|
+
config: apiPollingConfigSchema.optional()
|
|
10011
|
+
}).strict();
|
|
10012
|
+
const quoteExpiryStatusSchema = zod.z.discriminatedUnion('mode', [
|
|
10013
|
+
zod.z.object({
|
|
10014
|
+
mode: zod.z.literal('TIMESTAMP'),
|
|
10015
|
+
expired: zod.z.boolean(),
|
|
10016
|
+
secondsRemaining: zod.z.number().int().nonnegative(),
|
|
10017
|
+
expiresAt: zod.z.number().int().nonnegative()
|
|
10018
|
+
}).passthrough(),
|
|
10019
|
+
zod.z.object({
|
|
10020
|
+
mode: zod.z.literal('BLOCK_NUMBER'),
|
|
10021
|
+
expired: zod.z.boolean(),
|
|
10022
|
+
secondsRemaining: zod.z.number().int().nonnegative(),
|
|
10023
|
+
expiresAtBlock: zod.z.number().int().nonnegative(),
|
|
10024
|
+
blockEstimatedAt: zod.z.number().int().nonnegative().optional()
|
|
10025
|
+
}).passthrough()
|
|
10026
|
+
]);
|
|
10027
|
+
const validateQuoteItemSchema = zod.z.object({
|
|
10028
|
+
type: zod.z.string().min(1),
|
|
10029
|
+
argsMatch: zod.z.boolean(),
|
|
10030
|
+
amount: numericStringSchema.optional(),
|
|
10031
|
+
args: zod.z.array(zod.z.string()).optional(),
|
|
10032
|
+
argsHash: bytes32Schema.optional(),
|
|
10033
|
+
computedArgsHash: bytes32Schema.optional()
|
|
10034
|
+
}).passthrough();
|
|
10035
|
+
/**
|
|
10036
|
+
* Schema for a response from the Quote API validation endpoint.
|
|
10037
|
+
*
|
|
10038
|
+
* The endpoint takes the source domain as a URL path parameter and does not
|
|
10039
|
+
* return it in the response body, so `sourceDomain` is intentionally not part
|
|
10040
|
+
* of this schema.
|
|
10041
|
+
*/ zod.z.object({
|
|
10042
|
+
signedQuote: nonEmptyHexSchema,
|
|
10043
|
+
expiry: quoteExpiryStatusSchema,
|
|
10044
|
+
feeTotalAmount: numericStringSchema,
|
|
10045
|
+
feeToken: evmAddressSchema,
|
|
10046
|
+
nonce: numericStringSchema,
|
|
10047
|
+
claimable: zod.z.boolean(),
|
|
10048
|
+
// Preserve newly introduced server-side reasons as opaque strings rather
|
|
10049
|
+
// than rejecting the entire safety response before the SDK is updated.
|
|
10050
|
+
failedChecks: zod.z.array(zod.z.string().min(1)),
|
|
10051
|
+
items: zod.z.array(validateQuoteItemSchema)
|
|
10052
|
+
}).passthrough();
|
|
10053
|
+
|
|
9742
10054
|
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$3.name);
|
|
9743
10055
|
|
|
9744
10056
|
// Auto-register this kit for user agent tracking
|
|
9745
10057
|
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
9746
10058
|
|
|
9747
10059
|
var name$2 = "@circle-fin/swap-kit";
|
|
9748
|
-
var version$2 = "1.
|
|
10060
|
+
var version$2 = "1.6.0";
|
|
9749
10061
|
var pkg$2 = {
|
|
9750
10062
|
name: name$2,
|
|
9751
10063
|
version: version$2};
|
|
@@ -9759,7 +10071,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9759
10071
|
* Catches obviously malformed addresses at parse time; chain-specific validation
|
|
9760
10072
|
* is performed in buildServiceParams.
|
|
9761
10073
|
*/ const destinationAddressSchema = zod.z.union([
|
|
9762
|
-
evmAddressSchema,
|
|
10074
|
+
evmAddressSchema$1,
|
|
9763
10075
|
solanaAddressSchema
|
|
9764
10076
|
]);
|
|
9765
10077
|
/**
|
|
@@ -9805,9 +10117,16 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9805
10117
|
message: 'stopLimit must be greater than 0'
|
|
9806
10118
|
}).optional(),
|
|
9807
10119
|
customFee: serviceSwapCustomFeeSchema.optional(),
|
|
10120
|
+
apiKey: zod.z.string({
|
|
10121
|
+
invalid_type_error: 'apiKey must be a string'
|
|
10122
|
+
})// Tolerate '' so the `process.env.CIRCLE_API_KEY ?? ''` idiom falls back to
|
|
10123
|
+
// kitKey via resolveApiKey instead of being rejected here.
|
|
10124
|
+
.optional(),
|
|
9808
10125
|
kitKey: zod.z.string({
|
|
9809
10126
|
invalid_type_error: 'kitKey must be a string'
|
|
9810
|
-
})
|
|
10127
|
+
})// Tolerate '' so an unset kit-key env var yields the permissionless path,
|
|
10128
|
+
// matching buildServiceParams (which already omits an empty credential).
|
|
10129
|
+
.optional(),
|
|
9811
10130
|
provider: zod.z.string({
|
|
9812
10131
|
invalid_type_error: 'provider must be a string'
|
|
9813
10132
|
}).min(1, 'provider must be a non-empty string').optional(),
|
|
@@ -9980,6 +10299,41 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9980
10299
|
*
|
|
9981
10300
|
* @internal
|
|
9982
10301
|
*/ const MAX_RATE_ADDRESSES_PER_REQUEST = 100;
|
|
10302
|
+
/**
|
|
10303
|
+
* Environment prefixes carried by Circle platform API keys.
|
|
10304
|
+
*
|
|
10305
|
+
* A Circle API key is `<ENV>_API_KEY:<keyId>:<keySecret>`, where `<ENV>` is one
|
|
10306
|
+
* of these prefixes.
|
|
10307
|
+
*
|
|
10308
|
+
* @internal
|
|
10309
|
+
*/ const API_KEY_ENV_PREFIXES = [
|
|
10310
|
+
'TEST',
|
|
10311
|
+
'LIVE',
|
|
10312
|
+
'SAND',
|
|
10313
|
+
'SANDBOX',
|
|
10314
|
+
'SMOK',
|
|
10315
|
+
'PROD',
|
|
10316
|
+
'STAG',
|
|
10317
|
+
'DEV'
|
|
10318
|
+
];
|
|
10319
|
+
/**
|
|
10320
|
+
* Accepted credential formats for Stablecoin Service authentication.
|
|
10321
|
+
*
|
|
10322
|
+
* Matches a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
|
|
10323
|
+
* the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`). API keys are the
|
|
10324
|
+
* recommended credential; kit keys remain accepted as the legacy path.
|
|
10325
|
+
*
|
|
10326
|
+
* @remarks
|
|
10327
|
+
* This is a local pre-flight check, not the authority — the Stablecoin Service
|
|
10328
|
+
* validates the credential and answers 401 when it rejects one. The prefix list
|
|
10329
|
+
* is therefore deliberately permissive: a valid key carrying a prefix this SDK
|
|
10330
|
+
* has not been taught about should reach the service and be judged there rather
|
|
10331
|
+
* than be refused locally, since refusing locally is indistinguishable from an
|
|
10332
|
+
* outage to the caller. Kept as the single source of truth so the pattern is
|
|
10333
|
+
* not restated per call site.
|
|
10334
|
+
*
|
|
10335
|
+
* @internal
|
|
10336
|
+
*/ const API_KEY_PATTERN = new RegExp(`^(?:KIT_KEY|(?:${API_KEY_ENV_PREFIXES.join('|')})_API_KEY)` + ':[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$');
|
|
9983
10337
|
|
|
9984
10338
|
/**
|
|
9985
10339
|
* Zod schema for validating stop limits.
|
|
@@ -10048,13 +10402,14 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
10048
10402
|
/**
|
|
10049
10403
|
* Zod schema for validating API keys.
|
|
10050
10404
|
*
|
|
10051
|
-
*
|
|
10405
|
+
* Accepts a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
|
|
10406
|
+
* the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`).
|
|
10052
10407
|
*
|
|
10053
10408
|
* @example
|
|
10054
10409
|
* ```typescript
|
|
10055
10410
|
* import { apiKeySchema } from '@core/service-client'
|
|
10056
10411
|
*
|
|
10057
|
-
* const result = apiKeySchema.safeParse('
|
|
10412
|
+
* const result = apiKeySchema.safeParse('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
|
|
10058
10413
|
* if (!result.success) {
|
|
10059
10414
|
* console.error('Invalid API key format:', result.error.issues)
|
|
10060
10415
|
* }
|
|
@@ -10062,7 +10417,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
10062
10417
|
*/ const apiKeySchema = zod.z.string({
|
|
10063
10418
|
required_error: 'API key is required',
|
|
10064
10419
|
invalid_type_error: 'Invalid API key format'
|
|
10065
|
-
}).regex(
|
|
10420
|
+
}).regex(API_KEY_PATTERN, 'Invalid API key format');
|
|
10066
10421
|
/**
|
|
10067
10422
|
* Zod schema for platform fees configuration.
|
|
10068
10423
|
*
|
|
@@ -10505,8 +10860,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10505
10860
|
* Validates that an API key is properly formatted for Circle Stablecoin Service.
|
|
10506
10861
|
*
|
|
10507
10862
|
* 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
|
|
10863
|
+
* expected format before making API requests. The key must follow the structure
|
|
10864
|
+
* `<ENV>_API_KEY:keyId:keySecret`, or the legacy `KIT_KEY:keyId:keySecret`.
|
|
10510
10865
|
*
|
|
10511
10866
|
* @param apiKey - The API key to validate (can be any type for graceful handling).
|
|
10512
10867
|
* @returns True if the API key is valid, false otherwise.
|
|
@@ -10514,7 +10869,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10514
10869
|
* @remarks
|
|
10515
10870
|
* This function handles invalid inputs gracefully by returning false rather than
|
|
10516
10871
|
* throwing errors. It validates:
|
|
10517
|
-
* - The key
|
|
10872
|
+
* - The key carries a recognized prefix — `<ENV>_API_KEY:` for a Circle platform
|
|
10873
|
+
* API key, or `KIT_KEY:` for the legacy kit key
|
|
10518
10874
|
* - Contains exactly three colon-separated parts
|
|
10519
10875
|
* - keyId and keySecret contain only valid characters (alphanumeric, `-`, `_`, `.`)
|
|
10520
10876
|
* - keyId and keySecret are non-empty
|
|
@@ -10522,23 +10878,62 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10522
10878
|
*
|
|
10523
10879
|
* Valid characters in keyId and keySecret: `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
|
|
10524
10880
|
*
|
|
10881
|
+
* Format is checked locally only so an obviously malformed credential fails
|
|
10882
|
+
* before a request is made. The Stablecoin Service remains the authority on
|
|
10883
|
+
* whether a well-formed key is actually accepted.
|
|
10884
|
+
*
|
|
10525
10885
|
* @example
|
|
10526
10886
|
* ```typescript
|
|
10527
10887
|
* import { isValidApiKey } from '@core/service-client'
|
|
10528
10888
|
*
|
|
10529
10889
|
* // Valid API key
|
|
10530
|
-
* const isValid = isValidApiKey('
|
|
10890
|
+
* const isValid = isValidApiKey('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
|
|
10531
10891
|
* console.log(isValid) // true
|
|
10532
10892
|
*
|
|
10893
|
+
* // Legacy kit keys remain valid
|
|
10894
|
+
* console.log(isValidApiKey('KIT_KEY:my-key-id:my-key-secret')) // true
|
|
10895
|
+
*
|
|
10533
10896
|
* ```
|
|
10534
10897
|
*/ const isValidApiKey = (apiKey)=>{
|
|
10535
10898
|
// Handle invalid input types
|
|
10536
10899
|
if (typeof apiKey !== 'string') {
|
|
10537
10900
|
return false;
|
|
10538
10901
|
}
|
|
10539
|
-
const apiKeyPattern = /^KIT_KEY:[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$/;
|
|
10540
10902
|
// Validate without trimming - any whitespace will cause validation to fail
|
|
10541
|
-
return
|
|
10903
|
+
return API_KEY_PATTERN.test(apiKey);
|
|
10904
|
+
};
|
|
10905
|
+
/**
|
|
10906
|
+
* Resolve the credential to authenticate a Stablecoin Service request with.
|
|
10907
|
+
*
|
|
10908
|
+
* `apiKey` is the supported field; `kitKey` is the deprecated alias kept for
|
|
10909
|
+
* existing integrations. When both are supplied `apiKey` wins, so a caller
|
|
10910
|
+
* migrating field-by-field cannot be silently pinned to a stale credential.
|
|
10911
|
+
*
|
|
10912
|
+
* An empty-string value is treated as absent on either field. Without this, the
|
|
10913
|
+
* common `process.env.CIRCLE_API_KEY ?? ''` idiom (which yields `''` when the
|
|
10914
|
+
* variable is unset) would either shadow a working `kitKey` or, on a bare
|
|
10915
|
+
* `kitKey: ''`, reach downstream validation as an invalid credential instead of
|
|
10916
|
+
* falling through to the permissionless path.
|
|
10917
|
+
*
|
|
10918
|
+
* @param source - Object carrying either credential field, or neither.
|
|
10919
|
+
* @returns The credential to use, or `undefined` for the permissionless
|
|
10920
|
+
* (keyless) path.
|
|
10921
|
+
*
|
|
10922
|
+
* @example
|
|
10923
|
+
* ```typescript
|
|
10924
|
+
* import { resolveApiKey } from '@core/service-client'
|
|
10925
|
+
*
|
|
10926
|
+
* resolveApiKey({ apiKey: 'TEST_API_KEY:id:secret' }) // 'TEST_API_KEY:id:secret'
|
|
10927
|
+
* resolveApiKey({ kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
|
|
10928
|
+
* resolveApiKey({ apiKey: '', kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
|
|
10929
|
+
* resolveApiKey({ kitKey: '' }) // undefined
|
|
10930
|
+
* resolveApiKey({}) // undefined
|
|
10931
|
+
* ```
|
|
10932
|
+
*/ const resolveApiKey = (source)=>{
|
|
10933
|
+
// Treat an empty-string value as absent on either field so the
|
|
10934
|
+
// `env ?? ''` idiom falls through to the next credential (or permissionless).
|
|
10935
|
+
const normalize = (value)=>value !== undefined && value !== '' ? value : undefined;
|
|
10936
|
+
return normalize(source.apiKey) ?? normalize(source.kitKey);
|
|
10542
10937
|
};
|
|
10543
10938
|
|
|
10544
10939
|
/**
|
|
@@ -11275,7 +11670,7 @@ const abiParameterSchema = zod.z.object({
|
|
|
11275
11670
|
*/ zod.z.object({
|
|
11276
11671
|
type: zod.z.literal('evm'),
|
|
11277
11672
|
abi: abiSchema,
|
|
11278
|
-
address: evmAddressSchema,
|
|
11673
|
+
address: evmAddressSchema$1,
|
|
11279
11674
|
functionName: zod.z.string({
|
|
11280
11675
|
required_error: 'Function name is required',
|
|
11281
11676
|
invalid_type_error: 'Function name must be a string'
|
|
@@ -11312,7 +11707,7 @@ const abiParameterSchema = zod.z.object({
|
|
|
11312
11707
|
* }
|
|
11313
11708
|
* ```
|
|
11314
11709
|
*/ zod.z.object({
|
|
11315
|
-
address: evmAddressSchema,
|
|
11710
|
+
address: evmAddressSchema$1,
|
|
11316
11711
|
value: zod.z.bigint({
|
|
11317
11712
|
required_error: 'Value is required for native transfers',
|
|
11318
11713
|
invalid_type_error: 'Value must be a bigint'
|
|
@@ -11480,7 +11875,7 @@ zod.z.object({
|
|
|
11480
11875
|
signature: evmSignatureSchema,
|
|
11481
11876
|
tokenInputs: zod.z.array(zod.z.object({
|
|
11482
11877
|
permitType: zod.z.nativeEnum(PermitType),
|
|
11483
|
-
token: evmAddressSchema,
|
|
11878
|
+
token: evmAddressSchema$1,
|
|
11484
11879
|
amount: zod.z.bigint().refine((value)=>value >= 0n, {
|
|
11485
11880
|
message: 'amount must be a non-negative bigint'
|
|
11486
11881
|
}),
|
|
@@ -11900,7 +12295,7 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11900
12295
|
/**
|
|
11901
12296
|
* Fee recipient address (required).
|
|
11902
12297
|
* Must be a valid EVM address or Solana address.
|
|
11903
|
-
*/ recipientAddress: zod.z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
12298
|
+
*/ recipientAddress: zod.z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
11904
12299
|
message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
|
|
11905
12300
|
})
|
|
11906
12301
|
}).strict();
|
|
@@ -11912,7 +12307,8 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11912
12307
|
* - slippageBps: Optional positive number for slippage tolerance
|
|
11913
12308
|
* - stopLimit: Optional decimal string for minimum output
|
|
11914
12309
|
* - customFee: Optional fee configuration
|
|
11915
|
-
* -
|
|
12310
|
+
* - apiKey: Optional credential string
|
|
12311
|
+
* - kitKey: Optional credential string (deprecated alias for apiKey)
|
|
11916
12312
|
*/ const swapConfigSchema = zod.z.object({
|
|
11917
12313
|
allowanceStrategy: allowanceStrategySchema.optional(),
|
|
11918
12314
|
slippageBps: zod.z.number().int().min(0).optional(),
|
|
@@ -11922,11 +12318,12 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11922
12318
|
attributeName: 'stopLimit'
|
|
11923
12319
|
})(zod.z.string())).optional(),
|
|
11924
12320
|
customFee: swapCustomFeeSchema.optional(),
|
|
12321
|
+
apiKey: zod.z.string().optional(),
|
|
11925
12322
|
kitKey: zod.z.string().optional()
|
|
11926
12323
|
});
|
|
11927
12324
|
const swapDestinationSchema = zod.z.object({
|
|
11928
12325
|
chain: optionalSwapChainIdentifierField,
|
|
11929
|
-
recipientAddress: zod.z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
12326
|
+
recipientAddress: zod.z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
11930
12327
|
message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
|
|
11931
12328
|
}).optional()
|
|
11932
12329
|
}).strict();
|
|
@@ -13359,7 +13756,7 @@ new Set(Object.values(Blockchain));
|
|
|
13359
13756
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
13360
13757
|
|
|
13361
13758
|
var name$1 = "@circle-fin/earn-kit";
|
|
13362
|
-
var version$1 = "1.
|
|
13759
|
+
var version$1 = "1.6.0";
|
|
13363
13760
|
var pkg$1 = {
|
|
13364
13761
|
name: name$1,
|
|
13365
13762
|
version: version$1};
|
|
@@ -13575,7 +13972,7 @@ function toSdkChain(chain) {
|
|
|
13575
13972
|
*
|
|
13576
13973
|
* @internal
|
|
13577
13974
|
*/ function assertHexAddress(field, value, message = `${field} must be a 0x-prefixed 20-byte hex address`) {
|
|
13578
|
-
const result = evmAddressSchema.safeParse(value);
|
|
13975
|
+
const result = evmAddressSchema$1.safeParse(value);
|
|
13579
13976
|
if (!result.success) {
|
|
13580
13977
|
throw createValidationFailedError(field, value, message);
|
|
13581
13978
|
}
|
|
@@ -15223,7 +15620,7 @@ const EARN_OPERATIONS = new Set([
|
|
|
15223
15620
|
// Store the original service params non-enumerably. `retry()` reads them by
|
|
15224
15621
|
// direct property access (`trace.params`), but JSON.stringify, console.log,
|
|
15225
15622
|
// and telemetry serializers skip non-enumerable properties — so a
|
|
15226
|
-
// permissioned call's `config.
|
|
15623
|
+
// permissioned call's `config.apiKey` (a credential value) and
|
|
15227
15624
|
// the in-memory adapter never leak through a logged error. defineProperty
|
|
15228
15625
|
// also redefines any enumerable `params` an upstream trace may have carried.
|
|
15229
15626
|
Object.defineProperty(trace, 'params', {
|
|
@@ -15294,7 +15691,7 @@ function isNonNegativeBigIntLike(value) {
|
|
|
15294
15691
|
}
|
|
15295
15692
|
}
|
|
15296
15693
|
const hexSignatureSchema = evmSignatureSchema;
|
|
15297
|
-
const hexAddressSchema = evmAddressSchema;
|
|
15694
|
+
const hexAddressSchema = evmAddressSchema$1;
|
|
15298
15695
|
// '0x' prefix + 32 bytes * 2 hex chars.
|
|
15299
15696
|
const BYTES32_HEX_LENGTH = 66;
|
|
15300
15697
|
const bridgeFeeTokenSchema = hexAddressSchema;
|
|
@@ -16263,7 +16660,7 @@ const bridgeDepositPrepareReviewSchema = zod.z.object({
|
|
|
16263
16660
|
}
|
|
16264
16661
|
|
|
16265
16662
|
var name = "@circle-fin/provider-earn-service";
|
|
16266
|
-
var version = "1.
|
|
16663
|
+
var version = "1.5.0";
|
|
16267
16664
|
var pkg = {
|
|
16268
16665
|
name: name,
|
|
16269
16666
|
version: version};
|
|
@@ -16325,10 +16722,12 @@ var pkg = {
|
|
|
16325
16722
|
*
|
|
16326
16723
|
* @internal
|
|
16327
16724
|
*/ function buildConfig(serviceConfig) {
|
|
16328
|
-
|
|
16329
|
-
//
|
|
16330
|
-
|
|
16331
|
-
|
|
16725
|
+
const apiKey = resolveApiKey(serviceConfig ?? {});
|
|
16726
|
+
// The credential is a server-only secret. Reject it in the browser so it
|
|
16727
|
+
// cannot leak into a client bundle (no-op in Node.js). Keyless usage stays
|
|
16728
|
+
// allowed.
|
|
16729
|
+
if (apiKey !== undefined && isBrowserEnvironment()) {
|
|
16730
|
+
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
16731
|
}
|
|
16333
16732
|
const baseUrl = serviceConfig?.baseUrl ?? EARN_SERVICE_BASE_URL;
|
|
16334
16733
|
// The API CORS policy does not allow this custom header. Keep the existing
|
|
@@ -16337,7 +16736,7 @@ var pkg = {
|
|
|
16337
16736
|
const sdkVersionHeader = isNodeEnvironment() ? {
|
|
16338
16737
|
[SDK_VERSION_HEADER]: resolveSdkVersionHeader()
|
|
16339
16738
|
} : {};
|
|
16340
|
-
if (
|
|
16739
|
+
if (apiKey === undefined) {
|
|
16341
16740
|
return {
|
|
16342
16741
|
pollingConfig: {
|
|
16343
16742
|
...DEFAULT_CONFIG,
|
|
@@ -16349,11 +16748,11 @@ var pkg = {
|
|
|
16349
16748
|
baseUrl
|
|
16350
16749
|
};
|
|
16351
16750
|
}
|
|
16352
|
-
if (!isValidApiKey(
|
|
16751
|
+
if (!isValidApiKey(apiKey)) {
|
|
16353
16752
|
throw new KitError({
|
|
16354
16753
|
...InputError.VALIDATION_FAILED,
|
|
16355
16754
|
recoverability: 'FATAL',
|
|
16356
|
-
message: 'Invalid
|
|
16755
|
+
message: 'Invalid apiKey format. Expected <ENV>_API_KEY:<keyId>:<keySecret> (for example TEST_API_KEY:...), or a legacy KIT_KEY:<keyId>:<keySecret>.'
|
|
16357
16756
|
});
|
|
16358
16757
|
}
|
|
16359
16758
|
return {
|
|
@@ -16362,7 +16761,7 @@ var pkg = {
|
|
|
16362
16761
|
headers: {
|
|
16363
16762
|
...DEFAULT_CONFIG.headers,
|
|
16364
16763
|
...sdkVersionHeader,
|
|
16365
|
-
Authorization: `Bearer ${
|
|
16764
|
+
Authorization: `Bearer ${apiKey}`
|
|
16366
16765
|
}
|
|
16367
16766
|
},
|
|
16368
16767
|
baseUrl
|
|
@@ -17669,9 +18068,9 @@ function finishElapsedWait(lastStatus, lastError) {
|
|
|
17669
18068
|
* // Permissionless mode
|
|
17670
18069
|
* const provider = new EarnServiceProvider()
|
|
17671
18070
|
*
|
|
17672
|
-
* // Permissioned mode with
|
|
18071
|
+
* // Permissioned mode with an API key
|
|
17673
18072
|
* const provider = new EarnServiceProvider({
|
|
17674
|
-
*
|
|
18073
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
17675
18074
|
* })
|
|
17676
18075
|
*
|
|
17677
18076
|
* // Custom base URL for testing
|
|
@@ -18898,7 +19297,7 @@ function findProvider(context, chain, operation = 'earn') {
|
|
|
18898
19297
|
* fast instead of round-tripping to the service.
|
|
18899
19298
|
*
|
|
18900
19299
|
* @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');
|
|
19300
|
+
*/ 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
19301
|
/**
|
|
18903
19302
|
* Schema for the adapter context within earn operations.
|
|
18904
19303
|
*
|
|
@@ -18930,19 +19329,39 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
18930
19329
|
/**
|
|
18931
19330
|
* Schema for the EarnConfig options.
|
|
18932
19331
|
*
|
|
18933
|
-
* Validate the
|
|
18934
|
-
*
|
|
18935
|
-
*
|
|
18936
|
-
*
|
|
18937
|
-
*
|
|
18938
|
-
*
|
|
19332
|
+
* Validate the *resolved* credential using the standard `apiKeySchema` format
|
|
19333
|
+
* (`<ENV>_API_KEY:<keyId>:<keySecret>`, or a legacy
|
|
19334
|
+
* `KIT_KEY:<keyId>:<keySecret>`). `apiKey` takes precedence over the deprecated
|
|
19335
|
+
* `kitKey`, so a malformed `kitKey` that is being ignored must not fail a config
|
|
19336
|
+
* that supplies a valid `apiKey` (and vice versa) — only the credential that
|
|
19337
|
+
* would actually be sent is format-checked. When neither is supplied the SDK
|
|
19338
|
+
* operates in permissionless mode. `baseUrl` overrides the Earn Service endpoint
|
|
19339
|
+
* (e.g. staging); `batchTransactions: false` opts out of atomic batched
|
|
19340
|
+
* execution. All are forwarded to the provider, so this `.strict()` schema must
|
|
19341
|
+
* accept them or a valid config object is rejected.
|
|
18939
19342
|
*
|
|
18940
19343
|
* @internal
|
|
18941
19344
|
*/ const earnConfigSchema = zod.z.object({
|
|
18942
|
-
|
|
19345
|
+
apiKey: zod.z.string().optional(),
|
|
19346
|
+
kitKey: zod.z.string().optional(),
|
|
18943
19347
|
baseUrl: zod.z.string().optional(),
|
|
18944
19348
|
batchTransactions: zod.z.boolean().optional()
|
|
18945
|
-
}).strict()
|
|
19349
|
+
}).strict().superRefine((config, ctx)=>{
|
|
19350
|
+
const credential = resolveApiKey(config);
|
|
19351
|
+
if (credential === undefined) {
|
|
19352
|
+
return;
|
|
19353
|
+
}
|
|
19354
|
+
const result = apiKeySchema.safeParse(credential);
|
|
19355
|
+
if (!result.success) {
|
|
19356
|
+
ctx.addIssue({
|
|
19357
|
+
code: zod.z.ZodIssueCode.custom,
|
|
19358
|
+
path: [
|
|
19359
|
+
credential === config.apiKey ? 'apiKey' : 'kitKey'
|
|
19360
|
+
],
|
|
19361
|
+
message: result.error.issues[0]?.message ?? 'Invalid API key format'
|
|
19362
|
+
});
|
|
19363
|
+
}
|
|
19364
|
+
});
|
|
18946
19365
|
/**
|
|
18947
19366
|
* Canonical decimal form: a leading digit with no leading zeros (a single
|
|
18948
19367
|
* '0' is only allowed immediately before the decimal point). Rejects the
|
|
@@ -19014,7 +19433,7 @@ const sourceAdapterContextSchema = zod.z.object({
|
|
|
19014
19433
|
* currently supports EVM vault addresses on Arc Testnet.
|
|
19015
19434
|
*
|
|
19016
19435
|
* @internal
|
|
19017
|
-
*/ const vaultAddressSchema = evmAddressSchema.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19436
|
+
*/ const vaultAddressSchema = evmAddressSchema$1.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19018
19437
|
/**
|
|
19019
19438
|
* Validation schema for VaultQuery.
|
|
19020
19439
|
*
|
|
@@ -19289,7 +19708,7 @@ const sameChainGetDepositQuoteParamsSchema = zod.z.object({
|
|
|
19289
19708
|
const crossChainGetDepositQuoteParamsSchema = zod.z.object({
|
|
19290
19709
|
from: sourceAdapterContextSchema,
|
|
19291
19710
|
chain: earnBridgeDestinationChainIdentifierSchema,
|
|
19292
|
-
address: evmAddressSchema,
|
|
19711
|
+
address: evmAddressSchema$1,
|
|
19293
19712
|
vaultAddress: vaultAddressSchema,
|
|
19294
19713
|
amount: amountSchema,
|
|
19295
19714
|
transferSpeed: zod.z.enum([
|