Skip to content

Commit

Permalink
fix: parse from/to with tx detail
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Feb 17, 2023
1 parent 253ff37 commit 6e49c72
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions views/transactions/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { astraToEth } from '@astradefi/address-converter'
import { formatNumber } from '@astraprotocol/astra-ui'
import * as Sentry from '@sentry/nextjs'
import { cosmosApi } from 'api'
import API_LIST from 'api/api_list'
import { BigNumber } from 'ethers'
Expand Down Expand Up @@ -267,17 +268,19 @@ const _getFromAndToEvmFromCosmosMsg = (res: EvmTransactionDetailResponse): [stri

let from = ''
let to = ''
if (!isEmpty(result) && !isEmpty(result.from) && !isEmpty(result.to)) {
// server parsed
from = result.from
to = result.to
} else {
// server is parsing data
if (isEmpty(result)) {
// parse from first message body data
const message = messages?.[0]
try {
from = message.content.params.from
to = message.content.params.data.to
} catch (e) {}
} catch (e) {
Sentry.captureException(e)
}
} else {
// parsed from body data
from = result.from
to = result.to
}

return [from, to]
Expand Down

0 comments on commit 6e49c72

Please sign in to comment.