From a8fe15fd0c303e4ea2ea8892347856c5c8b3ead7 Mon Sep 17 00:00:00 2001 From: NguyenHuy1812 Date: Wed, 5 Jun 2024 11:41:08 +0700 Subject: [PATCH] fix(balances): render recent tx for onchain bals (#1685) --- src/commands/balances/index/processor.ts | 22 ++++------------------ src/utils/constants.ts | 2 +- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/commands/balances/index/processor.ts b/src/commands/balances/index/processor.ts index 9313a2fe4..1590c5f1e 100644 --- a/src/commands/balances/index/processor.ts +++ b/src/commands/balances/index/processor.ts @@ -366,27 +366,13 @@ async function getTxns( ), ) .map((d: any) => { - const date = d.signed_at - const firstAction = d.actions?.find( - (a: any) => a.native_transfer || a.name === "Transfer", - ) - if (!firstAction) return if (isValidRoninAddress(address)) { address = `0x${address.slice(6)}` } - const target = firstAction.to - const action = - target.toLowerCase() === address.toLowerCase() ? "Received" : "Sent" - const amount = formatTokenDigit(firstAction.amount) - const token = firstAction.unit - - return { - date, - action, - target, - amount, - token, - } + d.actions?.forEach((action: any) => { + action.amount = formatTokenDigit(action.amount) + }) + return d }) .filter(Boolean) .slice(0, 5) diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 63980ce6c..eeb1891de 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -60,7 +60,7 @@ export const VALID_BOOST_MESSAGE_TYPES = [ ] // usd -export const MIN_DUST = 0.001 +export const MIN_DUST = 3 export const HOMEPAGE_URL = process.env.HOMEPAGE_URL || "https://mochi.gg" export const MOCHI_DOC_URL = "https://docs.mochi.gg"