Skip to content

Commit

Permalink
fix: tx detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Nov 30, 2022
1 parent 1fe0c65 commit 6c6e776
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion utils/enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export enum CardInfoLabels {
block = 'Block:',
from = 'From:',
to = 'To:',
createdContractAddressHash = 'Interacted With (To):',
interactWith = 'Interacted With:',
time = 'Timestamp:',
value = 'Value:',
fee = 'Transaction Fee:',
Expand Down
15 changes: 9 additions & 6 deletions views/transactions/hook/useConvertData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ export default function useConvertData({ data }: { data: TransactionDetail }) {
})
break
case 'to': //to
if (data[key] !== undefined && data[key] !== null)
if (data[key] !== undefined && data[key] !== null) {
const isInteractWith = !!data?.rawInput?.startsWith('0x')
items.push({
label: CardInfoLabels[key],
label: isInteractWith ? CardInfoLabels.interactWith : CardInfoLabels.to,
type: 'link-copy',
contents: [
{
Expand All @@ -108,12 +109,13 @@ export default function useConvertData({ data }: { data: TransactionDetail }) {
}
]
})
}
break
case 'createdContractAddressHash': //to
const name = data['createdContractAddressName']
if (data[key] !== undefined && data[key] !== null)
if (data[key] !== undefined && data[key] !== null) {
const name = data['createdContractAddressName']
items.push({
label: CardInfoLabels[key],
label: CardInfoLabels.interactWith,
type: 'link-copy',
contents: [
{
Expand All @@ -123,6 +125,7 @@ export default function useConvertData({ data }: { data: TransactionDetail }) {
}
]
})
}
break
case 'time':
if (data[key] !== undefined && data[key] !== null)
Expand Down Expand Up @@ -278,7 +281,7 @@ export default function useConvertData({ data }: { data: TransactionDetail }) {
CardInfoLabels.time,
CardInfoLabels.from,
CardInfoLabels.to,
CardInfoLabels.createdContractAddressHash,
CardInfoLabels.interactWith,
CardInfoLabels.tokenTransfers,
CardInfoLabels.value,
CardInfoLabels.fee,
Expand Down

0 comments on commit 6c6e776

Please sign in to comment.