From 44ccd1c0c194a743abe51dcb6b4c1289a58a3ce2 Mon Sep 17 00:00:00 2001 From: Kristof Csillag Date: Tue, 26 Sep 2023 12:21:07 +0200 Subject: [PATCH] Add basic handling for new event types Mostly just placeholders, in order to avoid syntax errors with latest API wrapper code. This is going to be flushed out later. (Custom icons, proper data fields displayed, etc.) --- .changelog/893.internal.md | 1 + src/app/components/RuntimeTransactionLabel/index.tsx | 10 ++++++++++ src/app/components/Transactions/LogEvent.tsx | 10 ++++++++++ src/locales/en/translation.json | 7 ++++++- 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .changelog/893.internal.md diff --git a/.changelog/893.internal.md b/.changelog/893.internal.md new file mode 100644 index 0000000000..12ac84d082 --- /dev/null +++ b/.changelog/893.internal.md @@ -0,0 +1 @@ +Add basic handling of new event types diff --git a/src/app/components/RuntimeTransactionLabel/index.tsx b/src/app/components/RuntimeTransactionLabel/index.tsx index f0cbd64b97..d19472859f 100644 --- a/src/app/components/RuntimeTransactionLabel/index.tsx +++ b/src/app/components/RuntimeTransactionLabel/index.tsx @@ -23,6 +23,10 @@ const getRuntimeTransactionLabel = (t: TFunction, method: string | undefined) => return t('transactions.method.consensus.deposit') case 'consensus.Withdraw': return t('transactions.method.consensus.withdraw') + case 'consensus.Delegate': + return t('transactions.method.consensus.delegate') + case 'consensus.Undelegate': + return t('transactions.method.consensus.undelegate') case 'accounts.Transfer': return t('transactions.method.accounts.transfer') default: @@ -42,6 +46,10 @@ const getRuntimeTransactionIcon = (method: string | undefined) => { return case 'consensus.Deposit': return + case 'consensus.Delegate': + return // TODO: use the correct icon + case 'consensus.Undelegate': + return // TODO: use the correct icon case 'consensus.Withdraw': return case 'accounts.Transfer': @@ -62,6 +70,8 @@ type RuntimeTransactionLabelProps = { * - "accounts.Transfer" * - "consensus.Deposit" * - "consensus.Withdraw" + * - "consensus.Delegate" + * - "consensus.Undelegate" * - "evm.Create" * - "evm.Call" */ diff --git a/src/app/components/Transactions/LogEvent.tsx b/src/app/components/Transactions/LogEvent.tsx index 7fe0ee87a2..c5f2bf2113 100644 --- a/src/app/components/Transactions/LogEvent.tsx +++ b/src/app/components/Transactions/LogEvent.tsx @@ -26,6 +26,7 @@ import { COLORS } from '../../../styles/theme/colors' import StreamIcon from '@mui/icons-material/Stream' import LocalFireDepartmentIcon from '@mui/icons-material/LocalFireDepartment' import { getPreciseNumberFormat } from '../../../locales/getPreciseNumberFormat' +import { UnknownIcon } from '../CustomIcons/Unknown' export const EventTypeIcon: FC<{ eventType: RuntimeEventType @@ -37,6 +38,9 @@ export const EventTypeIcon: FC<{ [RuntimeEventType.coregas_used]: <>, [RuntimeEventType.consensus_accountswithdraw]: , [RuntimeEventType.consensus_accountsdeposit]: , + [RuntimeEventType.consensus_accountsdelegate]: , // TODO: use correct icon + [RuntimeEventType.consensus_accountsundelegate_start]: , // TODO: use correct icon + [RuntimeEventType.consensus_accountsundelegate_done]: , // TODO: use correct icon [RuntimeEventType.accountsmint]: , [RuntimeEventType.accountsburn]: ( @@ -138,6 +142,9 @@ const LogEvent: FC<{ [RuntimeEventType.coregas_used]: t('transactionEvent.gasUsed'), [RuntimeEventType.consensus_accountswithdraw]: t('transactionEvent.consensusWithdrawal'), [RuntimeEventType.consensus_accountsdeposit]: t('transactionEvent.consensusDeposit'), + [RuntimeEventType.consensus_accountsdelegate]: t('transactionEvent.consensusDelegate'), + [RuntimeEventType.consensus_accountsundelegate_start]: t('transactionEvent.consensusUndelegateStart'), + [RuntimeEventType.consensus_accountsundelegate_done]: t('transactionEvent.consensusUndelegateDone'), [RuntimeEventType.accountsmint]: t('transactionEvent.accountsmint'), [RuntimeEventType.accountsburn]: t('transactionEvent.accountsburn'), } @@ -231,6 +238,9 @@ const LogEvent: FC<{ case RuntimeEventType.accountstransfer: case RuntimeEventType.consensus_accountsdeposit: case RuntimeEventType.consensus_accountswithdraw: + case RuntimeEventType.consensus_accountsdelegate: // TODO show this properly + case RuntimeEventType.consensus_accountsundelegate_start: // TODO show this properly + case RuntimeEventType.consensus_accountsundelegate_done: // TODO show this properly return (
diff --git a/src/locales/en/translation.json b/src/locales/en/translation.json index 868c994674..ad8ba2ee08 100644 --- a/src/locales/en/translation.json +++ b/src/locales/en/translation.json @@ -256,7 +256,9 @@ }, "consensus": { "deposit": "Consensus Deposit", - "withdraw": "Consensus Withdraw" + "withdraw": "Consensus Withdraw", + "delegate": "Consensus delegate", + "undelegate": "Consensus undelegate" }, "evm": { "call": "Contract Call", @@ -288,6 +290,9 @@ "accountstransfer": "Transfer", "consensusDeposit": "Deposit from consensus", "consensusWithdrawal": "Withdrawal to consensus", + "consensusDelegate": "Delegate to consensus", + "consensusUndelegateStart": "Start to undelegate from consensus", + "consensusUndelegateDone": "Undelegate from consensus finished", "evmLog": "EVM log message", "gasUsed": "Gas used", "fields": {