@t2000/cli 0.25.10 → 0.25.11
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-CEYH4WJI.js → chunk-CDQ2RJBX.js} +25 -15
- package/dist/{chunk-CEYH4WJI.js.map → chunk-CDQ2RJBX.js.map} +1 -1
- package/dist/{dist-KPKCZ4IO.js → dist-MGJ75RIY.js} +2 -2
- package/dist/{dist-RWDYR67F.js → dist-OSTBPTHG.js} +2 -2
- package/dist/index.js +3 -3
- package/package.json +3 -3
- /package/dist/{dist-KPKCZ4IO.js.map → dist-MGJ75RIY.js.map} +0 -0
- /package/dist/{dist-RWDYR67F.js.map → dist-OSTBPTHG.js.map} +0 -0
|
@@ -66034,21 +66034,31 @@ var T2000 = class _T2000 extends import_index.default {
|
|
|
66034
66034
|
const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
|
|
66035
66035
|
const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
|
|
66036
66036
|
let toAmount = Number(route.amountOut) / 10 ** toDecimals;
|
|
66037
|
-
|
|
66038
|
-
|
|
66039
|
-
|
|
66040
|
-
|
|
66041
|
-
|
|
66042
|
-
|
|
66043
|
-
|
|
66044
|
-
|
|
66045
|
-
|
|
66046
|
-
|
|
66047
|
-
|
|
66048
|
-
|
|
66037
|
+
const toTypeSuffix = toType.split("::").slice(1).join("::");
|
|
66038
|
+
for (let attempt = 0; attempt < 4; attempt++) {
|
|
66039
|
+
try {
|
|
66040
|
+
const txBlock = await this.client.getTransactionBlock({
|
|
66041
|
+
digest: gasResult.digest,
|
|
66042
|
+
options: { showBalanceChanges: true }
|
|
66043
|
+
});
|
|
66044
|
+
const changes = txBlock.balanceChanges ?? [];
|
|
66045
|
+
const received = changes.find((c) => {
|
|
66046
|
+
if (BigInt(c.amount) <= 0n) return false;
|
|
66047
|
+
const ownerAddr = c.owner?.AddressOwner;
|
|
66048
|
+
if (!ownerAddr || ownerAddr.toLowerCase() !== this._address.toLowerCase()) return false;
|
|
66049
|
+
if (c.coinType === toType) return true;
|
|
66050
|
+
return c.coinType.endsWith(toTypeSuffix);
|
|
66051
|
+
});
|
|
66052
|
+
if (received) {
|
|
66053
|
+
const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
|
|
66054
|
+
if (actual > 0) {
|
|
66055
|
+
toAmount = actual;
|
|
66056
|
+
break;
|
|
66057
|
+
}
|
|
66058
|
+
}
|
|
66059
|
+
} catch {
|
|
66049
66060
|
}
|
|
66050
|
-
|
|
66051
|
-
console.warn("[swap] Could not read balance changes, using route estimate");
|
|
66061
|
+
if (attempt < 3) await new Promise((r) => setTimeout(r, 600));
|
|
66052
66062
|
}
|
|
66053
66063
|
const fromName = fromEntry ? fromEntry[0] : this._resolveTokenName(fromType, params.from);
|
|
66054
66064
|
const toName = toEntry ? toEntry[0] : this._resolveTokenName(toType, params.to);
|
|
@@ -67073,4 +67083,4 @@ axios/dist/node/axios.cjs:
|
|
|
67073
67083
|
@scure/bip39/index.js:
|
|
67074
67084
|
(*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
|
|
67075
67085
|
*/
|
|
67076
|
-
//# sourceMappingURL=chunk-
|
|
67086
|
+
//# sourceMappingURL=chunk-CDQ2RJBX.js.map
|