Remove wrongly introduced toNumber in fees (#599)

This commit is contained in:
Jaco Greeff 2019-01-14 13:21:34 +01:00 committed by GitHub
parent f82fbdf2e4
commit a834850280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -37,7 +37,9 @@ class Proposal extends React.PureComponent<Props, State> {
}
static getDerivedStateFromProps ({ deposit, query_democracy_minimumDeposit = new BN(0), onChange }: Props): State {
const extraAmount = new BN(deposit.toNumber());
const extraAmount = deposit instanceof Compact
? deposit.toBn()
: deposit;
const isBelowMinimum = extraAmount.lt(query_democracy_minimumDeposit);
const update = {

View File

@ -48,7 +48,7 @@ class Transfer extends React.PureComponent<Props, State> {
extraFees = extraFees.add(fees.creationFee);
}
const extraAmount = new BN(amount.toNumber());
const extraAmount = amount instanceof Compact ? amount.toBn() : new BN(amount);
const isCreation = derive_balances_votingBalance.votingBalance.isZero() && fees.creationFee.gtn(0);
const isNoEffect = extraAmount.add(derive_balances_votingBalance.votingBalance).lte(fees.existentialDeposit);
const extraWarn = isCreation || isNoEffect;