@t2000/engine 0.6.3 → 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 +18 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -261,6 +261,11 @@ function hasNaviMcp(context) {
|
|
|
261
261
|
const mgr = context.mcpManager;
|
|
262
262
|
return mgr.isConnected(NAVI_SERVER_NAME);
|
|
263
263
|
}
|
|
264
|
+
function hasNaviMcpGlobal(context) {
|
|
265
|
+
if (!context.mcpManager) return false;
|
|
266
|
+
const mgr = context.mcpManager;
|
|
267
|
+
return mgr.isConnected(NAVI_SERVER_NAME);
|
|
268
|
+
}
|
|
264
269
|
function getMcpManager(context) {
|
|
265
270
|
return context.mcpManager;
|
|
266
271
|
}
|
|
@@ -874,7 +879,7 @@ var ratesInfoTool = buildTool({
|
|
|
874
879
|
jsonSchema: { type: "object", properties: {}, required: [] },
|
|
875
880
|
isReadOnly: true,
|
|
876
881
|
async call(_input, context) {
|
|
877
|
-
if (
|
|
882
|
+
if (hasNaviMcpGlobal(context)) {
|
|
878
883
|
const rates2 = await fetchRates(getMcpManager(context));
|
|
879
884
|
return { data: rates2, displayText: formatRatesSummary(rates2) };
|
|
880
885
|
}
|
|
@@ -1662,9 +1667,20 @@ var explainTxTool = buildTool({
|
|
|
1662
1667
|
const amount = Number(bc.amount);
|
|
1663
1668
|
const isNegative = amount < 0;
|
|
1664
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
|
+
}
|
|
1665
1681
|
txEffects.push({
|
|
1666
1682
|
type: isNegative ? "send" : "receive",
|
|
1667
|
-
description: `${ownerAddr.slice(0, 8)}...${ownerAddr.slice(-4)} ${isNegative ? "sent" : "received"} ${
|
|
1683
|
+
description: `${ownerAddr.slice(0, 8)}...${ownerAddr.slice(-4)} ${isNegative ? "sent" : "received"} ${absHuman.toFixed(decimals > 6 ? 4 : 2)} ${symbol}`
|
|
1668
1684
|
});
|
|
1669
1685
|
}
|
|
1670
1686
|
}
|