Merge pull request #92 from Permissionless-Software-Foundation/feature/round_tokens

feat(token-card): Round tokens to appropriate decimal
This commit is contained in:
Chris Troutner
2020-10-27 18:47:52 -07:00
committed by GitHub
@@ -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,