Skip to content

Commit

Permalink
Improve displaying non-EVM events
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Jul 5, 2023
1 parent ee4f35e commit 7ff4fd4
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
1 change: 1 addition & 0 deletions .changelog/651.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve displaying events
50 changes: 49 additions & 1 deletion src/app/components/Transactions/LogEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,13 +169,61 @@ const DecodedLogEvent: FC<{

case RuntimeEventType.accountsburn:
case RuntimeEventType.accountsmint:
return (
<div>
<div>{eventName}</div>
<br />
<StyledDescriptionList titleWidth={isMobile ? '100px' : '200px'}>
<dt>{t('transactionEvent.fields.owner')}</dt>
<dd>
<AccountLink
address={event.body.owner}
scope={scope}
plain={addressSwitchOption === AddressSwitchOption.ETH}
/>
</dd>
<dt>{t('transactionEvent.fields.amount')}</dt>
<dd>
{t('common.valueInToken', {
value: event.body.amount.Amount,
ticker: event.body.amount.Denomination,
})}
</dd>
</StyledDescriptionList>
</div>
)
case RuntimeEventType.accountstransfer:
case RuntimeEventType.consensus_accountsdeposit:
case RuntimeEventType.consensus_accountswithdraw:
return (
<div>
<div>{eventName}</div>
<pre>{JSON.stringify(event, null, ' ')}</pre>
<br />
<StyledDescriptionList titleWidth={isMobile ? '100px' : '200px'}>
<dt>{t('common.from')}</dt>
<dd>
<AccountLink
address={event.body.from}
scope={scope}
plain={addressSwitchOption === AddressSwitchOption.ETH}
/>
</dd>
<dt>{t('common.to')}</dt>
<dd>
<AccountLink
address={event.body.to}
scope={scope}
plain={addressSwitchOption === AddressSwitchOption.ETH}
/>
</dd>
<dt>{t('transactionEvent.fields.amount')}</dt>
<dd>
{t('common.valueInToken', {
value: event.body.amount.Amount,
ticker: event.body.amount.Denomination,
})}
</dd>
</StyledDescriptionList>
</div>
)
default:
Expand Down
6 changes: 5 additions & 1 deletion src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,11 @@
"consensusWithdrawal": "Withdrawal to consensus",
"decoded": "Decoded",
"evmLog": "EVM log message",
"gasUsed": "Gas used"
"gasUsed": "Gas used",
"fields": {
"amount": "Amount",
"owner": "Owner"
}
},
"transactionStats": {
"header": "Transactions Per Day",
Expand Down

0 comments on commit 7ff4fd4

Please sign in to comment.