@t2000/cli 0.25.6 → 0.25.8

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",
@@ -65367,13 +65369,14 @@ async function trySelfFunded(client, signer, tx) {
65367
65369
  const result = await client.executeTransactionBlock({
65368
65370
  transactionBlock: toBase642(builtBytes),
65369
65371
  signature: [signature],
65370
- options: { showEffects: true }
65372
+ options: { showEffects: true, showBalanceChanges: true }
65371
65373
  });
65372
65374
  await client.waitForTransaction({ digest: result.digest });
65373
65375
  await assertTxSuccess(result.effects, result.digest);
65374
65376
  return {
65375
65377
  digest: result.digest,
65376
65378
  effects: result.effects,
65379
+ balanceChanges: result.balanceChanges,
65377
65380
  gasMethod: "self-funded",
65378
65381
  gasCostSui: extractGasCost(result.effects),
65379
65382
  preTxSuiMist: suiBalance
@@ -65392,13 +65395,14 @@ async function tryAutoTopUpThenSelfFund(client, signer, buildTx) {
65392
65395
  const result = await client.executeTransactionBlock({
65393
65396
  transactionBlock: toBase642(builtBytes),
65394
65397
  signature: [signature],
65395
- options: { showEffects: true }
65398
+ options: { showEffects: true, showBalanceChanges: true }
65396
65399
  });
65397
65400
  await client.waitForTransaction({ digest: result.digest });
65398
65401
  await assertTxSuccess(result.effects, result.digest);
65399
65402
  return {
65400
65403
  digest: result.digest,
65401
65404
  effects: result.effects,
65405
+ balanceChanges: result.balanceChanges,
65402
65406
  gasMethod: "auto-topup",
65403
65407
  gasCostSui: extractGasCost(result.effects),
65404
65408
  preTxSuiMist: suiAfterTopUp
@@ -65422,7 +65426,7 @@ async function trySponsored(client, signer, tx) {
65422
65426
  const result = await client.executeTransactionBlock({
65423
65427
  transactionBlock: sponsoredResult.txBytes,
65424
65428
  signature: [agentSig, sponsoredResult.sponsorSignature],
65425
- options: { showEffects: true }
65429
+ options: { showEffects: true, showBalanceChanges: true }
65426
65430
  });
65427
65431
  await client.waitForTransaction({ digest: result.digest });
65428
65432
  await assertTxSuccess(result.effects, result.digest);
@@ -65431,6 +65435,7 @@ async function trySponsored(client, signer, tx) {
65431
65435
  return {
65432
65436
  digest: result.digest,
65433
65437
  effects: result.effects,
65438
+ balanceChanges: result.balanceChanges,
65434
65439
  gasMethod: "sponsored",
65435
65440
  gasCostSui: gasCost,
65436
65441
  preTxSuiMist: suiBalance
@@ -66028,13 +66033,23 @@ var T2000 = class _T2000 extends import_index.default {
66028
66033
  const toEntry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === toType);
66029
66034
  const toDecimals = toEntry ? toEntry[1].decimals : toType === "0x2::sui::SUI" ? 9 : 6;
66030
66035
  const fromAmount = Number(route.amountIn) / 10 ** fromDecimals;
66031
- const toAmount = Number(route.amountOut) / 10 ** toDecimals;
66036
+ let toAmount = Number(route.amountOut) / 10 ** toDecimals;
66037
+ const changes = gasResult.balanceChanges ?? [];
66038
+ const received = changes.find(
66039
+ (c) => c.coinType === toType && BigInt(c.amount) > 0n && c.owner.AddressOwner === this._address
66040
+ );
66041
+ if (received) {
66042
+ const actual = Number(BigInt(received.amount)) / 10 ** toDecimals;
66043
+ if (actual > 0) toAmount = actual;
66044
+ }
66045
+ const fromName = fromEntry ? fromEntry[0] : this._resolveTokenName(fromType, params.from);
66046
+ const toName = toEntry ? toEntry[0] : this._resolveTokenName(toType, params.to);
66032
66047
  const routeDesc = route.routerData.paths?.map((p) => p.provider).filter(Boolean).slice(0, 3).join(" + ") ?? "Cetus Aggregator";
66033
66048
  return {
66034
66049
  success: true,
66035
66050
  tx: gasResult.digest,
66036
- fromToken: params.from,
66037
- toToken: params.to,
66051
+ fromToken: fromName,
66052
+ toToken: toName,
66038
66053
  fromAmount,
66039
66054
  toAmount,
66040
66055
  priceImpact: route.priceImpact,
@@ -66439,6 +66454,12 @@ var T2000 = class _T2000 extends import_index.default {
66439
66454
  }
66440
66455
  return all3;
66441
66456
  }
66457
+ _resolveTokenName(coinType, fallback) {
66458
+ const entry = Object.entries(SUPPORTED_ASSETS).find(([, v]) => v.type === coinType);
66459
+ if (entry) return entry[0];
66460
+ const suffix = coinType.split("::").pop();
66461
+ return suffix && suffix !== coinType ? suffix : fallback;
66462
+ }
66442
66463
  _mergeCoinsInTx(tx, coins) {
66443
66464
  if (coins.length === 0) throw new T2000Error("INSUFFICIENT_BALANCE", "No coins to merge");
66444
66465
  const primary = tx.object(coins[0].coinObjectId);
@@ -67044,4 +67065,4 @@ axios/dist/node/axios.cjs:
67044
67065
  @scure/bip39/index.js:
67045
67066
  (*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) *)
67046
67067
  */
67047
- //# sourceMappingURL=chunk-DKZ2SS27.js.map
67068
+ //# sourceMappingURL=chunk-MHJ6L6JJ.js.map