@t2000/cli 9.3.0 → 9.3.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.
@@ -9959,11 +9959,18 @@ function preflightPay(input) {
9959
9959
  return PREFLIGHT_OK;
9960
9960
  }
9961
9961
  async function payWithMpp(args) {
9962
- const { signer, client, options } = args;
9962
+ const { signer, client } = args;
9963
+ let options = args.options;
9963
9964
  const pf = preflightPay({ url: options.url, maxPrice: options.maxPrice });
9964
9965
  if (!pf.valid) throw new T2000Error(pf.code, pf.error);
9965
9966
  const method = (options.method ?? "GET").toUpperCase();
9966
9967
  const canHaveBody = method !== "GET" && method !== "HEAD";
9968
+ if (canHaveBody && typeof options.body === "string" && isJsonText(options.body) && !hasContentType(options.headers)) {
9969
+ options = {
9970
+ ...options,
9971
+ headers: { ...options.headers ?? {}, "content-type": "application/json" }
9972
+ };
9973
+ }
9967
9974
  const reqInit = {
9968
9975
  method,
9969
9976
  headers: options.headers,
@@ -10150,6 +10157,18 @@ async function ensureAddressBalanceCovers(args) {
10150
10157
  const migration = await executeTx(client, signer, () => tx, { buildClient: grpcClient });
10151
10158
  return migration.gasCostSui;
10152
10159
  }
10160
+ function isJsonText(text) {
10161
+ try {
10162
+ JSON.parse(text);
10163
+ return true;
10164
+ } catch {
10165
+ return false;
10166
+ }
10167
+ }
10168
+ function hasContentType(headers) {
10169
+ if (!headers) return false;
10170
+ return Object.keys(headers).some((k) => k.toLowerCase() === "content-type");
10171
+ }
10153
10172
  async function finalize(response, opts) {
10154
10173
  const contentType = response.headers.get("content-type") ?? "";
10155
10174
  let body2;
@@ -12479,4 +12498,4 @@ export {
12479
12498
  @scure/bip39/index.js:
12480
12499
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
12481
12500
  */
12482
- //# sourceMappingURL=chunk-DY7BZMEW.js.map
12501
+ //# sourceMappingURL=chunk-VCALQJDX.js.map