@t2000/cli 0.25.9 → 0.25.10
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-JHT7EXQL.js → chunk-CEYH4WJI.js} +15 -15
- package/dist/{chunk-JHT7EXQL.js.map → chunk-CEYH4WJI.js.map} +1 -1
- package/dist/{dist-MULWIXK5.js → dist-KPKCZ4IO.js} +2 -2
- package/dist/{dist-ZKLEFNJE.js → dist-RWDYR67F.js} +2 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
- /package/dist/{dist-MULWIXK5.js.map → dist-KPKCZ4IO.js.map} +0 -0
- /package/dist/{dist-ZKLEFNJE.js.map → dist-RWDYR67F.js.map} +0 -0
|
@@ -66008,14 +66008,6 @@ 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
|
-
}
|
|
66019
66011
|
const gasResult = await executeWithGas(this.client, this._signer, async () => {
|
|
66020
66012
|
const tx = new Transaction();
|
|
66021
66013
|
tx.setSender(this._address);
|
|
@@ -66038,17 +66030,25 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66038
66030
|
tx.transferObjects([outputCoin], this._address);
|
|
66039
66031
|
return tx;
|
|
66040
66032
|
});
|
|
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;
|
|
66041
66035
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
66042
66036
|
let toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
66043
66037
|
try {
|
|
66044
|
-
const
|
|
66045
|
-
|
|
66046
|
-
|
|
66047
|
-
|
|
66048
|
-
|
|
66038
|
+
const txBlock = await this.client.getTransactionBlock({
|
|
66039
|
+
digest: gasResult.digest,
|
|
66040
|
+
options: { showBalanceChanges: true }
|
|
66041
|
+
});
|
|
66042
|
+
const changes = txBlock.balanceChanges ?? [];
|
|
66043
|
+
const received = changes.find(
|
|
66044
|
+
(c) => c.coinType === toType && BigInt(c.amount) > 0n && c.owner.AddressOwner === this._address
|
|
66045
|
+
);
|
|
66046
|
+
if (received) {
|
|
66047
|
+
const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
|
|
66048
|
+
if (actual > 0) toAmount = actual;
|
|
66049
66049
|
}
|
|
66050
66050
|
} catch {
|
|
66051
|
-
console.warn("[swap] Could not read
|
|
66051
|
+
console.warn("[swap] Could not read balance changes, using route estimate");
|
|
66052
66052
|
}
|
|
66053
66053
|
const fromName = fromEntry ? fromEntry[0] : this._resolveTokenName(fromType, params.from);
|
|
66054
66054
|
const toName = toEntry ? toEntry[0] : this._resolveTokenName(toType, params.to);
|
|
@@ -67073,4 +67073,4 @@ axios/dist/node/axios.cjs:
|
|
|
67073
67073
|
@scure/bip39/index.js:
|
|
67074
67074
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
67075
67075
|
*/
|
|
67076
|
-
//# sourceMappingURL=chunk-
|
|
67076
|
+
//# sourceMappingURL=chunk-CEYH4WJI.js.map
|