From 7ed44f7b2f0224b4169f0a8f34bae09e8c6b986f Mon Sep 17 00:00:00 2001 From: Steve Klebanoff Date: Mon, 29 Oct 2018 09:07:40 -0700 Subject: Has Sufficient Funds/Balance -> Has Sufficient ETH --- packages/instant/src/components/buy_button.tsx | 6 +++--- packages/instant/src/types.ts | 2 +- packages/instant/src/util/balance.ts | 2 +- packages/instant/src/util/error.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx index bceabbca3..bcd435250 100644 --- a/packages/instant/src/components/buy_button.tsx +++ b/packages/instant/src/components/buy_button.tsx @@ -49,9 +49,9 @@ export class BuyButton extends React.Component { 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; } diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts index 9dd5624b6..c02b66990 100644 --- a/packages/instant/src/types.ts +++ b/packages/instant/src/types.ts @@ -72,5 +72,5 @@ export enum Network { export enum ZeroExInstantError { AssetMetaDataNotAvailable = 'ASSET_META_DATA_NOT_AVAILABLE', - InsufficientBalance = 'INSUFFICIENT_BALANCE', + InsufficientETH = 'INSUFFICIENT_ETH', } diff --git a/packages/instant/src/util/balance.ts b/packages/instant/src/util/balance.ts index 24b7b99c3..533656858 100644 --- a/packages/instant/src/util/balance.ts +++ b/packages/instant/src/util/balance.ts @@ -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; } diff --git a/packages/instant/src/util/error.ts b/packages/instant/src/util/error.ts index 5db0c66d2..39c563c75 100644 --- a/packages/instant/src/util/error.ts +++ b/packages/instant/src/util/error.ts @@ -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"; } -- cgit v1.2.3