aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/website/ts')
-rw-r--r--packages/website/ts/blockchain.ts8
-rw-r--r--packages/website/ts/blockchain_watcher.ts4
-rw-r--r--packages/website/ts/components/dialogs/ledger_config_dialog.tsx6
-rw-r--r--packages/website/ts/components/eth_weth_conversion_button.tsx6
-rw-r--r--packages/website/ts/components/fill_order.tsx10
-rw-r--r--packages/website/ts/components/generate_order/generate_order_form.tsx8
-rw-r--r--packages/website/ts/components/inputs/allowance_toggle.tsx6
-rw-r--r--packages/website/ts/components/order_json.tsx4
-rw-r--r--packages/website/ts/components/portal.tsx4
-rw-r--r--packages/website/ts/components/send_button.tsx6
-rw-r--r--packages/website/ts/components/token_balances.tsx8
-rw-r--r--packages/website/ts/pages/wiki/wiki.tsx3
-rw-r--r--packages/website/ts/utils/doc_utils.ts5
-rw-r--r--packages/website/ts/utils/error_reporter.ts3
-rw-r--r--packages/website/ts/utils/utils.ts5
15 files changed, 42 insertions, 44 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index c92023541..a3427baee 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -23,7 +23,7 @@ import {
LedgerWalletSubprovider,
RedundantRPCSubprovider,
} from '@0xproject/subproviders';
-import { BigNumber, intervalUtils, promisify } from '@0xproject/utils';
+import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import * as React from 'react';
@@ -405,7 +405,7 @@ export class Blockchain {
},
5000,
(err: Error) => {
- utils.consoleLog(`Polling tokenBalance failed: ${err}`);
+ logUtils.log(`Polling tokenBalance failed: ${err}`);
intervalUtils.clearAsyncExcludingInterval(tokenPollInterval);
reject(err);
},
@@ -822,7 +822,7 @@ export class Blockchain {
if (!_.isUndefined(contractAddress)) {
const doesContractExist = await this.doesContractExistAtAddressAsync(contractAddress);
if (!doesContractExist) {
- utils.consoleLog(`Contract does not exist: ${artifact.contract_name} at ${contractAddress}`);
+ logUtils.log(`Contract does not exist: ${artifact.contract_name} at ${contractAddress}`);
throw new Error(BlockchainCallErrs.ContractDoesNotExist);
}
}
@@ -832,7 +832,7 @@ export class Blockchain {
return contractInstance;
} catch (err) {
const errMsg = `${err}`;
- utils.consoleLog(`Notice: Error encountered: ${err} ${err.stack}`);
+ logUtils.log(`Notice: Error encountered: ${err} ${err.stack}`);
if (_.includes(errMsg, 'not been deployed to detected network')) {
throw new Error(BlockchainCallErrs.ContractDoesNotExist);
} else {
diff --git a/packages/website/ts/blockchain_watcher.ts b/packages/website/ts/blockchain_watcher.ts
index d3801cef4..2712b2c04 100644
--- a/packages/website/ts/blockchain_watcher.ts
+++ b/packages/website/ts/blockchain_watcher.ts
@@ -1,4 +1,4 @@
-import { BigNumber, intervalUtils, promisify } from '@0xproject/utils';
+import { BigNumber, intervalUtils, logUtils, promisify } from '@0xproject/utils';
import { Web3Wrapper } from '@0xproject/web3-wrapper';
import * as _ from 'lodash';
import { Dispatcher } from 'ts/redux/dispatcher';
@@ -87,7 +87,7 @@ export class BlockchainWatcher {
},
5000,
(err: Error) => {
- utils.consoleLog(`Watching network and balances failed: ${err.stack}`);
+ logUtils.log(`Watching network and balances failed: ${err.stack}`);
this._stopEmittingNetworkConnectionAndUserBalanceStateAsync();
},
);
diff --git a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
index 87b75ed95..d7190c0bb 100644
--- a/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
+++ b/packages/website/ts/components/dialogs/ledger_config_dialog.tsx
@@ -1,6 +1,6 @@
import { ZeroEx } from '0x.js';
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
import FlatButton from 'material-ui/FlatButton';
@@ -239,7 +239,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
addressBalances.push(balanceInWei);
}
} catch (err) {
- utils.consoleLog(`Ledger error: ${JSON.stringify(err)}`);
+ logUtils.log(`Ledger error: ${JSON.stringify(err)}`);
this.setState({
connectionErrMsg: 'Failed to connect. Follow the instructions and try again.',
});
@@ -265,7 +265,7 @@ export class LedgerConfigDialog extends React.Component<LedgerConfigDialogProps,
private async _onConnectLedgerClickAsync() {
const isU2FSupported = await utils.isU2FSupportedAsync();
if (!isU2FSupported) {
- utils.consoleLog(`U2F not supported in this browser`);
+ logUtils.log(`U2F not supported in this browser`);
this.setState({
connectionErrMsg: 'U2F not supported by this browser. Try using Chrome.',
});
diff --git a/packages/website/ts/components/eth_weth_conversion_button.tsx b/packages/website/ts/components/eth_weth_conversion_button.tsx
index 8e13d0aae..586d260fb 100644
--- a/packages/website/ts/components/eth_weth_conversion_button.tsx
+++ b/packages/website/ts/components/eth_weth_conversion_button.tsx
@@ -1,5 +1,5 @@
import { ZeroEx } from '0x.js';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import RaisedButton from 'material-ui/RaisedButton';
import * as React from 'react';
@@ -111,8 +111,8 @@ export class EthWethConversionButton extends React.Component<
if (_.includes(errMsg, BlockchainCallErrs.UserHasNoAssociatedAddresses)) {
this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true);
} else if (!utils.didUserDenyWeb3Request(errMsg)) {
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
const errorMsg =
direction === Side.Deposit
? 'Failed to wrap your ETH. Please try again.'
diff --git a/packages/website/ts/components/fill_order.tsx b/packages/website/ts/components/fill_order.tsx
index f1eee3e89..a6144bd6b 100644
--- a/packages/website/ts/components/fill_order.tsx
+++ b/packages/website/ts/components/fill_order.tsx
@@ -1,6 +1,6 @@
import { Order as ZeroExOrder, ZeroEx } from '0x.js';
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as accounting from 'accounting';
import * as _ from 'lodash';
import { Card, CardHeader, CardText } from 'material-ui/Card';
@@ -403,7 +403,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
const validationResult = validator.validate(order, portalOrderSchema);
if (validationResult.errors.length > 0) {
orderJSONErrMsg = 'Submitted order JSON is not a valid order';
- utils.consoleLog(`Unexpected order JSON validation error: ${validationResult.errors.join(', ')}`);
+ logUtils.log(`Unexpected order JSON validation error: ${validationResult.errors.join(', ')}`);
return;
}
parsedOrder = order;
@@ -448,7 +448,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
this.props.dispatcher.updateUserSuppliedOrderCache(parsedOrder);
}
} catch (err) {
- utils.consoleLog(`Validate order err: ${err}`);
+ logUtils.log(`Validate order err: ${err}`);
if (!_.isEmpty(orderJSON)) {
orderJSONErrMsg = 'Submitted order JSON is not valid JSON';
}
@@ -564,7 +564,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
return;
}
globalErrMsg = 'Failed to fill order, please refresh and try again';
- utils.consoleLog(`${err}`);
+ logUtils.log(`${err}`);
this.setState({
globalErrMsg,
});
@@ -635,7 +635,7 @@ export class FillOrder extends React.Component<FillOrderProps, FillOrderState> {
}
analytics.logEvent('Portal', 'Cancel Order Failure', eventLabel, parsedOrder.signedOrder.makerTokenAmount);
globalErrMsg = 'Failed to cancel order, please refresh and try again';
- utils.consoleLog(`${err}`);
+ logUtils.log(`${err}`);
this.setState({
globalErrMsg,
});
diff --git a/packages/website/ts/components/generate_order/generate_order_form.tsx b/packages/website/ts/components/generate_order/generate_order_form.tsx
index 559acd1d6..eb76cb529 100644
--- a/packages/website/ts/components/generate_order/generate_order_form.tsx
+++ b/packages/website/ts/components/generate_order/generate_order_form.tsx
@@ -1,6 +1,6 @@
import { ECSignature, Order, ZeroEx } from '0x.js';
import { colors, constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
import Divider from 'material-ui/Divider';
@@ -326,7 +326,7 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
const validationResult = validator.validate(order, portalOrderSchema);
if (validationResult.errors.length > 0) {
globalErrMsg = 'Order signing failed. Please refresh and try again';
- utils.consoleLog(`Unexpected error occured: Order validation failed:
+ logUtils.log(`Unexpected error occured: Order validation failed:
${validationResult.errors}`);
}
} catch (err) {
@@ -335,8 +335,8 @@ export class GenerateOrderForm extends React.Component<GenerateOrderFormProps, G
globalErrMsg = 'User denied sign request';
} else {
globalErrMsg = 'An unexpected error occured. Please try refreshing the page';
- utils.consoleLog(`Unexpected error occured: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error occured: ${err}`);
+ logUtils.log(err.stack);
await errorReporter.reportAsync(err);
}
}
diff --git a/packages/website/ts/components/inputs/allowance_toggle.tsx b/packages/website/ts/components/inputs/allowance_toggle.tsx
index e548bfc82..da6f900e6 100644
--- a/packages/website/ts/components/inputs/allowance_toggle.tsx
+++ b/packages/website/ts/components/inputs/allowance_toggle.tsx
@@ -1,5 +1,5 @@
import { constants as sharedConstants } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Toggle from 'material-ui/Toggle';
import * as React from 'react';
@@ -93,8 +93,8 @@ export class AllowanceToggle extends React.Component<AllowanceToggleProps, Allow
if (utils.didUserDenyWeb3Request(errMsg)) {
return;
}
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
this.props.onErrorOccurred(BalanceErrs.allowanceSettingFailed);
await errorReporter.reportAsync(err);
}
diff --git a/packages/website/ts/components/order_json.tsx b/packages/website/ts/components/order_json.tsx
index a5dd9ebc1..02b88b888 100644
--- a/packages/website/ts/components/order_json.tsx
+++ b/packages/website/ts/components/order_json.tsx
@@ -1,5 +1,5 @@
import { ECSignature } from '0x.js';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import Paper from 'material-ui/Paper';
import TextField from 'material-ui/TextField';
@@ -153,7 +153,7 @@ You can see and fill it here: ${this.state.shareLink}`);
const bodyObj = JSON.parse(responseBody);
if (response.status !== 200 || bodyObj.status_code !== 200) {
// TODO: Show error message in UI
- utils.consoleLog(`Unexpected status code: ${response.status} -> ${responseBody}`);
+ logUtils.log(`Unexpected status code: ${response.status} -> ${responseBody}`);
await errorReporter.reportAsync(new Error(`Bitly returned non-200: ${JSON.stringify(response)}`));
return '';
}
diff --git a/packages/website/ts/components/portal.tsx b/packages/website/ts/components/portal.tsx
index 7df340f45..5bdb5bde9 100644
--- a/packages/website/ts/components/portal.tsx
+++ b/packages/website/ts/components/portal.tsx
@@ -1,5 +1,5 @@
import { colors } from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import Paper from 'material-ui/Paper';
@@ -374,7 +374,7 @@ export class Portal extends React.Component<PortalAllProps, PortalAllState> {
const order = JSON.parse(decodeURIComponent(orderPair[1]));
const validationResult = validator.validate(order, portalOrderSchema);
if (validationResult.errors.length > 0) {
- utils.consoleLog(`Invalid shared order: ${validationResult.errors}`);
+ logUtils.log(`Invalid shared order: ${validationResult.errors}`);
return undefined;
}
return order;
diff --git a/packages/website/ts/components/send_button.tsx b/packages/website/ts/components/send_button.tsx
index ffa165f60..79c103e05 100644
--- a/packages/website/ts/components/send_button.tsx
+++ b/packages/website/ts/components/send_button.tsx
@@ -1,4 +1,4 @@
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import RaisedButton from 'material-ui/RaisedButton';
import * as React from 'react';
@@ -77,8 +77,8 @@ export class SendButton extends React.Component<SendButtonProps, SendButtonState
this.props.dispatcher.updateShouldBlockchainErrDialogBeOpen(true);
return;
} else if (!utils.didUserDenyWeb3Request(errMsg)) {
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
this.props.onError();
await errorReporter.reportAsync(err);
}
diff --git a/packages/website/ts/components/token_balances.tsx b/packages/website/ts/components/token_balances.tsx
index 894e0721f..186393c4f 100644
--- a/packages/website/ts/components/token_balances.tsx
+++ b/packages/website/ts/components/token_balances.tsx
@@ -7,7 +7,7 @@ import {
Styles,
utils as sharedUtils,
} from '@0xproject/react-shared';
-import { BigNumber } from '@0xproject/utils';
+import { BigNumber, logUtils } from '@0xproject/utils';
import DharmaLoanFrame from 'dharma-loan-frame';
import * as _ from 'lodash';
import Dialog from 'material-ui/Dialog';
@@ -591,8 +591,8 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
if (utils.didUserDenyWeb3Request(errMsg)) {
return false;
}
- utils.consoleLog(`Unexpected error encountered: ${err}`);
- utils.consoleLog(err.stack);
+ logUtils.log(`Unexpected error encountered: ${err}`);
+ logUtils.log(err.stack);
this.setState({
errorType: BalanceErrs.mintingFailed,
});
@@ -623,7 +623,7 @@ export class TokenBalances extends React.Component<TokenBalancesProps, TokenBala
);
const responseBody = await response.text();
if (response.status !== constants.SUCCESS_STATUS) {
- utils.consoleLog(`Unexpected status code: ${response.status} -> ${responseBody}`);
+ logUtils.log(`Unexpected status code: ${response.status} -> ${responseBody}`);
const errorType =
response.status === constants.UNAVAILABLE_STATUS
? BalanceErrs.faucetQueueIsFull
diff --git a/packages/website/ts/pages/wiki/wiki.tsx b/packages/website/ts/pages/wiki/wiki.tsx
index f6cff51e4..e2dd3a68e 100644
--- a/packages/website/ts/pages/wiki/wiki.tsx
+++ b/packages/website/ts/pages/wiki/wiki.tsx
@@ -8,6 +8,7 @@ import {
Styles,
utils as sharedUtils,
} from '@0xproject/react-shared';
+import { logUtils } from '@0xproject/utils';
import * as _ from 'lodash';
import CircularProgress from 'material-ui/CircularProgress';
import RaisedButton from 'material-ui/RaisedButton';
@@ -213,7 +214,7 @@ export class Wiki extends React.Component<WikiProps, WikiState> {
if (response.status !== 200) {
// TODO: Show the user an error message when the wiki fail to load
const errMsg = await response.text();
- utils.consoleLog(`Failed to load wiki: ${response.status} ${errMsg}`);
+ logUtils.log(`Failed to load wiki: ${response.status} ${errMsg}`);
return;
}
const articlesBySection = await response.json();
diff --git a/packages/website/ts/utils/doc_utils.ts b/packages/website/ts/utils/doc_utils.ts
index 0686e3e7f..6b3f5f378 100644
--- a/packages/website/ts/utils/doc_utils.ts
+++ b/packages/website/ts/utils/doc_utils.ts
@@ -1,4 +1,5 @@
import { DoxityDocObj, TypeDocNode } from '@0xproject/react-docs';
+import { logUtils } from '@0xproject/utils';
import findVersions = require('find-versions');
import * as _ from 'lodash';
import { S3FileObject, VersionToFileName } from 'ts/types';
@@ -20,7 +21,7 @@ export const docUtils = {
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
const errMsg = await response.text();
- utils.consoleLog(`Failed to load JSON file list: ${response.status} ${errMsg}`);
+ logUtils.log(`Failed to load JSON file list: ${response.status} ${errMsg}`);
throw new Error(errMsg);
}
const responseXML = await response.text();
@@ -43,7 +44,7 @@ export const docUtils = {
if (response.status !== 200) {
// TODO: Show the user an error message when the docs fail to load
const errMsg = await response.text();
- utils.consoleLog(`Failed to load Doc JSON: ${response.status} ${errMsg}`);
+ logUtils.log(`Failed to load Doc JSON: ${response.status} ${errMsg}`);
throw new Error(errMsg);
}
const jsonDocObj = await response.json();
diff --git a/packages/website/ts/utils/error_reporter.ts b/packages/website/ts/utils/error_reporter.ts
index 0bd247c5b..19f563880 100644
--- a/packages/website/ts/utils/error_reporter.ts
+++ b/packages/website/ts/utils/error_reporter.ts
@@ -1,3 +1,4 @@
+import { logUtils } from '@0xproject/utils';
import { Environments } from 'ts/types';
import { configs } from 'ts/utils/configs';
import { constants } from 'ts/utils/constants';
@@ -40,7 +41,7 @@ export const errorReporter = {
return new Promise((resolve, reject) => {
rollbar.error(err, (rollbarErr: Error) => {
if (rollbarErr) {
- utils.consoleLog(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
+ logUtils.log(`Error reporting to rollbar, ignoring: ${rollbarErr}`);
// We never want to reject and cause the app to throw because of rollbar
resolve();
} else {
diff --git a/packages/website/ts/utils/utils.ts b/packages/website/ts/utils/utils.ts
index abb2598c3..25d7e449b 100644
--- a/packages/website/ts/utils/utils.ts
+++ b/packages/website/ts/utils/utils.ts
@@ -95,11 +95,6 @@ export const utils = {
};
return order;
},
- consoleLog(message: string) {
- /* tslint:disable */
- console.log(message);
- /* tslint:enable */
- },
async sleepAsync(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms));
},