From 7b2c5b1d56d0506b2c6aa00e8a11000a57842390 Mon Sep 17 00:00:00 2001 From: tiendn Date: Wed, 22 Mar 2023 09:14:38 +0700 Subject: [PATCH] fix: get from/to from messages instead of account --- views/accounts/hook/useAddressTransaction.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/views/accounts/hook/useAddressTransaction.ts b/views/accounts/hook/useAddressTransaction.ts index 8bc1a1d9..7df3178f 100644 --- a/views/accounts/hook/useAddressTransaction.ts +++ b/views/accounts/hook/useAddressTransaction.ts @@ -30,10 +30,11 @@ export default function useAddressTransactions(address: string, page: number) { const { isWaiting } = useDelayUntilDone(() => !isEmpty(data) || error) - const getFromAndToOfEvm = (account: string, messages: TransactionMessage[]): [string, string] => { - if (account && !isEmpty(messages) && messages.length > 0) { - const from = astraToEth(account) - const to = (messages[0].content as MsgEthereumTxContent)?.params?.data?.to + const getFromAndToOfEvm = (messages: TransactionMessage[]): [string, string] => { + if (!isEmpty(messages) && messages.length > 0) { + const message = messages[0].content as MsgEthereumTxContent + const from = message?.params?.from + const to = message?.params?.data?.to return [from, to] } @@ -72,7 +73,7 @@ export default function useAddressTransactions(address: string, page: number) { let from = '' let to = '' if (!isEmpty(evmHash)) { - ;[from, to] = getFromAndToOfEvm(d.account, d.messages) + ;[from, to] = getFromAndToOfEvm(d.messages) } else { ;[from, to] = getFromAndToOfCosmos(d.messages) }