@circle-fin/app-kit 1.11.0 → 1.12.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
@@ -38,6 +38,7 @@ import '@coral-xyz/anchor';
38
38
  import bs58 from 'bs58';
39
39
  import '@noble/curves/ed25519';
40
40
  import { formatUnits as formatUnits$1 } from '@ethersproject/units';
41
+ import 'viem';
41
42
  import { keccak256 } from '@ethersproject/keccak256';
42
43
 
43
44
  // Import global type declarations
@@ -3002,6 +3003,8 @@ class KitError extends Error {
3002
3003
  Blockchain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
3003
3004
  Blockchain["XDC"] = "XDC";
3004
3005
  Blockchain["XDC_Apothem"] = "XDC_Apothem";
3006
+ Blockchain["X_Layer"] = "X_Layer";
3007
+ Blockchain["X_Layer_Testnet"] = "X_Layer_Testnet";
3005
3008
  Blockchain["ZKSync_Era"] = "ZKSync_Era";
3006
3009
  Blockchain["ZKSync_Sepolia"] = "ZKSync_Sepolia";
3007
3010
  })(Blockchain || (Blockchain = {}));
@@ -3055,6 +3058,7 @@ var BridgeChain;
3055
3058
  BridgeChain["Unichain"] = "Unichain";
3056
3059
  BridgeChain["World_Chain"] = "World_Chain";
3057
3060
  BridgeChain["XDC"] = "XDC";
3061
+ BridgeChain["X_Layer"] = "X_Layer";
3058
3062
  // Testnet chains with CCTPv2 support
3059
3063
  BridgeChain["Arc_Testnet"] = "Arc_Testnet";
3060
3064
  BridgeChain["Arbitrum_Sepolia"] = "Arbitrum_Sepolia";
@@ -3080,6 +3084,7 @@ var BridgeChain;
3080
3084
  BridgeChain["Unichain_Sepolia"] = "Unichain_Sepolia";
3081
3085
  BridgeChain["World_Chain_Sepolia"] = "World_Chain_Sepolia";
3082
3086
  BridgeChain["XDC_Apothem"] = "XDC_Apothem";
3087
+ BridgeChain["X_Layer_Testnet"] = "X_Layer_Testnet";
3083
3088
  })(BridgeChain || (BridgeChain = {}));
3084
3089
  var UnifiedBalanceChain;
3085
3090
  (function(UnifiedBalanceChain) {
@@ -5628,7 +5633,8 @@ var EarnChain;
5628
5633
  isTestnet: true,
5629
5634
  explorerUrl: 'https://amoy.polygonscan.com/tx/{hash}',
5630
5635
  rpcEndpoints: [
5631
- 'https://rpc-amoy.polygon.technology'
5636
+ 'https://polygon-amoy-bor-rpc.publicnode.com',
5637
+ 'https://polygon-amoy.drpc.org'
5632
5638
  ],
5633
5639
  eurcAddress: null,
5634
5640
  usdcAddress: '0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582',
@@ -6493,6 +6499,104 @@ var EarnChain;
6493
6499
  }
6494
6500
  });
6495
6501
 
6502
+ /**
6503
+ * X Layer Mainnet chain definition
6504
+ * @remarks
6505
+ * This represents the official production network for the X Layer blockchain.
6506
+ * X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
6507
+ * using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
6508
+ * OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
6509
+ */ const XLayer = defineChain({
6510
+ type: 'evm',
6511
+ chain: Blockchain.X_Layer,
6512
+ name: 'X Layer',
6513
+ title: 'X Layer Mainnet',
6514
+ nativeCurrency: {
6515
+ name: 'OKB',
6516
+ symbol: 'OKB',
6517
+ decimals: 18
6518
+ },
6519
+ chainId: 196,
6520
+ isTestnet: false,
6521
+ explorerUrl: 'https://www.oklink.com/xlayer/tx/{hash}',
6522
+ rpcEndpoints: [
6523
+ 'https://xlayerrpc.okx.com'
6524
+ ],
6525
+ eurcAddress: null,
6526
+ usdcAddress: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
6527
+ usdtAddress: null,
6528
+ cctp: {
6529
+ domain: 37,
6530
+ contracts: {
6531
+ v2: {
6532
+ type: 'split',
6533
+ tokenMessenger: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d',
6534
+ messageTransmitter: '0x81D40F21F12A8F0E3252Bccb954D722d4c464B64',
6535
+ confirmations: 65,
6536
+ fastConfirmations: 1
6537
+ }
6538
+ },
6539
+ forwarderSupported: {
6540
+ source: false,
6541
+ destination: false
6542
+ }
6543
+ },
6544
+ kitContracts: {
6545
+ bridge: BRIDGE_CONTRACT_EVM_MAINNET
6546
+ }
6547
+ });
6548
+
6549
+ /**
6550
+ * X Layer Testnet chain definition
6551
+ * @remarks
6552
+ * This represents the official test network for the X Layer blockchain.
6553
+ * X Layer is an EVM-compatible OP Stack Layer-2 blockchain built by OKX,
6554
+ * using OKB as its native gas token. (Migrated from Polygon zkEVM/CDK to the
6555
+ * OP Stack on 2025-10-27; older docs describing it as zkEVM are obsolete.)
6556
+ */ const XLayerTestnet = defineChain({
6557
+ type: 'evm',
6558
+ chain: Blockchain.X_Layer_Testnet,
6559
+ name: 'X Layer Testnet',
6560
+ title: 'X Layer Testnet',
6561
+ nativeCurrency: {
6562
+ name: 'OKB',
6563
+ symbol: 'OKB',
6564
+ decimals: 18
6565
+ },
6566
+ chainId: 1952,
6567
+ isTestnet: true,
6568
+ // Deliberately not oklink.com (used for mainnet): viem's bundled OKLink
6569
+ // testnet URL targets the deprecated pre-rebrand chain ID 195, not this
6570
+ // chain's ID (1952). Verified against the internal chain-expansion-scripts
6571
+ // config (`v2config.sandbox.yml`) — do not "normalize" this to match mainnet.
6572
+ explorerUrl: 'https://web3.okx.com/explorer/x-layer-testnet/tx/{hash}',
6573
+ rpcEndpoints: [
6574
+ 'https://testrpc.xlayer.tech'
6575
+ ],
6576
+ eurcAddress: null,
6577
+ usdcAddress: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
6578
+ usdtAddress: null,
6579
+ cctp: {
6580
+ domain: 37,
6581
+ contracts: {
6582
+ v2: {
6583
+ type: 'split',
6584
+ tokenMessenger: '0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA',
6585
+ messageTransmitter: '0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275',
6586
+ confirmations: 65,
6587
+ fastConfirmations: 1
6588
+ }
6589
+ },
6590
+ forwarderSupported: {
6591
+ source: false,
6592
+ destination: false
6593
+ }
6594
+ },
6595
+ kitContracts: {
6596
+ bridge: BRIDGE_CONTRACT_EVM_TESTNET
6597
+ }
6598
+ });
6599
+
6496
6600
  /**
6497
6601
  * ZKSync Era Mainnet chain definition
6498
6602
  * @remarks
@@ -6612,6 +6716,8 @@ var Chains = /*#__PURE__*/Object.freeze({
6612
6716
  WorldChainSepolia: WorldChainSepolia,
6613
6717
  XDC: XDC,
6614
6718
  XDCApothem: XDCApothem,
6719
+ XLayer: XLayer,
6720
+ XLayerTestnet: XLayerTestnet,
6615
6721
  ZKSyncEra: ZKSyncEra,
6616
6722
  ZKSyncEraSepolia: ZKSyncEraSepolia
6617
6723
  });
@@ -8640,6 +8746,7 @@ const swapTokenEnumSchema = z.enum([
8640
8746
  [Blockchain.Unichain]: '0x078D782b760474a361dDA0AF3839290b0EF57AD6',
8641
8747
  [Blockchain.World_Chain]: '0x79A02482A880bCE3F13e09Da970dC34db4CD24d1',
8642
8748
  [Blockchain.XDC]: '0xfA2958CB79b0491CC627c1557F441eF849Ca8eb1',
8749
+ [Blockchain.X_Layer]: '0xB6CEceAB302E2E4948951eE7843FC24E92933061',
8643
8750
  [Blockchain.ZKSync_Era]: '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4',
8644
8751
  // =========================================================================
8645
8752
  // Testnets (alphabetically sorted)
@@ -8674,6 +8781,7 @@ const swapTokenEnumSchema = z.enum([
8674
8781
  [Blockchain.Unichain_Sepolia]: '0x31d0220469e10c4E71834a79b1f276d740d3768F',
8675
8782
  [Blockchain.World_Chain_Sepolia]: '0x66145f38cBAC35Ca6F1Dfb4914dF98F1614aeA88',
8676
8783
  [Blockchain.XDC_Apothem]: '0xb5AB69F7bBada22B28e79C8FFAECe55eF1c771D4',
8784
+ [Blockchain.X_Layer_Testnet]: '0xDec90b78111Ba2fc6FC6d84d8B9ec159A2d4b9B3',
8677
8785
  [Blockchain.ZKSync_Sepolia]: '0xAe045DE5638162fa134807Cb558E15A3F5A7F853'
8678
8786
  }
8679
8787
  };
@@ -9961,7 +10069,7 @@ const swapTokenEnumSchema = z.enum([
9961
10069
  }
9962
10070
 
9963
10071
  var name$2 = "@circle-fin/bridge-kit";
9964
- var version$2 = "1.12.2";
10072
+ var version$2 = "1.13.0";
9965
10073
  var pkg$2 = {
9966
10074
  name: name$2,
9967
10075
  version: version$2};
@@ -9997,13 +10105,21 @@ var pkg$2 = {
9997
10105
  computeFee: z.function().returns(z.string().or(z.promise(z.string()))).optional(),
9998
10106
  calculateFee: z.function().returns(z.string().or(z.promise(z.string()))).optional(),
9999
10107
  resolveFeeRecipientAddress: z.function().returns(z.string().or(z.promise(z.string())))
10000
- }).strict().refine((data)=>{
10108
+ }).strict().superRefine((data, ctx)=>{
10001
10109
  const hasComputeFee = data.computeFee !== undefined;
10002
10110
  const hasCalculateFee = data.calculateFee !== undefined;
10003
- // XOR: exactly one must be provided
10004
- return hasComputeFee !== hasCalculateFee;
10005
- }, {
10006
- message: 'Provide either computeFee or calculateFee, not both. Use computeFee (recommended) for human-readable amounts.'
10111
+ if (hasComputeFee && hasCalculateFee) {
10112
+ ctx.addIssue({
10113
+ code: z.ZodIssueCode.custom,
10114
+ message: 'Provide either computeFee or calculateFee, not both. Use computeFee (recommended) for human-readable amounts.'
10115
+ });
10116
+ }
10117
+ if (!hasComputeFee && !hasCalculateFee) {
10118
+ ctx.addIssue({
10119
+ code: z.ZodIssueCode.custom,
10120
+ message: 'Provide either computeFee or calculateFee. Use computeFee (recommended) for human-readable amounts.'
10121
+ });
10122
+ }
10007
10123
  });
10008
10124
 
10009
10125
  /**
@@ -10862,7 +10978,7 @@ var TransferSpeed;
10862
10978
  registerKit(`${pkg$2.name}/${pkg$2.version}`);
10863
10979
 
10864
10980
  var name$1 = "@circle-fin/swap-kit";
10865
- var version$1 = "1.5.0";
10981
+ var version$1 = "1.5.1";
10866
10982
  var pkg$1 = {
10867
10983
  name: name$1,
10868
10984
  version: version$1};
@@ -21067,7 +21183,9 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
21067
21183
  disableAnalytics: context.disableAnalytics
21068
21184
  }
21069
21185
  });
21070
- if (hasBoth) {
21186
+ if (context.customFeePolicy?.swap != null) {
21187
+ kit.setCustomFeePolicy(context.customFeePolicy.swap);
21188
+ } else if (hasBoth) {
21071
21189
  kit.setCustomFeePolicy({
21072
21190
  computeFee: async (params)=>{
21073
21191
  // Adapt provider-level params (with tokenIn/tokenOut)
@@ -21126,7 +21244,7 @@ registerKit(`${pkg$1.name}/${pkg$1.version}`);
21126
21244
  };
21127
21245
 
21128
21246
  var name = "@circle-fin/earn-kit";
21129
- var version = "1.4.0";
21247
+ var version = "1.5.0";
21130
21248
  var pkg = {
21131
21249
  name: name,
21132
21250
  version: version};
@@ -22137,11 +22255,16 @@ const sourceAdapterContextSchema = z.object({
22137
22255
  *
22138
22256
  * Validate the optional Kit Key field using the standard `apiKeySchema`
22139
22257
  * format (`KIT_KEY:<keyId>:<keySecret>`). When omitted, the SDK
22140
- * operates in permissionless mode.
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.
22141
22262
  *
22142
22263
  * @internal
22143
22264
  */ const earnConfigSchema = z.object({
22144
- kitKey: apiKeySchema.optional()
22265
+ kitKey: apiKeySchema.optional(),
22266
+ baseUrl: z.string().optional(),
22267
+ batchTransactions: z.boolean().optional()
22145
22268
  }).strict();
22146
22269
  /**
22147
22270
  * Canonical decimal form: a leading digit with no leading zeros (a single