@x402x/extensions 2.3.1 → 2.4.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/dist/index.js CHANGED
@@ -201,10 +201,17 @@ function isValidHex(hex) {
201
201
  var NETWORK_ALIASES_V1_TO_V2 = {
202
202
  // V1 human-readable names -> V2 CAIP-2 canonical keys
203
203
  "base-sepolia": "eip155:84532",
204
+ "xlayer-testnet": "eip155:1952",
205
+ // Legacy alias for backward compatibility
204
206
  "x-layer-testnet": "eip155:1952",
207
+ // Canonical alias (must come after legacy to override)
205
208
  "skale-base-sepolia": "eip155:324705682",
209
+ "skale-base": "eip155:1187947933",
206
210
  base: "eip155:8453",
211
+ xlayer: "eip155:196",
212
+ // Legacy alias for backward compatibility
207
213
  "x-layer": "eip155:196",
214
+ // Canonical alias (must come after legacy to override)
208
215
  "bsc-testnet": "eip155:97",
209
216
  bsc: "eip155:56"
210
217
  };
@@ -273,6 +280,14 @@ var DEFAULT_ASSETS = {
273
280
  name: "x402 Wrapped USDT",
274
281
  version: "1"
275
282
  }
283
+ },
284
+ "eip155:1187947933": {
285
+ address: "0x85889c8c714505E0c94b30fcfcF64fE3Ac8FCb20",
286
+ decimals: 6,
287
+ eip712: {
288
+ name: "Bridged USDC (SKALE Bridge)",
289
+ version: "2"
290
+ }
276
291
  }
277
292
  };
278
293
  function getNetworkAlias(network) {
@@ -437,7 +452,7 @@ var networks = {
437
452
  },
438
453
  metadata: {
439
454
  gasModel: "legacy",
440
- nativeToken: "Credits"
455
+ nativeToken: "CREDIT"
441
456
  }
442
457
  },
443
458
  "eip155:97": {
@@ -528,6 +543,28 @@ var networks = {
528
543
  gasModel: "legacy",
529
544
  nativeToken: "BNB"
530
545
  }
546
+ },
547
+ "eip155:1187947933": {
548
+ chainId: 1187947933,
549
+ name: "SKALE on Base",
550
+ type: "mainnet",
551
+ addressExplorerBaseUrl: "https://skale-base-explorer.skalenodes.com/address/",
552
+ txExplorerBaseUrl: "https://skale-base-explorer.skalenodes.com/tx/",
553
+ settlementRouter: "0x1Ae0E196dC18355aF3a19985faf67354213F833D",
554
+ defaultAsset: getDefaultAssetConfig("eip155:1187947933"),
555
+ hooks: {
556
+ transfer: "0x2f05fe5674aE756E25C26855258B4877E9e021Fd"
557
+ },
558
+ demoHooks: {
559
+ nftMint: "0x73fc659Cd5494E69852bE8D9D23FE05Aab14b29B",
560
+ randomNFT: "0x081258287F692D61575387ee2a4075f34dd7Aef7",
561
+ reward: "0xC20634ea518985901e32Fbc1bA27fa673D37601A",
562
+ rewardToken: "0x9Fc2c199170B039f093ABCd54008038F0C0a31d6"
563
+ },
564
+ metadata: {
565
+ gasModel: "legacy",
566
+ nativeToken: "CREDIT"
567
+ }
531
568
  }
532
569
  };
533
570
  function getNetworkConfig(network) {
@@ -572,16 +609,16 @@ var customChains = {
572
609
  324705682: viem.defineChain({
573
610
  id: 324705682,
574
611
  name: "SKALE Nebula Testnet",
575
- nativeCurrency: { name: "sFUEL", symbol: "sFUEL", decimals: 18 },
612
+ nativeCurrency: { name: "CREDIT", symbol: "CREDIT", decimals: 18 },
576
613
  rpcUrls: {
577
614
  default: {
578
- http: ["https://testnet.skalenodes.com/v1/lanky-ill-funny-testnet"]
615
+ http: ["https://base-sepolia-testnet.skalenodes.com/v1/jubilant-horrible-ancha"]
579
616
  }
580
617
  },
581
618
  blockExplorers: {
582
619
  default: {
583
620
  name: "SKALE Explorer",
584
- url: "https://lanky-ill-funny-testnet.explorer.testnet.skalenodes.com"
621
+ url: "https://base-sepolia-testnet-explorer.skalenodes.com"
585
622
  }
586
623
  },
587
624
  testnet: true
@@ -598,6 +635,22 @@ var customChains = {
598
635
  default: { name: "OKLink", url: "https://www.oklink.com/xlayer" }
599
636
  },
600
637
  testnet: false
638
+ }),
639
+ // SKALE Base Mainnet
640
+ 1187947933: viem.defineChain({
641
+ id: 1187947933,
642
+ name: "SKALE Base",
643
+ nativeCurrency: { name: "CREDIT", symbol: "CREDIT", decimals: 18 },
644
+ rpcUrls: {
645
+ default: { http: ["https://skale-base.skalenodes.com/v1/base"] }
646
+ },
647
+ blockExplorers: {
648
+ default: {
649
+ name: "SKALE Explorer",
650
+ url: "https://skale-base-explorer.skalenodes.com"
651
+ }
652
+ },
653
+ testnet: false
601
654
  })
602
655
  };
603
656
  function getChain(network) {
@@ -1099,8 +1152,8 @@ async function verify(facilitatorUrl, paymentPayload, paymentRequirements) {
1099
1152
  body: JSON.stringify({
1100
1153
  paymentPayload,
1101
1154
  paymentRequirements,
1102
- x402Version: paymentPayload.x402Version
1103
- // Include x402Version at top level
1155
+ x402Version: paymentPayload.x402Version ?? 2
1156
+ // Include x402Version at top level, default to 2
1104
1157
  }),
1105
1158
  // Add timeout
1106
1159
  signal: AbortSignal.timeout(1e4)
@@ -1140,8 +1193,8 @@ async function settle(facilitatorUrl, paymentPayload, paymentRequirements, timeo
1140
1193
  body: JSON.stringify({
1141
1194
  paymentPayload,
1142
1195
  paymentRequirements,
1143
- x402Version: paymentPayload.x402Version
1144
- // Include x402Version at top level
1196
+ x402Version: paymentPayload.x402Version ?? 2
1197
+ // Include x402Version at top level, default to 2
1145
1198
  }),
1146
1199
  signal: controller.signal
1147
1200
  });