From 76eb1e9e7ff771a256b0ddeeabe2dc10e3861d14 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 2 Feb 2018 11:26:49 +1100 Subject: Test faucets to use new NonceTracker --- packages/testnet-faucets/Dockerfile | 1 + packages/testnet-faucets/src/ts/handler.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'packages/testnet-faucets') diff --git a/packages/testnet-faucets/Dockerfile b/packages/testnet-faucets/Dockerfile index 6d6ddc192..57d72049b 100644 --- a/packages/testnet-faucets/Dockerfile +++ b/packages/testnet-faucets/Dockerfile @@ -2,6 +2,7 @@ FROM node WORKDIR /src +RUN apt-get -qq update && apt-get install -y libhidapi-dev libusb-1.0-0-dev COPY package.json . RUN npm i RUN npm install forever -g diff --git a/packages/testnet-faucets/src/ts/handler.ts b/packages/testnet-faucets/src/ts/handler.ts index bf5b3e81e..121112fd3 100644 --- a/packages/testnet-faucets/src/ts/handler.ts +++ b/packages/testnet-faucets/src/ts/handler.ts @@ -1,9 +1,9 @@ +import { NonceTrackerSubprovider } from '@0xproject/subproviders'; import { addressUtils } from '@0xproject/utils'; import * as express from 'express'; import * as _ from 'lodash'; import ProviderEngine = require('web3-provider-engine'); import HookedWalletSubprovider = require('web3-provider-engine/subproviders/hooked-wallet'); -import NonceSubprovider = require('web3-provider-engine/subproviders/nonce-tracker'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import { EtherRequestQueue } from './ether_request_queue'; @@ -96,7 +96,7 @@ export class Handler { // tslint:disable-next-line:prefer-function-over-method private _createProviderEngine(rpcUrl: string) { const engine = new ProviderEngine(); - engine.addProvider(new NonceSubprovider()); + engine.addProvider(new NonceTrackerSubprovider()); engine.addProvider(new HookedWalletSubprovider(idManagement)); engine.addProvider( new RpcSubprovider({ -- cgit v1.2.3 From 2eccb28dee6ad16f8b4a73102d36463067be8262 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Thu, 1 Feb 2018 17:08:19 -0800 Subject: Enable CIRCLECI and declare web3 --- packages/testnet-faucets/Dockerfile | 1 + packages/testnet-faucets/package.json | 1 + packages/testnet-faucets/src/ts/global.d.ts | 12 ++++++++++++ 3 files changed, 14 insertions(+) (limited to 'packages/testnet-faucets') diff --git a/packages/testnet-faucets/Dockerfile b/packages/testnet-faucets/Dockerfile index 57d72049b..346f461d8 100644 --- a/packages/testnet-faucets/Dockerfile +++ b/packages/testnet-faucets/Dockerfile @@ -3,6 +3,7 @@ FROM node WORKDIR /src RUN apt-get -qq update && apt-get install -y libhidapi-dev libusb-1.0-0-dev +ENV CIRCLECI=true COPY package.json . RUN npm i RUN npm install forever -g diff --git a/packages/testnet-faucets/package.json b/packages/testnet-faucets/package.json index f05899896..964401a67 100644 --- a/packages/testnet-faucets/package.json +++ b/packages/testnet-faucets/package.json @@ -16,6 +16,7 @@ "dependencies": { "0x.js": "^0.31.1", "@0xproject/utils": "^0.2.4", + "@0xproject/subproviders": "^0.3.5", "body-parser": "^1.17.1", "ethereumjs-tx": "^1.3.3", "express": "^4.15.2", diff --git a/packages/testnet-faucets/src/ts/global.d.ts b/packages/testnet-faucets/src/ts/global.d.ts index 97cd35680..a790366fb 100644 --- a/packages/testnet-faucets/src/ts/global.d.ts +++ b/packages/testnet-faucets/src/ts/global.d.ts @@ -24,3 +24,15 @@ declare module 'ethereumjs-tx' { } export = EthereumTx; } + +declare module 'web3-provider-engine' { + class Web3ProviderEngine { + public on(event: string, handler: () => void): void; + public send(payload: any): void; + public sendAsync(payload: any, callback: (error: any, response: any) => void): void; + public addProvider(provider: any): void; + public start(): void; + public stop(): void; + } + export = Web3ProviderEngine; +} \ No newline at end of file -- cgit v1.2.3 From 48aa1ad57d91acba93c445c14177cb9e318974d8 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Thu, 1 Feb 2018 18:43:32 -0800 Subject: Remove double declaration --- packages/testnet-faucets/src/ts/global.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'packages/testnet-faucets') diff --git a/packages/testnet-faucets/src/ts/global.d.ts b/packages/testnet-faucets/src/ts/global.d.ts index a790366fb..cdd624b1c 100644 --- a/packages/testnet-faucets/src/ts/global.d.ts +++ b/packages/testnet-faucets/src/ts/global.d.ts @@ -1,8 +1,4 @@ declare module 'rollbar'; -declare module 'web3-provider-engine'; -declare module 'web3-provider-engine/subproviders/rpc'; -declare module 'web3-provider-engine/subproviders/nonce-tracker'; -declare module 'web3-provider-engine/subproviders/hooked-wallet'; declare module '*.json' { const json: any; @@ -35,4 +31,8 @@ declare module 'web3-provider-engine' { public stop(): void; } export = Web3ProviderEngine; -} \ No newline at end of file +} + +declare module 'web3-provider-engine/subproviders/rpc'; +declare module 'web3-provider-engine/subproviders/nonce-tracker'; +declare module 'web3-provider-engine/subproviders/hooked-wallet'; -- cgit v1.2.3 From dae6f28f8ad11358048a72a11ba4f8172092a1b0 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 2 Feb 2018 15:07:10 -0800 Subject: Disable linter for multiple class declarations --- packages/testnet-faucets/src/ts/global.d.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/testnet-faucets') diff --git a/packages/testnet-faucets/src/ts/global.d.ts b/packages/testnet-faucets/src/ts/global.d.ts index cdd624b1c..b9188bbf6 100644 --- a/packages/testnet-faucets/src/ts/global.d.ts +++ b/packages/testnet-faucets/src/ts/global.d.ts @@ -21,6 +21,7 @@ declare module 'ethereumjs-tx' { export = EthereumTx; } +/* tslint:disable */ declare module 'web3-provider-engine' { class Web3ProviderEngine { public on(event: string, handler: () => void): void; @@ -32,6 +33,7 @@ declare module 'web3-provider-engine' { } export = Web3ProviderEngine; } +/* tslint:enable */ declare module 'web3-provider-engine/subproviders/rpc'; declare module 'web3-provider-engine/subproviders/nonce-tracker'; -- cgit v1.2.3 From 4e284f5e6cbe48b307f3d3163dd7f158c56a5e82 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 5 Feb 2018 16:31:51 -0800 Subject: Refactor tests for reuse of the fixture subprovider --- packages/testnet-faucets/Dockerfile | 3 +++ packages/testnet-faucets/src/ts/global.d.ts | 9 ++++----- 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'packages/testnet-faucets') diff --git a/packages/testnet-faucets/Dockerfile b/packages/testnet-faucets/Dockerfile index 346f461d8..bd1dcc4a4 100644 --- a/packages/testnet-faucets/Dockerfile +++ b/packages/testnet-faucets/Dockerfile @@ -2,7 +2,10 @@ FROM node WORKDIR /src +# Ledger Provider (in the Subproviders package) requires node-hid at dependency install time +# which compiles and expects certain USB developer library packages to be present RUN apt-get -qq update && apt-get install -y libhidapi-dev libusb-1.0-0-dev +# Our fork of ledgerco disables requiring node-hid at run time if CIRCLECI is set to true ENV CIRCLECI=true COPY package.json . RUN npm i diff --git a/packages/testnet-faucets/src/ts/global.d.ts b/packages/testnet-faucets/src/ts/global.d.ts index b9188bbf6..3d9998698 100644 --- a/packages/testnet-faucets/src/ts/global.d.ts +++ b/packages/testnet-faucets/src/ts/global.d.ts @@ -1,4 +1,7 @@ declare module 'rollbar'; +declare module 'web3-provider-engine/subproviders/rpc'; +declare module 'web3-provider-engine/subproviders/nonce-tracker'; +declare module 'web3-provider-engine/subproviders/hooked-wallet'; declare module '*.json' { const json: any; @@ -33,8 +36,4 @@ declare module 'web3-provider-engine' { } export = Web3ProviderEngine; } -/* tslint:enable */ - -declare module 'web3-provider-engine/subproviders/rpc'; -declare module 'web3-provider-engine/subproviders/nonce-tracker'; -declare module 'web3-provider-engine/subproviders/hooked-wallet'; +/* tslint:enable */ \ No newline at end of file -- cgit v1.2.3 From fce70812150340a039a4bc02861e93574c1e965f Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 5 Feb 2018 16:57:27 -0800 Subject: Newline prettier/lint --- packages/testnet-faucets/src/ts/global.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/testnet-faucets') diff --git a/packages/testnet-faucets/src/ts/global.d.ts b/packages/testnet-faucets/src/ts/global.d.ts index 3d9998698..41a2f3a8a 100644 --- a/packages/testnet-faucets/src/ts/global.d.ts +++ b/packages/testnet-faucets/src/ts/global.d.ts @@ -36,4 +36,4 @@ declare module 'web3-provider-engine' { } export = Web3ProviderEngine; } -/* tslint:enable */ \ No newline at end of file +/* tslint:enable */ -- cgit v1.2.3