@t2000/sdk 0.19.0 → 0.19.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.js CHANGED
@@ -57115,14 +57115,25 @@ var T2000 = class _T2000 extends EventEmitter {
57115
57115
  this.enforcer.check({ operation: "pay", amount: options.maxPrice ?? 1 });
57116
57116
  const { Mppx } = await import('mppx/client');
57117
57117
  const { sui } = await import('@t2000/mpp-sui/client');
57118
+ const client = this.client;
57119
+ const keypair = this.keypair;
57118
57120
  const mppx = Mppx.create({
57119
57121
  polyfill: false,
57120
- methods: [sui({ client: this.client, signer: this.keypair })]
57122
+ methods: [sui({
57123
+ client,
57124
+ signer: keypair,
57125
+ execute: async (tx) => {
57126
+ const result = await executeWithGas(client, keypair, () => tx);
57127
+ return { digest: result.digest, effects: result.effects };
57128
+ }
57129
+ })]
57121
57130
  });
57131
+ const method = (options.method ?? "GET").toUpperCase();
57132
+ const canHaveBody = method !== "GET" && method !== "HEAD";
57122
57133
  const response = await mppx.fetch(options.url, {
57123
- method: options.method,
57134
+ method,
57124
57135
  headers: options.headers,
57125
- body: options.body
57136
+ body: canHaveBody ? options.body : void 0
57126
57137
  });
57127
57138
  const contentType = response.headers.get("content-type") ?? "";
57128
57139
  let body;
@@ -58183,7 +58194,7 @@ To sell investment: t2000 invest sell ${params.amount} ${fromAsset}`,
58183
58194
  await new Promise((r) => setTimeout(r, 1500));
58184
58195
  }
58185
58196
  const maxSellable = Math.max(0, walletAmount - gasReserve);
58186
- const trackedAmount = pos && pos.totalAmount > 0 ? pos.totalAmount : maxSellable;
58197
+ const trackedAmount = pos ? pos.totalAmount : maxSellable;
58187
58198
  if (trackedAmount <= 0) {
58188
58199
  throw new T2000Error("INSUFFICIENT_INVESTMENT", `No ${params.asset} position to sell`);
58189
58200
  }