x402z-facilitator 0.0.11 → 0.1.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/README.md +2 -1
- package/dist/chunk-PDAG647E.mjs +751 -0
- package/dist/chunk-TDT6WJI7.mjs +711 -0
- package/dist/index.js +124 -6
- package/dist/index.mjs +1 -1
- package/dist/service/bootstrap.js +124 -6
- package/dist/service/bootstrap.mjs +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -210,6 +210,38 @@ var X402zEvmFacilitator = class {
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
}
|
|
213
|
+
try {
|
|
214
|
+
const txRequest = {
|
|
215
|
+
address: this.batcherAddress,
|
|
216
|
+
abi: batcherAbi,
|
|
217
|
+
functionName: "batchConfidentialTransferWithAuthorization",
|
|
218
|
+
args: [
|
|
219
|
+
(0, import_viem.getAddress)(requirements.asset),
|
|
220
|
+
[
|
|
221
|
+
{
|
|
222
|
+
p: confidentialPayload.authorization,
|
|
223
|
+
encryptedAmountInput: confidentialPayload.encryptedAmountInput,
|
|
224
|
+
inputProof: confidentialPayload.inputProof,
|
|
225
|
+
sig: confidentialPayload.signature
|
|
226
|
+
}
|
|
227
|
+
]
|
|
228
|
+
]
|
|
229
|
+
};
|
|
230
|
+
const [successes] = await this.config.signer.simulateContract(txRequest);
|
|
231
|
+
if (!successes[0]) {
|
|
232
|
+
return {
|
|
233
|
+
isValid: false,
|
|
234
|
+
invalidReason: "preflight_failed",
|
|
235
|
+
payer: confidentialPayload.authorization.holder
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
} catch {
|
|
239
|
+
return {
|
|
240
|
+
isValid: false,
|
|
241
|
+
invalidReason: "preflight_failed",
|
|
242
|
+
payer: confidentialPayload.authorization.holder
|
|
243
|
+
};
|
|
244
|
+
}
|
|
213
245
|
return {
|
|
214
246
|
isValid: true,
|
|
215
247
|
payer: confidentialPayload.authorization.holder
|
|
@@ -514,6 +546,7 @@ function startFacilitatorService(config) {
|
|
|
514
546
|
// src/service/bootstrap.ts
|
|
515
547
|
var import_facilitator = require("@x402/core/facilitator");
|
|
516
548
|
var import_evm = require("@x402/evm");
|
|
549
|
+
var import_facilitator2 = require("@x402/evm/exact/facilitator");
|
|
517
550
|
var import_viem2 = require("viem");
|
|
518
551
|
var import_accounts = require("viem/accounts");
|
|
519
552
|
function requireEnv(key) {
|
|
@@ -526,18 +559,26 @@ function requireEnv(key) {
|
|
|
526
559
|
function createFacilitatorFromEnv() {
|
|
527
560
|
const privateKey = requireEnv("FACILITATOR_EVM_PRIVATE_KEY");
|
|
528
561
|
const chainId = Number(process.env.FACILITATOR_EVM_CHAIN_ID ?? "11155111");
|
|
529
|
-
const rpcUrl =
|
|
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
|
+
}
|
|
530
566
|
const networks = (process.env.FACILITATOR_NETWORKS ?? "eip155:11155111").split(",").map((network) => network.trim()).filter(Boolean);
|
|
531
567
|
const waitForReceipt = (process.env.FACILITATOR_WAIT_FOR_RECEIPT ?? "true") === "true";
|
|
532
568
|
const batcherAddress = process.env.FACILITATOR_BATCHER_ADDRESS;
|
|
533
569
|
if (!batcherAddress) {
|
|
534
570
|
throw new Error("FACILITATOR_BATCHER_ADDRESS is required");
|
|
535
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;
|
|
536
576
|
const batchIntervalMs = process.env.FACILITATOR_BATCH_INTERVAL_MS ? Number(process.env.FACILITATOR_BATCH_INTERVAL_MS) : void 0;
|
|
537
577
|
const receiptTimeoutMs = process.env.FACILITATOR_RECEIPT_TIMEOUT_MS ? Number(process.env.FACILITATOR_RECEIPT_TIMEOUT_MS) : void 0;
|
|
538
578
|
const receiptConfirmations = process.env.FACILITATOR_RECEIPT_CONFIRMATIONS ? Number(process.env.FACILITATOR_RECEIPT_CONFIRMATIONS) : void 0;
|
|
539
579
|
const receiptPollingIntervalMs = process.env.FACILITATOR_RECEIPT_POLLING_INTERVAL_MS ? Number(process.env.FACILITATOR_RECEIPT_POLLING_INTERVAL_MS) : void 0;
|
|
540
580
|
const gasMultiplier = process.env.FACILITATOR_GAS_MULTIPLIER ? Number(process.env.FACILITATOR_GAS_MULTIPLIER) : void 0;
|
|
581
|
+
const feeMultiplier = process.env.FACILITATOR_FEE_MULTIPLIER ? Number(process.env.FACILITATOR_FEE_MULTIPLIER) : void 0;
|
|
541
582
|
const debugEnabled = process.env.X402Z_DEBUG === "1";
|
|
542
583
|
const account = (0, import_accounts.privateKeyToAccount)(privateKey);
|
|
543
584
|
if (debugEnabled) {
|
|
@@ -548,6 +589,7 @@ function createFacilitatorFromEnv() {
|
|
|
548
589
|
waitForReceipt,
|
|
549
590
|
batcherAddress,
|
|
550
591
|
gasMultiplier,
|
|
592
|
+
feeMultiplier,
|
|
551
593
|
batchIntervalMs,
|
|
552
594
|
receipt: {
|
|
553
595
|
confirmations: receiptConfirmations,
|
|
@@ -577,6 +619,8 @@ function createFacilitatorFromEnv() {
|
|
|
577
619
|
verifyTypedData: (args) => client.verifyTypedData(args),
|
|
578
620
|
writeContract: async (args) => {
|
|
579
621
|
let gas;
|
|
622
|
+
let maxFeePerGas;
|
|
623
|
+
let maxPriorityFeePerGas;
|
|
580
624
|
if (gasMultiplier && gasMultiplier > 0) {
|
|
581
625
|
try {
|
|
582
626
|
const estimated = await client.estimateContractGas({
|
|
@@ -594,17 +638,59 @@ function createFacilitatorFromEnv() {
|
|
|
594
638
|
}
|
|
595
639
|
}
|
|
596
640
|
}
|
|
641
|
+
if (feeMultiplier && feeMultiplier > 0) {
|
|
642
|
+
try {
|
|
643
|
+
const fees = await client.estimateFeesPerGas();
|
|
644
|
+
if (fees.maxFeePerGas) {
|
|
645
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
646
|
+
maxFeePerGas = fees.maxFeePerGas * scale / 1000n;
|
|
647
|
+
}
|
|
648
|
+
if (fees.maxPriorityFeePerGas) {
|
|
649
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
650
|
+
maxPriorityFeePerGas = fees.maxPriorityFeePerGas * scale / 1000n;
|
|
651
|
+
}
|
|
652
|
+
} catch (error) {
|
|
653
|
+
if (debugEnabled) {
|
|
654
|
+
console.debug("[x402z-facilitator] fee estimate failed", error);
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
}
|
|
597
658
|
return client.writeContract({
|
|
598
659
|
...args,
|
|
599
660
|
args: args.args || [],
|
|
600
|
-
...gas ? { gas } : {}
|
|
661
|
+
...gas ? { gas } : {},
|
|
662
|
+
...maxFeePerGas ? { maxFeePerGas } : {},
|
|
663
|
+
...maxPriorityFeePerGas ? { maxPriorityFeePerGas } : {}
|
|
601
664
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
602
665
|
});
|
|
603
666
|
},
|
|
604
|
-
sendTransaction: (args) =>
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
667
|
+
sendTransaction: async (args) => {
|
|
668
|
+
let maxFeePerGas;
|
|
669
|
+
let maxPriorityFeePerGas;
|
|
670
|
+
if (feeMultiplier && feeMultiplier > 0) {
|
|
671
|
+
try {
|
|
672
|
+
const fees = await client.estimateFeesPerGas();
|
|
673
|
+
if (fees.maxFeePerGas) {
|
|
674
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
675
|
+
maxFeePerGas = fees.maxFeePerGas * scale / 1000n;
|
|
676
|
+
}
|
|
677
|
+
if (fees.maxPriorityFeePerGas) {
|
|
678
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
679
|
+
maxPriorityFeePerGas = fees.maxPriorityFeePerGas * scale / 1000n;
|
|
680
|
+
}
|
|
681
|
+
} catch (error) {
|
|
682
|
+
if (debugEnabled) {
|
|
683
|
+
console.debug("[x402z-facilitator] fee estimate failed", error);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
return client.sendTransaction({
|
|
688
|
+
to: args.to,
|
|
689
|
+
data: args.data,
|
|
690
|
+
...maxFeePerGas ? { maxFeePerGas } : {},
|
|
691
|
+
...maxPriorityFeePerGas ? { maxPriorityFeePerGas } : {}
|
|
692
|
+
});
|
|
693
|
+
},
|
|
608
694
|
waitForTransactionReceipt: (args) => client.waitForTransactionReceipt(args),
|
|
609
695
|
getCode: (args) => client.getCode(args)
|
|
610
696
|
});
|
|
@@ -621,6 +707,10 @@ function createFacilitatorFromEnv() {
|
|
|
621
707
|
}
|
|
622
708
|
};
|
|
623
709
|
const facilitator = new import_facilitator.x402Facilitator();
|
|
710
|
+
(0, import_facilitator2.registerExactEvmScheme)(facilitator, {
|
|
711
|
+
signer: baseSigner,
|
|
712
|
+
networks
|
|
713
|
+
});
|
|
624
714
|
for (const network of networks) {
|
|
625
715
|
facilitator.register(
|
|
626
716
|
network,
|
|
@@ -637,6 +727,34 @@ function createFacilitatorFromEnv() {
|
|
|
637
727
|
})
|
|
638
728
|
);
|
|
639
729
|
}
|
|
730
|
+
const supportedConfidential = confidentialAsset && confidentialEip712Name && confidentialEip712Version && batcherAddress ? {
|
|
731
|
+
asset: confidentialAsset,
|
|
732
|
+
eip712: {
|
|
733
|
+
name: confidentialEip712Name,
|
|
734
|
+
version: confidentialEip712Version
|
|
735
|
+
},
|
|
736
|
+
decimals: confidentialDecimals ?? 6,
|
|
737
|
+
batcherAddress
|
|
738
|
+
} : null;
|
|
739
|
+
if (supportedConfidential) {
|
|
740
|
+
const originalGetSupported = facilitator.getSupported.bind(facilitator);
|
|
741
|
+
facilitator.getSupported = () => {
|
|
742
|
+
const supported = originalGetSupported();
|
|
743
|
+
return {
|
|
744
|
+
...supported,
|
|
745
|
+
kinds: supported.kinds.map((kind) => {
|
|
746
|
+
if (kind.scheme !== "erc7984-mind-v1") {
|
|
747
|
+
return kind;
|
|
748
|
+
}
|
|
749
|
+
const extra = {
|
|
750
|
+
...kind.extra,
|
|
751
|
+
confidential: supportedConfidential
|
|
752
|
+
};
|
|
753
|
+
return { ...kind, extra };
|
|
754
|
+
})
|
|
755
|
+
};
|
|
756
|
+
};
|
|
757
|
+
}
|
|
640
758
|
return facilitator;
|
|
641
759
|
}
|
|
642
760
|
function startFacilitator() {
|
package/dist/index.mjs
CHANGED
|
@@ -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
|
|
|
@@ -262,6 +263,38 @@ var X402zEvmFacilitator = class {
|
|
|
262
263
|
};
|
|
263
264
|
}
|
|
264
265
|
}
|
|
266
|
+
try {
|
|
267
|
+
const txRequest = {
|
|
268
|
+
address: this.batcherAddress,
|
|
269
|
+
abi: batcherAbi,
|
|
270
|
+
functionName: "batchConfidentialTransferWithAuthorization",
|
|
271
|
+
args: [
|
|
272
|
+
(0, import_viem.getAddress)(requirements.asset),
|
|
273
|
+
[
|
|
274
|
+
{
|
|
275
|
+
p: confidentialPayload.authorization,
|
|
276
|
+
encryptedAmountInput: confidentialPayload.encryptedAmountInput,
|
|
277
|
+
inputProof: confidentialPayload.inputProof,
|
|
278
|
+
sig: confidentialPayload.signature
|
|
279
|
+
}
|
|
280
|
+
]
|
|
281
|
+
]
|
|
282
|
+
};
|
|
283
|
+
const [successes] = await this.config.signer.simulateContract(txRequest);
|
|
284
|
+
if (!successes[0]) {
|
|
285
|
+
return {
|
|
286
|
+
isValid: false,
|
|
287
|
+
invalidReason: "preflight_failed",
|
|
288
|
+
payer: confidentialPayload.authorization.holder
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
} catch {
|
|
292
|
+
return {
|
|
293
|
+
isValid: false,
|
|
294
|
+
invalidReason: "preflight_failed",
|
|
295
|
+
payer: confidentialPayload.authorization.holder
|
|
296
|
+
};
|
|
297
|
+
}
|
|
265
298
|
return {
|
|
266
299
|
isValid: true,
|
|
267
300
|
payer: confidentialPayload.authorization.holder
|
|
@@ -507,18 +540,26 @@ function requireEnv(key) {
|
|
|
507
540
|
function createFacilitatorFromEnv() {
|
|
508
541
|
const privateKey = requireEnv("FACILITATOR_EVM_PRIVATE_KEY");
|
|
509
542
|
const chainId = Number(process.env.FACILITATOR_EVM_CHAIN_ID ?? "11155111");
|
|
510
|
-
const rpcUrl =
|
|
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
|
+
}
|
|
511
547
|
const networks = (process.env.FACILITATOR_NETWORKS ?? "eip155:11155111").split(",").map((network) => network.trim()).filter(Boolean);
|
|
512
548
|
const waitForReceipt = (process.env.FACILITATOR_WAIT_FOR_RECEIPT ?? "true") === "true";
|
|
513
549
|
const batcherAddress = process.env.FACILITATOR_BATCHER_ADDRESS;
|
|
514
550
|
if (!batcherAddress) {
|
|
515
551
|
throw new Error("FACILITATOR_BATCHER_ADDRESS is required");
|
|
516
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;
|
|
517
557
|
const batchIntervalMs = process.env.FACILITATOR_BATCH_INTERVAL_MS ? Number(process.env.FACILITATOR_BATCH_INTERVAL_MS) : void 0;
|
|
518
558
|
const receiptTimeoutMs = process.env.FACILITATOR_RECEIPT_TIMEOUT_MS ? Number(process.env.FACILITATOR_RECEIPT_TIMEOUT_MS) : void 0;
|
|
519
559
|
const receiptConfirmations = process.env.FACILITATOR_RECEIPT_CONFIRMATIONS ? Number(process.env.FACILITATOR_RECEIPT_CONFIRMATIONS) : void 0;
|
|
520
560
|
const receiptPollingIntervalMs = process.env.FACILITATOR_RECEIPT_POLLING_INTERVAL_MS ? Number(process.env.FACILITATOR_RECEIPT_POLLING_INTERVAL_MS) : void 0;
|
|
521
561
|
const gasMultiplier = process.env.FACILITATOR_GAS_MULTIPLIER ? Number(process.env.FACILITATOR_GAS_MULTIPLIER) : void 0;
|
|
562
|
+
const feeMultiplier = process.env.FACILITATOR_FEE_MULTIPLIER ? Number(process.env.FACILITATOR_FEE_MULTIPLIER) : void 0;
|
|
522
563
|
const debugEnabled = process.env.X402Z_DEBUG === "1";
|
|
523
564
|
const account = (0, import_accounts.privateKeyToAccount)(privateKey);
|
|
524
565
|
if (debugEnabled) {
|
|
@@ -529,6 +570,7 @@ function createFacilitatorFromEnv() {
|
|
|
529
570
|
waitForReceipt,
|
|
530
571
|
batcherAddress,
|
|
531
572
|
gasMultiplier,
|
|
573
|
+
feeMultiplier,
|
|
532
574
|
batchIntervalMs,
|
|
533
575
|
receipt: {
|
|
534
576
|
confirmations: receiptConfirmations,
|
|
@@ -558,6 +600,8 @@ function createFacilitatorFromEnv() {
|
|
|
558
600
|
verifyTypedData: (args) => client.verifyTypedData(args),
|
|
559
601
|
writeContract: async (args) => {
|
|
560
602
|
let gas;
|
|
603
|
+
let maxFeePerGas;
|
|
604
|
+
let maxPriorityFeePerGas;
|
|
561
605
|
if (gasMultiplier && gasMultiplier > 0) {
|
|
562
606
|
try {
|
|
563
607
|
const estimated = await client.estimateContractGas({
|
|
@@ -575,17 +619,59 @@ function createFacilitatorFromEnv() {
|
|
|
575
619
|
}
|
|
576
620
|
}
|
|
577
621
|
}
|
|
622
|
+
if (feeMultiplier && feeMultiplier > 0) {
|
|
623
|
+
try {
|
|
624
|
+
const fees = await client.estimateFeesPerGas();
|
|
625
|
+
if (fees.maxFeePerGas) {
|
|
626
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
627
|
+
maxFeePerGas = fees.maxFeePerGas * scale / 1000n;
|
|
628
|
+
}
|
|
629
|
+
if (fees.maxPriorityFeePerGas) {
|
|
630
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
631
|
+
maxPriorityFeePerGas = fees.maxPriorityFeePerGas * scale / 1000n;
|
|
632
|
+
}
|
|
633
|
+
} catch (error) {
|
|
634
|
+
if (debugEnabled) {
|
|
635
|
+
console.debug("[x402z-facilitator] fee estimate failed", error);
|
|
636
|
+
}
|
|
637
|
+
}
|
|
638
|
+
}
|
|
578
639
|
return client.writeContract({
|
|
579
640
|
...args,
|
|
580
641
|
args: args.args || [],
|
|
581
|
-
...gas ? { gas } : {}
|
|
642
|
+
...gas ? { gas } : {},
|
|
643
|
+
...maxFeePerGas ? { maxFeePerGas } : {},
|
|
644
|
+
...maxPriorityFeePerGas ? { maxPriorityFeePerGas } : {}
|
|
582
645
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
583
646
|
});
|
|
584
647
|
},
|
|
585
|
-
sendTransaction: (args) =>
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
648
|
+
sendTransaction: async (args) => {
|
|
649
|
+
let maxFeePerGas;
|
|
650
|
+
let maxPriorityFeePerGas;
|
|
651
|
+
if (feeMultiplier && feeMultiplier > 0) {
|
|
652
|
+
try {
|
|
653
|
+
const fees = await client.estimateFeesPerGas();
|
|
654
|
+
if (fees.maxFeePerGas) {
|
|
655
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
656
|
+
maxFeePerGas = fees.maxFeePerGas * scale / 1000n;
|
|
657
|
+
}
|
|
658
|
+
if (fees.maxPriorityFeePerGas) {
|
|
659
|
+
const scale = BigInt(Math.round(feeMultiplier * 1e3));
|
|
660
|
+
maxPriorityFeePerGas = fees.maxPriorityFeePerGas * scale / 1000n;
|
|
661
|
+
}
|
|
662
|
+
} catch (error) {
|
|
663
|
+
if (debugEnabled) {
|
|
664
|
+
console.debug("[x402z-facilitator] fee estimate failed", error);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return client.sendTransaction({
|
|
669
|
+
to: args.to,
|
|
670
|
+
data: args.data,
|
|
671
|
+
...maxFeePerGas ? { maxFeePerGas } : {},
|
|
672
|
+
...maxPriorityFeePerGas ? { maxPriorityFeePerGas } : {}
|
|
673
|
+
});
|
|
674
|
+
},
|
|
589
675
|
waitForTransactionReceipt: (args) => client.waitForTransactionReceipt(args),
|
|
590
676
|
getCode: (args) => client.getCode(args)
|
|
591
677
|
});
|
|
@@ -602,6 +688,10 @@ function createFacilitatorFromEnv() {
|
|
|
602
688
|
}
|
|
603
689
|
};
|
|
604
690
|
const facilitator = new import_facilitator.x402Facilitator();
|
|
691
|
+
(0, import_facilitator2.registerExactEvmScheme)(facilitator, {
|
|
692
|
+
signer: baseSigner,
|
|
693
|
+
networks
|
|
694
|
+
});
|
|
605
695
|
for (const network of networks) {
|
|
606
696
|
facilitator.register(
|
|
607
697
|
network,
|
|
@@ -618,6 +708,34 @@ function createFacilitatorFromEnv() {
|
|
|
618
708
|
})
|
|
619
709
|
);
|
|
620
710
|
}
|
|
711
|
+
const supportedConfidential = confidentialAsset && confidentialEip712Name && confidentialEip712Version && batcherAddress ? {
|
|
712
|
+
asset: confidentialAsset,
|
|
713
|
+
eip712: {
|
|
714
|
+
name: confidentialEip712Name,
|
|
715
|
+
version: confidentialEip712Version
|
|
716
|
+
},
|
|
717
|
+
decimals: confidentialDecimals ?? 6,
|
|
718
|
+
batcherAddress
|
|
719
|
+
} : null;
|
|
720
|
+
if (supportedConfidential) {
|
|
721
|
+
const originalGetSupported = facilitator.getSupported.bind(facilitator);
|
|
722
|
+
facilitator.getSupported = () => {
|
|
723
|
+
const supported = originalGetSupported();
|
|
724
|
+
return {
|
|
725
|
+
...supported,
|
|
726
|
+
kinds: supported.kinds.map((kind) => {
|
|
727
|
+
if (kind.scheme !== "erc7984-mind-v1") {
|
|
728
|
+
return kind;
|
|
729
|
+
}
|
|
730
|
+
const extra = {
|
|
731
|
+
...kind.extra,
|
|
732
|
+
confidential: supportedConfidential
|
|
733
|
+
};
|
|
734
|
+
return { ...kind, extra };
|
|
735
|
+
})
|
|
736
|
+
};
|
|
737
|
+
};
|
|
738
|
+
}
|
|
621
739
|
return facilitator;
|
|
622
740
|
}
|
|
623
741
|
function startFacilitator() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x402z-facilitator",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
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
|
|
14
|
+
"x402z-shared": "0.1.0"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"jest": "^29.7.0",
|