From 3d81f34ba2b959295751a8f5a412a72805f720d0 Mon Sep 17 00:00:00 2001 From: TheLeoB Date: Thu, 11 Jun 2020 18:26:38 -0400 Subject: [PATCH] feat(withdrawal): add .0005 min to withdrawal form --- .../Interest/WithdrawalForm/validation.tsx | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/blockchain-wallet-v4-frontend/src/modals/Interest/WithdrawalForm/validation.tsx b/packages/blockchain-wallet-v4-frontend/src/modals/Interest/WithdrawalForm/validation.tsx index eb23337f0aa..59b4b412d79 100644 --- a/packages/blockchain-wallet-v4-frontend/src/modals/Interest/WithdrawalForm/validation.tsx +++ b/packages/blockchain-wallet-v4-frontend/src/modals/Interest/WithdrawalForm/validation.tsx @@ -1,3 +1,4 @@ +import { Exchange } from 'blockchain-wallet-v4/src' import { FormattedMessage } from 'react-intl' import BigNumber from 'bignumber.js' import React from 'react' @@ -22,12 +23,23 @@ export const maximumWithdrawalAmount = ( ) } -export const minimumWithdrawalAmount = (value: string) => { - // someday there may be a minimum withdrawal amount - const MIN_WITHDRAWAL = 0 - return new BigNumber(Number(MIN_WITHDRAWAL)).isGreaterThanOrEqualTo( - Number(value) - ) ? ( +export const minimumWithdrawalAmount = ( + value: string, + allValues: InterestWithdrawalFormType, + props: any +) => { + // withdrawal min across all products .0005 BTC + const MIN_WITHDRAWAL = 0.0005 + const withdrawalMin = props.displayCoin + ? MIN_WITHDRAWAL + : Exchange.convertCoinToFiat( + MIN_WITHDRAWAL, + props.coin, + props.walletCurrency, + props.rates + ) + + return new BigNumber(Number(withdrawalMin)).isGreaterThan(Number(value)) ? (