opentool 0.7.3 → 0.7.5
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 +26 -13
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +26 -13
- package/dist/index.js.map +1 -1
- package/dist/x402/index.js +26 -13
- package/dist/x402/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -587,16 +587,30 @@ async function verifyX402Payment(attempt, definition, options = {}) {
|
|
|
587
587
|
paymentRequirements: requirement
|
|
588
588
|
})
|
|
589
589
|
});
|
|
590
|
-
if (settleResponse.ok) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
}
|
|
597
|
-
}
|
|
590
|
+
if (!settleResponse.ok) {
|
|
591
|
+
return {
|
|
592
|
+
success: false,
|
|
593
|
+
failure: {
|
|
594
|
+
reason: `Facilitator settlement failed: ${settleResponse.status}`,
|
|
595
|
+
code: "settlement_failed"
|
|
596
|
+
}
|
|
597
|
+
};
|
|
598
598
|
}
|
|
599
|
-
|
|
599
|
+
const settlePayload = await settleResponse.json();
|
|
600
|
+
if (settlePayload.txHash) {
|
|
601
|
+
responseHeaders[HEADER_PAYMENT_RESPONSE] = JSON.stringify({
|
|
602
|
+
settled: true,
|
|
603
|
+
txHash: settlePayload.txHash
|
|
604
|
+
});
|
|
605
|
+
}
|
|
606
|
+
} catch (error) {
|
|
607
|
+
return {
|
|
608
|
+
success: false,
|
|
609
|
+
failure: {
|
|
610
|
+
reason: error instanceof Error ? error.message : "Settlement failed",
|
|
611
|
+
code: "settlement_failed"
|
|
612
|
+
}
|
|
613
|
+
};
|
|
600
614
|
}
|
|
601
615
|
}
|
|
602
616
|
const result = {
|
|
@@ -706,10 +720,9 @@ async function requireX402Payment(request, payment, options = {}) {
|
|
|
706
720
|
const response = createX402PaymentRequired(definition);
|
|
707
721
|
throw new X402PaymentRequiredError(response);
|
|
708
722
|
}
|
|
709
|
-
const verifyOptions = {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
}
|
|
723
|
+
const verifyOptions = {
|
|
724
|
+
settle: options.settle !== void 0 ? options.settle : true
|
|
725
|
+
};
|
|
713
726
|
if (options.fetchImpl !== void 0) {
|
|
714
727
|
verifyOptions.fetchImpl = options.fetchImpl;
|
|
715
728
|
}
|