From e3e2a6d3ece3d2d2bdbec512121948d1ea203b25 Mon Sep 17 00:00:00 2001 From: Filip Djokic <87134019+filipdjokic@users.noreply.github.com> Date: Tue, 16 Jul 2024 11:19:38 +0200 Subject: [PATCH] fix: 0 amount for withdraw commission rewards messages [DEV-4026] (#183) fix: 0 amount for withdraw commission rewards messages --- .../msg/distribution/msg_withdraw_validator_commission.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/ui/src/models/msg/distribution/msg_withdraw_validator_commission.ts b/packages/ui/src/models/msg/distribution/msg_withdraw_validator_commission.ts index 7a5ca5f5ce..da976c177d 100644 --- a/packages/ui/src/models/msg/distribution/msg_withdraw_validator_commission.ts +++ b/packages/ui/src/models/msg/distribution/msg_withdraw_validator_commission.ts @@ -26,11 +26,11 @@ class MsgWithdrawValidatorCommission { static getWithdrawalAmount(log?: Log) { const withdrawEvents = - log?.events ?? [].filter((x: { type: string }) => x.type === 'withdraw_commission'); + log?.events?.filter((x: { type?: string }) => x.type === 'withdraw_commission') ?? []; const withdrawAmounts = - withdrawEvents?.[0]?.attributes?.filter((x: { key?: string }) => x.key === 'amount') ?? []; + withdrawEvents[0]?.attributes?.filter((x: { key?: string }) => x.key === 'amount') ?? []; - const amounts = (withdrawAmounts?.[0]?.value ?? '0').split(',').map((x) => { + const amounts = (withdrawAmounts[0]?.value ?? '0').split(',').map((x) => { const [amount, denom = primaryTokenUnit] = x.match(/[a-z]+|[^a-z]+/gi) ?? []; return formatToken(amount, denom); });