@t2000/sdk 10.16.1 → 10.17.1
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 +1 -1
- package/dist/browser.cjs +0 -17
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +0 -17
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +2 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -19
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser.js
CHANGED
|
@@ -570,7 +570,6 @@ async function payWithMpp(args) {
|
|
|
570
570
|
}
|
|
571
571
|
assertNotSelfPayment(signer.getAddress(), requirements.payTo);
|
|
572
572
|
const result = await payViaX402({ signer, client, options, reqInit, requirements });
|
|
573
|
-
await reportDirectPayment(result, options.url);
|
|
574
573
|
return result;
|
|
575
574
|
}
|
|
576
575
|
const headerChallenge = await parseMppSuiChallenge(probe);
|
|
@@ -584,7 +583,6 @@ async function payWithMpp(args) {
|
|
|
584
583
|
}
|
|
585
584
|
assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
|
|
586
585
|
const result = await payViaMppHeader({ signer, client, options });
|
|
587
|
-
await reportDirectPayment(result, options.url);
|
|
588
586
|
return result;
|
|
589
587
|
}
|
|
590
588
|
if (pick.kind === "incomplete") {
|
|
@@ -599,21 +597,6 @@ async function payWithMpp(args) {
|
|
|
599
597
|
`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.`
|
|
600
598
|
);
|
|
601
599
|
}
|
|
602
|
-
var MPP_REPORT_URL = "https://mpp.t2000.ai/api/mpp/report";
|
|
603
|
-
var REPORT_TIMEOUT_MS = 2e3;
|
|
604
|
-
async function reportDirectPayment(result, url) {
|
|
605
|
-
if (!result.paid || !result.receipt?.reference) return;
|
|
606
|
-
try {
|
|
607
|
-
if (new URL(url).origin === new URL(MPP_REPORT_URL).origin) return;
|
|
608
|
-
await fetch(MPP_REPORT_URL, {
|
|
609
|
-
method: "POST",
|
|
610
|
-
headers: { "content-type": "application/json" },
|
|
611
|
-
body: JSON.stringify({ digest: result.receipt.reference, url }),
|
|
612
|
-
signal: AbortSignal.timeout(REPORT_TIMEOUT_MS)
|
|
613
|
-
});
|
|
614
|
-
} catch {
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
600
|
async function parseMppSuiChallenge(response) {
|
|
618
601
|
try {
|
|
619
602
|
const { Challenge } = await import('mppx');
|