@t2000/cli 9.3.1 → 9.4.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/dist/{chunk-VCALQJDX.js → chunk-H7T7CQ27.js} +22 -3
- package/dist/{chunk-VCALQJDX.js.map → chunk-H7T7CQ27.js.map} +1 -1
- package/dist/{dist-BHEY35W6.js → dist-6T57AF5D.js} +23 -4
- package/dist/{dist-BHEY35W6.js.map → dist-6T57AF5D.js.map} +1 -1
- package/dist/{dist-E4LDDE5K.js → dist-KRXW26WD.js} +2 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
- /package/dist/{dist-E4LDDE5K.js.map → dist-KRXW26WD.js.map} +0 -0
|
@@ -9982,17 +9982,36 @@ async function payWithMpp(args) {
|
|
|
9982
9982
|
}
|
|
9983
9983
|
const requirements = await pickSuiExactRequirements(probe, client.network);
|
|
9984
9984
|
if (requirements) {
|
|
9985
|
-
|
|
9985
|
+
const result = await payViaX402({ signer, client, options, reqInit, requirements });
|
|
9986
|
+
await reportDirectPayment(result, options.url);
|
|
9987
|
+
return result;
|
|
9986
9988
|
}
|
|
9987
9989
|
const headerChallenge = await parseMppSuiChallenge(probe);
|
|
9988
9990
|
if (headerChallenge) {
|
|
9989
|
-
|
|
9991
|
+
const result = await payViaMppHeader({ signer, client, options });
|
|
9992
|
+
await reportDirectPayment(result, options.url);
|
|
9993
|
+
return result;
|
|
9990
9994
|
}
|
|
9991
9995
|
throw new T2000Error(
|
|
9992
9996
|
"FACILITATOR_REJECTION",
|
|
9993
9997
|
`Endpoint returned 402 without an x402 'exact' / sui:${client.network} requirement in the body or an MPP 'sui' challenge in WWW-Authenticate. Nothing this SDK can pay.`
|
|
9994
9998
|
);
|
|
9995
9999
|
}
|
|
10000
|
+
var MPP_REPORT_URL = "https://mpp.t2000.ai/api/mpp/report";
|
|
10001
|
+
var REPORT_TIMEOUT_MS = 2e3;
|
|
10002
|
+
async function reportDirectPayment(result, url) {
|
|
10003
|
+
if (!result.paid || !result.receipt?.reference) return;
|
|
10004
|
+
try {
|
|
10005
|
+
if (new URL(url).origin === new URL(MPP_REPORT_URL).origin) return;
|
|
10006
|
+
await fetch(MPP_REPORT_URL, {
|
|
10007
|
+
method: "POST",
|
|
10008
|
+
headers: { "content-type": "application/json" },
|
|
10009
|
+
body: JSON.stringify({ digest: result.receipt.reference, url }),
|
|
10010
|
+
signal: AbortSignal.timeout(REPORT_TIMEOUT_MS)
|
|
10011
|
+
});
|
|
10012
|
+
} catch {
|
|
10013
|
+
}
|
|
10014
|
+
}
|
|
9996
10015
|
async function parseMppSuiChallenge(response) {
|
|
9997
10016
|
try {
|
|
9998
10017
|
const { Challenge } = await import("./dist-UO6YV6D3.js");
|
|
@@ -12498,4 +12517,4 @@ export {
|
|
|
12498
12517
|
@scure/bip39/index.js:
|
|
12499
12518
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
12500
12519
|
*/
|
|
12501
|
-
//# sourceMappingURL=chunk-
|
|
12520
|
+
//# sourceMappingURL=chunk-H7T7CQ27.js.map
|