Skip to content

Commit

Permalink
fix: refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
viennguyen2-tiki committed Mar 17, 2023
1 parent e68160f commit 1bdee43
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,20 +181,24 @@ export const getTransactionInOrOut = (
to: string = '',
defaultType: string = ''
) => {
if (address.toLowerCase().startsWith('astra')) {
address = astraToEth(address)
from = from.toLowerCase()
to = to.toLowerCase()
address = from.toLowerCase()

if (address.startsWith('astra')) {
address = astraToEth(address).toLowerCase()
}

if (from.toLowerCase().startsWith('astra')) {
from = astraToEth(from)
if (from.startsWith('astra')) {
from = astraToEth(from).toLowerCase()
}
if (to.toLowerCase().startsWith('astra')) {
to = astraToEth(to)
to = astraToEth(to).toLowerCase()
}
if (address.toLocaleLowerCase() === from.toLocaleLowerCase() && !isEmpty(to)) {
if (address === from && !isEmpty(to)) {
return 'OUT'
}
if (address.toLocaleLowerCase() === to.toLocaleLowerCase() && !isEmpty(from)) {
if (address === to && !isEmpty(from)) {
return 'IN'
}
return defaultType
Expand Down

0 comments on commit 1bdee43

Please sign in to comment.