Skip to content

Commit

Permalink
Remove needless toString calls
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaw3d committed Aug 5, 2022
1 parent 2ee27cc commit bba6c16
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/popup/pages/NodeDetail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class StakeNodeDetail extends React.Component {
let entityId = addressSlice(this.state.entityId)
let validatorName = nodeDetail.validatorName || nodeDetail.name || addressSlice(address, 6)
let statusText = nodeDetail.commission || this.state.commission || 0
statusText = new BigNumber(statusText).multipliedBy(100).toFixed(1, 1).toString() + "%"
statusText = new BigNumber(statusText).multipliedBy(100).toFixed(1, 1) + "%"
let icon = nodeDetail.icon || DEFAULT_VALIDATOR_ICON
return (
<div className={"node-detail-top-detail"}>
Expand Down
3 changes: 1 addition & 2 deletions src/popup/pages/Send/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,8 +696,7 @@ class SendPage extends React.Component {
let accountInfo = this.props.accountInfo

let shares = this.state.reclaimShare
let amount = new BigNumber(this.state.amount).toString()
amount = toNonExponential(amount)
let amount = new BigNumber(this.state.amount).toFixed()
let toAddress = this.getToAddress()

let nonce = trimSpace(this.state.nonce) || accountInfo.nonce
Expand Down
2 changes: 1 addition & 1 deletion src/popup/pages/Staking/MyStaking.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class MyStaking extends React.Component {
getStakePercent = (total_balance, delegations_balance) => {
let percent = "0"
if (new BigNumber(total_balance).gt(0)) {
percent = new BigNumber(delegations_balance).dividedBy(total_balance).multipliedBy(100).toFixed(4, 1).toString()
percent = new BigNumber(delegations_balance).dividedBy(total_balance).multipliedBy(100).toFixed(4, 1)
}
percent = percent + "%"
return percent
Expand Down
2 changes: 1 addition & 1 deletion src/popup/pages/Staking/StakeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class StakeNode extends React.Component {
renderNodeItem = (item, index) => {
let showAddress = addressSlice(item.entityAddress, 8)
let statusText = item.commission || 0
statusText = new BigNumber(statusText).multipliedBy(100).toFixed(1, 1).toString() + "%"
statusText = new BigNumber(statusText).multipliedBy(100).toFixed(1, 1) + "%"
let validatorName = item.name || showAddress
let icon = item.icon || DEFAULT_VALIDATOR_ICON
let delegators = item.delegators
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function getDisplayAmount(number, fixed = 4) {
if (isNaN(parseFloat(number)) || number === 0) {
return '0.00';
}
let showAmount = new BigNumber(number).toFixed(fixed, 1).toString()
let showAmount = new BigNumber(number).toFixed(fixed, 1)
return toNonExponential(showAmount)
}

Expand Down

0 comments on commit bba6c16

Please sign in to comment.