From 7a3a1dc0af39ea4afb57fbc76b8c8894f352b5f2 Mon Sep 17 00:00:00 2001 From: bluezdot <72647326+bluezdot@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:32:02 +0700 Subject: [PATCH] [Issue-3862] fix: fix display tx history --- .../src/Popup/Home/History/Detail/parts/Layout.tsx | 12 ++++++++++-- yarn.lock | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/extension-koni-ui/src/Popup/Home/History/Detail/parts/Layout.tsx b/packages/extension-koni-ui/src/Popup/Home/History/Detail/parts/Layout.tsx index 8db65e97c3..29214c7dc7 100644 --- a/packages/extension-koni-ui/src/Popup/Home/History/Detail/parts/Layout.tsx +++ b/packages/extension-koni-ui/src/Popup/Home/History/Detail/parts/Layout.tsx @@ -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'; @@ -28,6 +30,12 @@ const Component: React.FC = (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 ( @@ -47,7 +55,7 @@ const Component: React.FC = (props: Props) => { statusName={t(HistoryStatusMap[data.status].name)} valueColorSchema={HistoryStatusMap[data.status].schema} /> - {(data.extrinsicHash || '').startsWith('0x') ? toShort(data.extrinsicHash, 8, 9) : '...'} + {extrinsicHash} {formatHistoryDate(data.time, language, 'detail')} diff --git a/yarn.lock b/yarn.lock index 3648d46934..d9317af9ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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 @@ -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