@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/index.cjs CHANGED
@@ -1165,6 +1165,7 @@ async function payWithMpp(args) {
1165
1165
  { payTo: requirements.payTo, priceUsdc: price, escrow }
1166
1166
  );
1167
1167
  }
1168
+ assertNotSelfPayment(signer.getAddress(), requirements.payTo);
1168
1169
  const result = await payViaX402({ signer, client, options, reqInit, requirements });
1169
1170
  await reportDirectPayment(result, options.url);
1170
1171
  return result;
@@ -1178,6 +1179,7 @@ async function payWithMpp(args) {
1178
1179
  { dialect: "mpp-header", signerKind: "zklogin" }
1179
1180
  );
1180
1181
  }
1182
+ assertNotSelfPayment(signer.getAddress(), headerChallenge.recipient);
1181
1183
  const result = await payViaMppHeader({ signer, client, options });
1182
1184
  await reportDirectPayment(result, options.url);
1183
1185
  return result;
@@ -1324,6 +1326,15 @@ async function payViaMppHeader(args) {
1324
1326
  receipt: paymentDigest ? { reference: paymentDigest, timestamp: (/* @__PURE__ */ new Date()).toISOString() } : void 0
1325
1327
  };
1326
1328
  }
1329
+ function assertNotSelfPayment(payer, payTo) {
1330
+ if (utils.normalizeSuiAddress(payer) === utils.normalizeSuiAddress(payTo)) {
1331
+ throw new exports.T2000Error(
1332
+ "FACILITATOR_REJECTION",
1333
+ "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).",
1334
+ { payer, payTo }
1335
+ );
1336
+ }
1337
+ }
1327
1338
  function assertWithinMaxPrice(price, maxPrice) {
1328
1339
  if (maxPrice !== void 0 && price > maxPrice) {
1329
1340
  throw new exports.T2000Error(