Remove IS_MAINNET_ENABLED config
This commit is contained in:
		@@ -97,9 +97,6 @@ export class Blockchain {
 | 
				
			|||||||
    private static _getInjectedWeb3(): any {
 | 
					    private static _getInjectedWeb3(): any {
 | 
				
			||||||
        return (window as any).web3;
 | 
					        return (window as any).web3;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    private static _getFallbackNetworkId(): number {
 | 
					 | 
				
			||||||
        return configs.IS_MAINNET_ENABLED ? constants.NETWORK_ID_MAINNET : constants.NETWORK_ID_KOVAN;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    private static async _getInjectedWeb3ProviderNetworkIdIfExistsAsync(): Promise<number> {
 | 
					    private static async _getInjectedWeb3ProviderNetworkIdIfExistsAsync(): Promise<number> {
 | 
				
			||||||
        // Hack: We need to know the networkId the injectedWeb3 is connected to (if it is defined) in
 | 
					        // Hack: We need to know the networkId the injectedWeb3 is connected to (if it is defined) in
 | 
				
			||||||
        // order to properly instantiate the web3Wrapper. Since we must use the async call, we cannot
 | 
					        // order to properly instantiate the web3Wrapper. Since we must use the async call, we cannot
 | 
				
			||||||
@@ -172,7 +169,7 @@ export class Blockchain {
 | 
				
			|||||||
            // injected into their browser.
 | 
					            // injected into their browser.
 | 
				
			||||||
            const provider = new ProviderEngine();
 | 
					            const provider = new ProviderEngine();
 | 
				
			||||||
            provider.addProvider(new FilterSubprovider());
 | 
					            provider.addProvider(new FilterSubprovider());
 | 
				
			||||||
            const networkId = Blockchain._getFallbackNetworkId();
 | 
					            const networkId = constants.NETWORK_ID_MAINNET;
 | 
				
			||||||
            const rpcSubproviders = _.map(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId], publicNodeUrl => {
 | 
					            const rpcSubproviders = _.map(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId], publicNodeUrl => {
 | 
				
			||||||
                return new RpcSubprovider({
 | 
					                return new RpcSubprovider({
 | 
				
			||||||
                    rpcUrl: publicNodeUrl,
 | 
					                    rpcUrl: publicNodeUrl,
 | 
				
			||||||
@@ -774,7 +771,7 @@ export class Blockchain {
 | 
				
			|||||||
    private async _onPageLoadInitFireAndForgetAsync(): Promise<void> {
 | 
					    private async _onPageLoadInitFireAndForgetAsync(): Promise<void> {
 | 
				
			||||||
        await utils.onPageLoadAsync(); // wait for page to load
 | 
					        await utils.onPageLoadAsync(); // wait for page to load
 | 
				
			||||||
        const networkIdIfExists = await Blockchain._getInjectedWeb3ProviderNetworkIdIfExistsAsync();
 | 
					        const networkIdIfExists = await Blockchain._getInjectedWeb3ProviderNetworkIdIfExistsAsync();
 | 
				
			||||||
        this.networkId = !_.isUndefined(networkIdIfExists) ? networkIdIfExists : Blockchain._getFallbackNetworkId();
 | 
					        this.networkId = !_.isUndefined(networkIdIfExists) ? networkIdIfExists : constants.NETWORK_ID_MAINNET;
 | 
				
			||||||
        const injectedWeb3 = Blockchain._getInjectedWeb3();
 | 
					        const injectedWeb3 = Blockchain._getInjectedWeb3();
 | 
				
			||||||
        if (injectedWeb3) {
 | 
					        if (injectedWeb3) {
 | 
				
			||||||
            const injectedProviderObservable = injectedWeb3.currentProvider.publicConfigStore;
 | 
					            const injectedProviderObservable = injectedWeb3.currentProvider.publicConfigStore;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -125,8 +125,7 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
 | 
				
			|||||||
                        Parity Signer Chrome extension
 | 
					                        Parity Signer Chrome extension
 | 
				
			||||||
                    </a>{' '}
 | 
					                    </a>{' '}
 | 
				
			||||||
                    lets you connect to a locally running Parity node. Make sure you have started your local Parity node
 | 
					                    lets you connect to a locally running Parity node. Make sure you have started your local Parity node
 | 
				
			||||||
                    with {configs.IS_MAINNET_ENABLED && '`parity ui` or'} `parity --chain kovan ui` in order to connect
 | 
					                    with `parity ui` or `parity --chain kovan ui` in order to connect to mainnet or Kovan respectively.
 | 
				
			||||||
                    to {configs.IS_MAINNET_ENABLED ? 'mainnet or Kovan respectively.' : 'Kovan.'}
 | 
					 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <div className="pt2">
 | 
					                <div className="pt2">
 | 
				
			||||||
                    <span className="bold">Note:</span> If you have done one of the above steps and are still seeing
 | 
					                    <span className="bold">Note:</span> If you have done one of the above steps and are still seeing
 | 
				
			||||||
@@ -142,10 +141,8 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
 | 
				
			|||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
                    The 0x smart contracts are not deployed on the Ethereum network you are currently connected to
 | 
					                    The 0x smart contracts are not deployed on the Ethereum network you are currently connected to
 | 
				
			||||||
                    (network Id: {this.props.networkId}). In order to use the 0x portal dApp, please connect to the{' '}
 | 
					                    (network Id: {this.props.networkId}). In order to use the 0x portal dApp, please connect to the{' '}
 | 
				
			||||||
                    {Networks.Kovan} testnet (network Id: {constants.NETWORK_ID_KOVAN})
 | 
					                    {Networks.Kovan} testnet (network Id: {constants.NETWORK_ID_KOVAN}) or ${constants.MAINNET_NAME}{' '}
 | 
				
			||||||
                    {configs.IS_MAINNET_ENABLED
 | 
					                    (network Id: ${constants.NETWORK_ID_MAINNET}).
 | 
				
			||||||
                        ? ` or ${constants.MAINNET_NAME} (network Id: ${constants.NETWORK_ID_MAINNET}).`
 | 
					 | 
				
			||||||
                        : `.`}
 | 
					 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
                <h4>Metamask</h4>
 | 
					                <h4>Metamask</h4>
 | 
				
			||||||
                <div>
 | 
					                <div>
 | 
				
			||||||
@@ -159,11 +156,8 @@ export class BlockchainErrDialog extends React.Component<BlockchainErrDialogProp
 | 
				
			|||||||
                    If using the{' '}
 | 
					                    If using the{' '}
 | 
				
			||||||
                    <a href={constants.URL_PARITY_CHROME_STORE} target="_blank">
 | 
					                    <a href={constants.URL_PARITY_CHROME_STORE} target="_blank">
 | 
				
			||||||
                        Parity Signer Chrome extension
 | 
					                        Parity Signer Chrome extension
 | 
				
			||||||
                    </a>, make sure to start your local Parity node with{' '}
 | 
					                    </a>, make sure to start your local Parity node with `parity ui` or `parity --chain Kovan ui` in
 | 
				
			||||||
                    {configs.IS_MAINNET_ENABLED
 | 
					                    order to connect to mainnet \ or Kovan respectively.
 | 
				
			||||||
                        ? '`parity ui` or `parity --chain Kovan ui` in order to connect to mainnet \
 | 
					 | 
				
			||||||
                         or Kovan respectively.'
 | 
					 | 
				
			||||||
                        : '`parity --chain kovan ui` in order to connect to Kovan.'}
 | 
					 | 
				
			||||||
                </div>
 | 
					                </div>
 | 
				
			||||||
            </div>
 | 
					            </div>
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,7 +23,6 @@ import { GenerateOrderForm } from 'ts/containers/generate_order_form';
 | 
				
			|||||||
import { localStorage } from 'ts/local_storage/local_storage';
 | 
					import { localStorage } from 'ts/local_storage/local_storage';
 | 
				
			||||||
import { Dispatcher } from 'ts/redux/dispatcher';
 | 
					import { Dispatcher } from 'ts/redux/dispatcher';
 | 
				
			||||||
import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, TokenByAddress, WebsitePaths } from 'ts/types';
 | 
					import { BlockchainErrs, HashData, Order, ProviderType, ScreenWidths, TokenByAddress, WebsitePaths } from 'ts/types';
 | 
				
			||||||
import { configs } from 'ts/utils/configs';
 | 
					 | 
				
			||||||
import { constants } from 'ts/utils/constants';
 | 
					import { constants } from 'ts/utils/constants';
 | 
				
			||||||
import { orderParser } from 'ts/utils/order_parser';
 | 
					import { orderParser } from 'ts/utils/order_parser';
 | 
				
			||||||
import { Translate } from 'ts/utils/translate';
 | 
					import { Translate } from 'ts/utils/translate';
 | 
				
			||||||
@@ -170,67 +169,53 @@ export class LegacyPortal extends React.Component<LegacyPortalProps, LegacyPorta
 | 
				
			|||||||
                />
 | 
					                />
 | 
				
			||||||
                <div id="portal" className="mx-auto max-width-4" style={{ width: '100%' }}>
 | 
					                <div id="portal" className="mx-auto max-width-4" style={{ width: '100%' }}>
 | 
				
			||||||
                    <Paper className="mb3 mt2">
 | 
					                    <Paper className="mb3 mt2">
 | 
				
			||||||
                        {!configs.IS_MAINNET_ENABLED && this.props.networkId === constants.NETWORK_ID_MAINNET ? (
 | 
					                        <div className="mx-auto flex">
 | 
				
			||||||
                            <div className="p3 center">
 | 
					                            <div className="col col-2 pr2 pt1 sm-hide xs-hide" style={portalMenuContainerStyle}>
 | 
				
			||||||
                                <div className="h2 py2">Mainnet unavailable</div>
 | 
					                                <LegacyPortalMenu menuItemStyle={{ color: colors.white }} />
 | 
				
			||||||
                                <div className="mx-auto pb2 pt2">
 | 
					 | 
				
			||||||
                                    <img src="/images/zrx_token.png" style={{ width: 150 }} />
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                                <div>
 | 
					 | 
				
			||||||
                                    0x portal is currently unavailable on the Ethereum mainnet.
 | 
					 | 
				
			||||||
                                    <div>To try it out, switch to the Kovan test network (networkId: 42).</div>
 | 
					 | 
				
			||||||
                                    <div className="py2">Check back soon!</div>
 | 
					 | 
				
			||||||
                                </div>
 | 
					 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        ) : (
 | 
					                            <div className="col col-12 lg-col-10 md-col-10 sm-col sm-col-12">
 | 
				
			||||||
                            <div className="mx-auto flex">
 | 
					                                <div className="py2" style={{ backgroundColor: colors.grey50 }}>
 | 
				
			||||||
                                <div className="col col-2 pr2 pt1 sm-hide xs-hide" style={portalMenuContainerStyle}>
 | 
					                                    {this.props.blockchainIsLoaded ? (
 | 
				
			||||||
                                    <LegacyPortalMenu menuItemStyle={{ color: colors.white }} />
 | 
					                                        <Switch>
 | 
				
			||||||
                                </div>
 | 
					                                            <Route
 | 
				
			||||||
                                <div className="col col-12 lg-col-10 md-col-10 sm-col sm-col-12">
 | 
					                                                path={`${WebsitePaths.Portal}/weth`}
 | 
				
			||||||
                                    <div className="py2" style={{ backgroundColor: colors.grey50 }}>
 | 
					                                                render={this._renderEthWrapper.bind(this)}
 | 
				
			||||||
                                        {this.props.blockchainIsLoaded ? (
 | 
					                                            />
 | 
				
			||||||
                                            <Switch>
 | 
					                                            <Route
 | 
				
			||||||
                                                <Route
 | 
					                                                path={`${WebsitePaths.Portal}/fill`}
 | 
				
			||||||
                                                    path={`${WebsitePaths.Portal}/weth`}
 | 
					                                                render={this._renderFillOrder.bind(this)}
 | 
				
			||||||
                                                    render={this._renderEthWrapper.bind(this)}
 | 
					                                            />
 | 
				
			||||||
                                                />
 | 
					                                            <Route
 | 
				
			||||||
                                                <Route
 | 
					                                                path={`${WebsitePaths.Portal}/balances`}
 | 
				
			||||||
                                                    path={`${WebsitePaths.Portal}/fill`}
 | 
					                                                render={this._renderTokenBalances.bind(this)}
 | 
				
			||||||
                                                    render={this._renderFillOrder.bind(this)}
 | 
					                                            />
 | 
				
			||||||
                                                />
 | 
					                                            <Route
 | 
				
			||||||
                                                <Route
 | 
					                                                path={`${WebsitePaths.Portal}/trades`}
 | 
				
			||||||
                                                    path={`${WebsitePaths.Portal}/balances`}
 | 
					                                                render={this._renderTradeHistory.bind(this)}
 | 
				
			||||||
                                                    render={this._renderTokenBalances.bind(this)}
 | 
					                                            />
 | 
				
			||||||
                                                />
 | 
					                                            <Route
 | 
				
			||||||
                                                <Route
 | 
					                                                path={`${WebsitePaths.Home}`}
 | 
				
			||||||
                                                    path={`${WebsitePaths.Portal}/trades`}
 | 
					                                                render={this._renderGenerateOrderForm.bind(this)}
 | 
				
			||||||
                                                    render={this._renderTradeHistory.bind(this)}
 | 
					                                            />
 | 
				
			||||||
                                                />
 | 
					                                        </Switch>
 | 
				
			||||||
                                                <Route
 | 
					                                    ) : (
 | 
				
			||||||
                                                    path={`${WebsitePaths.Home}`}
 | 
					                                        <div className="pt4 sm-px2 sm-pt2 sm-m1" style={{ height: 500 }}>
 | 
				
			||||||
                                                    render={this._renderGenerateOrderForm.bind(this)}
 | 
					                                            <div
 | 
				
			||||||
                                                />
 | 
					                                                className="relative sm-px2 sm-pt2 sm-m1"
 | 
				
			||||||
                                            </Switch>
 | 
					                                                style={{ height: 122, top: '50%', transform: 'translateY(-50%)' }}
 | 
				
			||||||
                                        ) : (
 | 
					                                            >
 | 
				
			||||||
                                            <div className="pt4 sm-px2 sm-pt2 sm-m1" style={{ height: 500 }}>
 | 
					                                                <div className="center pb2">
 | 
				
			||||||
                                                <div
 | 
					                                                    <CircularProgress size={40} thickness={5} />
 | 
				
			||||||
                                                    className="relative sm-px2 sm-pt2 sm-m1"
 | 
					                                                </div>
 | 
				
			||||||
                                                    style={{ height: 122, top: '50%', transform: 'translateY(-50%)' }}
 | 
					                                                <div className="center pt2" style={{ paddingBottom: 11 }}>
 | 
				
			||||||
                                                >
 | 
					                                                    Loading Portal...
 | 
				
			||||||
                                                    <div className="center pb2">
 | 
					 | 
				
			||||||
                                                        <CircularProgress size={40} thickness={5} />
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                    <div className="center pt2" style={{ paddingBottom: 11 }}>
 | 
					 | 
				
			||||||
                                                        Loading Portal...
 | 
					 | 
				
			||||||
                                                    </div>
 | 
					 | 
				
			||||||
                                                </div>
 | 
					                                                </div>
 | 
				
			||||||
                                            </div>
 | 
					                                            </div>
 | 
				
			||||||
                                        )}
 | 
					                                        </div>
 | 
				
			||||||
                                    </div>
 | 
					                                    )}
 | 
				
			||||||
                                </div>
 | 
					                                </div>
 | 
				
			||||||
                            </div>
 | 
					                            </div>
 | 
				
			||||||
                        )}
 | 
					                        </div>
 | 
				
			||||||
                    </Paper>
 | 
					                    </Paper>
 | 
				
			||||||
                    <BlockchainErrDialog
 | 
					                    <BlockchainErrDialog
 | 
				
			||||||
                        blockchain={this._blockchain}
 | 
					                        blockchain={this._blockchain}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,6 @@ export const configs = {
 | 
				
			|||||||
        TKN: '/images/token_icons/tokencard.png',
 | 
					        TKN: '/images/token_icons/tokencard.png',
 | 
				
			||||||
        TRST: '/images/token_icons/trust.png',
 | 
					        TRST: '/images/token_icons/trust.png',
 | 
				
			||||||
    } as { [symbol: string]: string },
 | 
					    } as { [symbol: string]: string },
 | 
				
			||||||
    IS_MAINNET_ENABLED: true,
 | 
					 | 
				
			||||||
    GOOGLE_ANALYTICS_ID: 'UA-98720122-1',
 | 
					    GOOGLE_ANALYTICS_ID: 'UA-98720122-1',
 | 
				
			||||||
    LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE: '2017-11-22',
 | 
					    LAST_LOCAL_STORAGE_FILL_CLEARANCE_DATE: '2017-11-22',
 | 
				
			||||||
    LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2017-12-19',
 | 
					    LAST_LOCAL_STORAGE_TRACKED_TOKEN_CLEARANCE_DATE: '2017-12-19',
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user