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