Skip to content

Commit

Permalink
fix: get from/to from messages instead of account
Browse files Browse the repository at this point in the history
  • Loading branch information
tiendn committed Mar 22, 2023
1 parent ed98b85 commit 7b2c5b1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions views/accounts/hook/useAddressTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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]
}
Expand Down Expand Up @@ -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)
}
Expand Down

0 comments on commit 7b2c5b1

Please sign in to comment.