diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-13 20:26:02 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-13 20:26:02 +0800 |
commit | 512502ca0873a290accb53777ca9d93f8d28e84b (patch) | |
tree | 51dba0dbfd00021a8e84f040900283337010652b | |
parent | 6ce662c7a4d04540920bc2a11a376c71bc051bb0 (diff) | |
download | dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.tar dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.tar.gz dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.tar.bz2 dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.tar.lz dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.tar.xz dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.tar.zst dexon-sol-tools-512502ca0873a290accb53777ca9d93f8d28e84b.zip |
Export Web3ProviderEngine from subproviders package
21 files changed, 35 insertions, 47 deletions
diff --git a/packages/contract-wrappers/package.json b/packages/contract-wrappers/package.json index b8fd8bd50..a781496ab 100644 --- a/packages/contract-wrappers/package.json +++ b/packages/contract-wrappers/package.json @@ -70,8 +70,7 @@ "sinon": "^4.0.0", "source-map-support": "^0.5.0", "tslint": "5.8.0", - "typescript": "2.7.1", - "web3-provider-engine": "14.0.6" + "typescript": "2.7.1" }, "dependencies": { "@0xproject/assert": "^0.3.0", diff --git a/packages/contract-wrappers/test/erc20_wrapper_test.ts b/packages/contract-wrappers/test/erc20_wrapper_test.ts index 0011508e0..cf7ac527e 100644 --- a/packages/contract-wrappers/test/erc20_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc20_wrapper_test.ts @@ -1,11 +1,10 @@ import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; -import { EmptyWalletSubprovider } from '@0xproject/subproviders'; +import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders'; import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { Provider } from 'ethereum-types'; import 'mocha'; -import Web3ProviderEngine = require('web3-provider-engine'); import { BlockParamLiteral, diff --git a/packages/contract-wrappers/test/erc721_wrapper_test.ts b/packages/contract-wrappers/test/erc721_wrapper_test.ts index 96b8fcf1d..f005ac2e0 100644 --- a/packages/contract-wrappers/test/erc721_wrapper_test.ts +++ b/packages/contract-wrappers/test/erc721_wrapper_test.ts @@ -1,11 +1,10 @@ import { BlockchainLifecycle, callbackErrorReporter } from '@0xproject/dev-utils'; -import { EmptyWalletSubprovider } from '@0xproject/subproviders'; +import { EmptyWalletSubprovider, Web3ProviderEngine } from '@0xproject/subproviders'; import { DoneCallback } from '@0xproject/types'; import { BigNumber } from '@0xproject/utils'; import * as chai from 'chai'; import { Provider } from 'ethereum-types'; import 'mocha'; -import Web3ProviderEngine = require('web3-provider-engine'); import { BlockParamLiteral, diff --git a/packages/dev-utils/package.json b/packages/dev-utils/package.json index 1808e23e4..f0ef24684 100644 --- a/packages/dev-utils/package.json +++ b/packages/dev-utils/package.json @@ -51,8 +51,7 @@ "ethereum-types": "^0.0.2", "@0xproject/typescript-typings": "^0.4.2", "@0xproject/web3-wrapper": "^0.7.2", - "lodash": "^4.17.4", - "web3-provider-engine": "14.0.6" + "lodash": "^4.17.4" }, "publishConfig": { "access": "public" diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts index 67112d410..8e713fa68 100644 --- a/packages/dev-utils/src/web3_factory.ts +++ b/packages/dev-utils/src/web3_factory.ts @@ -1,10 +1,9 @@ -import ProviderEngine = require('web3-provider-engine'); - import { EmptyWalletSubprovider, FakeGasEstimateSubprovider, GanacheSubprovider, RPCSubprovider, + Web3ProviderEngine, } from '@0xproject/subproviders'; import * as fs from 'fs'; import * as _ from 'lodash'; @@ -20,8 +19,8 @@ export interface Web3Config { } export const web3Factory = { - getRpcProvider(config: Web3Config = {}): ProviderEngine { - const provider = new ProviderEngine(); + getRpcProvider(config: Web3Config = {}): Web3ProviderEngine { + const provider = new Web3ProviderEngine(); const hasAddresses = _.isUndefined(config.hasAddresses) || config.hasAddresses; config.shouldUseFakeGasEstimate = _.isUndefined(config.shouldUseFakeGasEstimate) || config.shouldUseFakeGasEstimate; diff --git a/packages/metacoin/package.json b/packages/metacoin/package.json index 9b96441c4..744e9e69a 100644 --- a/packages/metacoin/package.json +++ b/packages/metacoin/package.json @@ -44,8 +44,7 @@ "ethereum-types": "^0.0.2", "ethers": "3.0.22", "lodash": "^4.17.4", - "run-s": "^0.0.0", - "web3-provider-engine": "14.0.6" + "run-s": "^0.0.0" }, "devDependencies": { "@0xproject/dev-utils": "^0.4.5", diff --git a/packages/metacoin/test/utils/web3_wrapper.ts b/packages/metacoin/test/utils/web3_wrapper.ts index a3956e661..36bd6343f 100644 --- a/packages/metacoin/test/utils/web3_wrapper.ts +++ b/packages/metacoin/test/utils/web3_wrapper.ts @@ -1,9 +1,8 @@ import { env, EnvVars } from '@0xproject/dev-utils'; -import { GanacheSubprovider, prependSubprovider, RPCSubprovider } from '@0xproject/subproviders'; +import { GanacheSubprovider, prependSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0xproject/subproviders'; import { errorUtils, logUtils } from '@0xproject/utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as fs from 'fs'; -import ProviderEngine = require('web3-provider-engine'); import { config } from './config'; import { coverage } from './coverage'; @@ -29,7 +28,7 @@ switch (process.env.TEST_PROVIDER) { throw errorUtils.spawnSwitchErr('TEST_PROVIDER', process.env.TEST_PROVIDER); } -export const provider = new ProviderEngine(); +export const provider = new Web3ProviderEngine(); if (testProvider === ProviderType.Ganache) { provider.addProvider( new GanacheSubprovider({ diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 0b7ab8ae2..d4aa73912 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -60,8 +60,7 @@ "@ledgerhq/hw-app-eth": "^4.3.0", "ethereum-types": "^0.0.2", "ethers": "3.0.22", - "lodash": "^4.17.4", - "web3-provider-engine": "14.0.6" + "lodash": "^4.17.4" }, "optionalDependencies": { "@ledgerhq/hw-transport-node-hid": "^4.3.0" diff --git a/packages/migrations/src/utils/provider_factory.ts b/packages/migrations/src/utils/provider_factory.ts index cf95cb576..5f69b258d 100644 --- a/packages/migrations/src/utils/provider_factory.ts +++ b/packages/migrations/src/utils/provider_factory.ts @@ -1,9 +1,8 @@ -import { LedgerEthereumClient, LedgerSubprovider, RPCSubprovider } from '@0xproject/subproviders'; +import { LedgerEthereumClient, LedgerSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0xproject/subproviders'; import Eth from '@ledgerhq/hw-app-eth'; // tslint:disable:no-implicit-dependencies import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import { Provider } from 'ethereum-types'; -import ProviderEngine = require('web3-provider-engine'); import { constants } from './constants'; @@ -14,7 +13,7 @@ async function ledgerEthereumNodeJsClientFactoryAsync(): Promise<LedgerEthereumC } export const providerFactory = { async getLedgerProviderAsync(): Promise<Provider> { - const provider = new ProviderEngine(); + const provider = new Web3ProviderEngine(); const ledgerWalletConfigs = { networkId: constants.KOVAN_NETWORK_ID, ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync, diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index 9a5597a06..9d4480e59 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -1,5 +1,6 @@ import Eth from '@ledgerhq/hw-app-eth'; import TransportU2F from '@ledgerhq/hw-transport-u2f'; +export import Web3ProviderEngine = require('web3-provider-engine'); export { ECSignature } from '@0xproject/types'; import { LedgerEthereumClient } from './types'; diff --git a/packages/subproviders/src/utils/subprovider_utils.ts b/packages/subproviders/src/utils/subprovider_utils.ts index 24ebedd06..beda408ab 100644 --- a/packages/subproviders/src/utils/subprovider_utils.ts +++ b/packages/subproviders/src/utils/subprovider_utils.ts @@ -1,4 +1,4 @@ -import ProviderEngine = require('web3-provider-engine'); +import Web3ProviderEngine = require('web3-provider-engine'); import { Subprovider } from '../subproviders/subprovider'; @@ -7,7 +7,7 @@ import { Subprovider } from '../subproviders/subprovider'; * @param provider Given provider * @param subprovider Subprovider to prepend */ -export function prependSubprovider(provider: ProviderEngine, subprovider: Subprovider): void { +export function prependSubprovider(provider: Web3ProviderEngine, subprovider: Subprovider): void { subprovider.setEngine(provider); // HACK: We use implementation details of provider engine here // https://github.com/MetaMask/provider-engine/blob/master/index.js#L68 diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index e5233fdbc..103e8f952 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -7,9 +7,8 @@ import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import * as chai from 'chai'; import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; -import Web3ProviderEngine = require('web3-provider-engine'); -import { LedgerSubprovider, RPCSubprovider } from '../../src'; +import { LedgerSubprovider, RPCSubprovider, Web3ProviderEngine } from '../../src'; import { LedgerEthereumClient } from '../../src/types'; import { chaiSetup } from '../chai_setup'; import { fixtureData } from '../utils/fixture_data'; diff --git a/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts b/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts index f17c21f02..063817a95 100644 --- a/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/eth_lightwallet_subprovider_test.ts @@ -2,9 +2,8 @@ import * as chai from 'chai'; import * as lightwallet from 'eth-lightwallet'; import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; -import Web3ProviderEngine = require('web3-provider-engine'); -import { EthLightwalletSubprovider } from '../../src'; +import { EthLightwalletSubprovider, Web3ProviderEngine } from '../../src'; import { DoneCallback } from '../../src/types'; import { chaiSetup } from '../chai_setup'; import { fixtureData } from '../utils/fixture_data'; diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index 3b57e125b..edff5144e 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -2,9 +2,8 @@ import * as chai from 'chai'; import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; import * as _ from 'lodash'; -import Web3ProviderEngine = require('web3-provider-engine'); -import { LedgerSubprovider } from '../../src'; +import { LedgerSubprovider, Web3ProviderEngine } from '../../src'; import { DoneCallback, LedgerCommunicationClient, diff --git a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts index 51ba7094c..f2bdda3cd 100644 --- a/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/mnemonic_wallet_subprovider_test.ts @@ -1,9 +1,8 @@ import * as chai from 'chai'; import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; -import Web3ProviderEngine = require('web3-provider-engine'); -import { GanacheSubprovider, MnemonicWalletSubprovider } from '../../src/'; +import { GanacheSubprovider, MnemonicWalletSubprovider, Web3ProviderEngine } from '../../src/'; import { DoneCallback, WalletSubproviderErrors } from '../../src/types'; import { chaiSetup } from '../chai_setup'; import { fixtureData } from '../utils/fixture_data'; diff --git a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts index fa33cd50a..c437d0815 100644 --- a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts +++ b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts @@ -1,11 +1,10 @@ import * as chai from 'chai'; -import Web3ProviderEngine = require('web3-provider-engine'); import FixtureSubprovider = require('web3-provider-engine/subproviders/fixture'); import { promisify } from '@0xproject/utils'; import EthereumTx = require('ethereumjs-tx'); -import { NonceTrackerSubprovider } from '../../src'; +import { NonceTrackerSubprovider, Web3ProviderEngine } from '../../src'; import { chaiSetup } from '../chai_setup'; const expect = chai.expect; diff --git a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts index ab321bcff..95773145f 100644 --- a/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts +++ b/packages/subproviders/test/unit/private_key_wallet_subprovider_test.ts @@ -1,9 +1,8 @@ import * as chai from 'chai'; import { JSONRPCResponsePayload } from 'ethereum-types'; import * as ethUtils from 'ethereumjs-util'; -import Web3ProviderEngine = require('web3-provider-engine'); -import { GanacheSubprovider, PrivateKeyWalletSubprovider } from '../../src/'; +import { GanacheSubprovider, PrivateKeyWalletSubprovider, Web3ProviderEngine } from '../../src/'; import { DoneCallback, WalletSubproviderErrors } from '../../src/types'; import { chaiSetup } from '../chai_setup'; import { fixtureData } from '../utils/fixture_data'; diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts index e3f204b15..e30d2f74e 100644 --- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts +++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts @@ -2,9 +2,8 @@ import { DoneCallback } from '@0xproject/types'; import * as chai from 'chai'; import { JSONRPCResponsePayload } from 'ethereum-types'; import * as Sinon from 'sinon'; -import Web3ProviderEngine = require('web3-provider-engine'); -import { RedundantSubprovider, RPCSubprovider } from '../../src'; +import { RedundantSubprovider, RPCSubprovider, Web3ProviderEngine } from '../../src'; import { Subprovider } from '../../src/subproviders/subprovider'; import { chaiSetup } from '../chai_setup'; import { ganacheSubprovider } from '../utils/ganache_subprovider'; diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index 2aea0a47b..442f488c9 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -28,8 +28,7 @@ "ethereumjs-util": "^5.1.1", "express": "^4.15.2", "lodash": "^4.17.4", - "rollbar": "^0.6.5", - "web3-provider-engine": "14.0.6" + "rollbar": "^0.6.5" }, "devDependencies": { "@0xproject/tslint-config": "^0.4.21", diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts index a725a35f5..0f61159fa 100644 --- a/packages/testnet-faucets/src/ts/handler.ts +++ b/packages/testnet-faucets/src/ts/handler.ts @@ -5,8 +5,12 @@ import { Provider } from 'ethereum-types'; import * as express from 'express'; import * as _ from 'lodash'; -import { NonceTrackerSubprovider, PrivateKeyWalletSubprovider, RPCSubprovider } from '@0xproject/subproviders'; -import ProviderEngine = require('web3-provider-engine'); +import { + NonceTrackerSubprovider, + PrivateKeyWalletSubprovider, + RPCSubprovider, + Web3ProviderEngine, +} from '@0xproject/subproviders'; import { configs } from './configs'; import { constants } from './constants'; @@ -38,7 +42,7 @@ export class Handler { if (_.isUndefined(configs.DISPENSER_PRIVATE_KEY)) { throw new Error('Dispenser Private key not found'); } - const engine = new ProviderEngine(); + const engine = new Web3ProviderEngine(); engine.addProvider(new NonceTrackerSubprovider()); engine.addProvider(new PrivateKeyWalletSubprovider(configs.DISPENSER_PRIVATE_KEY)); engine.addProvider(new RPCSubprovider(rpcUrl)); diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts index 31d8ba2d6..099171c45 100644 --- a/packages/website/ts/blockchain.ts +++ b/packages/website/ts/blockchain.ts @@ -18,6 +18,7 @@ import { RPCSubprovider, SignerSubprovider, Subprovider, + Web3ProviderEngine, } from '@0xproject/subproviders'; import { BlockParam, @@ -61,7 +62,6 @@ import { configs } from 'ts/utils/configs'; import { constants } from 'ts/utils/constants'; import { errorReporter } from 'ts/utils/error_reporter'; import { utils } from 'ts/utils/utils'; -import ProviderEngine = require('web3-provider-engine'); import FilterSubprovider = require('web3-provider-engine/subproviders/filters'); import * as MintableArtifacts from '../contracts/Mintable.json'; @@ -148,7 +148,7 @@ export class Blockchain { if (!isU2FSupported) { throw new Error('Cannot update providerType to LEDGER without U2F support'); } - const provider = new ProviderEngine(); + const provider = new Web3ProviderEngine(); const ledgerWalletConfigs = { networkId: networkIdIfExists, ledgerEthereumClientFactoryAsync: ledgerEthereumBrowserClientFactoryAsync, @@ -165,7 +165,7 @@ export class Blockchain { } else if (doesInjectedWeb3Exist && isPublicNodeAvailableForNetworkId) { // We catch all requests involving a users account and send it to the injectedWeb3 // instance. All other requests go to the public hosted node. - const provider = new ProviderEngine(); + const provider = new Web3ProviderEngine(); provider.addProvider(new SignerSubprovider(injectedWeb3.currentProvider)); provider.addProvider(new FilterSubprovider()); const rpcSubproviders = _.map(publicNodeUrlsIfExistsForNetworkId, publicNodeUrl => { @@ -181,7 +181,7 @@ export class Blockchain { // If no injectedWeb3 instance, all requests fallback to our public hosted mainnet/testnet node // We do this so that users can still browse the 0x Portal DApp even if they do not have web3 // injected into their browser. - const provider = new ProviderEngine(); + const provider = new Web3ProviderEngine(); provider.addProvider(new FilterSubprovider()); const networkId = constants.NETWORK_ID_MAINNET; const rpcSubproviders = _.map(configs.PUBLIC_NODE_URLS_BY_NETWORK_ID[networkId], publicNodeUrl => { |