aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-26 05:44:25 +0800
committerSteve Klebanoff <steve.klebanoff@gmail.com>2018-10-26 05:44:25 +0800
commitcd06c0e913bf8f4a1d7b29eecb01c87f92a76e89 (patch)
treef3c50104629d1f57ad8430caebe6fec0db491711
parente55d8802e10afd20791aafd2b0958b674f9c0408 (diff)
downloaddexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.tar
dexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.tar.gz
dexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.tar.bz2
dexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.tar.lz
dexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.tar.xz
dexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.tar.zst
dexon-sol-tools-cd06c0e913bf8f4a1d7b29eecb01c87f92a76e89.zip
Added string to constants
-rw-r--r--packages/instant/src/components/buy_button.tsx3
-rw-r--r--packages/instant/src/constants.ts1
2 files changed, 3 insertions, 1 deletions
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 6fe333dc7..a7a22e3bc 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -2,6 +2,7 @@ import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
import * as _ from 'lodash';
import * as React from 'react';
+import { WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX } from '../constants';
import { ColorOption } from '../style/theme';
import { util } from '../util/util';
import { web3Wrapper } from '../util/web3_wrapper';
@@ -62,7 +63,7 @@ export class BuyButton extends React.Component<BuyButtonProps> {
try {
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
} catch (e) {
- if (e instanceof Error && e.message.startsWith('Transaction failed')) {
+ if (e instanceof Error && e.message.startsWith(WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX)) {
this.props.onBuyFailure(buyQuote, txHash);
return;
}
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index 31491c80a..48d0d4aa2 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -2,3 +2,4 @@ import { BigNumber } from '@0x/utils';
export const BIG_NUMBER_ZERO = new BigNumber(0);
export const ethDecimals = 18;
export const DEFAULT_ZERO_EX_CONTAINER_SELECTOR = '#zeroExInstantContainer';
+export const WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX = 'Transaction failed';