aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders')
-rw-r--r--packages/subproviders/README.md22
-rw-r--r--packages/subproviders/src/globals.d.ts52
-rw-r--r--packages/subproviders/src/subproviders/ganache.ts5
-rw-r--r--packages/subproviders/src/subproviders/injected_web3.ts4
4 files changed, 23 insertions, 60 deletions
diff --git a/packages/subproviders/README.md b/packages/subproviders/README.md
index ac92b89d2..2936be545 100644
--- a/packages/subproviders/README.md
+++ b/packages/subproviders/README.md
@@ -22,11 +22,11 @@ If your project is in [TypeScript](https://www.typescriptlang.org/), add the fol
## Contributing
-We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+We welcome improvements and fixes from the wider community! To report bugs within this package, please create an issue in this repository.
Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
-### Install Dependencies
+### Install dependencies
If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
@@ -34,17 +34,33 @@ If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
yarn config set workspaces-experimental true
```
+Then install dependencies
+
```bash
yarn install
```
### Build
+If this is your **first** time building this package, you must first build **all** packages within the monorepo. This is because packages that depend on other packages located inside this monorepo are symlinked when run from **within** the monorepo. This allows you to make changes across multiple packages without first publishing dependent packages to NPM. To build all packages, run the following from the monorepo root directory:
+
+```bash
+yarn lerna:rebuild
+```
+
+Or continuously rebuild on change:
+
+```bash
+yarn dev
+```
+
+You can also build this specific package by running the following from within its directory:
+
```bash
yarn build
```
-or
+or continuously rebuild on change:
```bash
yarn build:watch
diff --git a/packages/subproviders/src/globals.d.ts b/packages/subproviders/src/globals.d.ts
index 580c5aaa5..c5ad26876 100644
--- a/packages/subproviders/src/globals.d.ts
+++ b/packages/subproviders/src/globals.d.ts
@@ -51,42 +51,6 @@ declare module '@ledgerhq/hw-transport-node-hid' {
}
}
-// web3-provider-engine declarations
-declare module 'web3-provider-engine/subproviders/subprovider' {
- class Subprovider {}
- export = Subprovider;
-}
-declare module 'web3-provider-engine/subproviders/rpc' {
- import { JSONRPCRequestPayload } from '@0xproject/types';
- class RpcSubprovider {
- constructor(options: { rpcUrl: string });
- public handleRequest(
- payload: JSONRPCRequestPayload,
- next: () => void,
- end: (err: Error | null, data?: any) => void,
- ): void;
- }
- export = RpcSubprovider;
-}
-declare module 'web3-provider-engine/util/rpc-cache-utils' {
- class ProviderEngineRpcUtils {
- public static blockTagForPayload(payload: any): string | null;
- }
- export = ProviderEngineRpcUtils;
-}
-declare module 'web3-provider-engine/subproviders/fixture' {
- import { JSONRPCRequestPayload } from '@0xproject/types';
- class FixtureSubprovider {
- constructor(staticResponses: any);
- public handleRequest(
- payload: JSONRPCRequestPayload,
- next: () => void,
- end: (err: Error | null, data?: any) => void,
- ): void;
- }
- export = FixtureSubprovider;
-}
-
// hdkey declarations
declare module 'hdkey' {
class HDNode {
@@ -104,19 +68,3 @@ declare module '*.json' {
export default json;
/* tslint:enable */
}
-
-// ganache-core declarations
-declare module 'ganache-core' {
- import * as Web3 from 'web3';
- export interface GanacheOpts {
- verbose: boolean;
- logger: {
- log(msg: string): void;
- };
- port: number;
- networkId: number;
- mnemonic: string;
- }
- // tslint:disable-next-line:completed-docs
- export function provider(opts: GanacheOpts): Web3.Provider;
-}
diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts
index 785de792d..8008d1b4b 100644
--- a/packages/subproviders/src/subproviders/ganache.ts
+++ b/packages/subproviders/src/subproviders/ganache.ts
@@ -1,6 +1,5 @@
-import { JSONRPCRequestPayload } from '@0xproject/types';
+import { JSONRPCRequestPayload, Provider } from '@0xproject/types';
import * as Ganache from 'ganache-core';
-import * as Web3 from 'web3';
import { Callback, ErrorCallback } from '../types';
@@ -11,7 +10,7 @@ import { Subprovider } from './subprovider';
* It intercepts all JSON RPC requests and relays them to an in-process ganache instance.
*/
export class GanacheSubprovider extends Subprovider {
- private _ganacheProvider: Web3.Provider;
+ private _ganacheProvider: Provider;
/**
* Instantiates a GanacheSubprovider
* @param opts The desired opts with which to instantiate the Ganache provider
diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts
index edecd8bf6..1d7b2ddfe 100644
--- a/packages/subproviders/src/subproviders/injected_web3.ts
+++ b/packages/subproviders/src/subproviders/injected_web3.ts
@@ -1,4 +1,4 @@
-import { JSONRPCRequestPayload } from '@0xproject/types';
+import { JSONRPCRequestPayload, Provider } from '@0xproject/types';
import * as _ from 'lodash';
import * as Web3 from 'web3';
@@ -18,7 +18,7 @@ export class InjectedWeb3Subprovider extends Subprovider {
* Instantiates a new InjectedWeb3Subprovider
* @param provider Web3 provider that should handle all user account related requests
*/
- constructor(provider: Web3.Provider) {
+ constructor(provider: Provider) {
super();
this._injectedWeb3 = new Web3(provider);
}