aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders')
-rw-r--r--packages/subproviders/package.json19
-rw-r--r--packages/subproviders/src/index.ts33
-rw-r--r--packages/subproviders/src/monorepo_scripts/postpublish.ts8
-rw-r--r--packages/subproviders/src/monorepo_scripts/stage_docs.ts8
-rw-r--r--packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts5
-rw-r--r--packages/subproviders/src/subproviders/ganache.ts2
-rw-r--r--packages/subproviders/src/subproviders/redundant_subprovider.ts2
-rw-r--r--packages/subproviders/src/subproviders/rpc_subprovider.ts6
-rw-r--r--packages/subproviders/src/subproviders/subprovider.ts6
9 files changed, 45 insertions, 44 deletions
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index 57b0a13b3..8b8c06c25 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -9,8 +9,8 @@
"license": "Apache-2.0",
"scripts": {
"watch_without_deps": "tsc -w",
- "build": "tsc && copyfiles -u 3 './lib/src/monorepo_scripts/**/*' ./scripts",
- "clean": "shx rm -rf lib scripts",
+ "build": "tsc",
+ "clean": "shx rm -rf lib generated_docs",
"lint": "tslint --project .",
"run_mocha_unit": "mocha --require source-map-support/register --require make-promises-safe lib/test/unit/**/*_test.js --timeout 10000 --bail --exit",
"run_mocha_integration": "mocha --require source-map-support/register --require make-promises-safe lib/test/integration/**/*_test.js --timeout 10000 --bail --exit",
@@ -21,22 +21,12 @@
"test:all": "run-s test:unit test:integration",
"test:unit": "run-s clean build run_mocha_unit",
"test:integration": "run-s clean build run_mocha_integration",
- "manual:postpublish": "yarn build; node ./scripts/postpublish.js",
- "docs:stage": "node scripts/stage_docs.js",
- "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES",
- "upload_docs_json": "aws s3 cp generated_docs/index.json $S3_URL --profile 0xproject --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers --content-type application/json"
+ "docs:json": "typedoc --excludePrivate --excludeExternals --target ES5 --json $JSON_FILE_PATH $PROJECT_FILES"
},
"config": {
"postpublish": {
"assets": [],
- "docPublishConfigs": {
- "extraFileIncludes": [
- "../types/src/index.ts",
- "../ethereum-types/src/index.ts"
- ],
- "s3BucketPath": "s3://doc-jsons/subproviders/",
- "s3StagingBucketPath": "s3://staging-doc-jsons/subproviders/"
- }
+ "shouldPublishDocs": true
}
},
"dependencies": {
@@ -62,7 +52,6 @@
"web3-provider-engine": "14.0.6"
},
"devDependencies": {
- "@0xproject/monorepo-scripts": "^1.0.5",
"@0xproject/tslint-config": "^1.0.5",
"@types/bip39": "^2.4.0",
"@types/bn.js": "^4.11.0",
diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts
index 9d4480e59..b5f9b3f90 100644
--- a/packages/subproviders/src/index.ts
+++ b/packages/subproviders/src/index.ts
@@ -1,11 +1,21 @@
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';
+/**
+ * A factory method for creating a LedgerEthereumClient usable in a browser context.
+ * @return LedgerEthereumClient A browser client for the LedgerSubprovider
+ */
+export async function ledgerEthereumBrowserClientFactoryAsync(): Promise<LedgerEthereumClient> {
+ const ledgerConnection = await TransportU2F.create();
+ const ledgerEthClient = new Eth(ledgerConnection);
+ return ledgerEthClient;
+}
+
export { prependSubprovider } from './utils/subprovider_utils';
+
export { EmptyWalletSubprovider } from './subproviders/empty_wallet_subprovider';
export { FakeGasEstimateSubprovider } from './subproviders/fake_gas_estimate_subprovider';
export { SignerSubprovider } from './subproviders/signer';
@@ -18,6 +28,7 @@ export { NonceTrackerSubprovider } from './subproviders/nonce_tracker';
export { PrivateKeyWalletSubprovider } from './subproviders/private_key_wallet';
export { MnemonicWalletSubprovider } from './subproviders/mnemonic_wallet';
export { EthLightwalletSubprovider } from './subproviders/eth_lightwallet_subprovider';
+
export {
Callback,
ErrorCallback,
@@ -26,14 +37,16 @@ export {
LedgerEthereumClient,
NonceSubproviderErrors,
LedgerSubproviderConfigs,
+ PartialTxParams,
+ JSONRPCRequestPayloadWithMethod,
+ ECSignatureString,
+ AccountFetchingConfigs,
+ LedgerEthereumClientFactoryAsync,
+ OnNextCompleted,
+ MnemonicWalletSubproviderConfigs,
+ LedgerGetAddressResult,
} from './types';
-/**
- * A factory method for creating a LedgerEthereumClient usable in a browser context.
- * @return LedgerEthereumClient A browser client for the LedgerSubprovider
- */
-export async function ledgerEthereumBrowserClientFactoryAsync(): Promise<LedgerEthereumClient> {
- const ledgerConnection = await TransportU2F.create();
- const ledgerEthClient = new Eth(ledgerConnection);
- return ledgerEthClient;
-}
+export { ECSignature } from '@0xproject/types';
+
+export { JSONRPCRequestPayload, Provider, JSONRPCResponsePayload, JSONRPCErrorCallback } from 'ethereum-types';
diff --git a/packages/subproviders/src/monorepo_scripts/postpublish.ts b/packages/subproviders/src/monorepo_scripts/postpublish.ts
deleted file mode 100644
index dcb99d0f7..000000000
--- a/packages/subproviders/src/monorepo_scripts/postpublish.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.runAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/subproviders/src/monorepo_scripts/stage_docs.ts b/packages/subproviders/src/monorepo_scripts/stage_docs.ts
deleted file mode 100644
index e732ac8eb..000000000
--- a/packages/subproviders/src/monorepo_scripts/stage_docs.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { postpublishUtils } from '@0xproject/monorepo-scripts';
-
-import * as packageJSON from '../package.json';
-import * as tsConfigJSON from '../tsconfig.json';
-
-const cwd = `${__dirname}/..`;
-// tslint:disable-next-line:no-floating-promises
-postpublishUtils.publishDocsToStagingAsync(packageJSON, tsConfigJSON, cwd);
diff --git a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts
index 454dae58e..17fe59368 100644
--- a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts
+++ b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts
@@ -14,6 +14,11 @@ import { PrivateKeyWalletSubprovider } from './private_key_wallet';
export class EthLightwalletSubprovider extends BaseWalletSubprovider {
private readonly _keystore: lightwallet.keystore;
private readonly _pwDerivedKey: Uint8Array;
+ /**
+ *
+ * @param keystore The EthLightWallet keystore you wish to use
+ * @param pwDerivedKey The password derived key to use
+ */
constructor(keystore: lightwallet.keystore, pwDerivedKey: Uint8Array) {
super();
this._keystore = keystore;
diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts
index 986094dba..2b8544f8b 100644
--- a/packages/subproviders/src/subproviders/ganache.ts
+++ b/packages/subproviders/src/subproviders/ganache.ts
@@ -24,7 +24,7 @@ export class GanacheSubprovider extends Subprovider {
* It is called internally by the ProviderEngine when it is this subproviders
* turn to handle a JSON RPC request.
* @param payload JSON RPC payload
- * @param next Callback to call if this subprovider decides not to handle the request
+ * @param _next Callback to call if this subprovider decides not to handle the request
* @param end Callback to call if subprovider handled the request and wants to pass back the request.
*/
// tslint:disable-next-line:prefer-function-over-method async-suffix
diff --git a/packages/subproviders/src/subproviders/redundant_subprovider.ts b/packages/subproviders/src/subproviders/redundant_subprovider.ts
index 7aa6226d5..59a2986f8 100644
--- a/packages/subproviders/src/subproviders/redundant_subprovider.ts
+++ b/packages/subproviders/src/subproviders/redundant_subprovider.ts
@@ -34,7 +34,7 @@ export class RedundantSubprovider extends Subprovider {
}
/**
* Instantiates a new RedundantSubprovider
- * @param endpoints JSON RPC endpoints to attempt. Attempts are made in the order of the endpoints.
+ * @param subproviders Subproviders to attempt the request with
*/
constructor(subproviders: Subprovider[]) {
super();
diff --git a/packages/subproviders/src/subproviders/rpc_subprovider.ts b/packages/subproviders/src/subproviders/rpc_subprovider.ts
index d874c6f05..18d6da307 100644
--- a/packages/subproviders/src/subproviders/rpc_subprovider.ts
+++ b/packages/subproviders/src/subproviders/rpc_subprovider.ts
@@ -15,6 +15,10 @@ import { Subprovider } from './subprovider';
export class RPCSubprovider extends Subprovider {
private readonly _rpcUrl: string;
private readonly _requestTimeoutMs: number;
+ /**
+ * @param rpcUrl URL to the backing Ethereum node to which JSON RPC requests should be sent
+ * @param requestTimeoutMs Amount of miliseconds to wait before timing out the JSON RPC request
+ */
constructor(rpcUrl: string, requestTimeoutMs: number = 20000) {
super();
assert.isString('rpcUrl', rpcUrl);
@@ -27,7 +31,7 @@ export class RPCSubprovider extends Subprovider {
* It is called internally by the ProviderEngine when it is this subproviders
* turn to handle a JSON RPC request.
* @param payload JSON RPC payload
- * @param next Callback to call if this subprovider decides not to handle the request
+ * @param _next Callback to call if this subprovider decides not to handle the request
* @param end Callback to call if subprovider handled the request and wants to pass back the request.
*/
// tslint:disable-next-line:prefer-function-over-method async-suffix
diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts
index 5dc273569..53a3d07ea 100644
--- a/packages/subproviders/src/subproviders/subprovider.ts
+++ b/packages/subproviders/src/subproviders/subprovider.ts
@@ -32,6 +32,11 @@ export abstract class Subprovider {
// 16 digits
return datePart + extraPart;
}
+ /**
+ * @param payload JSON RPC request payload
+ * @param next A callback to pass the request to the next subprovider in the stack
+ * @param end A callback called once the subprovider is done handling the request
+ */
// tslint:disable-next-line:async-suffix
public abstract async handleRequest(
payload: JSONRPCRequestPayload,
@@ -55,6 +60,7 @@ export abstract class Subprovider {
* Set's the subprovider's engine to the ProviderEngine it is added to.
* This is only called within the ProviderEngine source code, do not call
* directly.
+ * @param engine The ProviderEngine this subprovider is added to
*/
public setEngine(engine: Provider): void {
this.engine = engine;