@t2000/cli 0.25.8 → 0.25.9
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-MHJ6L6JJ.js → chunk-JHT7EXQL.js} +18 -10
- package/dist/{chunk-MHJ6L6JJ.js.map → chunk-JHT7EXQL.js.map} +1 -1
- package/dist/{dist-7RSCCOLQ.js → dist-MULWIXK5.js} +2 -2
- package/dist/{dist-D7DSJO25.js → dist-ZKLEFNJE.js} +2 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
- /package/dist/{dist-7RSCCOLQ.js.map → dist-MULWIXK5.js.map} +0 -0
- /package/dist/{dist-D7DSJO25.js.map → dist-ZKLEFNJE.js.map} +0 -0
|
@@ -66008,6 +66008,14 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66008
66008
|
if (route.priceImpact > 0.05) {
|
|
66009
66009
|
console.warn(`[swap] High price impact: ${(route.priceImpact * 100).toFixed(2)}%`);
|
|
66010
66010
|
}
|
|
66011
|
+
const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
|
|
66012
|
+
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
66013
|
+
let preBalance = 0n;
|
|
66014
|
+
try {
|
|
66015
|
+
const bal = await this.client.getBalance({ owner: this._address, coinType: toType });
|
|
66016
|
+
preBalance = BigInt(bal.totalBalance);
|
|
66017
|
+
} catch {
|
|
66018
|
+
}
|
|
66011
66019
|
const gasResult = await executeWithGas(this.client, this._signer, async () => {
|
|
66012
66020
|
const tx = new Transaction();
|
|
66013
66021
|
tx.setSender(this._address);
|
|
@@ -66030,17 +66038,17 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66030
66038
|
tx.transferObjects([outputCoin], this._address);
|
|
66031
66039
|
return tx;
|
|
66032
66040
|
});
|
|
66033
|
-
const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
|
|
66034
|
-
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
66035
66041
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
66036
66042
|
let toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
66037
|
-
|
|
66038
|
-
|
|
66039
|
-
|
|
66040
|
-
|
|
66041
|
-
|
|
66042
|
-
|
|
66043
|
-
|
|
66043
|
+
try {
|
|
66044
|
+
const postBal = await this.client.getBalance({ owner: this._address, coinType: toType });
|
|
66045
|
+
const postBalance = BigInt(postBal.totalBalance);
|
|
66046
|
+
const diff = postBalance - preBalance;
|
|
66047
|
+
if (diff > 0n) {
|
|
66048
|
+
toAmount = Number(diff) / 10 ** toDecimals;
|
|
66049
|
+
}
|
|
66050
|
+
} catch {
|
|
66051
|
+
console.warn("[swap] Could not read post-swap balance, using route estimate");
|
|
66044
66052
|
}
|
|
66045
66053
|
const fromName = fromEntry ? fromEntry[0] : this._resolveTokenName(fromType, params.from);
|
|
66046
66054
|
const toName = toEntry ? toEntry[0] : this._resolveTokenName(toType, params.to);
|
|
@@ -67065,4 +67073,4 @@ axios/dist/node/axios.cjs:
|
|
|
67065
67073
|
@scure/bip39/index.js:
|
|
67066
67074
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
67067
67075
|
*/
|
|
67068
|
-
//# sourceMappingURL=chunk-
|
|
67076
|
+
//# sourceMappingURL=chunk-JHT7EXQL.js.map
|