Fix linter issues

This commit is contained in:
Fabio Berger 2019-02-19 23:09:26 -08:00
parent 6b775628d5
commit 26e17074c2
7 changed files with 12 additions and 10 deletions

View File

@ -9,9 +9,9 @@ import {
OrderValidator,
WETH9,
} from '@0x/contract-artifacts';
import { AbiDecoder, providerUtils } from '@0x/utils';
import { AbiDecoder } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, SupportedProvider } from 'ethereum-types';
import { SupportedProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';

View File

@ -3,7 +3,7 @@ import * as artifacts from '@0x/contract-artifacts';
import { assetDataUtils } from '@0x/order-utils';
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
import { BigNumber, providerUtils } from '@0x/utils';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { SupportedProvider } from 'ethereum-types';
import * as _ from 'lodash';

View File

@ -24,7 +24,7 @@ import { util } from './util/util';
const isInstantRendered = (): boolean => !!document.getElementById(INJECTED_DIV_ID);
const validateInstantRenderConfigAsync = async (config: ZeroExInstantConfig, selector: string) => {
const validateInstantRenderConfig = (config: ZeroExInstantConfig, selector: string) => {
assert.isValidOrderSource('orderSource', config.orderSource);
if (!_.isUndefined(config.defaultSelectedAssetData)) {
assert.isHexString('defaultSelectedAssetData', config.defaultSelectedAssetData);
@ -102,7 +102,7 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
: config.orderSource,
});
validateInstantRenderConfigAsync(coercedConfig, selector);
validateInstantRenderConfig(coercedConfig, selector);
if (coercedConfig.shouldDisablePushToHistory) {
if (!isInstantRendered()) {

View File

@ -1,6 +1,6 @@
import { EmptyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders';
import { providerUtils } from '@0x/utils';
import { SupportedProvider, ZeroExProvider } from 'ethereum-types';
import { ZeroExProvider } from 'ethereum-types';
import * as _ from 'lodash';
import { BLOCK_POLLING_INTERVAL_MS, ETHEREUM_NODE_URL_BY_NETWORK } from '../constants';

View File

@ -5,7 +5,7 @@ import { schemas } from '@0x/json-schemas';
import { ECSignature, Order, SignatureType, SignedOrder, ValidatorSignature } from '@0x/types';
import { providerUtils } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, SupportedProvider } from 'ethereum-types';
import { SupportedProvider } from 'ethereum-types';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';

View File

@ -24,17 +24,19 @@ export const providerUtils = {
isParity: (supportedProvider as any).isParity,
stop: (supportedProvider as any).stop,
enable: (supportedProvider as any).enable,
sendAsync: _.noop, // Will be replaced
sendAsync: _.noop.bind(_), // Will be replaced
};
// Case 1: We've already converted to our ZeroExProvider so noop.
if ((supportedProvider as any).isStandardizedProvider) {
// tslint:disable-next-line:no-unnecessary-type-assertion
return supportedProvider as ZeroExProvider;
// Case 2: It's a compliant EIP 1193 Provider
// tslint:disable-next-line:no-unnecessary-type-assertion
} else if ((supportedProvider as EIP1193Provider).isEIP1193) {
provider.sendAsync = (payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback) => {
const method = payload.method;
const params = payload.params;
(supportedProvider as EIP1193Provider)
(supportedProvider as any)
.send(method, params)
.then((result: any) => {
callback(null, result);

View File

@ -54,7 +54,7 @@ export class Web3Wrapper {
public abiDecoder: AbiDecoder;
private _provider: ZeroExProvider;
// Raw provider passed in. Do not use. Only here to return the unmodified provider passed in via `getProvider()`
private _supportedProvider: SupportedProvider;
private readonly _supportedProvider: SupportedProvider;
private readonly _txDefaults: Partial<TxData>;
private _jsonRpcRequestId: number;
/**