@t2000/sdk 10.0.0 → 10.1.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/dist/browser.cjs +11 -0
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.js +11 -0
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/browser.cjs
CHANGED
|
@@ -569,6 +569,7 @@ async function payWithMpp(args) {
|
|
|
569
569
|
{ payTo: requirements.payTo, priceUsdc: price, escrow }
|
|
570
570
|
);
|
|
571
571
|
}
|
|
572
|
+
assertNotSelfPayment(signer.getAddress(), requirements.payTo);
|
|
572
573
|
const result = await payViaX402({ signer, client, options, reqInit, requirements });
|
|
573
574
|
await reportDirectPayment(result, options.url);
|
|
574
575
|
return result;
|
|
@@ -582,6 +583,7 @@ async function payWithMpp(args) {
|
|
|
582
583
|
{ dialect: "mpp-header", signerKind: "zklogin" }
|
|
583
584
|
);
|
|
584
585
|
}
|
|
586
|
+
assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
|
|
585
587
|
const result = await payViaMppHeader({ signer, client, options });
|
|
586
588
|
await reportDirectPayment(result, options.url);
|
|
587
589
|
return result;
|
|
@@ -728,6 +730,15 @@ async function payViaMppHeader(args) {
|
|
|
728
730
|
receipt: paymentDigest ? { reference: paymentDigest, timestamp: (/* @__PURE__ */ new Date()).toISOString() } : void 0
|
|
729
731
|
};
|
|
730
732
|
}
|
|
733
|
+
function assertNotSelfPayment(payer, payTo) {
|
|
734
|
+
if (utils.normalizeSuiAddress(payer) === utils.normalizeSuiAddress(payTo)) {
|
|
735
|
+
throw new exports.T2000Error(
|
|
736
|
+
"FACILITATOR_REJECTION",
|
|
737
|
+
"This endpoint pays YOUR OWN wallet \u2014 a self-payment nets a zero balance change, so the seller will not serve it. Nothing was paid. Test your endpoint from a different wallet (e.g. the t2 CLI wallet).",
|
|
738
|
+
{ payer, payTo }
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
}
|
|
731
742
|
function assertWithinMaxPrice(price, maxPrice) {
|
|
732
743
|
if (maxPrice !== void 0 && price > maxPrice) {
|
|
733
744
|
throw new exports.T2000Error(
|