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/index.js
CHANGED
|
@@ -140,20 +140,28 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
140
140
|
const requirement = toX402Requirement(definition);
|
|
141
141
|
const headers = buildFacilitatorHeaders(facilitator);
|
|
142
142
|
try {
|
|
143
|
+
const verifyBody = {
|
|
144
|
+
x402Version: attempt.payload.x402Version,
|
|
145
|
+
paymentPayload: attempt.payload,
|
|
146
|
+
paymentRequirements: requirement
|
|
147
|
+
};
|
|
148
|
+
console.log("[x402] Calling facilitator /verify", {
|
|
149
|
+
url: verifierUrl,
|
|
150
|
+
bodyPreview: JSON.stringify(verifyBody).substring(0, 200)
|
|
151
|
+
});
|
|
143
152
|
const verifyResponse = await fetchImpl(verifierUrl, {
|
|
144
153
|
method: "POST",
|
|
145
154
|
headers,
|
|
146
|
-
body: JSON.stringify(
|
|
147
|
-
x402Version: attempt.payload.x402Version,
|
|
148
|
-
paymentPayload: attempt.payload,
|
|
149
|
-
paymentRequirements: requirement
|
|
150
|
-
})
|
|
155
|
+
body: JSON.stringify(verifyBody)
|
|
151
156
|
});
|
|
157
|
+
console.log("[x402] Facilitator /verify response", { status: verifyResponse.status });
|
|
152
158
|
if (!verifyResponse.ok) {
|
|
159
|
+
const errorText = await verifyResponse.text().catch(() => "");
|
|
160
|
+
console.error("[x402] Facilitator /verify error", { status: verifyResponse.status, body: errorText });
|
|
153
161
|
return {
|
|
154
162
|
success: false,
|
|
155
163
|
failure: {
|
|
156
|
-
reason: `Facilitator verify request failed: ${verifyResponse.status}`,
|
|
164
|
+
reason: `Facilitator verify request failed: ${verifyResponse.status}${errorText ? ` - ${errorText}` : ""}`,
|
|
157
165
|
code: "verification_failed"
|
|
158
166
|
}
|
|
159
167
|
};
|
|
@@ -175,6 +183,7 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
175
183
|
ensureTrailingSlash(facilitator.url)
|
|
176
184
|
).toString();
|
|
177
185
|
try {
|
|
186
|
+
console.log("[x402] Calling facilitator /settle", { url: settleUrl });
|
|
178
187
|
const settleResponse = await fetchImpl(settleUrl, {
|
|
179
188
|
method: "POST",
|
|
180
189
|
headers,
|
|
@@ -184,6 +193,7 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
184
193
|
paymentRequirements: requirement
|
|
185
194
|
})
|
|
186
195
|
});
|
|
196
|
+
console.log("[x402] Facilitator /settle response", { status: settleResponse.status });
|
|
187
197
|
if (!settleResponse.ok) {
|
|
188
198
|
return {
|
|
189
199
|
success: false,
|