@t2000/sdk 9.7.1 → 9.8.0

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
@@ -1152,6 +1152,19 @@ async function payWithMpp(args) {
1152
1152
  }
1153
1153
  const requirements = await pickSuiExactRequirements(probe, client.network);
1154
1154
  if (requirements) {
1155
+ const { isX402EscrowRequirements } = await import('@suimpp/mpp/x402');
1156
+ if (isX402EscrowRequirements(requirements)) {
1157
+ const escrow = requirements.extra.escrow;
1158
+ const price = atomicToHuman(
1159
+ BigInt(requirements.maxAmountRequired),
1160
+ await assetDecimals(requirements.asset)
1161
+ );
1162
+ throw new exports.T2000Error(
1163
+ "ESCROW_REQUIRED",
1164
+ `This endpoint sells deliverable work through on-chain escrow, not an instant call. Create a job instead: t2 job create ${price} ${requirements.payTo} --spec <your-brief> \u2014 funds lock in a Job object and release on delivery. No payment was made.`,
1165
+ { payTo: requirements.payTo, priceUsdc: price, escrow }
1166
+ );
1167
+ }
1155
1168
  const result = await payViaX402({ signer, client, options, reqInit, requirements });
1156
1169
  await reportDirectPayment(result, options.url);
1157
1170
  return result;