Skip to content

Commit

Permalink
fix: error parse number in token transfer. Int to Float value
Browse files Browse the repository at this point in the history
  • Loading branch information
tiendn committed Feb 20, 2023
1 parent f4da400 commit 1a8da17
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 23 deletions.
40 changes: 20 additions & 20 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
name: CI explorer-fe

on:
push:
branches: [ "dev" ]
pull_request:
branches: [ "dev" ]
push:
branches: ['dev']
pull_request:
branches: ['dev']

env:
BUILD_IMAGE: 'maven:3.6-jdk-11'
NEXT_PUBLIC_COSMOS_API: https://chainindexing.astranaut.dev
NEXT_PUBLIC_EVM_API: https://blockscout.astranaut.dev
NEXT_PUBLIC_URL: https://explorer.astranaut.dev
NEXT_PUBLIC_CHAIN_ID: 11115
NEXT_PUBLIC_TITLE: Astra Explorer Testnet
NEXT_PUBLIC_GA_MEASUREMENT_ID: G-XNDN41NMWF
NEXT_PUBLIC_SENTRY_CLIENT_DSN: "https://0df08007fb014e5fa05ce2a4fb3fccea@sentry.tiki.com.vn/473"
NEXT_PUBLIC_SENTRY_SSR_DSN: "https://b3b5ac84a31d407aa23b14b84af7f10d@sentry.tiki.com.vn/475"
NEXT_PUBLIC_ENV: "testnet"
BUILD_IMAGE: 'maven:3.6-jdk-11'
NEXT_PUBLIC_COSMOS_API: https://chainindexing.astranaut.dev
NEXT_PUBLIC_EVM_API: https://blockscout.astranaut.dev
NEXT_PUBLIC_URL: https://explorer.astranaut.dev
NEXT_PUBLIC_CHAIN_ID: 11115
NEXT_PUBLIC_TITLE: Astra Explorer Testnet
NEXT_PUBLIC_GA_MEASUREMENT_ID: G-XNDN41NMWF
NEXT_PUBLIC_SENTRY_CLIENT_DSN: 'https://0df08007fb014e5fa05ce2a4fb3fccea@sentry.tiki.com.vn/473'
NEXT_PUBLIC_SENTRY_SSR_DSN: 'https://b3b5ac84a31d407aa23b14b84af7f10d@sentry.tiki.com.vn/475'
NEXT_PUBLIC_ENV: 'testnet'

jobs:
build:
runs-on: [ self-hosted, linux ]
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag explorer-fe:$GITHUB_RUN_NUMBER --build-arg SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN --build-arg NEXT_PUBLIC_COSMOS_API=$NEXT_PUBLIC_COSMOS_API --build-arg NEXT_PUBLIC_EVM_API=$NEXT_PUBLIC_EVM_API --build-arg NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL --build-arg NEXT_PUBLIC_CHAIN_ID=$NEXT_PUBLIC_CHAIN_ID --build-arg NEXT_PUBLIC_TITLE=$NEXT_PUBLIC_TITLE --build-arg NEXT_PUBLIC_GA_MEASUREMENT_ID=$NEXT_PUBLIC_GA_MEASUREMENT_ID --build-arg NEXT_PUBLIC_SENTRY_CLIENT_DSN=$NEXT_PUBLIC_SENTRY_CLIENT_DSN --build-arg NEXT_PUBLIC_SENTRY_SSR_DSN=$NEXT_PUBLIC_SENTRY_SSR_DSN --build-arg NEXT_PUBLIC_ENV=$NEXT_PUBLIC_ENV
build:
runs-on: [self-hosted, linux]
steps:
- uses: actions/checkout@v3
- name: Build the Docker image
run: docker build . --file Dockerfile --tag explorer-fe:$GITHUB_RUN_NUMBER --build-arg SENTRY_AUTH_TOKEN=$SENTRY_AUTH_TOKEN --build-arg NEXT_PUBLIC_COSMOS_API=$NEXT_PUBLIC_COSMOS_API --build-arg NEXT_PUBLIC_EVM_API=$NEXT_PUBLIC_EVM_API --build-arg NEXT_PUBLIC_URL=$NEXT_PUBLIC_URL --build-arg NEXT_PUBLIC_CHAIN_ID=$NEXT_PUBLIC_CHAIN_ID --build-arg NEXT_PUBLIC_TITLE=$NEXT_PUBLIC_TITLE --build-arg NEXT_PUBLIC_GA_MEASUREMENT_ID=$NEXT_PUBLIC_GA_MEASUREMENT_ID --build-arg NEXT_PUBLIC_SENTRY_CLIENT_DSN=$NEXT_PUBLIC_SENTRY_CLIENT_DSN --build-arg NEXT_PUBLIC_SENTRY_SSR_DSN=$NEXT_PUBLIC_SENTRY_SSR_DSN --build-arg NEXT_PUBLIC_ENV=$NEXT_PUBLIC_ENV
6 changes: 4 additions & 2 deletions components/Card/CardInfo/Components/Transfers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { formatNumber } from '@astraprotocol/astra-ui'
import clsx from 'clsx'
import CopyButton from 'components/Button/CopyButton'
import Typography from 'components/Typography'
import { isERC721, LinkMaker } from 'utils/helper'
import { getEnvNumber, isERC721, LinkMaker } from 'utils/helper'
import { Content } from '../'
import styles from '../style.module.scss'

Expand Down Expand Up @@ -63,7 +63,9 @@ const Transfers = ({ content }: { content: Content }) => {
</>
) : (
<>
<span className="padding-right-xs">{formatNumber(content?.transfer.value)}</span>
<span className="padding-right-xs">
{formatNumber(content?.transfer.value, getEnvNumber('NEXT_PUBLIC_MAXIMUM_FRACTION_DIGITS'))}
</span>
<Typography.LinkText href={LinkMaker.token(data.tokenAddress)}>
{data.tokenSymbol}
</Typography.LinkText>
Expand Down
6 changes: 5 additions & 1 deletion views/transactions/cosmosMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BigNumber } from 'ethers'
import { formatEther } from 'ethers/lib/utils'
import { isArray, isEmpty } from 'lodash'
import { TransactionTypeEnum } from 'utils/enum'
import { getEnvNumber } from 'utils/helper'

export const handleCosmosMsg = (messages: TransactionMessage[]) => {
const messageData: CosmosTxMessage[] = []
Expand Down Expand Up @@ -363,7 +364,10 @@ const _mapMsgCreateClawbackVestingAccount = (msg: TransactionMessage): CosmosTxM
const tokenName = getTokenName(amount)
vestingPeriodsContent.push([
formatNumber(length),
`${formatNumber(formatEther(totalAmount), 5)} ${tokenName}`
`${formatNumber(
formatEther(totalAmount),
getEnvNumber('NEXT_PUBLIC_MAXIMUM_FRACTION_DIGITS')
)} ${tokenName}`
])
}
return {
Expand Down

0 comments on commit 1a8da17

Please sign in to comment.