@t2000/cli 0.25.5 → 0.25.7

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.
@@ -64044,6 +64044,8 @@ var init_cetus_swap = __esm2({
64044
64044
  AUSD: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
64045
64045
  BUCK: "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK",
64046
64046
  USDe: "0x41d587e5336f1c86cad50d38a7136db99333bb9bda91cea4ba69115defeb1402::sui_usde::SUI_USDE",
64047
+ USDSUI: "0x44f838219cf67b058f3b37907b655f226153c18e33dfcd0da559a844fea9b1c1::usdsui::USDSUI",
64048
+ MANIFEST: "0xc466c28d87b3d5cd34f3d5c088751532d71a38d93a8aae4551dd56272cfb4355::manifest::MANIFEST",
64047
64049
  NS: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS",
64048
64050
  BLUB: "0xfa7ac3951fdca12c1b6d18eb19e1aa2fbc31e4d45773c8e45b4ded3ef8d83f8a::blub::BLUB",
64049
64051
  SCA: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA",
@@ -66028,7 +66030,23 @@ var T2000 = class _T2000 extends import_index.default {
66028
66030
  const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
66029
66031
  const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
66030
66032
  const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
66031
- const toAmount = Number(route.amountOut) / 10 ** toDecimals;
66033
+ let toAmount = Number(route.amountOut) / 10 ** toDecimals;
66034
+ try {
66035
+ const txBlock = await this.client.getTransactionBlock({
66036
+ digest: gasResult.digest,
66037
+ options: { showBalanceChanges: true }
66038
+ });
66039
+ const changes = txBlock.balanceChanges ?? [];
66040
+ const received = changes.find(
66041
+ (c) => c.coinType === toType && BigInt(c.amount) > 0n && c.owner.AddressOwner === this._address
66042
+ );
66043
+ if (received) {
66044
+ const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
66045
+ if (actual > 0) toAmount = actual;
66046
+ }
66047
+ } catch (e) {
66048
+ console.warn("[swap] Could not parse on-chain balance changes, using route estimate:", e);
66049
+ }
66032
66050
  const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
66033
66051
  return {
66034
66052
  success: true,
@@ -67044,4 +67062,4 @@ axios/dist/node/axios.cjs:
67044
67062
  @scure/bip39/index.js:
67045
67063
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
67046
67064
  */
67047
- //# sourceMappingURL=chunk-DKZ2SS27.js.map
67065
+ //# sourceMappingURL=chunk-YZ6UELLB.js.map