From f4a2e227e1a7224fbbe9c99d9aa033d176a9c4de Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 21:58:39 +0200 Subject: Remove all in-package monorepo-scripts by adding doc gen/upload and aggregate release note publishing to publish script --- packages/subproviders/package.json | 19 ++++--------------- .../subproviders/src/monorepo_scripts/postpublish.ts | 8 -------- .../subproviders/src/monorepo_scripts/stage_docs.ts | 8 -------- 3 files changed, 4 insertions(+), 31 deletions(-) delete mode 100644 packages/subproviders/src/monorepo_scripts/postpublish.ts delete mode 100644 packages/subproviders/src/monorepo_scripts/stage_docs.ts (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 5e0153765..ad8ab9d29 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", "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.4", "@0xproject/tslint-config": "^1.0.4", "@types/bip39": "^2.4.0", "@types/bn.js": "^4.11.0", 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); -- cgit v1.2.3 From 4579e1637d9f4d0d7badb23336af6785330c6ecc Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 29 Jul 2018 21:59:09 +0200 Subject: Add missing exports discovered by generating compact typedoc JSON --- packages/subproviders/src/index.ts | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index 9d4480e59..905590539 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -26,6 +26,8 @@ export { LedgerEthereumClient, NonceSubproviderErrors, LedgerSubproviderConfigs, + PartialTxParams, + DerivedHDKeyInfo, } from './types'; /** @@ -37,3 +39,5 @@ export async function ledgerEthereumBrowserClientFactoryAsync(): Promise Date: Fri, 3 Aug 2018 13:27:08 +0200 Subject: Re-order subproviders index.ts and add missing types --- packages/subproviders/src/index.ts | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index 905590539..eb9347bdb 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'; +import { LedgerEthereumClient } from './types'; + 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 { + 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, @@ -28,16 +39,13 @@ export { LedgerSubproviderConfigs, PartialTxParams, DerivedHDKeyInfo, + JSONRPCRequestPayloadWithMethod, + ECSignatureString, + AccountFetchingConfigs, + LedgerEthereumClientFactoryAsync, + OnNextCompleted, } 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 { - const ledgerConnection = await TransportU2F.create(); - const ledgerEthClient = new Eth(ledgerConnection); - return ledgerEthClient; -} +export { ECSignature } from '@0xproject/types'; -export { JSONRPCRequestPayload, Provider } from 'ethereum-types'; +export { JSONRPCRequestPayload, Provider, JSONRPCResponsePayload, JSONRPCErrorCallback } from 'ethereum-types'; -- cgit v1.2.3 From 3ee3fc2fb35b5ecc8237363d6307b7135ed4f927 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Fri, 3 Aug 2018 17:13:10 +0200 Subject: Add missing doc comments --- .../subproviders/src/subproviders/eth_lightwallet_subprovider.ts | 5 +++++ packages/subproviders/src/subproviders/ganache.ts | 2 +- packages/subproviders/src/subproviders/redundant_subprovider.ts | 2 +- packages/subproviders/src/subproviders/rpc_subprovider.ts | 6 +++++- packages/subproviders/src/subproviders/subprovider.ts | 6 ++++++ 5 files changed, 18 insertions(+), 3 deletions(-) (limited to 'packages/subproviders') 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; -- cgit v1.2.3 From b4cf69b02113a51af82b596f3931cb081edde7f4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 20 Aug 2018 13:50:28 +0100 Subject: Cleanup web3-wrapper and subproviders index.ts --- packages/subproviders/src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/index.ts b/packages/subproviders/src/index.ts index eb9347bdb..b5f9b3f90 100644 --- a/packages/subproviders/src/index.ts +++ b/packages/subproviders/src/index.ts @@ -1,9 +1,9 @@ import Eth from '@ledgerhq/hw-app-eth'; import TransportU2F from '@ledgerhq/hw-transport-u2f'; -import { LedgerEthereumClient } from './types'; - export import Web3ProviderEngine = require('web3-provider-engine'); +import { LedgerEthereumClient } from './types'; + /** * A factory method for creating a LedgerEthereumClient usable in a browser context. * @return LedgerEthereumClient A browser client for the LedgerSubprovider @@ -38,12 +38,13 @@ export { NonceSubproviderErrors, LedgerSubproviderConfigs, PartialTxParams, - DerivedHDKeyInfo, JSONRPCRequestPayloadWithMethod, ECSignatureString, AccountFetchingConfigs, LedgerEthereumClientFactoryAsync, OnNextCompleted, + MnemonicWalletSubproviderConfigs, + LedgerGetAddressResult, } from './types'; export { ECSignature } from '@0xproject/types'; -- cgit v1.2.3 From 1bbd7bf870730dfe2146819e3740522990eb83ca Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 21 Aug 2018 23:20:01 +0100 Subject: Add generated_docs dir to clean command --- packages/subproviders/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 3eb3d381f..8b8c06c25 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -10,7 +10,7 @@ "scripts": { "watch_without_deps": "tsc -w", "build": "tsc", - "clean": "shx rm -rf lib", + "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", -- cgit v1.2.3 From 40b202f8c0907cb729cc0d7d755a6810c8b1ff06 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 15:53:19 +0100 Subject: Update all CHANGELOGs --- packages/subproviders/CHANGELOG.json | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index 93939066a..e474826e4 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,4 +1,15 @@ [ + { + "timestamp": 1534210131, + "version": "2.0.0", + "changes": [ + { + "note": + "Export types: `PartialTxParams`, `JSONRPCRequestPayloadWithMethod`, `ECSignatureString`, `AccountFetchingConfigs`, `LedgerEthereumClientFactoryAsync`, `OnNextCompleted`, `MnemonicWalletSubproviderConfigs`, LedgerGetAddressResult, `JSONRPCRequestPayload`, `Provider`, `JSONRPCResponsePayload` and `JSONRPCErrorCallback`", + "pr": 924 + } + ] + }, { "timestamp": 1534210131, "version": "1.0.5", -- cgit v1.2.3 From b7c119b2aaaa2f3579ca4aeef198eca7f38f1216 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 18:52:17 +0100 Subject: Fix many linter errors that showed up upon upgrading tsutil --- packages/subproviders/src/subproviders/subprovider.ts | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts index 53a3d07ea..dcf880c79 100644 --- a/packages/subproviders/src/subproviders/subprovider.ts +++ b/packages/subproviders/src/subproviders/subprovider.ts @@ -53,6 +53,8 @@ export abstract class Subprovider { */ public async emitPayloadAsync(payload: Partial): Promise { const finalPayload = Subprovider._createFinalPayload(payload); + // Promisify does the binding internally and `this` is supplied as a second argument + // tslint:disable-next-line:no-unbound-method const response = await promisify(this.engine.sendAsync, this.engine)(finalPayload); return response; } -- cgit v1.2.3 From 69b436babee4959a0bb6b5c78e3ea26e2a2f9720 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 22 Aug 2018 23:13:59 +0100 Subject: Refactor publish script so that root package.json configs.packagesWithDocs is canonical source of which packages have doc pages --- packages/subproviders/package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 8b8c06c25..38b99c976 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -25,8 +25,7 @@ }, "config": { "postpublish": { - "assets": [], - "shouldPublishDocs": true + "assets": [] } }, "dependencies": { -- cgit v1.2.3 From 0577ab96b8056b05dca1024227af53dad4ef5322 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 23 Aug 2018 14:29:22 +0100 Subject: Upgrade Typedoc to 0.12.0, which works with TS 3.x --- packages/subproviders/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 38b99c976..521785998 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -71,7 +71,7 @@ "shx": "^0.2.2", "sinon": "^4.0.0", "tslint": "5.11.0", - "typedoc": "0xProject/typedoc", + "typedoc": "0.12.0", "typescript": "3.0.1", "webpack": "^3.1.0" }, -- cgit v1.2.3 From 52e2c603619338c6c963c1bca92a799383a2c4f4 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 23 Aug 2018 15:12:34 +0100 Subject: Improve doc commebnt --- packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts index 17fe59368..6afd71422 100644 --- a/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/eth_lightwallet_subprovider.ts @@ -15,9 +15,10 @@ export class EthLightwalletSubprovider extends BaseWalletSubprovider { private readonly _keystore: lightwallet.keystore; private readonly _pwDerivedKey: Uint8Array; /** - * + * Instantiate an EthLightwalletSubprovider * @param keystore The EthLightWallet keystore you wish to use * @param pwDerivedKey The password derived key to use + * @return EthLightwalletSubprovider instance */ constructor(keystore: lightwallet.keystore, pwDerivedKey: Uint8Array) { super(); -- cgit v1.2.3 From 1ca176e992d821f6cea366c3177c0e568c823e6c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 23 Aug 2018 15:12:43 +0100 Subject: Remove excessive timestamp --- packages/subproviders/CHANGELOG.json | 1 - 1 file changed, 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.json b/packages/subproviders/CHANGELOG.json index e474826e4..bdda74c27 100644 --- a/packages/subproviders/CHANGELOG.json +++ b/packages/subproviders/CHANGELOG.json @@ -1,6 +1,5 @@ [ { - "timestamp": 1534210131, "version": "2.0.0", "changes": [ { -- cgit v1.2.3