aboutsummaryrefslogtreecommitdiffstats
path: root/packages/testnet-faucets/src/ts/handler.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-05 00:51:17 +0800
committerGitHub <noreply@github.com>2018-07-05 00:51:17 +0800
commit5176d929fa6d3c6ce414448ea2441bd450f04e3c (patch)
tree6ea9d1f9c9506bee42dbbe0543a8c407c6c5d05e /packages/testnet-faucets/src/ts/handler.ts
parentade620f4f7d9ac1e5726681aefcbddf742915a84 (diff)
parent8adc6f0faadb46f88c1f9738b04039d037cfbcb9 (diff)
downloaddexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.tar
dexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.tar.gz
dexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.tar.bz2
dexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.tar.lz
dexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.tar.xz
dexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.tar.zst
dexon-sol-tools-5176d929fa6d3c6ce414448ea2441bd450f04e3c.zip
Merge pull request #817 from 0xProject/remove-web3
Remove Web3 Dependencies (exept for in web3-wrapper)
Diffstat (limited to 'packages/testnet-faucets/src/ts/handler.ts')
-rw-r--r--packages/testnet-faucets/src/ts/handler.ts17
1 files changed, 6 insertions, 11 deletions
diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts
index 3a60d396c..6d26691d6 100644
--- a/packages/testnet-faucets/src/ts/handler.ts
+++ b/packages/testnet-faucets/src/ts/handler.ts
@@ -1,15 +1,10 @@
import { Order, ZeroEx } from '0x.js';
import { BigNumber, logUtils } from '@0xproject/utils';
+import { Web3Wrapper } from '@0xproject/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as express from 'express';
import * as _ from 'lodash';
-import * as Web3 from 'web3';
-// HACK: web3 injects XMLHttpRequest into the global scope and ProviderEngine checks XMLHttpRequest
-// to know whether it is running in a browser or node environment. We need it to be undefined since
-// we are not running in a browser env.
-// Filed issue: https://github.com/ethereum/web3.js/issues/844
-(global as any).XMLHttpRequest = undefined;
import { NonceTrackerSubprovider, PrivateKeyWalletSubprovider } from '@0xproject/subproviders';
import ProviderEngine = require('web3-provider-engine');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
@@ -22,7 +17,7 @@ import { rpcUrls } from './rpc_urls';
interface NetworkConfig {
dispatchQueue: DispatchQueue;
- web3: Web3;
+ web3Wrapper: Web3Wrapper;
zeroEx: ZeroEx;
}
@@ -58,15 +53,15 @@ export class Handler {
constructor() {
_.forIn(rpcUrls, (rpcUrl: string, networkId: string) => {
const providerObj = Handler._createProviderEngine(rpcUrl);
- const web3 = new Web3(providerObj);
+ const web3Wrapper = new Web3Wrapper(providerObj);
const zeroExConfig = {
networkId: +networkId,
};
- const zeroEx = new ZeroEx(web3.currentProvider, zeroExConfig);
+ const zeroEx = new ZeroEx(providerObj, zeroExConfig);
const dispatchQueue = new DispatchQueue();
this._networkConfigByNetworkId[networkId] = {
dispatchQueue,
- web3,
+ web3Wrapper,
zeroEx,
};
});
@@ -106,7 +101,7 @@ export class Handler {
let dispenserTask;
switch (requestedAssetType) {
case RequestedAssetType.ETH:
- dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3);
+ dispenserTask = dispenseAssetTasks.dispenseEtherTask(recipient, networkConfig.web3Wrapper);
break;
case RequestedAssetType.WETH:
case RequestedAssetType.ZRX: