Skip to content

Commit

Permalink
πŸ› Fix invalid amount check for undelegation
Browse files Browse the repository at this point in the history
  • Loading branch information
nwingt committed Jan 16, 2020
1 parent 31a8539 commit ce3c80a
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ export class StakingUnbondingDelegationAmountInputScreen extends React.Component
*/
private createTransactionForSigning = async () => {
try {
const { address, availableBalance } = this.props.chain.wallet
const { address } = this.props.chain.wallet
await this.props.txStore.createUnbondingDelegateTx(address)
const { totalAmount } = this.props.txStore
if (totalAmount.isGreaterThan(availableBalance)) {
const { target, totalAmount } = this.props.txStore
const delegatedAmount = this.props.chain.wallet.getDelegation(target).shares
if (totalAmount.isGreaterThan(delegatedAmount)) {
throw new Error("UNSTAKE_NOT_ENOUGH_FEE")
}
return true
Expand Down

0 comments on commit ce3c80a

Please sign in to comment.