@t2000/engine 0.6.4 → 0.6.5

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/index.js CHANGED
@@ -1667,9 +1667,20 @@ var explainTxTool = buildTool({
1667
1667
  const amount = Number(bc.amount);
1668
1668
  const isNegative = amount < 0;
1669
1669
  const decimals = guessDecimals(bc.coinType);
1670
+ const absHuman = Math.abs(amount / 10 ** decimals);
1671
+ const isSenderSui = ownerAddr === sender && bc.coinType.endsWith("::sui::SUI") && isNegative;
1672
+ if (isSenderSui) {
1673
+ const netTransfer = absHuman - gasCost;
1674
+ if (netTransfer < 1e-4) continue;
1675
+ txEffects.push({
1676
+ type: "send",
1677
+ description: `${ownerAddr.slice(0, 8)}...${ownerAddr.slice(-4)} sent ${netTransfer.toFixed(4)} ${symbol}`
1678
+ });
1679
+ continue;
1680
+ }
1670
1681
  txEffects.push({
1671
1682
  type: isNegative ? "send" : "receive",
1672
- description: `${ownerAddr.slice(0, 8)}...${ownerAddr.slice(-4)} ${isNegative ? "sent" : "received"} ${Math.abs(amount / 10 ** decimals).toFixed(decimals > 6 ? 4 : 2)} ${symbol}`
1683
+ description: `${ownerAddr.slice(0, 8)}...${ownerAddr.slice(-4)} ${isNegative ? "sent" : "received"} ${absHuman.toFixed(decimals > 6 ? 4 : 2)} ${symbol}`
1673
1684
  });
1674
1685
  }
1675
1686
  }