blob: 24b7b99c303e260dd97c6096b5d19d67b0826bbf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { BuyQuote } from '@0x/asset-buyer';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
export const balanceUtil = {
hasSufficientFunds: async (takerAddress: string | undefined, buyQuote: BuyQuote, web3Wrapper: Web3Wrapper) => {
if (_.isUndefined(takerAddress)) {
return false;
}
const balanceWei = await web3Wrapper.getBalanceInWeiAsync(takerAddress);
return balanceWei >= buyQuote.worstCaseQuoteInfo.totalEthAmount;
},
};
|