mirror of
https://github.com/fullstack-cash/fullstack-gatsby-theme-bch-wallet.git
synced 2026-09-21 16:52:06 -07:00
Merge pull request #92 from Permissionless-Software-Foundation/feature/round_tokens
feat(token-card): Round tokens to appropriate decimal
This commit is contained in:
@@ -34,7 +34,7 @@ class TokenCard extends React.Component {
|
||||
|
||||
<p className='info-content'>
|
||||
<b>Balance</b>
|
||||
<span>{token.qty}</span>
|
||||
<span>{_this.round(token.qty, token.decimals)}</span>
|
||||
</p>
|
||||
</div>
|
||||
</Col>
|
||||
@@ -68,6 +68,10 @@ class TokenCard extends React.Component {
|
||||
shouldComponentUpdate () {
|
||||
return false
|
||||
}
|
||||
|
||||
round (value, decimals) {
|
||||
return Number(Math.round(value + `e${decimals}`) + `e-${decimals}`)
|
||||
}
|
||||
}
|
||||
TokenCard.propTypes = {
|
||||
token: PropTypes.object.isRequired,
|
||||
|
||||
Reference in New Issue
Block a user