@t2000/sdk 10.1.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/index.js CHANGED
@@ -1159,6 +1159,7 @@ async function payWithMpp(args) {
1159
1159
  { payTo: requirements.payTo, priceUsdc: price, escrow }
1160
1160
  );
1161
1161
  }
1162
+ assertNotSelfPayment(signer.getAddress(), requirements.payTo);
1162
1163
  const result = await payViaX402({ signer, client, options, reqInit, requirements });
1163
1164
  await reportDirectPayment(result, options.url);
1164
1165
  return result;
@@ -1172,6 +1173,7 @@ async function payWithMpp(args) {
1172
1173
  { dialect: "mpp-header", signerKind: "zklogin" }
1173
1174
  );
1174
1175
  }
1176
+ assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
1175
1177
  const result = await payViaMppHeader({ signer, client, options });
1176
1178
  await reportDirectPayment(result, options.url);
1177
1179
  return result;
@@ -1318,6 +1320,15 @@ async function payViaMppHeader(args) {
1318
1320
  receipt: paymentDigest ? { reference: paymentDigest, timestamp: (/* @__PURE__ */ new Date()).toISOString() } : void 0
1319
1321
  };
1320
1322
  }
1323
+ function assertNotSelfPayment(payer, payTo) {
1324
+ if (normalizeSuiAddress(payer) === normalizeSuiAddress(payTo)) {
1325
+ throw new T2000Error(
1326
+ "FACILITATOR_REJECTION",
1327
+ "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).",
1328
+ { payer, payTo }
1329
+ );
1330
+ }
1331
+ }
1321
1332
  function assertWithinMaxPrice(price, maxPrice) {
1322
1333
  if (maxPrice !== void 0 && price > maxPrice) {
1323
1334
  throw new T2000Error(