Has Sufficient Funds/Balance -> Has Sufficient ETH

This commit is contained in:
Steve Klebanoff
2018-10-29 09:07:40 -07:00
parent 8288e8cce9
commit 7ed44f7b2f
4 changed files with 6 additions and 6 deletions

View File

@@ -49,9 +49,9 @@ export class BuyButton extends React.Component<BuyButtonProps> {
this.props.onValidationPending(buyQuote);
const takerAddress = await getBestAddress();
const hasSufficientFunds = await balanceUtil.hasSufficientFunds(takerAddress, buyQuote, web3Wrapper);
if (!hasSufficientFunds) {
this.props.onValidationFail(buyQuote, ZeroExInstantError.InsufficientBalance);
const hasSufficentEth = await balanceUtil.hasSufficentEth(takerAddress, buyQuote, web3Wrapper);
if (!hasSufficentEth) {
this.props.onValidationFail(buyQuote, ZeroExInstantError.InsufficientETH);
return;
}

View File

@@ -72,5 +72,5 @@ export enum Network {
export enum ZeroExInstantError {
AssetMetaDataNotAvailable = 'ASSET_META_DATA_NOT_AVAILABLE',
InsufficientBalance = 'INSUFFICIENT_BALANCE',
InsufficientETH = 'INSUFFICIENT_ETH',
}

View File

@@ -3,7 +3,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
export const balanceUtil = {
hasSufficientFunds: async (takerAddress: string | undefined, buyQuote: BuyQuote, web3Wrapper: Web3Wrapper) => {
hasSufficentEth: async (takerAddress: string | undefined, buyQuote: BuyQuote, web3Wrapper: Web3Wrapper) => {
if (_.isUndefined(takerAddress)) {
return false;
}

View File

@@ -49,7 +49,7 @@ const humanReadableMessageForError = (error: Error, asset?: Asset): string | und
if (error.message === AssetBuyerError.SignatureRequestDenied) {
return 'You denied this transaction';
}
if (error.message === ZeroExInstantError.InsufficientBalance) {
if (error.message === ZeroExInstantError.InsufficientETH) {
return "You don't have enough ETH";
}