Skip to content

Commit

Permalink
fix: not return NaN when format gas
Browse files Browse the repository at this point in the history
  • Loading branch information
vien.nguyen2-tiki committed Feb 22, 2023
1 parent 4e4cc57 commit 7cdff9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ export function formatCurrencyValue(value: number | string | undefined, symbol =
}

export function formatGasValue(value) {
if (isNaN(value) || isUndefined(value)) return 'NaN'
if (value === 0 || value === '0') return `0`
const minimumValue = 0.01
if (isNaN(value) || isUndefined(value)) return '0'
if (value === 0 || value === '0' || value <= minimumValue) return `0`
if (value <= 1000) return `${numeral(value).format('0,0')} NanoAstra`
// if (value <= 1000) return `${numeral(value).format('0,0')} MWEI`
if (value <= 1000000) return `${numeral(value / 10 ** 3).format('0,0')} MicroAstra`
Expand Down

0 comments on commit 7cdff9f

Please sign in to comment.