diff --git a/packages/contract-wrappers/src/contract_wrappers.ts b/packages/contract-wrappers/src/contract_wrappers.ts index 7be422febd..f43ed2a5b3 100644 --- a/packages/contract-wrappers/src/contract_wrappers.ts +++ b/packages/contract-wrappers/src/contract_wrappers.ts @@ -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'; diff --git a/packages/fill-scenarios/src/fill_scenarios.ts b/packages/fill-scenarios/src/fill_scenarios.ts index 8a0d6fef9e..2bdb8a19a1 100644 --- a/packages/fill-scenarios/src/fill_scenarios.ts +++ b/packages/fill-scenarios/src/fill_scenarios.ts @@ -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'; diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts index 5c9c42bd6f..30f33acdf8 100644 --- a/packages/instant/src/index.umd.ts +++ b/packages/instant/src/index.umd.ts @@ -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()) { diff --git a/packages/instant/src/util/provider_factory.ts b/packages/instant/src/util/provider_factory.ts index 1b66a9b7a7..5af235d044 100644 --- a/packages/instant/src/util/provider_factory.ts +++ b/packages/instant/src/util/provider_factory.ts @@ -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'; diff --git a/packages/order-utils/src/signature_utils.ts b/packages/order-utils/src/signature_utils.ts index 57b56099b8..8a5fb711c8 100644 --- a/packages/order-utils/src/signature_utils.ts +++ b/packages/order-utils/src/signature_utils.ts @@ -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'; diff --git a/packages/utils/src/provider_utils.ts b/packages/utils/src/provider_utils.ts index c9a00f6337..19ef0725e7 100644 --- a/packages/utils/src/provider_utils.ts +++ b/packages/utils/src/provider_utils.ts @@ -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); diff --git a/packages/web3-wrapper/src/web3_wrapper.ts b/packages/web3-wrapper/src/web3_wrapper.ts index b2694556b4..da6de7537c 100644 --- a/packages/web3-wrapper/src/web3_wrapper.ts +++ b/packages/web3-wrapper/src/web3_wrapper.ts @@ -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; private _jsonRpcRequestId: number; /**