opentool 0.7.5 → 0.7.7
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/cli/index.js +16 -6
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +16 -6
- package/dist/index.js.map +1 -1
- package/dist/x402/index.js +16 -6
- package/dist/x402/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -543,20 +543,28 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
543
543
|
const requirement = toX402Requirement(definition);
|
|
544
544
|
const headers = buildFacilitatorHeaders(facilitator);
|
|
545
545
|
try {
|
|
546
|
+
const verifyBody = {
|
|
547
|
+
x402Version: attempt.payload.x402Version,
|
|
548
|
+
paymentPayload: attempt.payload,
|
|
549
|
+
paymentRequirements: requirement
|
|
550
|
+
};
|
|
551
|
+
console.log("[x402] Calling facilitator /verify", {
|
|
552
|
+
url: verifierUrl,
|
|
553
|
+
bodyPreview: JSON.stringify(verifyBody).substring(0, 200)
|
|
554
|
+
});
|
|
546
555
|
const verifyResponse = await fetchImpl(verifierUrl, {
|
|
547
556
|
method: "POST",
|
|
548
557
|
headers,
|
|
549
|
-
body: JSON.stringify(
|
|
550
|
-
x402Version: attempt.payload.x402Version,
|
|
551
|
-
paymentPayload: attempt.payload,
|
|
552
|
-
paymentRequirements: requirement
|
|
553
|
-
})
|
|
558
|
+
body: JSON.stringify(verifyBody)
|
|
554
559
|
});
|
|
560
|
+
console.log("[x402] Facilitator /verify response", { status: verifyResponse.status });
|
|
555
561
|
if (!verifyResponse.ok) {
|
|
562
|
+
const errorText = await verifyResponse.text().catch(() => "");
|
|
563
|
+
console.error("[x402] Facilitator /verify error", { status: verifyResponse.status, body: errorText });
|
|
556
564
|
return {
|
|
557
565
|
success: false,
|
|
558
566
|
failure: {
|
|
559
|
-
reason: `Facilitator verify request failed: ${verifyResponse.status}`,
|
|
567
|
+
reason: `Facilitator verify request failed: ${verifyResponse.status}${errorText ? ` - ${errorText}` : ""}`,
|
|
560
568
|
code: "verification_failed"
|
|
561
569
|
}
|
|
562
570
|
};
|
|
@@ -578,6 +586,7 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
578
586
|
ensureTrailingSlash(facilitator.url)
|
|
579
587
|
).toString();
|
|
580
588
|
try {
|
|
589
|
+
console.log("[x402] Calling facilitator /settle", { url: settleUrl });
|
|
581
590
|
const settleResponse = await fetchImpl(settleUrl, {
|
|
582
591
|
method: "POST",
|
|
583
592
|
headers,
|
|
@@ -587,6 +596,7 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
587
596
|
paymentRequirements: requirement
|
|
588
597
|
})
|
|
589
598
|
});
|
|
599
|
+
console.log("[x402] Facilitator /settle response", { status: settleResponse.status });
|
|
590
600
|
if (!settleResponse.ok) {
|
|
591
601
|
return {
|
|
592
602
|
success: false,
|