import { WalletCheckModal , StateAndHelpers , WalletCheckCustomOptions } from '../../interfaces' ; import { balanceIcon } from './icons' ; function balance ( options = { minimumBalance : '0' } ) { const { minimumBalance , heading , description , icon , html , button } = options ; return async ( StateAndHelpers ) => { const { balance , BigNumber , stateSyncStatus , stateStore } = StateAndHelpers ; if ( balance === null ) { if ( stateSyncStatus . balance ) { try { await stateSyncStatus . balance ; } catch ( error ) { } } } if ( BigNumber ( stateStore . balance . get ( ) ) . lt ( BigNumber ( minimumBalance ) ) ) { return { heading : heading || 'Get Some ETH' , description : description || `Your current account has less than the necessary minimum balance of ${ BigNumber ( minimumBalance ) . div ( BigNumber ( '1000000000000000000' ) ) . toString ( 10 ) } ETH.` , eventCode : 'nsfFail' , icon : icon || balanceIcon , html , button } ; } } ; } export default balance ;