From a8fe15fd0c303e4ea2ea8892347856c5c8b3ead7 Mon Sep 17 00:00:00 2001 From: NguyenHuy1812 Date: Wed, 5 Jun 2024 11:41:08 +0700 Subject: [PATCH 1/4] 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" From 51ca7c8b58fad195ee7a7d404924025c3b11e699 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 5 Jun 2024 04:44:20 +0000 Subject: [PATCH 2/4] chore(release): 6.52.1-rc.1 [skip ci] ## [6.52.1-rc.1](https://github.com/consolelabs/mochi-discord/compare/v6.52.0...v6.52.1-rc.1) (2024-06-05) ### Bug Fixes * **balances:** render recent tx for onchain bals ([#1685](https://github.com/consolelabs/mochi-discord/issues/1685)) ([a8fe15f](https://github.com/consolelabs/mochi-discord/commit/a8fe15fd0c303e4ea2ea8892347856c5c8b3ead7)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4432ee1d9..6b1ef26ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [6.52.1-rc.1](https://github.com/consolelabs/mochi-discord/compare/v6.52.0...v6.52.1-rc.1) (2024-06-05) + + +### Bug Fixes + +* **balances:** render recent tx for onchain bals ([#1685](https://github.com/consolelabs/mochi-discord/issues/1685)) ([a8fe15f](https://github.com/consolelabs/mochi-discord/commit/a8fe15fd0c303e4ea2ea8892347856c5c8b3ead7)) + # [6.52.0](https://github.com/consolelabs/mochi-discord/compare/v6.51.0...v6.52.0) (2024-06-04) diff --git a/package.json b/package.json index 870417c0b..eec23e62c 100644 --- a/package.json +++ b/package.json @@ -121,5 +121,5 @@ "node": "18.x" }, "name": "mochi-discord", - "version": "6.52.0" + "version": "6.52.1-rc.1" } From 121f527b93fe442415985e61ad1c64197d14166c Mon Sep 17 00:00:00 2001 From: NguyenHuy1812 Date: Wed, 5 Jun 2024 12:13:55 +0700 Subject: [PATCH 3/4] fix(balance): filter spam tx when render onchain bal (#1686) --- src/commands/balances/index/processor.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands/balances/index/processor.ts b/src/commands/balances/index/processor.ts index 1590c5f1e..b11d779e3 100644 --- a/src/commands/balances/index/processor.ts +++ b/src/commands/balances/index/processor.ts @@ -362,7 +362,10 @@ async function getTxns( d.successful && d.actions?.some( (a: any) => - a.native_transfer || equalIgnoreCase(a.name, "Transfer"), + a.native_transfer || + (equalIgnoreCase(a.name, "Transfer") && + a.unit?.length >= 3 && + a.unit?.length <= 6), ), ) .map((d: any) => { From dbddc652ca4be903f0cfddf5bfb7742b8825592a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Wed, 5 Jun 2024 05:15:14 +0000 Subject: [PATCH 4/4] chore(release): 6.52.1-rc.2 [skip ci] ## [6.52.1-rc.2](https://github.com/consolelabs/mochi-discord/compare/v6.52.1-rc.1...v6.52.1-rc.2) (2024-06-05) ### Bug Fixes * **balance:** filter spam tx when render onchain bal ([#1686](https://github.com/consolelabs/mochi-discord/issues/1686)) ([121f527](https://github.com/consolelabs/mochi-discord/commit/121f527b93fe442415985e61ad1c64197d14166c)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b1ef26ea..ebe2fb533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [6.52.1-rc.2](https://github.com/consolelabs/mochi-discord/compare/v6.52.1-rc.1...v6.52.1-rc.2) (2024-06-05) + + +### Bug Fixes + +* **balance:** filter spam tx when render onchain bal ([#1686](https://github.com/consolelabs/mochi-discord/issues/1686)) ([121f527](https://github.com/consolelabs/mochi-discord/commit/121f527b93fe442415985e61ad1c64197d14166c)) + ## [6.52.1-rc.1](https://github.com/consolelabs/mochi-discord/compare/v6.52.0...v6.52.1-rc.1) (2024-06-05) diff --git a/package.json b/package.json index eec23e62c..8f3c4b623 100644 --- a/package.json +++ b/package.json @@ -121,5 +121,5 @@ "node": "18.x" }, "name": "mochi-discord", - "version": "6.52.1-rc.1" + "version": "6.52.1-rc.2" }