@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.mjs
CHANGED
|
@@ -2347,6 +2347,8 @@ function getOptionalString(value) {
|
|
|
2347
2347
|
Blockchain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
2348
2348
|
Blockchain["Pharos"] = "Pharos";
|
|
2349
2349
|
Blockchain["Pharos_Testnet"] = "Pharos_Testnet";
|
|
2350
|
+
Blockchain["Plasma"] = "Plasma";
|
|
2351
|
+
Blockchain["Plasma_Testnet"] = "Plasma_Testnet";
|
|
2350
2352
|
Blockchain["Polkadot_Asset_Hub"] = "Polkadot_Asset_Hub";
|
|
2351
2353
|
Blockchain["Polkadot_Westmint"] = "Polkadot_Westmint";
|
|
2352
2354
|
Blockchain["Plume"] = "Plume";
|
|
@@ -2416,6 +2418,7 @@ var BridgeChain;
|
|
|
2416
2418
|
BridgeChain["Morph"] = "Morph";
|
|
2417
2419
|
BridgeChain["Optimism"] = "Optimism";
|
|
2418
2420
|
BridgeChain["Pharos"] = "Pharos";
|
|
2421
|
+
BridgeChain["Plasma"] = "Plasma";
|
|
2419
2422
|
BridgeChain["Plume"] = "Plume";
|
|
2420
2423
|
BridgeChain["Polygon"] = "Polygon";
|
|
2421
2424
|
BridgeChain["Sei"] = "Sei";
|
|
@@ -2442,6 +2445,7 @@ var BridgeChain;
|
|
|
2442
2445
|
BridgeChain["Morph_Testnet"] = "Morph_Testnet";
|
|
2443
2446
|
BridgeChain["Optimism_Sepolia"] = "Optimism_Sepolia";
|
|
2444
2447
|
BridgeChain["Pharos_Testnet"] = "Pharos_Testnet";
|
|
2448
|
+
BridgeChain["Plasma_Testnet"] = "Plasma_Testnet";
|
|
2445
2449
|
BridgeChain["Plume_Testnet"] = "Plume_Testnet";
|
|
2446
2450
|
BridgeChain["Polygon_Amoy_Testnet"] = "Polygon_Amoy_Testnet";
|
|
2447
2451
|
BridgeChain["Sei_Testnet"] = "Sei_Testnet";
|
|
@@ -2888,6 +2892,8 @@ var EarnChain;
|
|
|
2888
2892
|
* This program handles minting operations for Gateway transactions
|
|
2889
2893
|
* on Solana devnet.
|
|
2890
2894
|
*/ const GATEWAY_MINTER_SOLANA_DEVNET = 'GATEmKK2ECL1brEngQZWCgMWPbvrEYqsV6u29dAaHavr';
|
|
2895
|
+
/** TokenMessengerWithFees address shared by enabled EVM mainnet sources. */ const TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET = '0x71f54F818671cD0D7ea140Da213e5C8b5C92a408';
|
|
2896
|
+
/** TokenMessengerWithFees address shared by enabled EVM testnet sources. */ const TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET = '0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A';
|
|
2891
2897
|
|
|
2892
2898
|
/**
|
|
2893
2899
|
* Arc Testnet chain definition
|
|
@@ -2925,6 +2931,7 @@ var EarnChain;
|
|
|
2925
2931
|
v2: {
|
|
2926
2932
|
type: 'split',
|
|
2927
2933
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
2934
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
2928
2935
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
2929
2936
|
confirmations: 1,
|
|
2930
2937
|
fastConfirmations: 1
|
|
@@ -2992,6 +2999,7 @@ var EarnChain;
|
|
|
2992
2999
|
v2: {
|
|
2993
3000
|
type: 'split',
|
|
2994
3001
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3002
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
2995
3003
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
2996
3004
|
confirmations: 65,
|
|
2997
3005
|
fastConfirmations: 1
|
|
@@ -3056,6 +3064,7 @@ var EarnChain;
|
|
|
3056
3064
|
v2: {
|
|
3057
3065
|
type: 'split',
|
|
3058
3066
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3067
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3059
3068
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3060
3069
|
confirmations: 65,
|
|
3061
3070
|
fastConfirmations: 1
|
|
@@ -3120,6 +3129,7 @@ var EarnChain;
|
|
|
3120
3129
|
v2: {
|
|
3121
3130
|
type: 'split',
|
|
3122
3131
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3132
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3123
3133
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3124
3134
|
confirmations: 1,
|
|
3125
3135
|
fastConfirmations: 1
|
|
@@ -3181,6 +3191,7 @@ var EarnChain;
|
|
|
3181
3191
|
v2: {
|
|
3182
3192
|
type: 'split',
|
|
3183
3193
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3194
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3184
3195
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3185
3196
|
confirmations: 1,
|
|
3186
3197
|
fastConfirmations: 1
|
|
@@ -3248,6 +3259,7 @@ var EarnChain;
|
|
|
3248
3259
|
v2: {
|
|
3249
3260
|
type: 'split',
|
|
3250
3261
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3262
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3251
3263
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3252
3264
|
confirmations: 65,
|
|
3253
3265
|
fastConfirmations: 1
|
|
@@ -3312,6 +3324,7 @@ var EarnChain;
|
|
|
3312
3324
|
v2: {
|
|
3313
3325
|
type: 'split',
|
|
3314
3326
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3327
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3315
3328
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3316
3329
|
confirmations: 65,
|
|
3317
3330
|
fastConfirmations: 1
|
|
@@ -3422,6 +3435,7 @@ var EarnChain;
|
|
|
3422
3435
|
v2: {
|
|
3423
3436
|
type: 'split',
|
|
3424
3437
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3438
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3425
3439
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3426
3440
|
confirmations: 65,
|
|
3427
3441
|
fastConfirmations: 1
|
|
@@ -3466,6 +3480,7 @@ var EarnChain;
|
|
|
3466
3480
|
v2: {
|
|
3467
3481
|
type: 'split',
|
|
3468
3482
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3483
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3469
3484
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3470
3485
|
confirmations: 65,
|
|
3471
3486
|
fastConfirmations: 1
|
|
@@ -3697,6 +3712,7 @@ var EarnChain;
|
|
|
3697
3712
|
v2: {
|
|
3698
3713
|
type: 'split',
|
|
3699
3714
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3715
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3700
3716
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3701
3717
|
confirmations: 65,
|
|
3702
3718
|
fastConfirmations: 2
|
|
@@ -3761,6 +3777,7 @@ var EarnChain;
|
|
|
3761
3777
|
v2: {
|
|
3762
3778
|
type: 'split',
|
|
3763
3779
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
3780
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3764
3781
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
3765
3782
|
confirmations: 65,
|
|
3766
3783
|
fastConfirmations: 2
|
|
@@ -3871,6 +3888,7 @@ var EarnChain;
|
|
|
3871
3888
|
v2: {
|
|
3872
3889
|
type: 'split',
|
|
3873
3890
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
3891
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
3874
3892
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
3875
3893
|
confirmations: 1,
|
|
3876
3894
|
fastConfirmations: 1
|
|
@@ -3930,6 +3948,7 @@ var EarnChain;
|
|
|
3930
3948
|
v2: {
|
|
3931
3949
|
type: 'split',
|
|
3932
3950
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
3951
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
3933
3952
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
3934
3953
|
confirmations: 1,
|
|
3935
3954
|
fastConfirmations: 1
|
|
@@ -4084,6 +4103,7 @@ var EarnChain;
|
|
|
4084
4103
|
v2: {
|
|
4085
4104
|
type: 'split',
|
|
4086
4105
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4106
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4087
4107
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4088
4108
|
confirmations: 65,
|
|
4089
4109
|
fastConfirmations: 1
|
|
@@ -4131,6 +4151,7 @@ var EarnChain;
|
|
|
4131
4151
|
v2: {
|
|
4132
4152
|
type: 'split',
|
|
4133
4153
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4154
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4134
4155
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4135
4156
|
confirmations: 65,
|
|
4136
4157
|
fastConfirmations: 1
|
|
@@ -4175,6 +4196,7 @@ var EarnChain;
|
|
|
4175
4196
|
v2: {
|
|
4176
4197
|
type: 'split',
|
|
4177
4198
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4199
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4178
4200
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4179
4201
|
confirmations: 1,
|
|
4180
4202
|
fastConfirmations: 1
|
|
@@ -4220,6 +4242,7 @@ var EarnChain;
|
|
|
4220
4242
|
v2: {
|
|
4221
4243
|
type: 'split',
|
|
4222
4244
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
4245
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4223
4246
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
4224
4247
|
confirmations: 1,
|
|
4225
4248
|
fastConfirmations: 1
|
|
@@ -4266,6 +4289,7 @@ var EarnChain;
|
|
|
4266
4289
|
v2: {
|
|
4267
4290
|
type: 'split',
|
|
4268
4291
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4292
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4269
4293
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4270
4294
|
confirmations: 1,
|
|
4271
4295
|
fastConfirmations: 1
|
|
@@ -4579,6 +4603,7 @@ var EarnChain;
|
|
|
4579
4603
|
v2: {
|
|
4580
4604
|
type: 'split',
|
|
4581
4605
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4606
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4582
4607
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4583
4608
|
confirmations: 65,
|
|
4584
4609
|
fastConfirmations: 1
|
|
@@ -4643,6 +4668,7 @@ var EarnChain;
|
|
|
4643
4668
|
v2: {
|
|
4644
4669
|
type: 'split',
|
|
4645
4670
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
4671
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4646
4672
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
4647
4673
|
confirmations: 65,
|
|
4648
4674
|
fastConfirmations: 1
|
|
@@ -4763,6 +4789,98 @@ var EarnChain;
|
|
|
4763
4789
|
}
|
|
4764
4790
|
});
|
|
4765
4791
|
|
|
4792
|
+
/**
|
|
4793
|
+
* Plasma Mainnet chain definition
|
|
4794
|
+
* @remarks
|
|
4795
|
+
* This represents the official production network for the Plasma blockchain.
|
|
4796
|
+
* Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
|
|
4797
|
+
* stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
|
|
4798
|
+
*/ const Plasma = defineChain({
|
|
4799
|
+
type: 'evm',
|
|
4800
|
+
chain: Blockchain.Plasma,
|
|
4801
|
+
name: 'Plasma',
|
|
4802
|
+
title: 'Plasma Mainnet',
|
|
4803
|
+
nativeCurrency: {
|
|
4804
|
+
name: 'Plasma',
|
|
4805
|
+
symbol: 'XPL',
|
|
4806
|
+
decimals: 18
|
|
4807
|
+
},
|
|
4808
|
+
chainId: 9745,
|
|
4809
|
+
isTestnet: false,
|
|
4810
|
+
explorerUrl: 'https://plasmascan.to/tx/{hash}',
|
|
4811
|
+
rpcEndpoints: [
|
|
4812
|
+
'https://rpc.plasma.to'
|
|
4813
|
+
],
|
|
4814
|
+
eurcAddress: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
|
|
4815
|
+
usdcAddress: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
|
|
4816
|
+
usdtAddress: null,
|
|
4817
|
+
cctp: {
|
|
4818
|
+
domain: 33,
|
|
4819
|
+
contracts: {
|
|
4820
|
+
v2: {
|
|
4821
|
+
type: 'split',
|
|
4822
|
+
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4823
|
+
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4824
|
+
confirmations: 3,
|
|
4825
|
+
fastConfirmations: 1
|
|
4826
|
+
}
|
|
4827
|
+
},
|
|
4828
|
+
forwarderSupported: {
|
|
4829
|
+
source: false,
|
|
4830
|
+
destination: false
|
|
4831
|
+
}
|
|
4832
|
+
},
|
|
4833
|
+
kitContracts: {
|
|
4834
|
+
bridge: BRIDGE_CONTRACT_EVM_MAINNET
|
|
4835
|
+
}
|
|
4836
|
+
});
|
|
4837
|
+
|
|
4838
|
+
/**
|
|
4839
|
+
* Plasma Testnet chain definition
|
|
4840
|
+
* @remarks
|
|
4841
|
+
* This represents the official test network for the Plasma blockchain.
|
|
4842
|
+
* Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
|
|
4843
|
+
* stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
|
|
4844
|
+
*/ const PlasmaTestnet = defineChain({
|
|
4845
|
+
type: 'evm',
|
|
4846
|
+
chain: Blockchain.Plasma_Testnet,
|
|
4847
|
+
name: 'Plasma Testnet',
|
|
4848
|
+
title: 'Plasma Testnet',
|
|
4849
|
+
nativeCurrency: {
|
|
4850
|
+
name: 'Plasma',
|
|
4851
|
+
symbol: 'XPL',
|
|
4852
|
+
decimals: 18
|
|
4853
|
+
},
|
|
4854
|
+
chainId: 9746,
|
|
4855
|
+
isTestnet: true,
|
|
4856
|
+
explorerUrl: 'https://testnet.plasmascan.to/tx/{hash}',
|
|
4857
|
+
rpcEndpoints: [
|
|
4858
|
+
'https://testnet-rpc.plasma.to'
|
|
4859
|
+
],
|
|
4860
|
+
eurcAddress: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330',
|
|
4861
|
+
usdcAddress: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
|
|
4862
|
+
usdtAddress: null,
|
|
4863
|
+
cctp: {
|
|
4864
|
+
domain: 33,
|
|
4865
|
+
contracts: {
|
|
4866
|
+
v2: {
|
|
4867
|
+
type: 'split',
|
|
4868
|
+
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4869
|
+
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4870
|
+
confirmations: 3,
|
|
4871
|
+
fastConfirmations: 1
|
|
4872
|
+
}
|
|
4873
|
+
},
|
|
4874
|
+
forwarderSupported: {
|
|
4875
|
+
source: false,
|
|
4876
|
+
destination: false
|
|
4877
|
+
}
|
|
4878
|
+
},
|
|
4879
|
+
kitContracts: {
|
|
4880
|
+
bridge: BRIDGE_CONTRACT_EVM_TESTNET
|
|
4881
|
+
}
|
|
4882
|
+
});
|
|
4883
|
+
|
|
4766
4884
|
/**
|
|
4767
4885
|
* Plume Mainnet chain definition
|
|
4768
4886
|
* @remarks
|
|
@@ -4794,6 +4912,7 @@ var EarnChain;
|
|
|
4794
4912
|
v2: {
|
|
4795
4913
|
type: 'split',
|
|
4796
4914
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
4915
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4797
4916
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4798
4917
|
confirmations: 65,
|
|
4799
4918
|
fastConfirmations: 1
|
|
@@ -4840,6 +4959,7 @@ var EarnChain;
|
|
|
4840
4959
|
v2: {
|
|
4841
4960
|
type: 'split',
|
|
4842
4961
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
4962
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
4843
4963
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
4844
4964
|
confirmations: 65,
|
|
4845
4965
|
fastConfirmations: 1
|
|
@@ -4941,6 +5061,7 @@ var EarnChain;
|
|
|
4941
5061
|
v2: {
|
|
4942
5062
|
type: 'split',
|
|
4943
5063
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5064
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
4944
5065
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
4945
5066
|
confirmations: 33,
|
|
4946
5067
|
fastConfirmations: 13
|
|
@@ -5006,6 +5127,7 @@ var EarnChain;
|
|
|
5006
5127
|
v2: {
|
|
5007
5128
|
type: 'split',
|
|
5008
5129
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5130
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5009
5131
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5010
5132
|
confirmations: 33,
|
|
5011
5133
|
fastConfirmations: 13
|
|
@@ -5065,6 +5187,7 @@ var EarnChain;
|
|
|
5065
5187
|
v2: {
|
|
5066
5188
|
type: 'split',
|
|
5067
5189
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5190
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5068
5191
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5069
5192
|
confirmations: 1,
|
|
5070
5193
|
fastConfirmations: 1
|
|
@@ -5124,6 +5247,7 @@ var EarnChain;
|
|
|
5124
5247
|
v2: {
|
|
5125
5248
|
type: 'split',
|
|
5126
5249
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5250
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5127
5251
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5128
5252
|
confirmations: 1,
|
|
5129
5253
|
fastConfirmations: 1
|
|
@@ -5181,6 +5305,7 @@ var EarnChain;
|
|
|
5181
5305
|
v2: {
|
|
5182
5306
|
type: 'split',
|
|
5183
5307
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5308
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5184
5309
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5185
5310
|
confirmations: 1,
|
|
5186
5311
|
fastConfirmations: 1
|
|
@@ -5239,6 +5364,7 @@ var EarnChain;
|
|
|
5239
5364
|
v2: {
|
|
5240
5365
|
type: 'split',
|
|
5241
5366
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5367
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5242
5368
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5243
5369
|
confirmations: 1,
|
|
5244
5370
|
fastConfirmations: 1
|
|
@@ -5554,6 +5680,7 @@ var EarnChain;
|
|
|
5554
5680
|
v2: {
|
|
5555
5681
|
type: 'split',
|
|
5556
5682
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5683
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5557
5684
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5558
5685
|
confirmations: 65,
|
|
5559
5686
|
fastConfirmations: 1
|
|
@@ -5618,6 +5745,7 @@ var EarnChain;
|
|
|
5618
5745
|
v2: {
|
|
5619
5746
|
type: 'split',
|
|
5620
5747
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5748
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5621
5749
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5622
5750
|
confirmations: 65,
|
|
5623
5751
|
fastConfirmations: 1
|
|
@@ -5675,6 +5803,7 @@ var EarnChain;
|
|
|
5675
5803
|
v2: {
|
|
5676
5804
|
type: 'split',
|
|
5677
5805
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cF5d',
|
|
5806
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5678
5807
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5679
5808
|
confirmations: 65,
|
|
5680
5809
|
fastConfirmations: 1
|
|
@@ -5734,6 +5863,7 @@ var EarnChain;
|
|
|
5734
5863
|
v2: {
|
|
5735
5864
|
type: 'split',
|
|
5736
5865
|
tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
|
|
5866
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5737
5867
|
messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
|
|
5738
5868
|
confirmations: 65,
|
|
5739
5869
|
fastConfirmations: 1
|
|
@@ -5794,6 +5924,7 @@ var EarnChain;
|
|
|
5794
5924
|
v2: {
|
|
5795
5925
|
type: 'split',
|
|
5796
5926
|
tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
|
|
5927
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
|
|
5797
5928
|
messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
|
|
5798
5929
|
confirmations: 3,
|
|
5799
5930
|
fastConfirmations: 3
|
|
@@ -5839,6 +5970,7 @@ var EarnChain;
|
|
|
5839
5970
|
v2: {
|
|
5840
5971
|
type: 'split',
|
|
5841
5972
|
tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
|
|
5973
|
+
tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
|
|
5842
5974
|
messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
|
|
5843
5975
|
confirmations: 3,
|
|
5844
5976
|
fastConfirmations: 1
|
|
@@ -6049,6 +6181,8 @@ var Chains = /*#__PURE__*/Object.freeze({
|
|
|
6049
6181
|
OptimismSepolia: OptimismSepolia,
|
|
6050
6182
|
Pharos: Pharos,
|
|
6051
6183
|
PharosTestnet: PharosTestnet,
|
|
6184
|
+
Plasma: Plasma,
|
|
6185
|
+
PlasmaTestnet: PlasmaTestnet,
|
|
6052
6186
|
Plume: Plume,
|
|
6053
6187
|
PlumeTestnet: PlumeTestnet,
|
|
6054
6188
|
PolkadotAssetHub: PolkadotAssetHub,
|
|
@@ -7505,6 +7639,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7505
7639
|
[Blockchain.Noble]: 'uusdc',
|
|
7506
7640
|
[Blockchain.Optimism]: '0x0b2c639c533813f4aa9d7837caf62653d097ff85',
|
|
7507
7641
|
[Blockchain.Pharos]: '0xC879C018dB60520F4355C26eD1a6D572cdAC1815',
|
|
7642
|
+
[Blockchain.Plasma]: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
|
|
7508
7643
|
[Blockchain.Plume]: '0x222365EF19F7947e5484218551B56bb3965Aa7aF',
|
|
7509
7644
|
[Blockchain.Polkadot_Asset_Hub]: '1337',
|
|
7510
7645
|
[Blockchain.Polygon]: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359',
|
|
@@ -7541,6 +7676,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7541
7676
|
[Blockchain.Noble_Testnet]: 'uusdc',
|
|
7542
7677
|
[Blockchain.Optimism_Sepolia]: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',
|
|
7543
7678
|
[Blockchain.Pharos_Testnet]: '0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B',
|
|
7679
|
+
[Blockchain.Plasma_Testnet]: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
|
|
7544
7680
|
[Blockchain.Plume_Testnet]: '0xcB5f30e335672893c7eb944B374c196392C19D18',
|
|
7545
7681
|
[Blockchain.Polkadot_Westmint]: '31337',
|
|
7546
7682
|
[Blockchain.Polygon_Amoy_Testnet]: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
|
|
@@ -7603,6 +7739,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7603
7739
|
[Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
|
|
7604
7740
|
[Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
|
|
7605
7741
|
[Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
|
|
7742
|
+
[Blockchain.Plasma]: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
|
|
7606
7743
|
[Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
|
|
7607
7744
|
[Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
|
|
7608
7745
|
// =========================================================================
|
|
@@ -7611,7 +7748,8 @@ const swapTokenEnumSchema = z.enum([
|
|
|
7611
7748
|
[Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
|
|
7612
7749
|
[Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
|
|
7613
7750
|
[Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
|
|
7614
|
-
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
|
|
7751
|
+
[Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4',
|
|
7752
|
+
[Blockchain.Plasma_Testnet]: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330'
|
|
7615
7753
|
}
|
|
7616
7754
|
};
|
|
7617
7755
|
|
|
@@ -8694,7 +8832,7 @@ const swapTokenEnumSchema = z.enum([
|
|
|
8694
8832
|
}
|
|
8695
8833
|
|
|
8696
8834
|
var name$3 = "@circle-fin/bridge-kit";
|
|
8697
|
-
var version$3 = "1.
|
|
8835
|
+
var version$3 = "1.14.0";
|
|
8698
8836
|
var pkg$3 = {
|
|
8699
8837
|
name: name$3,
|
|
8700
8838
|
version: version$3};
|
|
@@ -8969,7 +9107,7 @@ const READ_ACTION_KEY_SET = new Set(READ_ACTION_KEYS);
|
|
|
8969
9107
|
* const result = evmAddressSchema.safeParse(validAddress)
|
|
8970
9108
|
* console.log(result.success) // true
|
|
8971
9109
|
* ```
|
|
8972
|
-
*/ const evmAddressSchema = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
|
|
9110
|
+
*/ const evmAddressSchema$1 = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
|
|
8973
9111
|
/**
|
|
8974
9112
|
* Schema for validating transaction hashes.
|
|
8975
9113
|
*
|
|
@@ -9506,6 +9644,10 @@ var TransferSpeed;
|
|
|
9506
9644
|
token: z.literal('USDC').optional(),
|
|
9507
9645
|
config: z.object({
|
|
9508
9646
|
transferSpeed: z.nativeEnum(TransferSpeed).optional(),
|
|
9647
|
+
feePayment: z.enum([
|
|
9648
|
+
'source',
|
|
9649
|
+
'destination'
|
|
9650
|
+
]).optional(),
|
|
9509
9651
|
maxFee: z.string().min(1, 'Required').pipe(createDecimalStringValidator({
|
|
9510
9652
|
allowZero: true,
|
|
9511
9653
|
regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
|
|
@@ -9513,7 +9655,8 @@ var TransferSpeed;
|
|
|
9513
9655
|
maxDecimals: 6
|
|
9514
9656
|
})(z.string())).optional(),
|
|
9515
9657
|
customFee: customFeeSchema.optional()
|
|
9516
|
-
}).optional()
|
|
9658
|
+
}).optional(),
|
|
9659
|
+
quote: z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex').optional()
|
|
9517
9660
|
});
|
|
9518
9661
|
|
|
9519
9662
|
// ============================================================================
|
|
@@ -9737,13 +9880,182 @@ var TransferSpeed;
|
|
|
9737
9880
|
* @internal
|
|
9738
9881
|
*/ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
|
|
9739
9882
|
|
|
9883
|
+
/** Decimal string in token minor units, constrained to be strictly positive. */ const positiveAmountSchema = z.string().regex(/^\d+$/, 'must be a non-negative integer string')// Re-check the digit shape here: zod still runs this refinement when the
|
|
9884
|
+
// regex check above fails ("dirty"), so guard BigInt() against throwing on a
|
|
9885
|
+
// non-numeric value before comparing.
|
|
9886
|
+
.refine((value)=>/^\d+$/.test(value) && BigInt(value) > 0n, 'must be greater than zero');
|
|
9887
|
+
/**
|
|
9888
|
+
* A 20-byte EVM address in `0x` hex.
|
|
9889
|
+
*
|
|
9890
|
+
* The MVP prepaid-`FORWARD` `burn/usdc` path targets EVM contracts
|
|
9891
|
+
* (`TokenMessengerWithFees` / `GenericExecutor`), so `feeToken` and
|
|
9892
|
+
* `destinationCaller` are constrained to EVM addresses by design. This is an
|
|
9893
|
+
* intentional scope limit, not a permanent one: it can be widened to other
|
|
9894
|
+
* address formats as the fee service expands to more chains.
|
|
9895
|
+
*/ const evmAddressSchema = z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 20-byte 0x address');
|
|
9896
|
+
/** Even-length `0x` hex (the empty `0x` is allowed). */ const hexSchema = z.string().regex(/^0x([a-fA-F0-9]{2})*$/, 'must be even-length 0x hex');
|
|
9897
|
+
/** Non-empty, even-length `0x` hex. */ const nonEmptyHexSchema = z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex');
|
|
9898
|
+
/** A 32-byte `0x` hex hash. */ const bytes32Schema = z.string().regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 32-byte 0x hash');
|
|
9899
|
+
/** Decimal string in minor units, allowing zero. */ const numericStringSchema = z.string().regex(/^\d+$/, 'must be a non-negative integer string');
|
|
9900
|
+
/** An `https:` URL, used for the optional base-URL override. */ const httpsUrlSchema = z.string().refine((value)=>{
|
|
9901
|
+
try {
|
|
9902
|
+
return new URL(value).protocol === 'https:';
|
|
9903
|
+
} catch {
|
|
9904
|
+
return false;
|
|
9905
|
+
}
|
|
9906
|
+
}, 'must be an https URL');
|
|
9907
|
+
const forwardParamsSchema = z.object({
|
|
9908
|
+
hookData: hexSchema.optional(),
|
|
9909
|
+
destinationCaller: evmAddressSchema.optional()
|
|
9910
|
+
}).strict();
|
|
9911
|
+
const forwardRequestSchema = z.object({
|
|
9912
|
+
type: z.literal('FORWARD'),
|
|
9913
|
+
params: forwardParamsSchema.optional()
|
|
9914
|
+
}).strict();
|
|
9915
|
+
const preFinalityRequestSchema = z.object({
|
|
9916
|
+
type: z.literal('PRE_FINALITY')
|
|
9917
|
+
}).strict();
|
|
9918
|
+
/** A single quote request item (`FORWARD` or `PRE_FINALITY`). */ const feeQuoteRequestSchema = z.discriminatedUnion('type', [
|
|
9919
|
+
forwardRequestSchema,
|
|
9920
|
+
preFinalityRequestSchema
|
|
9921
|
+
]);
|
|
9922
|
+
/** A non-empty list of quote request items with unique types. */ const feeQuoteRequestsSchema = 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');
|
|
9923
|
+
/**
|
|
9924
|
+
* A structured `Partial<ApiPollingConfig>` polling override.
|
|
9925
|
+
*
|
|
9926
|
+
* Validates the field types callers actually set, so a plain-JS caller passing
|
|
9927
|
+
* `{ timeout: 'soon' }` is rejected at the boundary rather than failing opaquely
|
|
9928
|
+
* inside the transport. Unknown keys pass through so a future `ApiPollingConfig`
|
|
9929
|
+
* field is forwarded rather than silently dropped.
|
|
9930
|
+
*/ const apiPollingConfigSchema = z.object({
|
|
9931
|
+
timeout: z.number().int().positive().optional(),
|
|
9932
|
+
maxRetries: z.number().int().nonnegative().optional(),
|
|
9933
|
+
retryDelay: z.number().int().nonnegative().optional(),
|
|
9934
|
+
backoff: z.enum([
|
|
9935
|
+
'fixed',
|
|
9936
|
+
'exponential'
|
|
9937
|
+
]).optional(),
|
|
9938
|
+
maxRetryDelayMs: z.number().int().positive().optional(),
|
|
9939
|
+
headers: z.record(z.string()).optional()
|
|
9940
|
+
}).passthrough();
|
|
9941
|
+
/**
|
|
9942
|
+
* The validatable input for {@link fetchFeeQuote}.
|
|
9943
|
+
*
|
|
9944
|
+
* This is the single source of truth for input validation, including the CCTP
|
|
9945
|
+
* domains and the `isTestnet` environment flag. Validating `isTestnet` at
|
|
9946
|
+
* runtime matters because a plain-JS caller who omits it would otherwise leave
|
|
9947
|
+
* it `undefined`, which is falsy and silently selects the production base URL.
|
|
9948
|
+
* (`buildFeeQuoteUrl` independently re-validates the domains for standalone
|
|
9949
|
+
* callers.)
|
|
9950
|
+
*/ z.object({
|
|
9951
|
+
sourceDomain: z.number().int().nonnegative(),
|
|
9952
|
+
destinationDomain: z.number().int().nonnegative(),
|
|
9953
|
+
amount: positiveAmountSchema,
|
|
9954
|
+
feeToken: evmAddressSchema.optional(),
|
|
9955
|
+
requests: feeQuoteRequestsSchema,
|
|
9956
|
+
isTestnet: z.boolean(),
|
|
9957
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
9958
|
+
config: apiPollingConfigSchema.optional()
|
|
9959
|
+
}).strict();
|
|
9960
|
+
const feeQuoteItemSchema = z.object({
|
|
9961
|
+
type: z.string().min(1),
|
|
9962
|
+
amount: numericStringSchema,
|
|
9963
|
+
args: z.array(z.string()),
|
|
9964
|
+
argsHash: bytes32Schema
|
|
9965
|
+
}).passthrough();
|
|
9966
|
+
const exchangeRatesSchema = z.object({
|
|
9967
|
+
feeTokenUsd: z.string(),
|
|
9968
|
+
destinationTokenUsd: z.string()
|
|
9969
|
+
}).passthrough();
|
|
9970
|
+
const metadataSchema = z.object({
|
|
9971
|
+
destinationGasPrice: z.string().optional(),
|
|
9972
|
+
exchangeRates: exchangeRatesSchema.optional()
|
|
9973
|
+
}).passthrough();
|
|
9974
|
+
/** The `expiry` object the Quote API nests the quote TTL under. */ const expirySchema = z.discriminatedUnion('mode', [
|
|
9975
|
+
z.object({
|
|
9976
|
+
mode: z.literal('TIMESTAMP'),
|
|
9977
|
+
expiresAt: z.number().int().nonnegative()
|
|
9978
|
+
}).passthrough(),
|
|
9979
|
+
z.object({
|
|
9980
|
+
mode: z.literal('BLOCK_NUMBER'),
|
|
9981
|
+
expiresAtBlock: z.number().int().nonnegative(),
|
|
9982
|
+
blockEstimatedAt: z.number().int().nonnegative().optional()
|
|
9983
|
+
}).passthrough()
|
|
9984
|
+
]);
|
|
9985
|
+
/** Schema for a signed fee quote returned by the Quote API. */ z.object({
|
|
9986
|
+
// The runtime YAML spec maps signedQuote to a looser `hex` (which allows
|
|
9987
|
+
// an empty `0x`); we keep the stricter non-empty form. Do not relax
|
|
9988
|
+
// without a reason.
|
|
9989
|
+
signedQuote: nonEmptyHexSchema,
|
|
9990
|
+
issuedAt: z.number().int().nonnegative(),
|
|
9991
|
+
// The API returns a mode-specific timestamp or source-block deadline.
|
|
9992
|
+
expiry: expirySchema,
|
|
9993
|
+
feeTotalAmount: numericStringSchema,
|
|
9994
|
+
feeToken: evmAddressSchema,
|
|
9995
|
+
nonce: numericStringSchema,
|
|
9996
|
+
items: z.array(feeQuoteItemSchema),
|
|
9997
|
+
metadata: metadataSchema.optional()
|
|
9998
|
+
}).passthrough();
|
|
9999
|
+
/** Validate input to {@link validateQuote}. */ z.object({
|
|
10000
|
+
sourceDomain: z.number().int().nonnegative(),
|
|
10001
|
+
abiSignature: z.string().min(1),
|
|
10002
|
+
args: z.array(z.union([
|
|
10003
|
+
z.string(),
|
|
10004
|
+
z.array(z.string())
|
|
10005
|
+
])),
|
|
10006
|
+
isTestnet: z.boolean(),
|
|
10007
|
+
baseUrl: httpsUrlSchema.optional(),
|
|
10008
|
+
config: apiPollingConfigSchema.optional()
|
|
10009
|
+
}).strict();
|
|
10010
|
+
const quoteExpiryStatusSchema = z.discriminatedUnion('mode', [
|
|
10011
|
+
z.object({
|
|
10012
|
+
mode: z.literal('TIMESTAMP'),
|
|
10013
|
+
expired: z.boolean(),
|
|
10014
|
+
secondsRemaining: z.number().int().nonnegative(),
|
|
10015
|
+
expiresAt: z.number().int().nonnegative()
|
|
10016
|
+
}).passthrough(),
|
|
10017
|
+
z.object({
|
|
10018
|
+
mode: z.literal('BLOCK_NUMBER'),
|
|
10019
|
+
expired: z.boolean(),
|
|
10020
|
+
secondsRemaining: z.number().int().nonnegative(),
|
|
10021
|
+
expiresAtBlock: z.number().int().nonnegative(),
|
|
10022
|
+
blockEstimatedAt: z.number().int().nonnegative().optional()
|
|
10023
|
+
}).passthrough()
|
|
10024
|
+
]);
|
|
10025
|
+
const validateQuoteItemSchema = z.object({
|
|
10026
|
+
type: z.string().min(1),
|
|
10027
|
+
argsMatch: z.boolean(),
|
|
10028
|
+
amount: numericStringSchema.optional(),
|
|
10029
|
+
args: z.array(z.string()).optional(),
|
|
10030
|
+
argsHash: bytes32Schema.optional(),
|
|
10031
|
+
computedArgsHash: bytes32Schema.optional()
|
|
10032
|
+
}).passthrough();
|
|
10033
|
+
/**
|
|
10034
|
+
* Schema for a response from the Quote API validation endpoint.
|
|
10035
|
+
*
|
|
10036
|
+
* The endpoint takes the source domain as a URL path parameter and does not
|
|
10037
|
+
* return it in the response body, so `sourceDomain` is intentionally not part
|
|
10038
|
+
* of this schema.
|
|
10039
|
+
*/ z.object({
|
|
10040
|
+
signedQuote: nonEmptyHexSchema,
|
|
10041
|
+
expiry: quoteExpiryStatusSchema,
|
|
10042
|
+
feeTotalAmount: numericStringSchema,
|
|
10043
|
+
feeToken: evmAddressSchema,
|
|
10044
|
+
nonce: numericStringSchema,
|
|
10045
|
+
claimable: z.boolean(),
|
|
10046
|
+
// Preserve newly introduced server-side reasons as opaque strings rather
|
|
10047
|
+
// than rejecting the entire safety response before the SDK is updated.
|
|
10048
|
+
failedChecks: z.array(z.string().min(1)),
|
|
10049
|
+
items: z.array(validateQuoteItemSchema)
|
|
10050
|
+
}).passthrough();
|
|
10051
|
+
|
|
9740
10052
|
/** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$3.name);
|
|
9741
10053
|
|
|
9742
10054
|
// Auto-register this kit for user agent tracking
|
|
9743
10055
|
registerKit(`${pkg$3.name}/${pkg$3.version}`);
|
|
9744
10056
|
|
|
9745
10057
|
var name$2 = "@circle-fin/swap-kit";
|
|
9746
|
-
var version$2 = "1.
|
|
10058
|
+
var version$2 = "1.6.0";
|
|
9747
10059
|
var pkg$2 = {
|
|
9748
10060
|
name: name$2,
|
|
9749
10061
|
version: version$2};
|
|
@@ -9757,7 +10069,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9757
10069
|
* Catches obviously malformed addresses at parse time; chain-specific validation
|
|
9758
10070
|
* is performed in buildServiceParams.
|
|
9759
10071
|
*/ const destinationAddressSchema = z.union([
|
|
9760
|
-
evmAddressSchema,
|
|
10072
|
+
evmAddressSchema$1,
|
|
9761
10073
|
solanaAddressSchema
|
|
9762
10074
|
]);
|
|
9763
10075
|
/**
|
|
@@ -9803,9 +10115,16 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9803
10115
|
message: 'stopLimit must be greater than 0'
|
|
9804
10116
|
}).optional(),
|
|
9805
10117
|
customFee: serviceSwapCustomFeeSchema.optional(),
|
|
10118
|
+
apiKey: z.string({
|
|
10119
|
+
invalid_type_error: 'apiKey must be a string'
|
|
10120
|
+
})// Tolerate '' so the `process.env.CIRCLE_API_KEY ?? ''` idiom falls back to
|
|
10121
|
+
// kitKey via resolveApiKey instead of being rejected here.
|
|
10122
|
+
.optional(),
|
|
9806
10123
|
kitKey: z.string({
|
|
9807
10124
|
invalid_type_error: 'kitKey must be a string'
|
|
9808
|
-
})
|
|
10125
|
+
})// Tolerate '' so an unset kit-key env var yields the permissionless path,
|
|
10126
|
+
// matching buildServiceParams (which already omits an empty credential).
|
|
10127
|
+
.optional(),
|
|
9809
10128
|
provider: z.string({
|
|
9810
10129
|
invalid_type_error: 'provider must be a string'
|
|
9811
10130
|
}).min(1, 'provider must be a non-empty string').optional(),
|
|
@@ -9978,6 +10297,41 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
9978
10297
|
*
|
|
9979
10298
|
* @internal
|
|
9980
10299
|
*/ const MAX_RATE_ADDRESSES_PER_REQUEST = 100;
|
|
10300
|
+
/**
|
|
10301
|
+
* Environment prefixes carried by Circle platform API keys.
|
|
10302
|
+
*
|
|
10303
|
+
* A Circle API key is `<ENV>_API_KEY:<keyId>:<keySecret>`, where `<ENV>` is one
|
|
10304
|
+
* of these prefixes.
|
|
10305
|
+
*
|
|
10306
|
+
* @internal
|
|
10307
|
+
*/ const API_KEY_ENV_PREFIXES = [
|
|
10308
|
+
'TEST',
|
|
10309
|
+
'LIVE',
|
|
10310
|
+
'SAND',
|
|
10311
|
+
'SANDBOX',
|
|
10312
|
+
'SMOK',
|
|
10313
|
+
'PROD',
|
|
10314
|
+
'STAG',
|
|
10315
|
+
'DEV'
|
|
10316
|
+
];
|
|
10317
|
+
/**
|
|
10318
|
+
* Accepted credential formats for Stablecoin Service authentication.
|
|
10319
|
+
*
|
|
10320
|
+
* Matches a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
|
|
10321
|
+
* the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`). API keys are the
|
|
10322
|
+
* recommended credential; kit keys remain accepted as the legacy path.
|
|
10323
|
+
*
|
|
10324
|
+
* @remarks
|
|
10325
|
+
* This is a local pre-flight check, not the authority — the Stablecoin Service
|
|
10326
|
+
* validates the credential and answers 401 when it rejects one. The prefix list
|
|
10327
|
+
* is therefore deliberately permissive: a valid key carrying a prefix this SDK
|
|
10328
|
+
* has not been taught about should reach the service and be judged there rather
|
|
10329
|
+
* than be refused locally, since refusing locally is indistinguishable from an
|
|
10330
|
+
* outage to the caller. Kept as the single source of truth so the pattern is
|
|
10331
|
+
* not restated per call site.
|
|
10332
|
+
*
|
|
10333
|
+
* @internal
|
|
10334
|
+
*/ const API_KEY_PATTERN = new RegExp(`^(?:KIT_KEY|(?:${API_KEY_ENV_PREFIXES.join('|')})_API_KEY)` + ':[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$');
|
|
9981
10335
|
|
|
9982
10336
|
/**
|
|
9983
10337
|
* Zod schema for validating stop limits.
|
|
@@ -10046,13 +10400,14 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
10046
10400
|
/**
|
|
10047
10401
|
* Zod schema for validating API keys.
|
|
10048
10402
|
*
|
|
10049
|
-
*
|
|
10403
|
+
* Accepts a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
|
|
10404
|
+
* the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`).
|
|
10050
10405
|
*
|
|
10051
10406
|
* @example
|
|
10052
10407
|
* ```typescript
|
|
10053
10408
|
* import { apiKeySchema } from '@core/service-client'
|
|
10054
10409
|
*
|
|
10055
|
-
* const result = apiKeySchema.safeParse('
|
|
10410
|
+
* const result = apiKeySchema.safeParse('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
|
|
10056
10411
|
* if (!result.success) {
|
|
10057
10412
|
* console.error('Invalid API key format:', result.error.issues)
|
|
10058
10413
|
* }
|
|
@@ -10060,7 +10415,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
|
|
|
10060
10415
|
*/ const apiKeySchema = z.string({
|
|
10061
10416
|
required_error: 'API key is required',
|
|
10062
10417
|
invalid_type_error: 'Invalid API key format'
|
|
10063
|
-
}).regex(
|
|
10418
|
+
}).regex(API_KEY_PATTERN, 'Invalid API key format');
|
|
10064
10419
|
/**
|
|
10065
10420
|
* Zod schema for platform fees configuration.
|
|
10066
10421
|
*
|
|
@@ -10503,8 +10858,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10503
10858
|
* Validates that an API key is properly formatted for Circle Stablecoin Service.
|
|
10504
10859
|
*
|
|
10505
10860
|
* This function performs validation on API keys to ensure they conform to the
|
|
10506
|
-
* expected format before making API requests. The key must follow the structure
|
|
10507
|
-
* `KIT_KEY:keyId:keySecret
|
|
10861
|
+
* expected format before making API requests. The key must follow the structure
|
|
10862
|
+
* `<ENV>_API_KEY:keyId:keySecret`, or the legacy `KIT_KEY:keyId:keySecret`.
|
|
10508
10863
|
*
|
|
10509
10864
|
* @param apiKey - The API key to validate (can be any type for graceful handling).
|
|
10510
10865
|
* @returns True if the API key is valid, false otherwise.
|
|
@@ -10512,7 +10867,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10512
10867
|
* @remarks
|
|
10513
10868
|
* This function handles invalid inputs gracefully by returning false rather than
|
|
10514
10869
|
* throwing errors. It validates:
|
|
10515
|
-
* - The key
|
|
10870
|
+
* - The key carries a recognized prefix — `<ENV>_API_KEY:` for a Circle platform
|
|
10871
|
+
* API key, or `KIT_KEY:` for the legacy kit key
|
|
10516
10872
|
* - Contains exactly three colon-separated parts
|
|
10517
10873
|
* - keyId and keySecret contain only valid characters (alphanumeric, `-`, `_`, `.`)
|
|
10518
10874
|
* - keyId and keySecret are non-empty
|
|
@@ -10520,23 +10876,62 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
|
|
|
10520
10876
|
*
|
|
10521
10877
|
* Valid characters in keyId and keySecret: `a-z`, `A-Z`, `0-9`, `-`, `_`, `.`
|
|
10522
10878
|
*
|
|
10879
|
+
* Format is checked locally only so an obviously malformed credential fails
|
|
10880
|
+
* before a request is made. The Stablecoin Service remains the authority on
|
|
10881
|
+
* whether a well-formed key is actually accepted.
|
|
10882
|
+
*
|
|
10523
10883
|
* @example
|
|
10524
10884
|
* ```typescript
|
|
10525
10885
|
* import { isValidApiKey } from '@core/service-client'
|
|
10526
10886
|
*
|
|
10527
10887
|
* // Valid API key
|
|
10528
|
-
* const isValid = isValidApiKey('
|
|
10888
|
+
* const isValid = isValidApiKey('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
|
|
10529
10889
|
* console.log(isValid) // true
|
|
10530
10890
|
*
|
|
10891
|
+
* // Legacy kit keys remain valid
|
|
10892
|
+
* console.log(isValidApiKey('KIT_KEY:my-key-id:my-key-secret')) // true
|
|
10893
|
+
*
|
|
10531
10894
|
* ```
|
|
10532
10895
|
*/ const isValidApiKey = (apiKey)=>{
|
|
10533
10896
|
// Handle invalid input types
|
|
10534
10897
|
if (typeof apiKey !== 'string') {
|
|
10535
10898
|
return false;
|
|
10536
10899
|
}
|
|
10537
|
-
const apiKeyPattern = /^KIT_KEY:[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$/;
|
|
10538
10900
|
// Validate without trimming - any whitespace will cause validation to fail
|
|
10539
|
-
return
|
|
10901
|
+
return API_KEY_PATTERN.test(apiKey);
|
|
10902
|
+
};
|
|
10903
|
+
/**
|
|
10904
|
+
* Resolve the credential to authenticate a Stablecoin Service request with.
|
|
10905
|
+
*
|
|
10906
|
+
* `apiKey` is the supported field; `kitKey` is the deprecated alias kept for
|
|
10907
|
+
* existing integrations. When both are supplied `apiKey` wins, so a caller
|
|
10908
|
+
* migrating field-by-field cannot be silently pinned to a stale credential.
|
|
10909
|
+
*
|
|
10910
|
+
* An empty-string value is treated as absent on either field. Without this, the
|
|
10911
|
+
* common `process.env.CIRCLE_API_KEY ?? ''` idiom (which yields `''` when the
|
|
10912
|
+
* variable is unset) would either shadow a working `kitKey` or, on a bare
|
|
10913
|
+
* `kitKey: ''`, reach downstream validation as an invalid credential instead of
|
|
10914
|
+
* falling through to the permissionless path.
|
|
10915
|
+
*
|
|
10916
|
+
* @param source - Object carrying either credential field, or neither.
|
|
10917
|
+
* @returns The credential to use, or `undefined` for the permissionless
|
|
10918
|
+
* (keyless) path.
|
|
10919
|
+
*
|
|
10920
|
+
* @example
|
|
10921
|
+
* ```typescript
|
|
10922
|
+
* import { resolveApiKey } from '@core/service-client'
|
|
10923
|
+
*
|
|
10924
|
+
* resolveApiKey({ apiKey: 'TEST_API_KEY:id:secret' }) // 'TEST_API_KEY:id:secret'
|
|
10925
|
+
* resolveApiKey({ kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
|
|
10926
|
+
* resolveApiKey({ apiKey: '', kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
|
|
10927
|
+
* resolveApiKey({ kitKey: '' }) // undefined
|
|
10928
|
+
* resolveApiKey({}) // undefined
|
|
10929
|
+
* ```
|
|
10930
|
+
*/ const resolveApiKey = (source)=>{
|
|
10931
|
+
// Treat an empty-string value as absent on either field so the
|
|
10932
|
+
// `env ?? ''` idiom falls through to the next credential (or permissionless).
|
|
10933
|
+
const normalize = (value)=>value !== undefined && value !== '' ? value : undefined;
|
|
10934
|
+
return normalize(source.apiKey) ?? normalize(source.kitKey);
|
|
10540
10935
|
};
|
|
10541
10936
|
|
|
10542
10937
|
/**
|
|
@@ -11273,7 +11668,7 @@ const abiParameterSchema = z.object({
|
|
|
11273
11668
|
*/ z.object({
|
|
11274
11669
|
type: z.literal('evm'),
|
|
11275
11670
|
abi: abiSchema,
|
|
11276
|
-
address: evmAddressSchema,
|
|
11671
|
+
address: evmAddressSchema$1,
|
|
11277
11672
|
functionName: z.string({
|
|
11278
11673
|
required_error: 'Function name is required',
|
|
11279
11674
|
invalid_type_error: 'Function name must be a string'
|
|
@@ -11310,7 +11705,7 @@ const abiParameterSchema = z.object({
|
|
|
11310
11705
|
* }
|
|
11311
11706
|
* ```
|
|
11312
11707
|
*/ z.object({
|
|
11313
|
-
address: evmAddressSchema,
|
|
11708
|
+
address: evmAddressSchema$1,
|
|
11314
11709
|
value: z.bigint({
|
|
11315
11710
|
required_error: 'Value is required for native transfers',
|
|
11316
11711
|
invalid_type_error: 'Value must be a bigint'
|
|
@@ -11478,7 +11873,7 @@ z.object({
|
|
|
11478
11873
|
signature: evmSignatureSchema,
|
|
11479
11874
|
tokenInputs: z.array(z.object({
|
|
11480
11875
|
permitType: z.nativeEnum(PermitType),
|
|
11481
|
-
token: evmAddressSchema,
|
|
11876
|
+
token: evmAddressSchema$1,
|
|
11482
11877
|
amount: z.bigint().refine((value)=>value >= 0n, {
|
|
11483
11878
|
message: 'amount must be a non-negative bigint'
|
|
11484
11879
|
}),
|
|
@@ -11898,7 +12293,7 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11898
12293
|
/**
|
|
11899
12294
|
* Fee recipient address (required).
|
|
11900
12295
|
* Must be a valid EVM address or Solana address.
|
|
11901
|
-
*/ recipientAddress: z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
12296
|
+
*/ recipientAddress: z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
11902
12297
|
message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
|
|
11903
12298
|
})
|
|
11904
12299
|
}).strict();
|
|
@@ -11910,7 +12305,8 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11910
12305
|
* - slippageBps: Optional positive number for slippage tolerance
|
|
11911
12306
|
* - stopLimit: Optional decimal string for minimum output
|
|
11912
12307
|
* - customFee: Optional fee configuration
|
|
11913
|
-
* -
|
|
12308
|
+
* - apiKey: Optional credential string
|
|
12309
|
+
* - kitKey: Optional credential string (deprecated alias for apiKey)
|
|
11914
12310
|
*/ const swapConfigSchema = z.object({
|
|
11915
12311
|
allowanceStrategy: allowanceStrategySchema.optional(),
|
|
11916
12312
|
slippageBps: z.number().int().min(0).optional(),
|
|
@@ -11920,11 +12316,12 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
|
|
|
11920
12316
|
attributeName: 'stopLimit'
|
|
11921
12317
|
})(z.string())).optional(),
|
|
11922
12318
|
customFee: swapCustomFeeSchema.optional(),
|
|
12319
|
+
apiKey: z.string().optional(),
|
|
11923
12320
|
kitKey: z.string().optional()
|
|
11924
12321
|
});
|
|
11925
12322
|
const swapDestinationSchema = z.object({
|
|
11926
12323
|
chain: optionalSwapChainIdentifierField,
|
|
11927
|
-
recipientAddress: z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
12324
|
+
recipientAddress: z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
|
|
11928
12325
|
message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
|
|
11929
12326
|
}).optional()
|
|
11930
12327
|
}).strict();
|
|
@@ -13357,7 +13754,7 @@ new Set(Object.values(Blockchain));
|
|
|
13357
13754
|
registerKit(`${pkg$2.name}/${pkg$2.version}`);
|
|
13358
13755
|
|
|
13359
13756
|
var name$1 = "@circle-fin/earn-kit";
|
|
13360
|
-
var version$1 = "1.
|
|
13757
|
+
var version$1 = "1.6.0";
|
|
13361
13758
|
var pkg$1 = {
|
|
13362
13759
|
name: name$1,
|
|
13363
13760
|
version: version$1};
|
|
@@ -13573,7 +13970,7 @@ function toSdkChain(chain) {
|
|
|
13573
13970
|
*
|
|
13574
13971
|
* @internal
|
|
13575
13972
|
*/ function assertHexAddress(field, value, message = `${field} must be a 0x-prefixed 20-byte hex address`) {
|
|
13576
|
-
const result = evmAddressSchema.safeParse(value);
|
|
13973
|
+
const result = evmAddressSchema$1.safeParse(value);
|
|
13577
13974
|
if (!result.success) {
|
|
13578
13975
|
throw createValidationFailedError(field, value, message);
|
|
13579
13976
|
}
|
|
@@ -15221,7 +15618,7 @@ const EARN_OPERATIONS = new Set([
|
|
|
15221
15618
|
// Store the original service params non-enumerably. `retry()` reads them by
|
|
15222
15619
|
// direct property access (`trace.params`), but JSON.stringify, console.log,
|
|
15223
15620
|
// and telemetry serializers skip non-enumerable properties — so a
|
|
15224
|
-
// permissioned call's `config.
|
|
15621
|
+
// permissioned call's `config.apiKey` (a credential value) and
|
|
15225
15622
|
// the in-memory adapter never leak through a logged error. defineProperty
|
|
15226
15623
|
// also redefines any enumerable `params` an upstream trace may have carried.
|
|
15227
15624
|
Object.defineProperty(trace, 'params', {
|
|
@@ -15292,7 +15689,7 @@ function isNonNegativeBigIntLike(value) {
|
|
|
15292
15689
|
}
|
|
15293
15690
|
}
|
|
15294
15691
|
const hexSignatureSchema = evmSignatureSchema;
|
|
15295
|
-
const hexAddressSchema = evmAddressSchema;
|
|
15692
|
+
const hexAddressSchema = evmAddressSchema$1;
|
|
15296
15693
|
// '0x' prefix + 32 bytes * 2 hex chars.
|
|
15297
15694
|
const BYTES32_HEX_LENGTH = 66;
|
|
15298
15695
|
const bridgeFeeTokenSchema = hexAddressSchema;
|
|
@@ -16261,7 +16658,7 @@ const bridgeDepositPrepareReviewSchema = z.object({
|
|
|
16261
16658
|
}
|
|
16262
16659
|
|
|
16263
16660
|
var name = "@circle-fin/provider-earn-service";
|
|
16264
|
-
var version = "1.
|
|
16661
|
+
var version = "1.5.0";
|
|
16265
16662
|
var pkg = {
|
|
16266
16663
|
name: name,
|
|
16267
16664
|
version: version};
|
|
@@ -16323,10 +16720,12 @@ var pkg = {
|
|
|
16323
16720
|
*
|
|
16324
16721
|
* @internal
|
|
16325
16722
|
*/ function buildConfig(serviceConfig) {
|
|
16326
|
-
|
|
16327
|
-
//
|
|
16328
|
-
|
|
16329
|
-
|
|
16723
|
+
const apiKey = resolveApiKey(serviceConfig ?? {});
|
|
16724
|
+
// The credential is a server-only secret. Reject it in the browser so it
|
|
16725
|
+
// cannot leak into a client bundle (no-op in Node.js). Keyless usage stays
|
|
16726
|
+
// allowed.
|
|
16727
|
+
if (apiKey !== undefined && isBrowserEnvironment()) {
|
|
16728
|
+
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');
|
|
16330
16729
|
}
|
|
16331
16730
|
const baseUrl = serviceConfig?.baseUrl ?? EARN_SERVICE_BASE_URL;
|
|
16332
16731
|
// The API CORS policy does not allow this custom header. Keep the existing
|
|
@@ -16335,7 +16734,7 @@ var pkg = {
|
|
|
16335
16734
|
const sdkVersionHeader = isNodeEnvironment() ? {
|
|
16336
16735
|
[SDK_VERSION_HEADER]: resolveSdkVersionHeader()
|
|
16337
16736
|
} : {};
|
|
16338
|
-
if (
|
|
16737
|
+
if (apiKey === undefined) {
|
|
16339
16738
|
return {
|
|
16340
16739
|
pollingConfig: {
|
|
16341
16740
|
...DEFAULT_CONFIG,
|
|
@@ -16347,11 +16746,11 @@ var pkg = {
|
|
|
16347
16746
|
baseUrl
|
|
16348
16747
|
};
|
|
16349
16748
|
}
|
|
16350
|
-
if (!isValidApiKey(
|
|
16749
|
+
if (!isValidApiKey(apiKey)) {
|
|
16351
16750
|
throw new KitError({
|
|
16352
16751
|
...InputError.VALIDATION_FAILED,
|
|
16353
16752
|
recoverability: 'FATAL',
|
|
16354
|
-
message: 'Invalid
|
|
16753
|
+
message: 'Invalid apiKey format. Expected <ENV>_API_KEY:<keyId>:<keySecret> (for example TEST_API_KEY:...), or a legacy KIT_KEY:<keyId>:<keySecret>.'
|
|
16355
16754
|
});
|
|
16356
16755
|
}
|
|
16357
16756
|
return {
|
|
@@ -16360,7 +16759,7 @@ var pkg = {
|
|
|
16360
16759
|
headers: {
|
|
16361
16760
|
...DEFAULT_CONFIG.headers,
|
|
16362
16761
|
...sdkVersionHeader,
|
|
16363
|
-
Authorization: `Bearer ${
|
|
16762
|
+
Authorization: `Bearer ${apiKey}`
|
|
16364
16763
|
}
|
|
16365
16764
|
},
|
|
16366
16765
|
baseUrl
|
|
@@ -17667,9 +18066,9 @@ function finishElapsedWait(lastStatus, lastError) {
|
|
|
17667
18066
|
* // Permissionless mode
|
|
17668
18067
|
* const provider = new EarnServiceProvider()
|
|
17669
18068
|
*
|
|
17670
|
-
* // Permissioned mode with
|
|
18069
|
+
* // Permissioned mode with an API key
|
|
17671
18070
|
* const provider = new EarnServiceProvider({
|
|
17672
|
-
*
|
|
18071
|
+
* apiKey: 'TEST_API_KEY:keyId:keySecret',
|
|
17673
18072
|
* })
|
|
17674
18073
|
*
|
|
17675
18074
|
* // Custom base URL for testing
|
|
@@ -18896,7 +19295,7 @@ function findProvider(context, chain, operation = 'earn') {
|
|
|
18896
19295
|
* fast instead of round-tripping to the service.
|
|
18897
19296
|
*
|
|
18898
19297
|
* @internal
|
|
18899
|
-
*/ 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');
|
|
19298
|
+
*/ 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');
|
|
18900
19299
|
/**
|
|
18901
19300
|
* Schema for the adapter context within earn operations.
|
|
18902
19301
|
*
|
|
@@ -18928,19 +19327,39 @@ const sourceAdapterContextSchema = z.object({
|
|
|
18928
19327
|
/**
|
|
18929
19328
|
* Schema for the EarnConfig options.
|
|
18930
19329
|
*
|
|
18931
|
-
* Validate the
|
|
18932
|
-
*
|
|
18933
|
-
*
|
|
18934
|
-
*
|
|
18935
|
-
*
|
|
18936
|
-
*
|
|
19330
|
+
* Validate the *resolved* credential using the standard `apiKeySchema` format
|
|
19331
|
+
* (`<ENV>_API_KEY:<keyId>:<keySecret>`, or a legacy
|
|
19332
|
+
* `KIT_KEY:<keyId>:<keySecret>`). `apiKey` takes precedence over the deprecated
|
|
19333
|
+
* `kitKey`, so a malformed `kitKey` that is being ignored must not fail a config
|
|
19334
|
+
* that supplies a valid `apiKey` (and vice versa) — only the credential that
|
|
19335
|
+
* would actually be sent is format-checked. When neither is supplied the SDK
|
|
19336
|
+
* operates in permissionless mode. `baseUrl` overrides the Earn Service endpoint
|
|
19337
|
+
* (e.g. staging); `batchTransactions: false` opts out of atomic batched
|
|
19338
|
+
* execution. All are forwarded to the provider, so this `.strict()` schema must
|
|
19339
|
+
* accept them or a valid config object is rejected.
|
|
18937
19340
|
*
|
|
18938
19341
|
* @internal
|
|
18939
19342
|
*/ const earnConfigSchema = z.object({
|
|
18940
|
-
|
|
19343
|
+
apiKey: z.string().optional(),
|
|
19344
|
+
kitKey: z.string().optional(),
|
|
18941
19345
|
baseUrl: z.string().optional(),
|
|
18942
19346
|
batchTransactions: z.boolean().optional()
|
|
18943
|
-
}).strict()
|
|
19347
|
+
}).strict().superRefine((config, ctx)=>{
|
|
19348
|
+
const credential = resolveApiKey(config);
|
|
19349
|
+
if (credential === undefined) {
|
|
19350
|
+
return;
|
|
19351
|
+
}
|
|
19352
|
+
const result = apiKeySchema.safeParse(credential);
|
|
19353
|
+
if (!result.success) {
|
|
19354
|
+
ctx.addIssue({
|
|
19355
|
+
code: z.ZodIssueCode.custom,
|
|
19356
|
+
path: [
|
|
19357
|
+
credential === config.apiKey ? 'apiKey' : 'kitKey'
|
|
19358
|
+
],
|
|
19359
|
+
message: result.error.issues[0]?.message ?? 'Invalid API key format'
|
|
19360
|
+
});
|
|
19361
|
+
}
|
|
19362
|
+
});
|
|
18944
19363
|
/**
|
|
18945
19364
|
* Canonical decimal form: a leading digit with no leading zeros (a single
|
|
18946
19365
|
* '0' is only allowed immediately before the decimal point). Rejects the
|
|
@@ -19012,7 +19431,7 @@ const sourceAdapterContextSchema = z.object({
|
|
|
19012
19431
|
* currently supports EVM vault addresses on Arc Testnet.
|
|
19013
19432
|
*
|
|
19014
19433
|
* @internal
|
|
19015
|
-
*/ const vaultAddressSchema = evmAddressSchema.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19434
|
+
*/ const vaultAddressSchema = evmAddressSchema$1.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
|
|
19016
19435
|
/**
|
|
19017
19436
|
* Validation schema for VaultQuery.
|
|
19018
19437
|
*
|
|
@@ -19287,7 +19706,7 @@ const sameChainGetDepositQuoteParamsSchema = z.object({
|
|
|
19287
19706
|
const crossChainGetDepositQuoteParamsSchema = z.object({
|
|
19288
19707
|
from: sourceAdapterContextSchema,
|
|
19289
19708
|
chain: earnBridgeDestinationChainIdentifierSchema,
|
|
19290
|
-
address: evmAddressSchema,
|
|
19709
|
+
address: evmAddressSchema$1,
|
|
19291
19710
|
vaultAddress: vaultAddressSchema,
|
|
19292
19711
|
amount: amountSchema,
|
|
19293
19712
|
transferSpeed: z.enum([
|