@t2000/engine 0.31.0 → 0.31.1

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.d.ts CHANGED
@@ -832,19 +832,10 @@ declare const healthCheckTool: Tool<{}, {
832
832
 
833
833
  declare const ratesInfoTool: Tool<{}, _t2000_sdk.RatesResult>;
834
834
 
835
- interface TxRecord {
836
- digest: string;
837
- action: string;
838
- amount?: number;
839
- asset?: string;
840
- recipient?: string;
841
- timestamp: number;
842
- gasCost?: number;
843
- }
844
835
  declare const transactionHistoryTool: Tool<{
845
836
  limit?: number | undefined;
846
837
  }, {
847
- transactions: TxRecord[];
838
+ transactions: _t2000_sdk.TransactionRecord[];
848
839
  count: number;
849
840
  }>;
850
841
 
package/dist/index.js CHANGED
@@ -980,13 +980,15 @@ function parseRpcTx(tx, address) {
980
980
  const recipientChange = inflows.find((c) => c.coinType === coinType);
981
981
  recipient = recipientChange ? resolveOwner(recipientChange.owner) ?? void 0 : void 0;
982
982
  }
983
+ const timestampMs = Number(tx.timestampMs ?? 0);
983
984
  return {
984
985
  digest: tx.digest,
985
986
  action: classifyAction(moveCallTargets, commandTypes),
986
987
  amount,
987
988
  asset,
988
989
  recipient,
989
- timestamp: Number(tx.timestampMs ?? 0),
990
+ timestamp: timestampMs,
991
+ date: timestampMs > 0 ? new Date(timestampMs).toISOString() : void 0,
990
992
  gasCost
991
993
  };
992
994
  }
@@ -2645,6 +2647,7 @@ Always prefer the canvas for visualisation requests. After rendering, offer to e
2645
2647
  };
2646
2648
  }
2647
2649
  if (template === "health_simulator") {
2650
+ const roundedDebt = totalBorrows >= 1 ? Math.round(totalBorrows) : totalBorrows > 0 ? parseFloat(totalBorrows.toFixed(4)) : 0;
2648
2651
  return {
2649
2652
  data: {
2650
2653
  __canvas: true,
@@ -2653,7 +2656,7 @@ Always prefer the canvas for visualisation requests. After rendering, offer to e
2653
2656
  templateData: {
2654
2657
  available: true,
2655
2658
  initialCollateral: totalSavings > 0 ? Math.round(totalSavings) : 1500,
2656
- initialDebt: totalBorrows > 0 ? Math.round(totalBorrows) : 500,
2659
+ initialDebt: roundedDebt > 0 ? roundedDebt : totalSavings > 0 ? 0 : 500,
2657
2660
  currentHf: healthFactor
2658
2661
  }
2659
2662
  },