x402z-facilitator 0.0.12 → 0.1.11

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
@@ -546,6 +546,7 @@ function startFacilitatorService(config) {
546
546
  // src/service/bootstrap.ts
547
547
  var import_facilitator = require("@x402/core/facilitator");
548
548
  var import_evm = require("@x402/evm");
549
+ var import_facilitator2 = require("@x402/evm/exact/facilitator");
549
550
  var import_viem2 = require("viem");
550
551
  var import_accounts = require("viem/accounts");
551
552
  function requireEnv(key) {
@@ -558,13 +559,23 @@ function requireEnv(key) {
558
559
  function createFacilitatorFromEnv() {
559
560
  const privateKey = requireEnv("FACILITATOR_EVM_PRIVATE_KEY");
560
561
  const chainId = Number(process.env.FACILITATOR_EVM_CHAIN_ID ?? "11155111");
561
- const rpcUrl = requireEnv("FACILITATOR_EVM_RPC_URL");
562
+ const rpcUrl = process.env.FACILITATOR_EVM_RPC_URL ?? process.env.RPC_URL;
563
+ if (!rpcUrl) {
564
+ throw new Error("Missing required env var: RPC_URL or FACILITATOR_EVM_RPC_URL");
565
+ }
562
566
  const networks = (process.env.FACILITATOR_NETWORKS ?? "eip155:11155111").split(",").map((network) => network.trim()).filter(Boolean);
563
567
  const waitForReceipt = (process.env.FACILITATOR_WAIT_FOR_RECEIPT ?? "true") === "true";
564
568
  const batcherAddress = process.env.FACILITATOR_BATCHER_ADDRESS;
565
569
  if (!batcherAddress) {
566
570
  throw new Error("FACILITATOR_BATCHER_ADDRESS is required");
567
571
  }
572
+ const confidentialAsset = process.env.FACILITATOR_CONFIDENTIAL_ASSET;
573
+ const confidentialEip712Name = process.env.FACILITATOR_CONFIDENTIAL_EIP712_NAME;
574
+ const confidentialEip712Version = process.env.FACILITATOR_CONFIDENTIAL_EIP712_VERSION;
575
+ const confidentialDecimals = process.env.FACILITATOR_CONFIDENTIAL_DECIMALS ? Number(process.env.FACILITATOR_CONFIDENTIAL_DECIMALS) : void 0;
576
+ const exactAsset = process.env.FACILITATOR_EXACT_ASSET;
577
+ const exactDecimals = process.env.FACILITATOR_EXACT_DECIMALS ? Number(process.env.FACILITATOR_EXACT_DECIMALS) : void 0;
578
+ const exactNetwork = process.env.FACILITATOR_EXACT_NETWORK;
568
579
  const batchIntervalMs = process.env.FACILITATOR_BATCH_INTERVAL_MS ? Number(process.env.FACILITATOR_BATCH_INTERVAL_MS) : void 0;
569
580
  const receiptTimeoutMs = process.env.FACILITATOR_RECEIPT_TIMEOUT_MS ? Number(process.env.FACILITATOR_RECEIPT_TIMEOUT_MS) : void 0;
570
581
  const receiptConfirmations = process.env.FACILITATOR_RECEIPT_CONFIRMATIONS ? Number(process.env.FACILITATOR_RECEIPT_CONFIRMATIONS) : void 0;
@@ -699,6 +710,10 @@ function createFacilitatorFromEnv() {
699
710
  }
700
711
  };
701
712
  const facilitator = new import_facilitator.x402Facilitator();
713
+ (0, import_facilitator2.registerExactEvmScheme)(facilitator, {
714
+ signer: baseSigner,
715
+ networks
716
+ });
702
717
  for (const network of networks) {
703
718
  facilitator.register(
704
719
  network,
@@ -715,6 +730,48 @@ function createFacilitatorFromEnv() {
715
730
  })
716
731
  );
717
732
  }
733
+ const supportedConfidential = confidentialAsset && confidentialEip712Name && confidentialEip712Version && batcherAddress ? {
734
+ asset: confidentialAsset,
735
+ eip712: {
736
+ name: confidentialEip712Name,
737
+ version: confidentialEip712Version
738
+ },
739
+ decimals: confidentialDecimals ?? 6,
740
+ batcherAddress
741
+ } : null;
742
+ const supportedExact = exactAsset ? {
743
+ asset: exactAsset,
744
+ decimals: exactDecimals ?? 6
745
+ } : null;
746
+ if (supportedConfidential || supportedExact) {
747
+ const originalGetSupported = facilitator.getSupported.bind(facilitator);
748
+ facilitator.getSupported = () => {
749
+ const supported = originalGetSupported();
750
+ return {
751
+ ...supported,
752
+ kinds: supported.kinds.map((kind) => {
753
+ if (kind.scheme !== "erc7984-mind-v1") {
754
+ if (!supportedExact || kind.scheme !== "exact") {
755
+ return kind;
756
+ }
757
+ if (exactNetwork && kind.network !== exactNetwork) {
758
+ return kind;
759
+ }
760
+ const extra2 = {
761
+ ...kind.extra,
762
+ exact: supportedExact
763
+ };
764
+ return { ...kind, extra: extra2 };
765
+ }
766
+ const extra = {
767
+ ...kind.extra,
768
+ confidential: supportedConfidential
769
+ };
770
+ return { ...kind, extra };
771
+ })
772
+ };
773
+ };
774
+ }
718
775
  return facilitator;
719
776
  }
720
777
  function startFacilitator() {
package/dist/index.mjs CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  createFacilitatorService,
4
4
  startFacilitator,
5
5
  startFacilitatorService
6
- } from "./chunk-TDT6WJI7.mjs";
6
+ } from "./chunk-2BNYP3FU.mjs";
7
7
 
8
8
  // src/scheme/register.ts
9
9
  function registerX402zEvmFacilitatorScheme(facilitator, config) {
@@ -26,6 +26,7 @@ __export(bootstrap_exports, {
26
26
  module.exports = __toCommonJS(bootstrap_exports);
27
27
  var import_facilitator = require("@x402/core/facilitator");
28
28
  var import_evm = require("@x402/evm");
29
+ var import_facilitator2 = require("@x402/evm/exact/facilitator");
29
30
  var import_viem2 = require("viem");
30
31
  var import_accounts = require("viem/accounts");
31
32
 
@@ -539,13 +540,23 @@ function requireEnv(key) {
539
540
  function createFacilitatorFromEnv() {
540
541
  const privateKey = requireEnv("FACILITATOR_EVM_PRIVATE_KEY");
541
542
  const chainId = Number(process.env.FACILITATOR_EVM_CHAIN_ID ?? "11155111");
542
- const rpcUrl = requireEnv("FACILITATOR_EVM_RPC_URL");
543
+ const rpcUrl = process.env.FACILITATOR_EVM_RPC_URL ?? process.env.RPC_URL;
544
+ if (!rpcUrl) {
545
+ throw new Error("Missing required env var: RPC_URL or FACILITATOR_EVM_RPC_URL");
546
+ }
543
547
  const networks = (process.env.FACILITATOR_NETWORKS ?? "eip155:11155111").split(",").map((network) => network.trim()).filter(Boolean);
544
548
  const waitForReceipt = (process.env.FACILITATOR_WAIT_FOR_RECEIPT ?? "true") === "true";
545
549
  const batcherAddress = process.env.FACILITATOR_BATCHER_ADDRESS;
546
550
  if (!batcherAddress) {
547
551
  throw new Error("FACILITATOR_BATCHER_ADDRESS is required");
548
552
  }
553
+ const confidentialAsset = process.env.FACILITATOR_CONFIDENTIAL_ASSET;
554
+ const confidentialEip712Name = process.env.FACILITATOR_CONFIDENTIAL_EIP712_NAME;
555
+ const confidentialEip712Version = process.env.FACILITATOR_CONFIDENTIAL_EIP712_VERSION;
556
+ const confidentialDecimals = process.env.FACILITATOR_CONFIDENTIAL_DECIMALS ? Number(process.env.FACILITATOR_CONFIDENTIAL_DECIMALS) : void 0;
557
+ const exactAsset = process.env.FACILITATOR_EXACT_ASSET;
558
+ const exactDecimals = process.env.FACILITATOR_EXACT_DECIMALS ? Number(process.env.FACILITATOR_EXACT_DECIMALS) : void 0;
559
+ const exactNetwork = process.env.FACILITATOR_EXACT_NETWORK;
549
560
  const batchIntervalMs = process.env.FACILITATOR_BATCH_INTERVAL_MS ? Number(process.env.FACILITATOR_BATCH_INTERVAL_MS) : void 0;
550
561
  const receiptTimeoutMs = process.env.FACILITATOR_RECEIPT_TIMEOUT_MS ? Number(process.env.FACILITATOR_RECEIPT_TIMEOUT_MS) : void 0;
551
562
  const receiptConfirmations = process.env.FACILITATOR_RECEIPT_CONFIRMATIONS ? Number(process.env.FACILITATOR_RECEIPT_CONFIRMATIONS) : void 0;
@@ -680,6 +691,10 @@ function createFacilitatorFromEnv() {
680
691
  }
681
692
  };
682
693
  const facilitator = new import_facilitator.x402Facilitator();
694
+ (0, import_facilitator2.registerExactEvmScheme)(facilitator, {
695
+ signer: baseSigner,
696
+ networks
697
+ });
683
698
  for (const network of networks) {
684
699
  facilitator.register(
685
700
  network,
@@ -696,6 +711,48 @@ function createFacilitatorFromEnv() {
696
711
  })
697
712
  );
698
713
  }
714
+ const supportedConfidential = confidentialAsset && confidentialEip712Name && confidentialEip712Version && batcherAddress ? {
715
+ asset: confidentialAsset,
716
+ eip712: {
717
+ name: confidentialEip712Name,
718
+ version: confidentialEip712Version
719
+ },
720
+ decimals: confidentialDecimals ?? 6,
721
+ batcherAddress
722
+ } : null;
723
+ const supportedExact = exactAsset ? {
724
+ asset: exactAsset,
725
+ decimals: exactDecimals ?? 6
726
+ } : null;
727
+ if (supportedConfidential || supportedExact) {
728
+ const originalGetSupported = facilitator.getSupported.bind(facilitator);
729
+ facilitator.getSupported = () => {
730
+ const supported = originalGetSupported();
731
+ return {
732
+ ...supported,
733
+ kinds: supported.kinds.map((kind) => {
734
+ if (kind.scheme !== "erc7984-mind-v1") {
735
+ if (!supportedExact || kind.scheme !== "exact") {
736
+ return kind;
737
+ }
738
+ if (exactNetwork && kind.network !== exactNetwork) {
739
+ return kind;
740
+ }
741
+ const extra2 = {
742
+ ...kind.extra,
743
+ exact: supportedExact
744
+ };
745
+ return { ...kind, extra: extra2 };
746
+ }
747
+ const extra = {
748
+ ...kind.extra,
749
+ confidential: supportedConfidential
750
+ };
751
+ return { ...kind, extra };
752
+ })
753
+ };
754
+ };
755
+ }
699
756
  return facilitator;
700
757
  }
701
758
  function startFacilitator() {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createFacilitatorFromEnv,
3
3
  startFacilitator
4
- } from "../chunk-TDT6WJI7.mjs";
4
+ } from "../chunk-2BNYP3FU.mjs";
5
5
  export {
6
6
  createFacilitatorFromEnv,
7
7
  startFacilitator
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x402z-facilitator",
3
- "version": "0.0.12",
3
+ "version": "0.1.11",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "@x402/core": "^2.0.0",
12
12
  "@x402/evm": "^2.0.0",
13
13
  "viem": "^2.39.3",
14
- "x402z-shared": "0.0.19"
14
+ "x402z-shared": "0.1.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "jest": "^29.7.0",