Skip to content

Commit

Permalink
fix: display token transfer currency symbol + logo
Browse files Browse the repository at this point in the history
  • Loading branch information
Tien Nam Dao committed Jan 6, 2023
1 parent 04bbb40 commit ee57652
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 12 deletions.
2 changes: 0 additions & 2 deletions pages/tx/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Pagination, useMobileLayout } from '@astraprotocol/astra-ui'
import { CryptoIconNames } from '@astraprotocol/astra-ui/lib/es/components/CryptoIcon'
import clsx from 'clsx'
import Container from 'components/Container'
import RowLoader from 'components/Loader/RowLoader'
Expand Down Expand Up @@ -84,7 +83,6 @@ const BlockDetailPage: React.FC<NextPage> = _ => {
from={item.from}
to={item.to}
value={item.value}
valueToken={process.env.NEXT_PUBLIC_NATIVE_TOKEN as CryptoIconNames}
labelStatus={item.evmType}
type={item.type}
newBlock={item.newTransaction}
Expand Down
4 changes: 3 additions & 1 deletion utils/cosmos.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { astraToEth } from '@astradefi/address-converter'
import { CryptoIconNames } from '@astraprotocol/astra-ui/lib/es/components/CryptoIcon'
import { formatEther } from 'ethers/lib/utils'
import { TransactionRowProps } from 'views/transactions/TransactionRow'
import { caculateAmount } from 'views/transactions/utils'
Expand Down Expand Up @@ -40,7 +41,8 @@ const _parseCosmosMsgSend = (content: MsgSendContent, blockTime: string, status:
blockNumber: content.height,
updatedAt: blockTime,
value: formatEther(amountItem.amount || '0'),
valueCurrency: amountItem.denom,
valueCurrency: process.env.NEXT_PUBLIC_NATIVE_TOKEN as CryptoIconNames,
valueToken: process.env.NEXT_PUBLIC_NATIVE_TOKEN as CryptoIconNames,
hash: content.txHash,
type: getTransactionType(content?.msgName),
status,
Expand Down
3 changes: 2 additions & 1 deletion views/accounts/hook/useAddressInternalTransaction.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { CryptoIconNames } from '@astraprotocol/astra-ui/lib/es/components/CryptoIcon'
import API_LIST from 'api/api_list'
import { formatEther } from 'ethers/lib/utils'
import { useEffect, useState } from 'react'
Expand Down Expand Up @@ -42,7 +43,7 @@ export default function useAddressInternalTransaction(
blockNumber: Number(d?.blockNumber),
updatedAt: Number(d?.timeStamp) * 1000,
value: formatEther(d?.value || '0'),
valueToken: 'asa',
valueToken: process.env.NEXT_PUBLIC_NATIVE_TOKEN as CryptoIconNames,
// valueCurrency: d.
hash: d?.transactionHash,
labelStatus: evmInternalTransactionType(d?.callType || d?.type),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ const AddressTransaction = ({ transaction }: Props) => {
<TypographyLib.Balance
size="2xs"
value={transaction.value}
currency={''}
icon={<CryptoIcon name={'asa'} size="sm" />}
currency={process.env.NEXT_PUBLIC_NATIVE_TOKEN?.toUpperCase()}
icon={<CryptoIcon name="asa" size="sm" />}
/>
<br />
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const ContractTransaction = ({ transaction }: Props) => {
<TypographyLib.Balance
size="2xs"
value={convertBalanceToView(transaction.value)}
currency={''}
currency={process.env.NEXT_PUBLIC_NATIVE_TOKEN?.toUpperCase()}
icon={<CryptoIcon name={'asa'} size="sm" />}
/>
<br />
Expand Down
9 changes: 8 additions & 1 deletion views/tokens/tabs/TokenTransactionTab/TokenTransaction.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Typography as TypographyLib } from '@astraprotocol/astra-ui'
import { CryptoIcon, Typography as TypographyLib } from '@astraprotocol/astra-ui'
import { CryptoIconNames } from '@astraprotocol/astra-ui/lib/es/components/CryptoIcon'
import clsx from 'clsx'
import GradientRow from 'components/Row/GradientRow'
import Timer from 'components/Timer'
Expand Down Expand Up @@ -95,6 +96,12 @@ const TokenTransaction = ({ transaction, tokenData }: Props) => {
size="xs"
value={convertBalanceToView(transaction.amount, parseInt(transaction.decimals))}
currency={transaction.tokenSymbol}
icon={
<CryptoIcon
name={transaction.tokenSymbol?.toLowerCase() as CryptoIconNames}
size="sm"
/>
}
/>
<br />
</>
Expand Down
6 changes: 2 additions & 4 deletions views/transactions/TransactionRowContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,8 @@ export default function TransactionRowContent({
value={value}
currency={
valueCurrency
? valueCurrency.toLowerCase() == 'aastra'
? process.env.NEXT_PUBLIC_NATIVE_TOKEN
: valueCurrency?.toUpperCase()
: 'ASA'
? valueCurrency.toUpperCase()
: process.env.NEXT_PUBLIC_NATIVE_TOKEN?.toUpperCase()
}
icon={valueToken && <CryptoIcon name={valueToken} size="sm" />}
/>
Expand Down

0 comments on commit ee57652

Please sign in to comment.