import * as BigNumber from 'bignumber.js' ; import WorkerProxy from '../WorkerProxy' ; export default async function entireBalance ( workerProxy , walletBalance ) { const gasPrice = await getGasPrice ( workerProxy ) ; const gasCost = gasPrice . times ( 300000 ) ; return walletBalance . minus ( gasCost ) ; } function getGasPrice ( workerProxy ) { return new Promise ( ( resolve , reject ) => workerProxy . web3 . eth . getGasPrice ( ( err , data ) => { return err ? reject ( err ) : resolve ( data ) ; } ) ) ; }