@circle-fin/app-kit 1.12.0 → 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/estimateSwap.mjs CHANGED
@@ -2981,6 +2981,8 @@ class KitError extends Error {
2981
2981
  Blockchain["Optimism_Sepolia"] = "Optimism_Sepolia";
2982
2982
  Blockchain["Pharos"] = "Pharos";
2983
2983
  Blockchain["Pharos_Testnet"] = "Pharos_Testnet";
2984
+ Blockchain["Plasma"] = "Plasma";
2985
+ Blockchain["Plasma_Testnet"] = "Plasma_Testnet";
2984
2986
  Blockchain["Polkadot_Asset_Hub"] = "Polkadot_Asset_Hub";
2985
2987
  Blockchain["Polkadot_Westmint"] = "Polkadot_Westmint";
2986
2988
  Blockchain["Plume"] = "Plume";
@@ -3050,6 +3052,7 @@ var BridgeChain;
3050
3052
  BridgeChain["Morph"] = "Morph";
3051
3053
  BridgeChain["Optimism"] = "Optimism";
3052
3054
  BridgeChain["Pharos"] = "Pharos";
3055
+ BridgeChain["Plasma"] = "Plasma";
3053
3056
  BridgeChain["Plume"] = "Plume";
3054
3057
  BridgeChain["Polygon"] = "Polygon";
3055
3058
  BridgeChain["Sei"] = "Sei";
@@ -3076,6 +3079,7 @@ var BridgeChain;
3076
3079
  BridgeChain["Morph_Testnet"] = "Morph_Testnet";
3077
3080
  BridgeChain["Optimism_Sepolia"] = "Optimism_Sepolia";
3078
3081
  BridgeChain["Pharos_Testnet"] = "Pharos_Testnet";
3082
+ BridgeChain["Plasma_Testnet"] = "Plasma_Testnet";
3079
3083
  BridgeChain["Plume_Testnet"] = "Plume_Testnet";
3080
3084
  BridgeChain["Polygon_Amoy_Testnet"] = "Polygon_Amoy_Testnet";
3081
3085
  BridgeChain["Sei_Testnet"] = "Sei_Testnet";
@@ -3533,6 +3537,8 @@ var EarnChain;
3533
3537
  * This program handles minting operations for Gateway transactions
3534
3538
  * on Solana devnet.
3535
3539
  */ const GATEWAY_MINTER_SOLANA_DEVNET = 'GATEmKK2ECL1brEngQZWCgMWPbvrEYqsV6u29dAaHavr';
3540
+ /** TokenMessengerWithFees address shared by enabled EVM mainnet sources. */ const TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET = '0x71f54F818671cD0D7ea140Da213e5C8b5C92a408';
3541
+ /** TokenMessengerWithFees address shared by enabled EVM testnet sources. */ const TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET = '0x8745D906D67C346E5eb1aEEED38Eb87F34DF0C0A';
3536
3542
 
3537
3543
  /**
3538
3544
  * Arc Testnet chain definition
@@ -3570,6 +3576,7 @@ var EarnChain;
3570
3576
  v2: {
3571
3577
  type: 'split',
3572
3578
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
3579
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
3573
3580
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
3574
3581
  confirmations: 1,
3575
3582
  fastConfirmations: 1
@@ -3637,6 +3644,7 @@ var EarnChain;
3637
3644
  v2: {
3638
3645
  type: 'split',
3639
3646
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
3647
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
3640
3648
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
3641
3649
  confirmations: 65,
3642
3650
  fastConfirmations: 1
@@ -3701,6 +3709,7 @@ var EarnChain;
3701
3709
  v2: {
3702
3710
  type: 'split',
3703
3711
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
3712
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
3704
3713
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
3705
3714
  confirmations: 65,
3706
3715
  fastConfirmations: 1
@@ -3765,6 +3774,7 @@ var EarnChain;
3765
3774
  v2: {
3766
3775
  type: 'split',
3767
3776
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
3777
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
3768
3778
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
3769
3779
  confirmations: 1,
3770
3780
  fastConfirmations: 1
@@ -3826,6 +3836,7 @@ var EarnChain;
3826
3836
  v2: {
3827
3837
  type: 'split',
3828
3838
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
3839
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
3829
3840
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
3830
3841
  confirmations: 1,
3831
3842
  fastConfirmations: 1
@@ -3893,6 +3904,7 @@ var EarnChain;
3893
3904
  v2: {
3894
3905
  type: 'split',
3895
3906
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
3907
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
3896
3908
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
3897
3909
  confirmations: 65,
3898
3910
  fastConfirmations: 1
@@ -3957,6 +3969,7 @@ var EarnChain;
3957
3969
  v2: {
3958
3970
  type: 'split',
3959
3971
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
3972
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
3960
3973
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
3961
3974
  confirmations: 65,
3962
3975
  fastConfirmations: 1
@@ -4067,6 +4080,7 @@ var EarnChain;
4067
4080
  v2: {
4068
4081
  type: 'split',
4069
4082
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
4083
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
4070
4084
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
4071
4085
  confirmations: 65,
4072
4086
  fastConfirmations: 1
@@ -4111,6 +4125,7 @@ var EarnChain;
4111
4125
  v2: {
4112
4126
  type: 'split',
4113
4127
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
4128
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
4114
4129
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
4115
4130
  confirmations: 65,
4116
4131
  fastConfirmations: 1
@@ -4342,6 +4357,7 @@ var EarnChain;
4342
4357
  v2: {
4343
4358
  type: 'split',
4344
4359
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
4360
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
4345
4361
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
4346
4362
  confirmations: 65,
4347
4363
  fastConfirmations: 2
@@ -4406,6 +4422,7 @@ var EarnChain;
4406
4422
  v2: {
4407
4423
  type: 'split',
4408
4424
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
4425
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
4409
4426
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
4410
4427
  confirmations: 65,
4411
4428
  fastConfirmations: 2
@@ -4516,6 +4533,7 @@ var EarnChain;
4516
4533
  v2: {
4517
4534
  type: 'split',
4518
4535
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
4536
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
4519
4537
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
4520
4538
  confirmations: 1,
4521
4539
  fastConfirmations: 1
@@ -4575,6 +4593,7 @@ var EarnChain;
4575
4593
  v2: {
4576
4594
  type: 'split',
4577
4595
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
4596
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
4578
4597
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
4579
4598
  confirmations: 1,
4580
4599
  fastConfirmations: 1
@@ -4729,6 +4748,7 @@ var EarnChain;
4729
4748
  v2: {
4730
4749
  type: 'split',
4731
4750
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
4751
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
4732
4752
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
4733
4753
  confirmations: 65,
4734
4754
  fastConfirmations: 1
@@ -4776,6 +4796,7 @@ var EarnChain;
4776
4796
  v2: {
4777
4797
  type: 'split',
4778
4798
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
4799
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
4779
4800
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
4780
4801
  confirmations: 65,
4781
4802
  fastConfirmations: 1
@@ -4820,6 +4841,7 @@ var EarnChain;
4820
4841
  v2: {
4821
4842
  type: 'split',
4822
4843
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
4844
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
4823
4845
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
4824
4846
  confirmations: 1,
4825
4847
  fastConfirmations: 1
@@ -4865,6 +4887,7 @@ var EarnChain;
4865
4887
  v2: {
4866
4888
  type: 'split',
4867
4889
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
4890
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
4868
4891
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
4869
4892
  confirmations: 1,
4870
4893
  fastConfirmations: 1
@@ -4911,6 +4934,7 @@ var EarnChain;
4911
4934
  v2: {
4912
4935
  type: 'split',
4913
4936
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
4937
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
4914
4938
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
4915
4939
  confirmations: 1,
4916
4940
  fastConfirmations: 1
@@ -5224,6 +5248,7 @@ var EarnChain;
5224
5248
  v2: {
5225
5249
  type: 'split',
5226
5250
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
5251
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
5227
5252
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
5228
5253
  confirmations: 65,
5229
5254
  fastConfirmations: 1
@@ -5288,6 +5313,7 @@ var EarnChain;
5288
5313
  v2: {
5289
5314
  type: 'split',
5290
5315
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
5316
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
5291
5317
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
5292
5318
  confirmations: 65,
5293
5319
  fastConfirmations: 1
@@ -5408,6 +5434,98 @@ var EarnChain;
5408
5434
  }
5409
5435
  });
5410
5436
 
5437
+ /**
5438
+ * Plasma Mainnet chain definition
5439
+ * @remarks
5440
+ * This represents the official production network for the Plasma blockchain.
5441
+ * Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
5442
+ * stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
5443
+ */ const Plasma = defineChain({
5444
+ type: 'evm',
5445
+ chain: Blockchain.Plasma,
5446
+ name: 'Plasma',
5447
+ title: 'Plasma Mainnet',
5448
+ nativeCurrency: {
5449
+ name: 'Plasma',
5450
+ symbol: 'XPL',
5451
+ decimals: 18
5452
+ },
5453
+ chainId: 9745,
5454
+ isTestnet: false,
5455
+ explorerUrl: 'https://plasmascan.to/tx/{hash}',
5456
+ rpcEndpoints: [
5457
+ 'https://rpc.plasma.to'
5458
+ ],
5459
+ eurcAddress: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
5460
+ usdcAddress: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
5461
+ usdtAddress: null,
5462
+ cctp: {
5463
+ domain: 33,
5464
+ contracts: {
5465
+ v2: {
5466
+ type: 'split',
5467
+ tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
5468
+ messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
5469
+ confirmations: 3,
5470
+ fastConfirmations: 1
5471
+ }
5472
+ },
5473
+ forwarderSupported: {
5474
+ source: false,
5475
+ destination: false
5476
+ }
5477
+ },
5478
+ kitContracts: {
5479
+ bridge: BRIDGE_CONTRACT_EVM_MAINNET
5480
+ }
5481
+ });
5482
+
5483
+ /**
5484
+ * Plasma Testnet chain definition
5485
+ * @remarks
5486
+ * This represents the official test network for the Plasma blockchain.
5487
+ * Plasma is an EVM-equivalent Layer 1 blockchain purpose-built for global
5488
+ * stablecoin payments, with deterministic BFT finality (PlasmaBFT/Fast-HotStuff).
5489
+ */ const PlasmaTestnet = defineChain({
5490
+ type: 'evm',
5491
+ chain: Blockchain.Plasma_Testnet,
5492
+ name: 'Plasma Testnet',
5493
+ title: 'Plasma Testnet',
5494
+ nativeCurrency: {
5495
+ name: 'Plasma',
5496
+ symbol: 'XPL',
5497
+ decimals: 18
5498
+ },
5499
+ chainId: 9746,
5500
+ isTestnet: true,
5501
+ explorerUrl: 'https://testnet.plasmascan.to/tx/{hash}',
5502
+ rpcEndpoints: [
5503
+ 'https://testnet-rpc.plasma.to'
5504
+ ],
5505
+ eurcAddress: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330',
5506
+ usdcAddress: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
5507
+ usdtAddress: null,
5508
+ cctp: {
5509
+ domain: 33,
5510
+ contracts: {
5511
+ v2: {
5512
+ type: 'split',
5513
+ tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
5514
+ messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
5515
+ confirmations: 3,
5516
+ fastConfirmations: 1
5517
+ }
5518
+ },
5519
+ forwarderSupported: {
5520
+ source: false,
5521
+ destination: false
5522
+ }
5523
+ },
5524
+ kitContracts: {
5525
+ bridge: BRIDGE_CONTRACT_EVM_TESTNET
5526
+ }
5527
+ });
5528
+
5411
5529
  /**
5412
5530
  * Plume Mainnet chain definition
5413
5531
  * @remarks
@@ -5439,6 +5557,7 @@ var EarnChain;
5439
5557
  v2: {
5440
5558
  type: 'split',
5441
5559
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
5560
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
5442
5561
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
5443
5562
  confirmations: 65,
5444
5563
  fastConfirmations: 1
@@ -5485,6 +5604,7 @@ var EarnChain;
5485
5604
  v2: {
5486
5605
  type: 'split',
5487
5606
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
5607
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
5488
5608
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
5489
5609
  confirmations: 65,
5490
5610
  fastConfirmations: 1
@@ -5586,6 +5706,7 @@ var EarnChain;
5586
5706
  v2: {
5587
5707
  type: 'split',
5588
5708
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
5709
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
5589
5710
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
5590
5711
  confirmations: 33,
5591
5712
  fastConfirmations: 13
@@ -5651,6 +5772,7 @@ var EarnChain;
5651
5772
  v2: {
5652
5773
  type: 'split',
5653
5774
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
5775
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
5654
5776
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
5655
5777
  confirmations: 33,
5656
5778
  fastConfirmations: 13
@@ -5710,6 +5832,7 @@ var EarnChain;
5710
5832
  v2: {
5711
5833
  type: 'split',
5712
5834
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
5835
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
5713
5836
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
5714
5837
  confirmations: 1,
5715
5838
  fastConfirmations: 1
@@ -5769,6 +5892,7 @@ var EarnChain;
5769
5892
  v2: {
5770
5893
  type: 'split',
5771
5894
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
5895
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
5772
5896
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
5773
5897
  confirmations: 1,
5774
5898
  fastConfirmations: 1
@@ -5826,6 +5950,7 @@ var EarnChain;
5826
5950
  v2: {
5827
5951
  type: 'split',
5828
5952
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
5953
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
5829
5954
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
5830
5955
  confirmations: 1,
5831
5956
  fastConfirmations: 1
@@ -5884,6 +6009,7 @@ var EarnChain;
5884
6009
  v2: {
5885
6010
  type: 'split',
5886
6011
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
6012
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
5887
6013
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
5888
6014
  confirmations: 1,
5889
6015
  fastConfirmations: 1
@@ -6199,6 +6325,7 @@ var EarnChain;
6199
6325
  v2: {
6200
6326
  type: 'split',
6201
6327
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
6328
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
6202
6329
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
6203
6330
  confirmations: 65,
6204
6331
  fastConfirmations: 1
@@ -6263,6 +6390,7 @@ var EarnChain;
6263
6390
  v2: {
6264
6391
  type: 'split',
6265
6392
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
6393
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
6266
6394
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
6267
6395
  confirmations: 65,
6268
6396
  fastConfirmations: 1
@@ -6320,6 +6448,7 @@ var EarnChain;
6320
6448
  v2: {
6321
6449
  type: 'split',
6322
6450
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cF5d',
6451
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
6323
6452
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
6324
6453
  confirmations: 65,
6325
6454
  fastConfirmations: 1
@@ -6379,6 +6508,7 @@ var EarnChain;
6379
6508
  v2: {
6380
6509
  type: 'split',
6381
6510
  tokenMessenger: '0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa',
6511
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
6382
6512
  messageTransmitter: '0xe737e5cebeeba77efe34d4aa090756590b1ce275',
6383
6513
  confirmations: 65,
6384
6514
  fastConfirmations: 1
@@ -6439,6 +6569,7 @@ var EarnChain;
6439
6569
  v2: {
6440
6570
  type: 'split',
6441
6571
  tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
6572
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_MAINNET,
6442
6573
  messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
6443
6574
  confirmations: 3,
6444
6575
  fastConfirmations: 3
@@ -6484,6 +6615,7 @@ var EarnChain;
6484
6615
  v2: {
6485
6616
  type: 'split',
6486
6617
  tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
6618
+ tokenMessengerWithFees: TOKEN_MESSENGER_WITH_FEES_EVM_TESTNET,
6487
6619
  messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
6488
6620
  confirmations: 3,
6489
6621
  fastConfirmations: 1
@@ -6694,6 +6826,8 @@ var Chains = /*#__PURE__*/Object.freeze({
6694
6826
  OptimismSepolia: OptimismSepolia,
6695
6827
  Pharos: Pharos,
6696
6828
  PharosTestnet: PharosTestnet,
6829
+ Plasma: Plasma,
6830
+ PlasmaTestnet: PlasmaTestnet,
6697
6831
  Plume: Plume,
6698
6832
  PlumeTestnet: PlumeTestnet,
6699
6833
  PolkadotAssetHub: PolkadotAssetHub,
@@ -8735,6 +8869,7 @@ const swapTokenEnumSchema = z.enum([
8735
8869
  [Blockchain.Noble]: 'uusdc',
8736
8870
  [Blockchain.Optimism]: '0x0b2c639c533813f4aa9d7837caf62653d097ff85',
8737
8871
  [Blockchain.Pharos]: '0xC879C018dB60520F4355C26eD1a6D572cdAC1815',
8872
+ [Blockchain.Plasma]: '0x2d661C89D812261039AF9764eceaAee884f5F67F',
8738
8873
  [Blockchain.Plume]: '0x222365EF19F7947e5484218551B56bb3965Aa7aF',
8739
8874
  [Blockchain.Polkadot_Asset_Hub]: '1337',
8740
8875
  [Blockchain.Polygon]: '0x3c499c542cef5e3811e1192ce70d8cc03d5c3359',
@@ -8755,6 +8890,7 @@ const swapTokenEnumSchema = z.enum([
8755
8890
  [Blockchain.Arbitrum_Sepolia]: '0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d',
8756
8891
  [Blockchain.Avalanche_Fuji]: '0x5425890298aed601595a70AB815c96711a31Bc65',
8757
8892
  [Blockchain.Base_Sepolia]: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
8893
+ [Blockchain.Celo_Alfajores_Testnet]: '0x2F25deB3848C207fc8E0c34035B3Ba7fC157602B',
8758
8894
  [Blockchain.Codex_Testnet]: '0x6d7f141b6819C2c9CC2f818e6ad549E7Ca090F8f',
8759
8895
  [Blockchain.Cronos_Testnet]: '0xEb33dc5fac03833e132593659e1dE7256aB59794',
8760
8896
  [Blockchain.Edge_Testnet]: '0x2d9F7CAD728051AA35Ecdc472a14cf8cDF5CFD6B',
@@ -8770,6 +8906,7 @@ const swapTokenEnumSchema = z.enum([
8770
8906
  [Blockchain.Noble_Testnet]: 'uusdc',
8771
8907
  [Blockchain.Optimism_Sepolia]: '0x5fd84259d66Cd46123540766Be93DFE6D43130D7',
8772
8908
  [Blockchain.Pharos_Testnet]: '0xcfC8330f4BCAB529c625D12781b1C19466A9Fc8B',
8909
+ [Blockchain.Plasma_Testnet]: '0xE67Fb267022cBA8064Dd388CC2FED724F3120D9D',
8773
8910
  [Blockchain.Plume_Testnet]: '0xcB5f30e335672893c7eb944B374c196392C19D18',
8774
8911
  [Blockchain.Polkadot_Westmint]: '31337',
8775
8912
  [Blockchain.Polygon_Amoy_Testnet]: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
@@ -8832,6 +8969,7 @@ const swapTokenEnumSchema = z.enum([
8832
8969
  [Blockchain.Base]: '0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42',
8833
8970
  [Blockchain.Cronos]: '0xA6dE01a2d62C6B5f3525d768f34d276652C554c8',
8834
8971
  [Blockchain.Ethereum]: '0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c',
8972
+ [Blockchain.Plasma]: '0x3EE196E78d4d4248b849B8E1C7F44C5457FAFD2C',
8835
8973
  [Blockchain.Solana]: 'HzwqbKZw8HxMN6bF2yFZNrht3c2iXXzpKcFu7uBEDKtr',
8836
8974
  [Blockchain.World_Chain]: '0x1C60ba0A0eD1019e8Eb035E6daF4155A5cE2380B',
8837
8975
  // =========================================================================
@@ -8840,7 +8978,8 @@ const swapTokenEnumSchema = z.enum([
8840
8978
  [Blockchain.Arc_Testnet]: '0x89B50855Aa3bE2F677cD6303Cec089B5F319D72a',
8841
8979
  [Blockchain.Base_Sepolia]: '0x808456652fdb597867f38412077A9182bf77359F',
8842
8980
  [Blockchain.Cronos_Testnet]: '0x31f7538adb53cF16350e6B0c89d03D91b7D12c46',
8843
- [Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4'
8981
+ [Blockchain.Ethereum_Sepolia]: '0x08210F9170F89Ab7658F0B5E3fF39b0E03C594D4',
8982
+ [Blockchain.Plasma_Testnet]: '0x98AfA0F93Dd993B736399f9074eDcEBD1985A330'
8844
8983
  }
8845
8984
  };
8846
8985
 
@@ -10069,7 +10208,7 @@ const swapTokenEnumSchema = z.enum([
10069
10208
  }
10070
10209
 
10071
10210
  var name$2 = "@circle-fin/bridge-kit";
10072
- var version$2 = "1.13.0";
10211
+ var version$2 = "1.14.0";
10073
10212
  var pkg$2 = {
10074
10213
  name: name$2,
10075
10214
  version: version$2};
@@ -10122,6 +10261,44 @@ var pkg$2 = {
10122
10261
  }
10123
10262
  });
10124
10263
 
10264
+ /**
10265
+ * Canonical list of actions that do not prepare or submit transactions.
10266
+ *
10267
+ * @internal
10268
+ */ const READ_ACTION_KEYS = [
10269
+ 'token.allowance',
10270
+ 'token.balanceOf',
10271
+ 'token.name',
10272
+ 'native.balanceOf',
10273
+ 'usdc.allowance',
10274
+ 'usdc.balanceOf',
10275
+ 'usdc.name',
10276
+ 'gateway.v1.isDelegate',
10277
+ 'gateway.v1.withdrawingBalance',
10278
+ 'gateway.v1.withdrawalBlock',
10279
+ 'gateway.v1.signBurnIntents'
10280
+ ];
10281
+ const READ_ACTION_KEY_SET = new Set(READ_ACTION_KEYS);
10282
+ /**
10283
+ * Check whether a runtime value identifies a read action.
10284
+ *
10285
+ * @param action - The value to classify.
10286
+ * @returns Whether the value is a registered read-action key.
10287
+ *
10288
+ * @example
10289
+ * ```typescript
10290
+ * import { isReadActionKey } from '@core/adapter'
10291
+ *
10292
+ * if (isReadActionKey(value)) {
10293
+ * await adapter.readAction(value, params, context)
10294
+ * }
10295
+ * ```
10296
+ *
10297
+ * @internal
10298
+ */ function isReadActionKey(action) {
10299
+ return typeof action === 'string' && READ_ACTION_KEY_SET.has(action);
10300
+ }
10301
+
10125
10302
  /**
10126
10303
  * Resolves an operation context into concrete chain and address values.
10127
10304
  *
@@ -10201,6 +10378,141 @@ var pkg$2 = {
10201
10378
  };
10202
10379
  }
10203
10380
 
10381
+ /**
10382
+ * Create the standard error for a missing or non-read action.
10383
+ *
10384
+ * @param action - The unsupported action value.
10385
+ * @returns A fatal unsupported-action error.
10386
+ *
10387
+ * @internal
10388
+ */ function createUnsupportedReadActionError(action) {
10389
+ return new KitError({
10390
+ ...InputError.UNSUPPORTED_ACTION,
10391
+ recoverability: 'FATAL',
10392
+ message: `Read action "${String(action)}" is not registered in this adapter.`
10393
+ });
10394
+ }
10395
+ /**
10396
+ * Execute a read through the adapter's dedicated read seam when available.
10397
+ *
10398
+ * @remarks
10399
+ * Fall back to the legacy `prepareAction().execute()` contract so providers
10400
+ * remain runtime-compatible with adapter versions released before `readAction`.
10401
+ * Consumers must upgrade their adapter package for reads to bypass custom
10402
+ * `prepareAction` wrappers.
10403
+ *
10404
+ * @typeParam TAdapterCapabilities - The adapter capabilities type.
10405
+ * @typeParam TActionKey - The read action key.
10406
+ * @param adapter - The adapter that owns the read action.
10407
+ * @param action - The read action to execute.
10408
+ * @param params - The parameters for the read action.
10409
+ * @param ctx - The operation context.
10410
+ * @returns The raw read-action result.
10411
+ * @throws {KitError} When `action` is not a supported read-action key.
10412
+ *
10413
+ * @example
10414
+ * ```typescript
10415
+ * import { executeAdapterReadAction } from '@core/adapter'
10416
+ * import { Ethereum } from '@core/chains'
10417
+ *
10418
+ * const allowance = await executeAdapterReadAction(
10419
+ * adapter,
10420
+ * 'token.allowance',
10421
+ * { tokenAddress, delegate },
10422
+ * { chain: Ethereum },
10423
+ * )
10424
+ * ```
10425
+ *
10426
+ * @internal
10427
+ */ async function executeAdapterReadAction(adapter, action, params, ctx) {
10428
+ if (!isReadActionKey(action)) {
10429
+ throw createUnsupportedReadActionError(action);
10430
+ }
10431
+ const runtimeAdapter = adapter;
10432
+ if (typeof runtimeAdapter.readAction === 'function') {
10433
+ return runtimeAdapter.readAction(action, params, ctx);
10434
+ }
10435
+ let request;
10436
+ try {
10437
+ request = await adapter.prepareAction(action, params, ctx);
10438
+ } catch (error) {
10439
+ if (error instanceof Error && error.message === `Action ${action} is not supported`) {
10440
+ throw createUnsupportedReadActionError(action);
10441
+ }
10442
+ throw error;
10443
+ }
10444
+ return request.execute();
10445
+ }
10446
+ /**
10447
+ * Read and parse a token allowance while supporting older adapter versions.
10448
+ *
10449
+ * @remarks
10450
+ * Prefer the adapter's dedicated read seam and fall back to the legacy
10451
+ * `prepareAction().execute()` contract when the runtime adapter predates it.
10452
+ *
10453
+ * @typeParam TAdapterCapabilities - The adapter capabilities type.
10454
+ * @param adapter - The adapter that owns the allowance action.
10455
+ * @param params - The token and delegate whose allowance is being read.
10456
+ * @param ctx - The operation context.
10457
+ * @returns The non-negative allowance in token base units.
10458
+ * @throws {KitError} When the action is unsupported or its response is malformed.
10459
+ *
10460
+ * @example
10461
+ * ```typescript
10462
+ * import { readTokenAllowance } from '@core/adapter'
10463
+ * import { Ethereum } from '@core/chains'
10464
+ *
10465
+ * const allowance = await readTokenAllowance(
10466
+ * adapter,
10467
+ * { tokenAddress, delegate },
10468
+ * { chain: Ethereum },
10469
+ * )
10470
+ * ```
10471
+ *
10472
+ * @internal
10473
+ */ async function readTokenAllowance(adapter, params, ctx) {
10474
+ return parseAllowanceResponse(await executeAdapterReadAction(adapter, 'token.allowance', params, ctx));
10475
+ }
10476
+ /**
10477
+ * Parse a raw token allowance response into base units.
10478
+ *
10479
+ * @param allowanceRaw - The adapter response, optionally wrapped as an Amount output.
10480
+ * @returns The non-negative allowance as a bigint, or zero for a missing value.
10481
+ * @throws {KitError} When the response cannot represent a non-negative bigint.
10482
+ *
10483
+ * @example
10484
+ * ```typescript
10485
+ * import { parseAllowanceResponse } from '@core/adapter'
10486
+ *
10487
+ * const allowance = parseAllowanceResponse({ amount: { raw: 1000000n } })
10488
+ * ```
10489
+ */ function parseAllowanceResponse(allowanceRaw) {
10490
+ let value = allowanceRaw;
10491
+ if (typeof value === 'object' && value !== null && 'amount' in value) {
10492
+ const amount = value.amount;
10493
+ if (typeof amount === 'object' && amount !== null && 'raw' in amount) {
10494
+ value = amount.raw;
10495
+ }
10496
+ }
10497
+ if (value === undefined || value === null) {
10498
+ return 0n;
10499
+ }
10500
+ let allowance;
10501
+ if (typeof value === 'bigint') {
10502
+ allowance = value;
10503
+ } else if (typeof value === 'string') {
10504
+ try {
10505
+ allowance = BigInt(value);
10506
+ } catch {
10507
+ allowance = undefined;
10508
+ }
10509
+ }
10510
+ if (allowance === undefined || allowance < 0n) {
10511
+ throw createValidationFailedError$1('token.allowance', value, 'token.allowance response must be a non-negative bigint-compatible string or bigint');
10512
+ }
10513
+ return allowance;
10514
+ }
10515
+
10204
10516
  /**
10205
10517
  * Schema for validating hexadecimal strings with '0x' prefix.
10206
10518
  *
@@ -10250,7 +10562,7 @@ var pkg$2 = {
10250
10562
  * const result = evmAddressSchema.safeParse(validAddress)
10251
10563
  * console.log(result.success) // true
10252
10564
  * ```
10253
- */ const evmAddressSchema = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
10565
+ */ const evmAddressSchema$1 = hexStringSchema.refine((value)=>value.length === 42, 'EVM address must be exactly 42 characters long (0x + 40 hex characters)').transform((value)=>value);
10254
10566
  /**
10255
10567
  * Schema for validating transaction hashes.
10256
10568
  *
@@ -10787,6 +11099,10 @@ var TransferSpeed;
10787
11099
  token: z.literal('USDC').optional(),
10788
11100
  config: z.object({
10789
11101
  transferSpeed: z.nativeEnum(TransferSpeed).optional(),
11102
+ feePayment: z.enum([
11103
+ 'source',
11104
+ 'destination'
11105
+ ]).optional(),
10790
11106
  maxFee: z.string().min(1, 'Required').pipe(createDecimalStringValidator({
10791
11107
  allowZero: true,
10792
11108
  regexMessage: MAX_FEE_FORMAT_ERROR_MESSAGE,
@@ -10794,7 +11110,8 @@ var TransferSpeed;
10794
11110
  maxDecimals: 6
10795
11111
  })(z.string())).optional(),
10796
11112
  customFee: customFeeSchema.optional()
10797
- }).optional()
11113
+ }).optional(),
11114
+ quote: z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex').optional()
10798
11115
  });
10799
11116
 
10800
11117
  /**
@@ -10972,13 +11289,182 @@ var TransferSpeed;
10972
11289
  * @internal
10973
11290
  */ Object.values(Chains).filter((chain)=>isCCTPV2Supported(chain));
10974
11291
 
11292
+ /** 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
11293
+ // regex check above fails ("dirty"), so guard BigInt() against throwing on a
11294
+ // non-numeric value before comparing.
11295
+ .refine((value)=>/^\d+$/.test(value) && BigInt(value) > 0n, 'must be greater than zero');
11296
+ /**
11297
+ * A 20-byte EVM address in `0x` hex.
11298
+ *
11299
+ * The MVP prepaid-`FORWARD` `burn/usdc` path targets EVM contracts
11300
+ * (`TokenMessengerWithFees` / `GenericExecutor`), so `feeToken` and
11301
+ * `destinationCaller` are constrained to EVM addresses by design. This is an
11302
+ * intentional scope limit, not a permanent one: it can be widened to other
11303
+ * address formats as the fee service expands to more chains.
11304
+ */ const evmAddressSchema = z.string().regex(/^0x[a-fA-F0-9]{40}$/, 'must be a 20-byte 0x address');
11305
+ /** 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');
11306
+ /** Non-empty, even-length `0x` hex. */ const nonEmptyHexSchema = z.string().regex(/^0x([a-fA-F0-9]{2})+$/, 'must be non-empty 0x hex');
11307
+ /** A 32-byte `0x` hex hash. */ const bytes32Schema = z.string().regex(/^0x[a-fA-F0-9]{64}$/, 'must be a 32-byte 0x hash');
11308
+ /** Decimal string in minor units, allowing zero. */ const numericStringSchema = z.string().regex(/^\d+$/, 'must be a non-negative integer string');
11309
+ /** An `https:` URL, used for the optional base-URL override. */ const httpsUrlSchema = z.string().refine((value)=>{
11310
+ try {
11311
+ return new URL(value).protocol === 'https:';
11312
+ } catch {
11313
+ return false;
11314
+ }
11315
+ }, 'must be an https URL');
11316
+ const forwardParamsSchema = z.object({
11317
+ hookData: hexSchema.optional(),
11318
+ destinationCaller: evmAddressSchema.optional()
11319
+ }).strict();
11320
+ const forwardRequestSchema = z.object({
11321
+ type: z.literal('FORWARD'),
11322
+ params: forwardParamsSchema.optional()
11323
+ }).strict();
11324
+ const preFinalityRequestSchema = z.object({
11325
+ type: z.literal('PRE_FINALITY')
11326
+ }).strict();
11327
+ /** A single quote request item (`FORWARD` or `PRE_FINALITY`). */ const feeQuoteRequestSchema = z.discriminatedUnion('type', [
11328
+ forwardRequestSchema,
11329
+ preFinalityRequestSchema
11330
+ ]);
11331
+ /** 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');
11332
+ /**
11333
+ * A structured `Partial<ApiPollingConfig>` polling override.
11334
+ *
11335
+ * Validates the field types callers actually set, so a plain-JS caller passing
11336
+ * `{ timeout: 'soon' }` is rejected at the boundary rather than failing opaquely
11337
+ * inside the transport. Unknown keys pass through so a future `ApiPollingConfig`
11338
+ * field is forwarded rather than silently dropped.
11339
+ */ const apiPollingConfigSchema = z.object({
11340
+ timeout: z.number().int().positive().optional(),
11341
+ maxRetries: z.number().int().nonnegative().optional(),
11342
+ retryDelay: z.number().int().nonnegative().optional(),
11343
+ backoff: z.enum([
11344
+ 'fixed',
11345
+ 'exponential'
11346
+ ]).optional(),
11347
+ maxRetryDelayMs: z.number().int().positive().optional(),
11348
+ headers: z.record(z.string()).optional()
11349
+ }).passthrough();
11350
+ /**
11351
+ * The validatable input for {@link fetchFeeQuote}.
11352
+ *
11353
+ * This is the single source of truth for input validation, including the CCTP
11354
+ * domains and the `isTestnet` environment flag. Validating `isTestnet` at
11355
+ * runtime matters because a plain-JS caller who omits it would otherwise leave
11356
+ * it `undefined`, which is falsy and silently selects the production base URL.
11357
+ * (`buildFeeQuoteUrl` independently re-validates the domains for standalone
11358
+ * callers.)
11359
+ */ z.object({
11360
+ sourceDomain: z.number().int().nonnegative(),
11361
+ destinationDomain: z.number().int().nonnegative(),
11362
+ amount: positiveAmountSchema,
11363
+ feeToken: evmAddressSchema.optional(),
11364
+ requests: feeQuoteRequestsSchema,
11365
+ isTestnet: z.boolean(),
11366
+ baseUrl: httpsUrlSchema.optional(),
11367
+ config: apiPollingConfigSchema.optional()
11368
+ }).strict();
11369
+ const feeQuoteItemSchema = z.object({
11370
+ type: z.string().min(1),
11371
+ amount: numericStringSchema,
11372
+ args: z.array(z.string()),
11373
+ argsHash: bytes32Schema
11374
+ }).passthrough();
11375
+ const exchangeRatesSchema = z.object({
11376
+ feeTokenUsd: z.string(),
11377
+ destinationTokenUsd: z.string()
11378
+ }).passthrough();
11379
+ const metadataSchema = z.object({
11380
+ destinationGasPrice: z.string().optional(),
11381
+ exchangeRates: exchangeRatesSchema.optional()
11382
+ }).passthrough();
11383
+ /** The `expiry` object the Quote API nests the quote TTL under. */ const expirySchema = z.discriminatedUnion('mode', [
11384
+ z.object({
11385
+ mode: z.literal('TIMESTAMP'),
11386
+ expiresAt: z.number().int().nonnegative()
11387
+ }).passthrough(),
11388
+ z.object({
11389
+ mode: z.literal('BLOCK_NUMBER'),
11390
+ expiresAtBlock: z.number().int().nonnegative(),
11391
+ blockEstimatedAt: z.number().int().nonnegative().optional()
11392
+ }).passthrough()
11393
+ ]);
11394
+ /** Schema for a signed fee quote returned by the Quote API. */ z.object({
11395
+ // The runtime YAML spec maps signedQuote to a looser `hex` (which allows
11396
+ // an empty `0x`); we keep the stricter non-empty form. Do not relax
11397
+ // without a reason.
11398
+ signedQuote: nonEmptyHexSchema,
11399
+ issuedAt: z.number().int().nonnegative(),
11400
+ // The API returns a mode-specific timestamp or source-block deadline.
11401
+ expiry: expirySchema,
11402
+ feeTotalAmount: numericStringSchema,
11403
+ feeToken: evmAddressSchema,
11404
+ nonce: numericStringSchema,
11405
+ items: z.array(feeQuoteItemSchema),
11406
+ metadata: metadataSchema.optional()
11407
+ }).passthrough();
11408
+ /** Validate input to {@link validateQuote}. */ z.object({
11409
+ sourceDomain: z.number().int().nonnegative(),
11410
+ abiSignature: z.string().min(1),
11411
+ args: z.array(z.union([
11412
+ z.string(),
11413
+ z.array(z.string())
11414
+ ])),
11415
+ isTestnet: z.boolean(),
11416
+ baseUrl: httpsUrlSchema.optional(),
11417
+ config: apiPollingConfigSchema.optional()
11418
+ }).strict();
11419
+ const quoteExpiryStatusSchema = z.discriminatedUnion('mode', [
11420
+ z.object({
11421
+ mode: z.literal('TIMESTAMP'),
11422
+ expired: z.boolean(),
11423
+ secondsRemaining: z.number().int().nonnegative(),
11424
+ expiresAt: z.number().int().nonnegative()
11425
+ }).passthrough(),
11426
+ z.object({
11427
+ mode: z.literal('BLOCK_NUMBER'),
11428
+ expired: z.boolean(),
11429
+ secondsRemaining: z.number().int().nonnegative(),
11430
+ expiresAtBlock: z.number().int().nonnegative(),
11431
+ blockEstimatedAt: z.number().int().nonnegative().optional()
11432
+ }).passthrough()
11433
+ ]);
11434
+ const validateQuoteItemSchema = z.object({
11435
+ type: z.string().min(1),
11436
+ argsMatch: z.boolean(),
11437
+ amount: numericStringSchema.optional(),
11438
+ args: z.array(z.string()).optional(),
11439
+ argsHash: bytes32Schema.optional(),
11440
+ computedArgsHash: bytes32Schema.optional()
11441
+ }).passthrough();
11442
+ /**
11443
+ * Schema for a response from the Quote API validation endpoint.
11444
+ *
11445
+ * The endpoint takes the source domain as a URL path parameter and does not
11446
+ * return it in the response body, so `sourceDomain` is intentionally not part
11447
+ * of this schema.
11448
+ */ z.object({
11449
+ signedQuote: nonEmptyHexSchema,
11450
+ expiry: quoteExpiryStatusSchema,
11451
+ feeTotalAmount: numericStringSchema,
11452
+ feeToken: evmAddressSchema,
11453
+ nonce: numericStringSchema,
11454
+ claimable: z.boolean(),
11455
+ // Preserve newly introduced server-side reasons as opaque strings rather
11456
+ // than rejecting the entire safety response before the SDK is updated.
11457
+ failedChecks: z.array(z.string().min(1)),
11458
+ items: z.array(validateQuoteItemSchema)
11459
+ }).passthrough();
11460
+
10975
11461
  /** SDK name used in telemetry payloads. */ resolveKitSdkName(pkg$2.name);
10976
11462
 
10977
11463
  // Auto-register this kit for user agent tracking
10978
11464
  registerKit(`${pkg$2.name}/${pkg$2.version}`);
10979
11465
 
10980
11466
  var name$1 = "@circle-fin/swap-kit";
10981
- var version$1 = "1.5.1";
11467
+ var version$1 = "1.6.0";
10982
11468
  var pkg$1 = {
10983
11469
  name: name$1,
10984
11470
  version: version$1};
@@ -10992,7 +11478,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
10992
11478
  * Catches obviously malformed addresses at parse time; chain-specific validation
10993
11479
  * is performed in buildServiceParams.
10994
11480
  */ const destinationAddressSchema = z.union([
10995
- evmAddressSchema,
11481
+ evmAddressSchema$1,
10996
11482
  solanaAddressSchema
10997
11483
  ]);
10998
11484
  /**
@@ -11038,9 +11524,16 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
11038
11524
  message: 'stopLimit must be greater than 0'
11039
11525
  }).optional(),
11040
11526
  customFee: serviceSwapCustomFeeSchema.optional(),
11527
+ apiKey: z.string({
11528
+ invalid_type_error: 'apiKey must be a string'
11529
+ })// Tolerate '' so the `process.env.CIRCLE_API_KEY ?? ''` idiom falls back to
11530
+ // kitKey via resolveApiKey instead of being rejected here.
11531
+ .optional(),
11041
11532
  kitKey: z.string({
11042
11533
  invalid_type_error: 'kitKey must be a string'
11043
- }).min(1, 'kitKey must be a non-empty string').optional(),
11534
+ })// Tolerate '' so an unset kit-key env var yields the permissionless path,
11535
+ // matching buildServiceParams (which already omits an empty credential).
11536
+ .optional(),
11044
11537
  provider: z.string({
11045
11538
  invalid_type_error: 'provider must be a string'
11046
11539
  }).min(1, 'provider must be a non-empty string').optional(),
@@ -11205,23 +11698,49 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
11205
11698
  fees: z.array(serviceSwapFeeSchema).optional()
11206
11699
  }).passthrough();
11207
11700
 
11208
- /** Placeholder used wherever a kit key is scrubbed from logs, traces, or errors. */ const REDACTED_KIT_KEY = '[redacted]';
11701
+ /** Placeholder used wherever a credential is scrubbed from logs, traces, or errors. */ const REDACTED_CREDENTIAL = '[redacted]';
11702
+ /**
11703
+ * Config fields that carry a Stablecoin Service credential.
11704
+ *
11705
+ * `apiKey` is the supported field; `kitKey` is the deprecated alias. Redaction
11706
+ * and credential resolution both read this list so a newly added field is
11707
+ * scrubbed everywhere it needs to be.
11708
+ */ const CREDENTIAL_CONFIG_FIELDS = [
11709
+ 'apiKey',
11710
+ 'kitKey'
11711
+ ];
11209
11712
 
11713
+ /**
11714
+ * Replaces any credential field present on a config with a redaction marker.
11715
+ *
11716
+ * Covers `apiKey` and the deprecated `kitKey`, so adding a credential field
11717
+ * without extending this list cannot silently leak it into a trace. Returns the
11718
+ * config unchanged when it carries no credential.
11719
+ */ const redactCredentialFields = (config)=>{
11720
+ const present = CREDENTIAL_CONFIG_FIELDS.filter((field)=>field in config);
11721
+ if (present.length === 0) {
11722
+ return config;
11723
+ }
11724
+ return present.reduce((acc, field)=>({
11725
+ ...acc,
11726
+ [field]: REDACTED_CREDENTIAL
11727
+ }), {
11728
+ ...config
11729
+ });
11730
+ };
11210
11731
  /**
11211
11732
  * Builds a redacted projection of swap params that is safe to embed in error
11212
11733
  * traces (which may be logged downstream). Allow-lists only non-sensitive
11213
11734
  * fields and drops `from` entirely — `from.adapter` can carry signer/private-key
11214
- * material for signer-backed (viem/ethers) flows — and redacts `config.kitKey`.
11735
+ * material for signer-backed (viem/ethers) flows — and redacts every credential
11736
+ * field on `config`.
11215
11737
  */ const redactSwapParamsForTrace = (params)=>{
11216
11738
  if (typeof params !== 'object' || params === null) {
11217
11739
  return params;
11218
11740
  }
11219
11741
  const record = params;
11220
11742
  const config = record['config'];
11221
- const redactedConfig = typeof config === 'object' && config !== null && 'kitKey' in config ? {
11222
- ...config,
11223
- kitKey: REDACTED_KIT_KEY
11224
- } : config;
11743
+ const redactedConfig = typeof config === 'object' && config !== null ? redactCredentialFields(config) : config;
11225
11744
  return {
11226
11745
  tokenIn: record['tokenIn'],
11227
11746
  tokenOut: record['tokenOut'],
@@ -11305,6 +11824,41 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
11305
11824
  *
11306
11825
  * @internal
11307
11826
  */ const MAX_RATE_ADDRESSES_PER_REQUEST = 100;
11827
+ /**
11828
+ * Environment prefixes carried by Circle platform API keys.
11829
+ *
11830
+ * A Circle API key is `<ENV>_API_KEY:<keyId>:<keySecret>`, where `<ENV>` is one
11831
+ * of these prefixes.
11832
+ *
11833
+ * @internal
11834
+ */ const API_KEY_ENV_PREFIXES = [
11835
+ 'TEST',
11836
+ 'LIVE',
11837
+ 'SAND',
11838
+ 'SANDBOX',
11839
+ 'SMOK',
11840
+ 'PROD',
11841
+ 'STAG',
11842
+ 'DEV'
11843
+ ];
11844
+ /**
11845
+ * Accepted credential formats for Stablecoin Service authentication.
11846
+ *
11847
+ * Matches a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
11848
+ * the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`). API keys are the
11849
+ * recommended credential; kit keys remain accepted as the legacy path.
11850
+ *
11851
+ * @remarks
11852
+ * This is a local pre-flight check, not the authority — the Stablecoin Service
11853
+ * validates the credential and answers 401 when it rejects one. The prefix list
11854
+ * is therefore deliberately permissive: a valid key carrying a prefix this SDK
11855
+ * has not been taught about should reach the service and be judged there rather
11856
+ * than be refused locally, since refusing locally is indistinguishable from an
11857
+ * outage to the caller. Kept as the single source of truth so the pattern is
11858
+ * not restated per call site.
11859
+ *
11860
+ * @internal
11861
+ */ const API_KEY_PATTERN = new RegExp(`^(?:KIT_KEY|(?:${API_KEY_ENV_PREFIXES.join('|')})_API_KEY)` + ':[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$');
11308
11862
 
11309
11863
  /**
11310
11864
  * Zod schema for validating stop limits.
@@ -11373,13 +11927,14 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
11373
11927
  /**
11374
11928
  * Zod schema for validating API keys.
11375
11929
  *
11376
- * Validates that the API key is a valid API key format.
11930
+ * Accepts a Circle platform API key (`<ENV>_API_KEY:<keyId>:<keySecret>`) and
11931
+ * the legacy kit key (`KIT_KEY:<keyId>:<keySecret>`).
11377
11932
  *
11378
11933
  * @example
11379
11934
  * ```typescript
11380
11935
  * import { apiKeySchema } from '@core/service-client'
11381
11936
  *
11382
- * const result = apiKeySchema.safeParse('KIT_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
11937
+ * const result = apiKeySchema.safeParse('TEST_API_KEY:e84d2546d4e321b2ff427dc988c89503:f84d2548d4e322b2ff427fc989c87503')
11383
11938
  * if (!result.success) {
11384
11939
  * console.error('Invalid API key format:', result.error.issues)
11385
11940
  * }
@@ -11387,7 +11942,7 @@ const optionalChainIdentifierField = chainIdentifierField.optional();
11387
11942
  */ const apiKeySchema = z.string({
11388
11943
  required_error: 'API key is required',
11389
11944
  invalid_type_error: 'Invalid API key format'
11390
- }).regex(/^KIT_KEY:[a-zA-Z0-9._-]+:[a-zA-Z0-9._-]+$/, 'Invalid API key format');
11945
+ }).regex(API_KEY_PATTERN, 'Invalid API key format');
11391
11946
  /**
11392
11947
  * Zod schema for platform fees configuration.
11393
11948
  *
@@ -11908,21 +12463,55 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
11908
12463
  * ```
11909
12464
  */ const isGetTokenRatesResponse = (obj)=>getTokenRatesResponseSchema.safeParse(obj).success;
11910
12465
  /**
11911
- * Assert that a Stablecoin Service kit key is not being supplied from a browser.
12466
+ * Resolve the credential to authenticate a Stablecoin Service request with.
12467
+ *
12468
+ * `apiKey` is the supported field; `kitKey` is the deprecated alias kept for
12469
+ * existing integrations. When both are supplied `apiKey` wins, so a caller
12470
+ * migrating field-by-field cannot be silently pinned to a stale credential.
12471
+ *
12472
+ * An empty-string value is treated as absent on either field. Without this, the
12473
+ * common `process.env.CIRCLE_API_KEY ?? ''` idiom (which yields `''` when the
12474
+ * variable is unset) would either shadow a working `kitKey` or, on a bare
12475
+ * `kitKey: ''`, reach downstream validation as an invalid credential instead of
12476
+ * falling through to the permissionless path.
12477
+ *
12478
+ * @param source - Object carrying either credential field, or neither.
12479
+ * @returns The credential to use, or `undefined` for the permissionless
12480
+ * (keyless) path.
12481
+ *
12482
+ * @example
12483
+ * ```typescript
12484
+ * import { resolveApiKey } from '@core/service-client'
12485
+ *
12486
+ * resolveApiKey({ apiKey: 'TEST_API_KEY:id:secret' }) // 'TEST_API_KEY:id:secret'
12487
+ * resolveApiKey({ kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
12488
+ * resolveApiKey({ apiKey: '', kitKey: 'KIT_KEY:id:secret' }) // 'KIT_KEY:id:secret'
12489
+ * resolveApiKey({ kitKey: '' }) // undefined
12490
+ * resolveApiKey({}) // undefined
12491
+ * ```
12492
+ */ const resolveApiKey = (source)=>{
12493
+ // Treat an empty-string value as absent on either field so the
12494
+ // `env ?? ''` idiom falls through to the next credential (or permissionless).
12495
+ const normalize = (value)=>value !== undefined && value !== '' ? value : undefined;
12496
+ return normalize(source.apiKey) ?? normalize(source.kitKey);
12497
+ };
12498
+ /**
12499
+ * Assert that a Stablecoin Service credential is not supplied from a browser.
11912
12500
  *
11913
- * The kit key (`KIT_KEY:<id>:<secret>`) is a server-only secret. Every
11914
- * Stablecoin Service request that attaches an `Authorization: Bearer` header
11915
- * funnels through this package, so calling this guard before that header is
11916
- * built prevents the secret from being sent from and thus bundled into — a
11917
- * client application. In Node.js the check is a no-op, preserving the
11918
- * legitimate "hold the kit key on the server, forward the prepared transaction
11919
- * to the client" flow. When no kit key is supplied the permissionless (keyless)
11920
- * client path remains fully allowed.
12501
+ * An API key (`<ENV>_API_KEY:<id>:<secret>`) and a legacy kit key
12502
+ * (`KIT_KEY:<id>:<secret>`) are both server-only secrets. Every Stablecoin
12503
+ * Service request that attaches an `Authorization: Bearer` header funnels
12504
+ * through this package, so calling this guard before that header is built
12505
+ * prevents the secret from being sent from and thus bundled into — a client
12506
+ * application. In Node.js the check is a no-op, preserving the legitimate "hold
12507
+ * the credential on the server, forward the prepared transaction to the client"
12508
+ * flow. When no credential is supplied the permissionless (keyless) client path
12509
+ * remains fully allowed.
11921
12510
  *
11922
- * @param apiKey - The inline kit key for the request, or `undefined` when none
11923
- * was supplied (permissionless mode).
12511
+ * @param apiKey - The inline credential for the request, or `undefined` when
12512
+ * none was supplied (permissionless mode).
11924
12513
  * @returns Nothing.
11925
- * @throws KitError with VALIDATION_FAILED when a kit key is supplied while
12514
+ * @throws KitError with VALIDATION_FAILED when a credential is supplied while
11926
12515
  * running in a browser environment. The secret value is never echoed.
11927
12516
  *
11928
12517
  * @example
@@ -11930,10 +12519,10 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
11930
12519
  * import { assertBrowserSafeApiKey } from '@core/service-client'
11931
12520
  *
11932
12521
  * // Server (Node.js): no-op, request proceeds with the Authorization header.
11933
- * assertBrowserSafeApiKey('KIT_KEY:my-id:my-secret')
12522
+ * assertBrowserSafeApiKey('TEST_API_KEY:my-id:my-secret')
11934
12523
  *
11935
12524
  * // Browser: throws to stop the secret from leaking into the client bundle.
11936
- * assertBrowserSafeApiKey('KIT_KEY:my-id:my-secret')
12525
+ * assertBrowserSafeApiKey('TEST_API_KEY:my-id:my-secret')
11937
12526
  *
11938
12527
  * // Browser, permissionless: allowed.
11939
12528
  * assertBrowserSafeApiKey(undefined)
@@ -11943,7 +12532,7 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
11943
12532
  return;
11944
12533
  }
11945
12534
  if (isBrowserEnvironment()) {
11946
- throw createValidationFailedError$1('kitKey', '[redacted]', 'kitKey must not be provided in a browser environment — it is a server-only secret. Run kit operations that use a kit key on your server, or omit kitKey to use the permissionless (keyless) client path');
12535
+ throw createValidationFailedError$1('apiKey', '[redacted]', 'apiKey must not be provided in a browser environment — it is a server-only secret. Run kit operations that use an API key on your server, or omit apiKey (and the legacy kitKey) to use the permissionless (keyless) client path');
11947
12536
  }
11948
12537
  };
11949
12538
 
@@ -11955,7 +12544,8 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
11955
12544
  *
11956
12545
  * @remarks
11957
12546
  * - Input validation leverages Zod schemas to surface actionable KitErrors.
11958
- * - API key format must match `KIT_KEY:<keyId>:<keySecret>`
12547
+ * - API key format must match `<ENV>_API_KEY:<keyId>:<keySecret>`, or the
12548
+ * legacy `KIT_KEY:<keyId>:<keySecret>`
11959
12549
  *
11960
12550
  * @param params - The create transaction request parameters with API key.
11961
12551
  * @returns A promise that resolves to a typed {@link CreateSwapResponse}.
@@ -11984,7 +12574,7 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
11984
12574
  * recipientAddress: '0x050928e1f9086b20539c767c96909663ff7fbdf2',
11985
12575
  * },
11986
12576
  * },
11987
- * apiKey: 'KIT_KEY:example-key:example-secret',
12577
+ * apiKey: 'TEST_API_KEY:example-key:example-secret',
11988
12578
  * })
11989
12579
  *
11990
12580
  * console.log(`Transaction target: ${transaction.transaction.target}`)
@@ -12003,13 +12593,13 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
12003
12593
  const url = new URL('/v1/stablecoinKits/swap', STABLECOIN_SERVICE_BASE_URL).toString();
12004
12594
  // Remove the API key from the request body
12005
12595
  const { apiKey, ...requestBody } = validatedParams;
12006
- // Never let a server-only kit key leave a browser (no-op in Node.js).
12596
+ // Never let a server-only credential leave a browser (no-op in Node.js).
12007
12597
  assertBrowserSafeApiKey(apiKey);
12008
12598
  const effectiveConfig = {
12009
12599
  ...DEFAULT_CONFIG,
12010
12600
  headers: {
12011
12601
  ...DEFAULT_CONFIG.headers,
12012
- // Permissionless mode: no Authorization header when the kit key is absent.
12602
+ // Permissionless mode: no Authorization header when the credential is absent.
12013
12603
  ...apiKey !== undefined && {
12014
12604
  Authorization: `Bearer ${apiKey}`
12015
12605
  }
@@ -12159,7 +12749,7 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
12159
12749
  }
12160
12750
  // Use validated data
12161
12751
  const validatedParams = result.data;
12162
- // Never let a server-only kit key leave a browser (no-op in Node.js).
12752
+ // Never let a server-only credential leave a browser (no-op in Node.js).
12163
12753
  assertBrowserSafeApiKey(validatedParams.apiKey);
12164
12754
  // Build the API URL
12165
12755
  const url = buildQuoteUrl(validatedParams);
@@ -12168,7 +12758,7 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
12168
12758
  ...DEFAULT_CONFIG,
12169
12759
  headers: {
12170
12760
  ...DEFAULT_CONFIG.headers,
12171
- // Permissionless mode: no Authorization header when the kit key is absent.
12761
+ // Permissionless mode: no Authorization header when the credential is absent.
12172
12762
  ...validatedParams.apiKey !== undefined && {
12173
12763
  Authorization: `Bearer ${validatedParams.apiKey}`
12174
12764
  }
@@ -12233,14 +12823,14 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
12233
12823
  toChain: result.data.toChain
12234
12824
  }
12235
12825
  };
12236
- // Never let a server-only kit key leave a browser (no-op in Node.js).
12826
+ // Never let a server-only credential leave a browser (no-op in Node.js).
12237
12827
  assertBrowserSafeApiKey(validatedParams.apiKey);
12238
12828
  const url = buildSwapStatusUrl(validatedParams);
12239
12829
  const effectiveConfig = {
12240
12830
  ...DEFAULT_CONFIG,
12241
12831
  headers: {
12242
12832
  ...DEFAULT_CONFIG.headers,
12243
- // Permissionless mode: no Authorization header when the kit key is absent.
12833
+ // Permissionless mode: no Authorization header when the credential is absent.
12244
12834
  ...validatedParams.apiKey !== undefined && {
12245
12835
  Authorization: `Bearer ${validatedParams.apiKey}`
12246
12836
  }
@@ -12266,7 +12856,7 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
12266
12856
  * const url = buildTokenRatesUrl({
12267
12857
  * chain: 'Ethereum',
12268
12858
  * addresses: ['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48'],
12269
- * apiKey: 'KIT_KEY:key:secret',
12859
+ * apiKey: 'TEST_API_KEY:key:secret',
12270
12860
  * })
12271
12861
  * // => 'https://api.circle.com/v1/stablecoinKits/rates?chain=Ethereum&addresses=...'
12272
12862
  * ```
@@ -12339,14 +12929,14 @@ getQuoteRequestBaseSchema.superRefine(requireCrossChainQuoteToAddress);
12339
12929
  addresses: result.data.addresses
12340
12930
  }
12341
12931
  };
12342
- // Never let a server-only kit key leave a browser (no-op in Node.js).
12932
+ // Never let a server-only credential leave a browser (no-op in Node.js).
12343
12933
  assertBrowserSafeApiKey(validatedParams.apiKey);
12344
12934
  const url = buildTokenRatesUrl(validatedParams);
12345
12935
  const effectiveConfig = {
12346
12936
  ...DEFAULT_CONFIG,
12347
12937
  headers: {
12348
12938
  ...DEFAULT_CONFIG.headers,
12349
- // Permissionless mode: no Authorization header when the kit key is absent.
12939
+ // Permissionless mode: no Authorization header when the credential is absent.
12350
12940
  ...validatedParams.apiKey !== undefined && {
12351
12941
  Authorization: `Bearer ${validatedParams.apiKey}`
12352
12942
  }
@@ -12784,7 +13374,7 @@ const abiParameterSchema = z.object({
12784
13374
  */ z.object({
12785
13375
  type: z.literal('evm'),
12786
13376
  abi: abiSchema,
12787
- address: evmAddressSchema,
13377
+ address: evmAddressSchema$1,
12788
13378
  functionName: z.string({
12789
13379
  required_error: 'Function name is required',
12790
13380
  invalid_type_error: 'Function name must be a string'
@@ -12821,7 +13411,7 @@ const abiParameterSchema = z.object({
12821
13411
  * }
12822
13412
  * ```
12823
13413
  */ z.object({
12824
- address: evmAddressSchema,
13414
+ address: evmAddressSchema$1,
12825
13415
  value: z.bigint({
12826
13416
  required_error: 'Value is required for native transfers',
12827
13417
  invalid_type_error: 'Value must be a bigint'
@@ -13353,7 +13943,7 @@ z.object({
13353
13943
  signature: evmSignatureSchema,
13354
13944
  tokenInputs: z.array(z.object({
13355
13945
  permitType: z.nativeEnum(PermitType),
13356
- token: evmAddressSchema,
13946
+ token: evmAddressSchema$1,
13357
13947
  amount: z.bigint().refine((value)=>value >= 0n, {
13358
13948
  message: 'amount must be a non-negative bigint'
13359
13949
  }),
@@ -13614,7 +14204,7 @@ enc.encode('used_transfer_spec_hash');
13614
14204
  });
13615
14205
 
13616
14206
  /**
13617
- * Assert that the kit key is valid for swap operations.
14207
+ * Assert that the credential is valid for swap operations.
13618
14208
  *
13619
14209
  * @remarks
13620
14210
  * This validation is called when swap operations are executed, not at construction time.
@@ -13622,34 +14212,35 @@ enc.encode('used_transfer_spec_hash');
13622
14212
  * at usage time rather than construction time.
13623
14213
  *
13624
14214
  * Validates:
13625
- * - Kit key matches the required format (KIT_KEY:id:secret) when provided.
13626
- * An absent or empty kit key is permitted (permissionless mode) — the swap
13627
- * service now treats the key as optional.
14215
+ * - The credential matches an accepted format when provided — a Circle API key
14216
+ * (`<ENV>_API_KEY:id:secret`) or a legacy kit key (`KIT_KEY:id:secret`).
14217
+ * An absent or empty credential is permitted (permissionless mode) — the swap
14218
+ * service treats the credential as optional.
13628
14219
  *
13629
- * @param kitKey - The inline kit key from the swap operation config (optional)
13630
- * @throws KitError with VALIDATION_FAILED if a kit key is provided but does not
13631
- * match the KIT_KEY:<keyId>:<keySecret> format
14220
+ * @param apiKey - The inline credential from the swap operation config (optional)
14221
+ * @throws KitError with VALIDATION_FAILED if a credential is provided but does
14222
+ * not match an accepted format
13632
14223
  *
13633
14224
  * @example
13634
14225
  * ```typescript
13635
- * import { assertKitKey } from './assertKitKey'
14226
+ * import { assertApiKey } from './assertApiKey'
13636
14227
  *
13637
- * const kitKey = 'KIT_KEY:9d1bd085-bad2-4a2b-ae67-5814b85167c9:secretvalue'
14228
+ * const apiKey = 'TEST_API_KEY:9d1bd085-bad2-4a2b-ae67-5814b85167c9:secretvalue'
13638
14229
  *
13639
- * // Validate kit key before use
13640
- * assertKitKey(kitKey)
14230
+ * // Validate the credential before use
14231
+ * assertApiKey(apiKey)
13641
14232
  * ```
13642
- */ function assertKitKey(kitKey) {
13643
- // Permissionless mode: the swap service treats the kit key as optional, so an
13644
- // absent (or empty) key is valid. Only validate the format when a key is
14233
+ */ function assertApiKey(apiKey) {
14234
+ // Permissionless mode: the swap service treats the credential as optional, so
14235
+ // an absent (or empty) value is valid. Only validate the format when one is
13645
14236
  // actually provided.
13646
- if (!kitKey) {
14237
+ if (!apiKey) {
13647
14238
  return;
13648
14239
  }
13649
- const apiKeyResult = apiKeySchema.safeParse(kitKey);
14240
+ const apiKeyResult = apiKeySchema.safeParse(apiKey);
13650
14241
  if (!apiKeyResult.success) {
13651
14242
  const errors = apiKeyResult.error.issues.map((issue)=>issue.message).join(', ');
13652
- throw createValidationFailedError$1('kitKey', REDACTED_KIT_KEY, `Invalid API key format. ${errors}. Expected format: KIT_KEY:<keyId>:<keySecret>. Get your free Kit Key at: https://developers.circle.com/w3s/keys#kit-keys`);
14243
+ throw createValidationFailedError$1('apiKey', REDACTED_CREDENTIAL, `Invalid API key format. ${errors}. Expected format: <ENV>_API_KEY:<keyId>:<keySecret> (for example TEST_API_KEY:... or LIVE_API_KEY:...). Legacy KIT_KEY:<keyId>:<keySecret> values are still accepted. Get your key at: https://developers.circle.com/w3s/keys`);
13653
14244
  }
13654
14245
  }
13655
14246
 
@@ -13841,7 +14432,7 @@ const TOKEN_REGISTRY$3 = createTokenRegistry();
13841
14432
  }
13842
14433
  // Validate recipient address format matches the chain type
13843
14434
  if (chain.type === 'evm') {
13844
- const result = evmAddressSchema.safeParse(recipientAddress);
14435
+ const result = evmAddressSchema$1.safeParse(recipientAddress);
13845
14436
  if (!result.success) {
13846
14437
  throw createInvalidAddressError(recipientAddress, chain.name, '0x-prefixed 42-character hex string (0x + 40 hex characters)');
13847
14438
  }
@@ -13903,7 +14494,7 @@ function resolveFeePayoutChain(tokenIn, tokenOut, sourceChain, destinationChain)
13903
14494
  * to: '0x742d35Cc6634C0532925a3b844Bc454e4438f44e',
13904
14495
  * config: {
13905
14496
  * slippageBps: 300,
13906
- * kitKey: 'KIT_KEY:...:...' // Required inline kit key
14497
+ * apiKey: 'TEST_API_KEY:...:...' // Inline credential (optional)
13907
14498
  * }
13908
14499
  * }
13909
14500
  *
@@ -13941,18 +14532,17 @@ function resolveFeePayoutChain(tokenIn, tokenOut, sourceChain, destinationChain)
13941
14532
  validateResolvedAddress(resolvedTokenInAddress, chain);
13942
14533
  validateResolvedAddress(resolvedTokenOutAddress, destinationChain);
13943
14534
  validateResolvedAddress(to, destinationChain);
13944
- const kitKey = config?.kitKey;
13945
- // Validate the kit key format when one is provided (permissionless otherwise).
13946
- assertKitKey(kitKey);
14535
+ const apiKey = resolveApiKey(config ?? {});
14536
+ // Validate the credential format when one is provided (permissionless
14537
+ // otherwise).
14538
+ assertApiKey(apiKey);
13947
14539
  // Validate custom fee configuration if present
13948
14540
  const customFee = config?.customFee;
13949
14541
  if (customFee !== undefined) {
13950
14542
  const feePayoutChain = resolveFeePayoutChain(tokenIn, tokenOut, chain, destinationChain);
13951
14543
  validateCustomFeeConfig(customFee, feePayoutChain);
13952
14544
  }
13953
- // Build CreateSwapParams for service client
13954
- // Use object spread to conditionally include optional properties
13955
- // Note: Service client expects 'apiKey' field, so we map kitKey → apiKey
14545
+ // Build CreateSwapParams for service client, spreading optional properties.
13956
14546
  const chainName = chain.chain // The API expects the Blockchain enum value format like "World_Chain"
13957
14547
  ;
13958
14548
  const destinationChainName = destinationChain.chain;
@@ -13987,9 +14577,9 @@ function resolveFeePayoutChain(tokenIn, tokenOut, sourceChain, destinationChain)
13987
14577
  }
13988
14578
  }
13989
14579
  },
13990
- // Map kitKey → apiKey for the service client; omitted in permissionless mode.
13991
- ...kitKey ? {
13992
- apiKey: kitKey
14580
+ // Omitted in permissionless mode.
14581
+ ...apiKey ? {
14582
+ apiKey
13993
14583
  } : {}
13994
14584
  };
13995
14585
  }
@@ -15298,14 +15888,13 @@ const TOKEN_REGISTRY$2 = createTokenRegistry();
15298
15888
  return;
15299
15889
  }
15300
15890
  // For non-native tokens (SPL tokens, ERC-20 tokens), check the token balance
15301
- const balancePrepared = await adapter.prepareAction('token.balanceOf', {
15891
+ const balance = await executeAdapterReadAction(adapter, 'token.balanceOf', {
15302
15892
  tokenAddress: tokenInAddress,
15303
15893
  walletAddress
15304
15894
  }, context);
15305
- const balance = await balancePrepared.execute();
15306
15895
  // Compare balances
15307
15896
  const requiredAmount = BigInt(amount);
15308
- const currentBalance = BigInt(balance);
15897
+ const currentBalance = BigInt(String(balance));
15309
15898
  if (currentBalance < requiredAmount) {
15310
15899
  throw new KitError({
15311
15900
  ...BalanceError.INSUFFICIENT_TOKEN,
@@ -15894,9 +16483,9 @@ async function fetchSameChainStatusSnapshot({ isCrossChainSwap, txHash, chain, a
15894
16483
  * ```typescript
15895
16484
  * import { StablecoinServiceSwapProvider } from '@circle-fin/provider-stablecoin-service-swap'
15896
16485
  *
15897
- * // Create provider with developer fee (1 USDC)
16486
+ * // Create provider with developer fee (1 USDC).
16487
+ * // Credentials are supplied per operation via `config.apiKey`, not here.
15898
16488
  * const provider = new StablecoinServiceSwapProvider({
15899
- * kitKey: process.env.STABLECOIN_KIT_API_KEY,
15900
16489
  * customFee: {
15901
16490
  * amount: '1000000', // 1 USDC in base units (6 decimals)
15902
16491
  * recipientAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0'
@@ -16466,11 +17055,10 @@ async function fetchSameChainStatusSnapshot({ isCrossChainSwap, txHash, chain, a
16466
17055
  * @throws Error if the adapter fails to prepare or execute approval transactions
16467
17056
  * @throws Error if transaction confirmation fails or times out
16468
17057
  */ async handleUsdtApproval(adapter, chain, executionCtx, adapterContractAddress, resolvedContext, executedTransactions) {
16469
- const allowanceRequest = await adapter.prepareAction('token.allowance', {
17058
+ const current = await readTokenAllowance(adapter, {
16470
17059
  tokenAddress: executionCtx.tokenInAddress,
16471
17060
  delegate: adapterContractAddress
16472
17061
  }, resolvedContext);
16473
- const current = BigInt(await allowanceRequest.execute());
16474
17062
  const required = BigInt(executionCtx.amount);
16475
17063
  if (current >= required) {
16476
17064
  // Sufficient allowance - proceed to swap
@@ -16559,9 +17147,7 @@ async function fetchSameChainStatusSnapshot({ isCrossChainSwap, txHash, chain, a
16559
17147
  * import { createAdapterFromPrivateKey } from '@circle-fin/adapter-viem-v2'
16560
17148
  * import { Ethereum } from '@core/chains'
16561
17149
  *
16562
- * const provider = new StablecoinServiceSwapProvider({
16563
- * kitKey: process.env.STABLECOIN_KIT_API_KEY
16564
- * })
17150
+ * const provider = new StablecoinServiceSwapProvider()
16565
17151
  *
16566
17152
  * const adapter = createAdapterFromPrivateKey({
16567
17153
  * privateKey: process.env.PRIVATE_KEY
@@ -17055,7 +17641,7 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
17055
17641
  /**
17056
17642
  * Fee recipient address (required).
17057
17643
  * Must be a valid EVM address or Solana address.
17058
- */ recipientAddress: z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
17644
+ */ recipientAddress: z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
17059
17645
  message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
17060
17646
  })
17061
17647
  }).strict();
@@ -17067,7 +17653,8 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
17067
17653
  * - slippageBps: Optional positive number for slippage tolerance
17068
17654
  * - stopLimit: Optional decimal string for minimum output
17069
17655
  * - customFee: Optional fee configuration
17070
- * - kitKey: Optional string identifier
17656
+ * - apiKey: Optional credential string
17657
+ * - kitKey: Optional credential string (deprecated alias for apiKey)
17071
17658
  */ const swapConfigSchema = z.object({
17072
17659
  allowanceStrategy: allowanceStrategySchema.optional(),
17073
17660
  slippageBps: z.number().int().min(0).optional(),
@@ -17077,11 +17664,12 @@ const optionalSwapChainIdentifierField = swapChainIdentifierField.optional();
17077
17664
  attributeName: 'stopLimit'
17078
17665
  })(z.string())).optional(),
17079
17666
  customFee: swapCustomFeeSchema.optional(),
17667
+ apiKey: z.string().optional(),
17080
17668
  kitKey: z.string().optional()
17081
17669
  });
17082
17670
  const swapDestinationSchema = z.object({
17083
17671
  chain: optionalSwapChainIdentifierField,
17084
- recipientAddress: z.string().refine((value)=>evmAddressSchema.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
17672
+ recipientAddress: z.string().refine((value)=>evmAddressSchema$1.safeParse(value).success || solanaAddressSchema.safeParse(value).success, {
17085
17673
  message: 'recipientAddress must be a valid blockchain address: EVM (0x + 40 hex chars) or Solana (base58, 32-44 chars)'
17086
17674
  }).optional()
17087
17675
  }).strict();
@@ -19188,7 +19776,8 @@ const transformAmount = (value, direction, decimals)=>formatUnits(value, decimal
19188
19776
  /**
19189
19777
  * Helper to format the config section of a swap result, transforming fee amounts.
19190
19778
  *
19191
- * Strips sensitive fields like kitKey from the config before returning.
19779
+ * Strips the credential fields (`apiKey` and the deprecated `kitKey`) from the
19780
+ * config before returning, so a result is safe to log or serialize.
19192
19781
  *
19193
19782
  * @param config - The swap config from the provider.
19194
19783
  * @param outputTokenTransform - The amount transformer for output-token-denominated values (fees and amountOut).
@@ -19197,11 +19786,11 @@ const transformAmount = (value, direction, decimals)=>formatUnits(value, decimal
19197
19786
  if (!config) {
19198
19787
  return undefined;
19199
19788
  }
19200
- // Remove kitKey from the config
19201
- const cloneConfig = {
19202
- ...config
19203
- };
19204
- delete cloneConfig.kitKey;
19789
+ // Rebuild the config without any credential field. Filtering entries rather
19790
+ // than deleting them avoids reading the deprecated `kitKey` property
19791
+ // directly, and keeps the credential list in one place.
19792
+ const credentialFields = CREDENTIAL_CONFIG_FIELDS;
19793
+ const cloneConfig = Object.fromEntries(Object.entries(config).filter(([key])=>!credentialFields.includes(key)));
19205
19794
  if (Object.keys(cloneConfig).length === 0) {
19206
19795
  return undefined;
19207
19796
  }
@@ -19402,9 +19991,9 @@ const transformAmount = (value, direction, decimals)=>formatUnits(value, decimal
19402
19991
  try {
19403
19992
  // Step 1: Build quote params directly (no need for buildServiceParams)
19404
19993
  // Use chain.chain (Blockchain enum value like "World_Chain") not chain.name
19405
- // The kit key is optional (permissionless mode); when absent the quote is
19406
- // fetched without an Authorization header.
19407
- const kitKey = params.config?.kitKey;
19994
+ // The credential is optional (permissionless mode); when absent the quote
19995
+ // is fetched without an Authorization header.
19996
+ const apiKey = resolveApiKey(params.config ?? {});
19408
19997
  // Resolve token aliases to addresses for the quote API
19409
19998
  // The quote endpoint requires resolved addresses, not aliases like 'USDC'
19410
19999
  const chain = params.from.chain;
@@ -19429,8 +20018,8 @@ const transformAmount = (value, direction, decimals)=>formatUnits(value, decimal
19429
20018
  ...params.config?.slippageBps !== undefined && {
19430
20019
  slippageBps: params.config.slippageBps
19431
20020
  },
19432
- ...kitKey ? {
19433
- apiKey: kitKey
20021
+ ...apiKey ? {
20022
+ apiKey
19434
20023
  } : {}
19435
20024
  };
19436
20025
  // Step 2: Get quote from service
@@ -19834,7 +20423,7 @@ const sleep$1 = async (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
19834
20423
  * the service returns `receivingTokenDecimals`. When decimals are missing
19835
20424
  * the field is omitted entirely (never raw base units).
19836
20425
  *
19837
- * @param params - `txHash`, `chainIn`, optional `chainOut`, and `kitKey`.
20426
+ * @param params - `txHash`, `chainIn`, optional `chainOut`, and `apiKey`.
19838
20427
  * @returns A single snapshot of the swap's status.
19839
20428
  * @throws \{KitError\} If `chainIn` or `chainOut` is malformed.
19840
20429
  *
@@ -19850,7 +20439,7 @@ const sleep$1 = async (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
19850
20439
  * txHash: result.txHash,
19851
20440
  * chainIn: result.chainIn,
19852
20441
  * chainOut: result.chainOut,
19853
- * kitKey: process.env.KIT_KEY ?? '',
20442
+ * apiKey: process.env.CIRCLE_API_KEY,
19854
20443
  * })
19855
20444
  * while (status.progress.status === 'PENDING') {
19856
20445
  * await new Promise((r) => setTimeout(r, 3_000))
@@ -19858,7 +20447,7 @@ const sleep$1 = async (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
19858
20447
  * txHash: result.txHash,
19859
20448
  * chainIn: result.chainIn,
19860
20449
  * chainOut: result.chainOut,
19861
- * kitKey: process.env.KIT_KEY ?? '',
20450
+ * apiKey: process.env.CIRCLE_API_KEY,
19862
20451
  * })
19863
20452
  * }
19864
20453
  *
@@ -19876,14 +20465,15 @@ const sleep$1 = async (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
19876
20465
  const chainIn = normalizeChain(params.chainIn, 'chainIn');
19877
20466
  const chainOut = params.chainOut === undefined ? undefined : normalizeChain(params.chainOut, 'chainOut');
19878
20467
  const isCrossChain = chainOut !== undefined && chainOut !== chainIn;
20468
+ const apiKey = resolveApiKey(params);
19879
20469
  const request = {
19880
20470
  txHash: params.txHash,
19881
20471
  chain: chainIn,
19882
20472
  ...isCrossChain && {
19883
20473
  toChain: chainOut
19884
20474
  },
19885
- ...params.kitKey ? {
19886
- apiKey: params.kitKey
20475
+ ...apiKey ? {
20476
+ apiKey
19887
20477
  } : {}
19888
20478
  };
19889
20479
  let raw = await getSwapStatus$1(request);
@@ -19962,9 +20552,9 @@ const isResultShape = (params)=>'result' in params;
19962
20552
  *
19963
20553
  * Two parameter shapes are accepted:
19964
20554
  *
19965
- * - Pass the {@link SwapResult} directly: `{ result, kitKey, ... }`.
20555
+ * - Pass the {@link SwapResult} directly: `{ result, apiKey, ... }`.
19966
20556
  * Cleanest when chaining off `kit.swap()`.
19967
- * - Pass discrete fields: `{ txHash, chainIn, chainOut?, kitKey, ... }`.
20557
+ * - Pass discrete fields: `{ txHash, chainIn, chainOut?, apiKey, ... }`.
19968
20558
  * Useful for resuming an in-flight swap from a persisted record.
19969
20559
  *
19970
20560
  * @param params - Wait configuration. See {@link WaitForSwapParams}.
@@ -19984,7 +20574,7 @@ const isResultShape = (params)=>'result' in params;
19984
20574
  *
19985
20575
  * const final = await waitForSwap({
19986
20576
  * result,
19987
- * kitKey: process.env.KIT_KEY ?? '',
20577
+ * apiKey: process.env.CIRCLE_API_KEY,
19988
20578
  * onProgress: (snapshot) => {
19989
20579
  * console.log(snapshot.progress.substatus ?? snapshot.progress.status)
19990
20580
  * },
@@ -20002,7 +20592,7 @@ const isResultShape = (params)=>'result' in params;
20002
20592
  * txHash: '0x…',
20003
20593
  * chainIn: 'Ethereum',
20004
20594
  * chainOut: 'Base',
20005
- * kitKey: process.env.KIT_KEY ?? '',
20595
+ * apiKey: process.env.CIRCLE_API_KEY,
20006
20596
  * })
20007
20597
  * ```
20008
20598
  */ async function waitForSwap(params) {
@@ -20018,14 +20608,15 @@ const isResultShape = (params)=>'result' in params;
20018
20608
  const chainOut = isResultShape(params) ? params.result.chainOut : params.chainOut;
20019
20609
  // Delegate parameter validation (txHash, chainIn, chainOut) to
20020
20610
  // getSwapStatus so the same rules apply to both helpers.
20611
+ const apiKey = resolveApiKey(params);
20021
20612
  const statusParams = {
20022
20613
  txHash,
20023
20614
  chainIn,
20024
20615
  ...chainOut !== undefined && {
20025
20616
  chainOut
20026
20617
  },
20027
- ...params.kitKey ? {
20028
- kitKey: params.kitKey
20618
+ ...apiKey ? {
20619
+ apiKey
20029
20620
  } : {}
20030
20621
  };
20031
20622
  const deadline = Date.now() + timeoutMs;
@@ -20149,7 +20740,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20149
20740
  *
20150
20741
  * @param context - SwapKit context (provides the `TokenRegistry` used for
20151
20742
  * symbol resolution).
20152
- * @param params - `chain`, optional `tokens`, and `kitKey`.
20743
+ * @param params - `chain`, optional `tokens`, and `apiKey`.
20153
20744
  * @returns A nested map of `[chain][address] → { priceUSD, fetchedAt }`.
20154
20745
  * @throws \{KitError\} If `chain` cannot be resolved, `tokens` exceeds 100
20155
20746
  * entries, or any entry is neither a registered symbol nor a
@@ -20164,7 +20755,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20164
20755
  * const { rates } = await getTokenRates(context, {
20165
20756
  * chain: Blockchain.Ethereum,
20166
20757
  * tokens: ['USDC', 'EURC', 'NATIVE'],
20167
- * kitKey: process.env.KIT_KEY ?? '',
20758
+ * apiKey: process.env.CIRCLE_API_KEY,
20168
20759
  * })
20169
20760
  *
20170
20761
  * const usdc = rates['Ethereum']?.['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48']
@@ -20185,10 +20776,11 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20185
20776
  // valid Blockchain enum string, so `getChainByEnum` is guaranteed to resolve.
20186
20777
  const chainDef = getChainByEnum(chain);
20187
20778
  const resolvedAddresses = params.tokens?.map((entry, index)=>resolveTokenEntry(entry, index, chain, chainDef, context));
20779
+ const apiKey = resolveApiKey(params);
20188
20780
  return getTokenRates$1({
20189
20781
  chain,
20190
- ...params.kitKey ? {
20191
- apiKey: params.kitKey
20782
+ ...apiKey ? {
20783
+ apiKey
20192
20784
  } : {},
20193
20785
  ...resolvedAddresses !== undefined && {
20194
20786
  addresses: resolvedAddresses
@@ -20819,7 +21411,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20819
21411
  * is formatted as a human-readable decimal string; when decimals are
20820
21412
  * missing the field is omitted entirely (never raw base units).
20821
21413
  *
20822
- * @param params - `txHash`, `chainIn`, optional `chainOut`, and `kitKey`.
21414
+ * @param params - `txHash`, `chainIn`, optional `chainOut`, and `apiKey`.
20823
21415
  * @returns A snapshot of the swap's status at the time of the call.
20824
21416
  * @throws \{KitError\} If `chainIn` or `chainOut` is malformed.
20825
21417
  *
@@ -20832,7 +21424,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20832
21424
  * txHash: result.txHash,
20833
21425
  * chainIn: result.chainIn,
20834
21426
  * chainOut: result.chainOut,
20835
- * kitKey: process.env.KIT_KEY ?? '',
21427
+ * apiKey: process.env.CIRCLE_API_KEY,
20836
21428
  * })
20837
21429
  * console.log(status.progress.status, status.progress.substatus)
20838
21430
  * ```
@@ -20844,7 +21436,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20844
21436
  * txHash: result.txHash,
20845
21437
  * chainIn: result.chainIn,
20846
21438
  * chainOut: result.chainOut,
20847
- * kitKey: process.env.KIT_KEY ?? '',
21439
+ * apiKey: process.env.CIRCLE_API_KEY,
20848
21440
  * })
20849
21441
  * while (status.progress.status === 'PENDING') {
20850
21442
  * await new Promise((r) => setTimeout(r, 3_000))
@@ -20852,7 +21444,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20852
21444
  * txHash: result.txHash,
20853
21445
  * chainIn: result.chainIn,
20854
21446
  * chainOut: result.chainOut,
20855
- * kitKey: process.env.KIT_KEY ?? '',
21447
+ * apiKey: process.env.CIRCLE_API_KEY,
20856
21448
  * })
20857
21449
  * }
20858
21450
  *
@@ -20883,7 +21475,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20883
21475
  * 5xx, etc.) surface unchanged so the caller can decide whether to
20884
21476
  * retry the whole wait. The wait itself only emits a timeout error.
20885
21477
  *
20886
- * @param params - Wait configuration including identifiers, kit key,
21478
+ * @param params - Wait configuration including identifiers, API key,
20887
21479
  * optional `timeoutMs`, and an optional `onProgress`
20888
21480
  * callback fired on every successful poll.
20889
21481
  * @returns The first terminal {@link SwapStatusResult} observed.
@@ -20902,7 +21494,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20902
21494
  *
20903
21495
  * const final = await kit.waitForSwap({
20904
21496
  * result,
20905
- * kitKey: process.env.KIT_KEY ?? '',
21497
+ * apiKey: process.env.CIRCLE_API_KEY,
20906
21498
  * onProgress: (snap) => console.log(snap.progress.substatus ?? snap.progress.status),
20907
21499
  * })
20908
21500
  *
@@ -20920,7 +21512,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20920
21512
  * txHash: persisted.txHash,
20921
21513
  * chainIn: persisted.chainIn,
20922
21514
  * chainOut: persisted.chainOut,
20923
- * kitKey: process.env.KIT_KEY ?? '',
21515
+ * apiKey: process.env.CIRCLE_API_KEY,
20924
21516
  * })
20925
21517
  * ```
20926
21518
  */ async waitForSwap(params) {
@@ -20954,7 +21546,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20954
21546
  * not cache a rate for the native asset on that chain, the response simply
20955
21547
  * omits the address.
20956
21548
  *
20957
- * @param params - `chain`, optional `tokens`, and `kitKey`.
21549
+ * @param params - `chain`, optional `tokens`, and `apiKey`.
20958
21550
  * @returns A nested map of `[chain][address] → { priceUSD, fetchedAt }`.
20959
21551
  * @throws \{KitError\} If `chain` is malformed, `tokens` exceeds 100
20960
21552
  * entries, or any entry is neither a registered symbol nor a
@@ -20966,7 +21558,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20966
21558
  * const { rates } = await kit.getTokenRates({
20967
21559
  * chain: 'Ethereum',
20968
21560
  * tokens: ['USDC', 'EURC', 'NATIVE'],
20969
- * kitKey: process.env.KIT_KEY ?? '',
21561
+ * apiKey: process.env.CIRCLE_API_KEY,
20970
21562
  * })
20971
21563
  *
20972
21564
  * const usdc = rates['Ethereum']?.['0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48']
@@ -20980,7 +21572,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20980
21572
  * chain: 'Ethereum',
20981
21573
  * // 'USDC' (registry symbol) + raw USDT address
20982
21574
  * tokens: ['USDC', '0xdAC17F958D2ee523a2206206994597C13D831ec7'],
20983
- * kitKey: process.env.KIT_KEY ?? '',
21575
+ * apiKey: process.env.CIRCLE_API_KEY,
20984
21576
  * })
20985
21577
  * ```
20986
21578
  *
@@ -20989,7 +21581,7 @@ function resolveTokenEntry(entry, index, chain, chainDef, context) {
20989
21581
  * ```typescript
20990
21582
  * const { rates } = await kit.getTokenRates({
20991
21583
  * chain: 'Base',
20992
- * kitKey: process.env.KIT_KEY ?? '',
21584
+ * apiKey: process.env.CIRCLE_API_KEY,
20993
21585
  * })
20994
21586
  * ```
20995
21587
  */ async getTokenRates(params) {
@@ -21244,7 +21836,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
21244
21836
  };
21245
21837
 
21246
21838
  var name = "@circle-fin/earn-kit";
21247
- var version = "1.5.0";
21839
+ var version = "1.6.0";
21248
21840
  var pkg = {
21249
21841
  name: name,
21250
21842
  version: version};
@@ -21316,7 +21908,7 @@ function isNonNegativeBigIntLike(value) {
21316
21908
  }
21317
21909
  }
21318
21910
  const hexSignatureSchema = evmSignatureSchema;
21319
- const hexAddressSchema = evmAddressSchema;
21911
+ const hexAddressSchema = evmAddressSchema$1;
21320
21912
  // '0x' prefix + 32 bytes * 2 hex chars.
21321
21913
  const BYTES32_HEX_LENGTH = 66;
21322
21914
  const bridgeFeeTokenSchema = hexAddressSchema;
@@ -22221,7 +22813,7 @@ createTokenRegistry();
22221
22813
  * fast instead of round-tripping to the service.
22222
22814
  *
22223
22815
  * @internal
22224
- */ 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');
22816
+ */ 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');
22225
22817
  /**
22226
22818
  * Schema for the adapter context within earn operations.
22227
22819
  *
@@ -22253,19 +22845,39 @@ const sourceAdapterContextSchema = z.object({
22253
22845
  /**
22254
22846
  * Schema for the EarnConfig options.
22255
22847
  *
22256
- * Validate the optional Kit Key field using the standard `apiKeySchema`
22257
- * format (`KIT_KEY:<keyId>:<keySecret>`). When omitted, the SDK
22258
- * operates in permissionless mode. `baseUrl` overrides the Earn Service
22259
- * endpoint (e.g. staging); `batchTransactions: false` opts out of atomic
22260
- * batched execution. Both are forwarded to the provider, so this `.strict()`
22261
- * schema must accept them or a valid config object is rejected.
22848
+ * Validate the *resolved* credential using the standard `apiKeySchema` format
22849
+ * (`<ENV>_API_KEY:<keyId>:<keySecret>`, or a legacy
22850
+ * `KIT_KEY:<keyId>:<keySecret>`). `apiKey` takes precedence over the deprecated
22851
+ * `kitKey`, so a malformed `kitKey` that is being ignored must not fail a config
22852
+ * that supplies a valid `apiKey` (and vice versa) only the credential that
22853
+ * would actually be sent is format-checked. When neither is supplied the SDK
22854
+ * operates in permissionless mode. `baseUrl` overrides the Earn Service endpoint
22855
+ * (e.g. staging); `batchTransactions: false` opts out of atomic batched
22856
+ * execution. All are forwarded to the provider, so this `.strict()` schema must
22857
+ * accept them or a valid config object is rejected.
22262
22858
  *
22263
22859
  * @internal
22264
22860
  */ const earnConfigSchema = z.object({
22265
- kitKey: apiKeySchema.optional(),
22861
+ apiKey: z.string().optional(),
22862
+ kitKey: z.string().optional(),
22266
22863
  baseUrl: z.string().optional(),
22267
22864
  batchTransactions: z.boolean().optional()
22268
- }).strict();
22865
+ }).strict().superRefine((config, ctx)=>{
22866
+ const credential = resolveApiKey(config);
22867
+ if (credential === undefined) {
22868
+ return;
22869
+ }
22870
+ const result = apiKeySchema.safeParse(credential);
22871
+ if (!result.success) {
22872
+ ctx.addIssue({
22873
+ code: z.ZodIssueCode.custom,
22874
+ path: [
22875
+ credential === config.apiKey ? 'apiKey' : 'kitKey'
22876
+ ],
22877
+ message: result.error.issues[0]?.message ?? 'Invalid API key format'
22878
+ });
22879
+ }
22880
+ });
22269
22881
  /**
22270
22882
  * Canonical decimal form: a leading digit with no leading zeros (a single
22271
22883
  * '0' is only allowed immediately before the decimal point). Rejects the
@@ -22337,7 +22949,7 @@ const sourceAdapterContextSchema = z.object({
22337
22949
  * currently supports EVM vault addresses on Arc Testnet.
22338
22950
  *
22339
22951
  * @internal
22340
- */ const vaultAddressSchema = evmAddressSchema.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
22952
+ */ const vaultAddressSchema = evmAddressSchema$1.refine(isValidEip55Checksum, 'address has an invalid EIP-55 checksum');
22341
22953
  /**
22342
22954
  * Validation schema for VaultQuery.
22343
22955
  *
@@ -22612,7 +23224,7 @@ const sameChainGetDepositQuoteParamsSchema = z.object({
22612
23224
  const crossChainGetDepositQuoteParamsSchema = z.object({
22613
23225
  from: sourceAdapterContextSchema,
22614
23226
  chain: earnBridgeDestinationChainIdentifierSchema,
22615
- address: evmAddressSchema,
23227
+ address: evmAddressSchema$1,
22616
23228
  vaultAddress: vaultAddressSchema,
22617
23229
  amount: amountSchema,
22618
23230
  transferSpeed: z.enum([