@t2000/sdk 10.1.0 → 10.1.2

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.js CHANGED
@@ -567,6 +567,7 @@ async function payWithMpp(args) {
567
567
  { payTo: requirements.payTo, priceUsdc: price, escrow }
568
568
  );
569
569
  }
570
+ assertNotSelfPayment(signer.getAddress(), requirements.payTo);
570
571
  const result = await payViaX402({ signer, client, options, reqInit, requirements });
571
572
  await reportDirectPayment(result, options.url);
572
573
  return result;
@@ -580,6 +581,7 @@ async function payWithMpp(args) {
580
581
  { dialect: "mpp-header", signerKind: "zklogin" }
581
582
  );
582
583
  }
584
+ assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
583
585
  const result = await payViaMppHeader({ signer, client, options });
584
586
  await reportDirectPayment(result, options.url);
585
587
  return result;
@@ -726,6 +728,15 @@ async function payViaMppHeader(args) {
726
728
  receipt: paymentDigest ? { reference: paymentDigest, timestamp: (/* @__PURE__ */ new Date()).toISOString() } : void 0
727
729
  };
728
730
  }
731
+ function assertNotSelfPayment(payer, payTo) {
732
+ if (normalizeSuiAddress(payer) === normalizeSuiAddress(payTo)) {
733
+ throw new T2000Error(
734
+ "FACILITATOR_REJECTION",
735
+ "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).",
736
+ { payer, payTo }
737
+ );
738
+ }
739
+ }
729
740
  function assertWithinMaxPrice(price, maxPrice) {
730
741
  if (maxPrice !== void 0 && price > maxPrice) {
731
742
  throw new T2000Error(