Skip to content

Commit

Permalink
[Issue-3862] fix: fix display tx history
Browse files Browse the repository at this point in the history
  • Loading branch information
bluezdot committed Dec 6, 2024
1 parent 2e2223a commit 7a3a1dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ import SwapLayout from '@subwallet/extension-koni-ui/Popup/Home/History/Detail/p
import { ThemeProps, TransactionHistoryDisplayItem } from '@subwallet/extension-koni-ui/types';
import { formatHistoryDate, isAbleToShowFee, toShort } from '@subwallet/extension-koni-ui/utils';
import CN from 'classnames';
import React from 'react';
import React, { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import styled from 'styled-components';

import { hexAddPrefix, isHex } from '@polkadot/util';

import HistoryDetailAmount from './Amount';
import HistoryDetailFee from './Fee';
import HistoryDetailHeader from './Header';
Expand All @@ -28,6 +30,12 @@ const Component: React.FC<Props> = (props: Props) => {

const { language } = useSelector((state) => state.settings);

const extrinsicHash = useMemo(() => {
const hash = data.extrinsicHash || '';

return isHex(hexAddPrefix(hash)) ? toShort(data.extrinsicHash, 8, 9) : '...';
}, [data.extrinsicHash]);

if (data.type === ExtrinsicType.SWAP) {
return (
<SwapLayout data={data} />
Expand All @@ -47,7 +55,7 @@ const Component: React.FC<Props> = (props: Props) => {
statusName={t(HistoryStatusMap[data.status].name)}
valueColorSchema={HistoryStatusMap[data.status].schema}
/>
<MetaInfo.Default label={t('Extrinsic hash')}>{(data.extrinsicHash || '').startsWith('0x') ? toShort(data.extrinsicHash, 8, 9) : '...'}</MetaInfo.Default>
<MetaInfo.Default label={t('Extrinsic hash')}>{extrinsicHash}</MetaInfo.Default>
<MetaInfo.Default label={t('Transaction time')}>{formatHistoryDate(data.time, language, 'detail')}</MetaInfo.Default>
<HistoryDetailAmount data={data} />

Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6681,7 +6681,7 @@ __metadata:

"@subwallet/keyring@file:../SubWallet-Base/packages/keyring/build/::locator=root-workspace-0b6124%40workspace%3A.":
version: 0.1.7
resolution: "@subwallet/keyring@file:../SubWallet-Base/packages/keyring/build/#../SubWallet-Base/packages/keyring/build/::hash=76926d&locator=root-workspace-0b6124%40workspace%3A."
resolution: "@subwallet/keyring@file:../SubWallet-Base/packages/keyring/build/#../SubWallet-Base/packages/keyring/build/::hash=f6dfa7&locator=root-workspace-0b6124%40workspace%3A."
dependencies:
"@emurgo/cardano-serialization-lib-nodejs": ^13.2.0
"@ethereumjs/tx": ^5.0.0
Expand All @@ -6702,7 +6702,7 @@ __metadata:
rxjs: ^7.5.6
tiny-secp256k1: ^2.2.3
tslib: ^2.6.2
checksum: e3f787399e9fd27f9261caeb41fb0b8f6e32fbff9e27dc5e51d4a9250ab432f78c95ef6f2ff1f335992b89250f4e9798623a158360e248853a02411b5fce303d
checksum: 0219898a8a5c0c9c8fe996c7346c7c2783cb8a7e17b70c8e3b0ba9574554a67c11ecfe3a31dfc7fa2ff096fda5a720d4ca30ae8da79a79b5ace6855340c300c1
languageName: node
linkType: hard

Expand Down

0 comments on commit 7a3a1dc

Please sign in to comment.