@t2000/cli 10.13.2 → 10.13.3
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/{chunk-XYBAD4N6.js → chunk-M3VP3LAY.js} +30 -5
- package/dist/{chunk-XYBAD4N6.js.map → chunk-M3VP3LAY.js.map} +1 -1
- package/dist/{dist-DC323R52.js → dist-4BBYOHH2.js} +2 -2
- package/dist/{dist-NPHL44A3.js → dist-QEBZPEX3.js} +31 -6
- package/dist/{dist-NPHL44A3.js.map → dist-QEBZPEX3.js.map} +1 -1
- package/dist/index.js +3 -3
- package/package.json +4 -4
- /package/dist/{dist-DC323R52.js.map → dist-4BBYOHH2.js.map} +0 -0
|
@@ -9981,8 +9981,9 @@ async function payWithMpp(args) {
|
|
|
9981
9981
|
if (probe.status !== 402) {
|
|
9982
9982
|
return finalize(probe, { paid: false });
|
|
9983
9983
|
}
|
|
9984
|
-
const
|
|
9985
|
-
if (
|
|
9984
|
+
const pick = await pickSuiExactRequirements(probe, client.network);
|
|
9985
|
+
if (pick.kind === "payable") {
|
|
9986
|
+
const requirements = pick.requirements;
|
|
9986
9987
|
const { isX402EscrowRequirements } = await import("./x402-N4N7VWNW.js");
|
|
9987
9988
|
if (isX402EscrowRequirements(requirements)) {
|
|
9988
9989
|
const escrow = requirements.extra.escrow;
|
|
@@ -10015,6 +10016,13 @@ async function payWithMpp(args) {
|
|
|
10015
10016
|
await reportDirectPayment(result, options.url);
|
|
10016
10017
|
return result;
|
|
10017
10018
|
}
|
|
10019
|
+
if (pick.kind === "incomplete") {
|
|
10020
|
+
throw new T2000Error(
|
|
10021
|
+
"FACILITATOR_REJECTION",
|
|
10022
|
+
"Seller's x402 challenge is incomplete (missing extra.suimpp) \u2014 nothing was paid. The 402 advertises an exact/sui entry but carries no settlement challenge to bind a payment to; the seller must emit the createX402Requirements shape to be x402-payable.",
|
|
10023
|
+
{ reason: "incomplete-x402-accepts" }
|
|
10024
|
+
);
|
|
10025
|
+
}
|
|
10018
10026
|
throw new T2000Error(
|
|
10019
10027
|
"FACILITATOR_REJECTION",
|
|
10020
10028
|
`Endpoint returned 402 without an x402 'exact' / sui:${client.network} requirement in the body or an MPP 'sui' challenge in WWW-Authenticate. Nothing this SDK can pay.`
|
|
@@ -10053,17 +10061,34 @@ async function parseMppSuiChallenge(response) {
|
|
|
10053
10061
|
return void 0;
|
|
10054
10062
|
}
|
|
10055
10063
|
}
|
|
10064
|
+
function hasCompleteSuimppChallenge(entry) {
|
|
10065
|
+
const s = entry.extra?.suimpp;
|
|
10066
|
+
return !!s && typeof s.challengeId === "string" && s.challengeId.length > 0 && typeof s.nonce === "number" && typeof s.chain === "string" && s.chain.length > 0 && typeof s.minEpoch === "string" && typeof s.maxEpoch === "string";
|
|
10067
|
+
}
|
|
10056
10068
|
async function pickSuiExactRequirements(response, network) {
|
|
10057
10069
|
try {
|
|
10058
10070
|
const body2 = await response.clone().json();
|
|
10059
10071
|
const want = `sui:${network === "testnet" ? "testnet" : "mainnet"}`;
|
|
10060
|
-
|
|
10072
|
+
const entry = body2.accepts?.find((a) => a.scheme === "exact" && a.network === want);
|
|
10073
|
+
if (!entry) return { kind: "none" };
|
|
10074
|
+
const { isX402EscrowRequirements } = await import("./x402-N4N7VWNW.js");
|
|
10075
|
+
if (hasCompleteSuimppChallenge(entry) || isX402EscrowRequirements(entry)) {
|
|
10076
|
+
return { kind: "payable", requirements: entry };
|
|
10077
|
+
}
|
|
10078
|
+
return { kind: "incomplete" };
|
|
10061
10079
|
} catch {
|
|
10062
|
-
return
|
|
10080
|
+
return { kind: "none" };
|
|
10063
10081
|
}
|
|
10064
10082
|
}
|
|
10065
10083
|
async function payViaX402(args) {
|
|
10066
10084
|
const { signer, client, options, reqInit, requirements } = args;
|
|
10085
|
+
if (!hasCompleteSuimppChallenge(requirements)) {
|
|
10086
|
+
throw new T2000Error(
|
|
10087
|
+
"FACILITATOR_REJECTION",
|
|
10088
|
+
"Seller's x402 challenge is incomplete (missing extra.suimpp) \u2014 nothing was paid.",
|
|
10089
|
+
{ reason: "incomplete-x402-accepts" }
|
|
10090
|
+
);
|
|
10091
|
+
}
|
|
10067
10092
|
const { buildX402SignedPayment, X402_PAYMENT_HEADER, X402_PAYMENT_RESPONSE_HEADER } = await import("./x402-N4N7VWNW.js");
|
|
10068
10093
|
const amountRaw = BigInt(requirements.maxAmountRequired);
|
|
10069
10094
|
assertWithinMaxPrice(atomicToHuman(amountRaw, await assetDecimals(requirements.asset)), options.maxPrice);
|
|
@@ -13320,4 +13345,4 @@ export {
|
|
|
13320
13345
|
@scure/bip39/index.js:
|
|
13321
13346
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
13322
13347
|
*/
|
|
13323
|
-
//# sourceMappingURL=chunk-
|
|
13348
|
+
//# sourceMappingURL=chunk-M3VP3LAY.js.map
|