From 3db42deb426580d204bcd73d957b64ac556a6e6c Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 10:20:30 +0100 Subject: Make web3 typings a dep for subproviders --- packages/subproviders/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 5e9c2ed89..250a608ef 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -30,7 +30,8 @@ "lodash": "^4.17.4", "semaphore-async-await": "^1.5.1", "web3": "^0.20.0", - "web3-provider-engine": "^13.0.1" + "web3-typescript-typings": "^0.9.11", + "web3-provider-engine": "^13.0.1", }, "devDependencies": { "@0xproject/tslint-config": "^0.4.9", @@ -51,7 +52,6 @@ "types-bn": "^0.0.1", "types-ethereumjs-util": "0xProject/types-ethereumjs-util", "typescript": "2.7.1", - "web3-typescript-typings": "^0.9.11", "webpack": "^3.1.0" } } -- cgit v1.2.3 From 6d56f01c40d6a1852f10d1391f144478f3c0339f Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 10:28:51 +0100 Subject: Remove extra comma --- 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 250a608ef..6b702fcb3 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -31,7 +31,7 @@ "semaphore-async-await": "^1.5.1", "web3": "^0.20.0", "web3-typescript-typings": "^0.9.11", - "web3-provider-engine": "^13.0.1", + "web3-provider-engine": "^13.0.1" }, "devDependencies": { "@0xproject/tslint-config": "^0.4.9", -- cgit v1.2.3 From e5c755b1fce92db572ada978e591bc8933811d23 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 10:29:14 +0100 Subject: Add changelog entry to subproviders --- packages/subproviders/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index c2d590a35..3be8cdbe3 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.6.0 - _TBD_ + + * Move web3 types from being a devDep to a dep since one cannot use this package without it. + ## v0.5.0 - _February 16, 2018_ * Add EmptyWalletSubprovider and FakeGasEstimateSubprovider (#392) -- cgit v1.2.3 From 8eafa62bbeae2f636b40de2c5c21f1ade70eb2ae Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sat, 3 Mar 2018 10:36:53 +0100 Subject: Add PR number --- packages/subproviders/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 3be8cdbe3..c1288e2b5 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -2,7 +2,7 @@ ## v0.6.0 - _TBD_ - * Move web3 types from being a devDep to a dep since one cannot use this package without it. + * Move web3 types from being a devDep to a dep since one cannot use this package without it (#429) ## v0.5.0 - _February 16, 2018_ -- cgit v1.2.3 From 86e26240a1995eac85178c277a227d75221077f6 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 15:52:16 +0100 Subject: Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` and add tests --- packages/subproviders/src/subproviders/ledger.ts | 6 +++--- .../subproviders/test/integration/ledger_subprovider_test.ts | 10 ++++++++-- packages/subproviders/test/unit/ledger_subprovider_test.ts | 8 +++++++- 3 files changed, 18 insertions(+), 6 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts index 5966a88bb..85cdf0efc 100644 --- a/packages/subproviders/src/subproviders/ledger.ts +++ b/packages/subproviders/src/subproviders/ledger.ts @@ -19,7 +19,7 @@ import { import { Subprovider } from './subprovider'; const DEFAULT_DERIVATION_PATH = `44'/60'/0'`; -const NUM_ADDRESSES_TO_FETCH = 10; +const DEFAULT_NUM_ADDRESSES_TO_FETCH = 10; const ASK_FOR_ON_DEVICE_CONFIRMATION = false; const SHOULD_GET_CHAIN_CODE = true; @@ -129,7 +129,7 @@ export class LedgerSubprovider extends Subprovider { return; } } - public async getAccountsAsync(): Promise { + public async getAccountsAsync(numberOfAccounts: number = DEFAULT_NUM_ADDRESSES_TO_FETCH): Promise { this._ledgerClientIfExists = await this._createLedgerClientAsync(); let ledgerResponse; @@ -148,7 +148,7 @@ export class LedgerSubprovider extends Subprovider { hdKey.chainCode = new Buffer(ledgerResponse.chainCode, 'hex'); const accounts = []; - for (let i = 0; i < NUM_ADDRESSES_TO_FETCH; i++) { + for (let i = 0; i < numberOfAccounts; i++) { const derivedHDNode = hdKey.derive(`m/${i + this._derivationPathIndex}`); const derivedPublicKey = derivedHDNode.publicKey; const shouldSanitizePublicKey = true; diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index 628b532d7..e17ededee 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -26,11 +26,17 @@ describe('LedgerSubprovider', () => { }); }); describe('direct method calls', () => { - it('returns a list of accounts', async () => { + it('returns defaut number of accounts', async () => { const accounts = await ledgerSubprovider.getAccountsAsync(); expect(accounts[0]).to.not.be.an('undefined'); expect(accounts.length).to.be.equal(10); }); + it('returns requested number of accounts', async () => { + const numberOfAccounts = 20; + const accounts = await ledgerSubprovider.getAccountsAsync(numberOfAccounts); + expect(accounts[0]).to.not.be.an('undefined'); + expect(accounts.length).to.be.equal(numberOfAccounts); + }); it('signs a personal message', async () => { const data = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); const ecSignatureHex = await ledgerSubprovider.signPersonalMessageAsync(data); @@ -172,7 +178,7 @@ describe('LedgerSubprovider', () => { }; const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { expect(err).to.be.a('null'); - const result = response.result.result; + const result = response.result; expect(result.length).to.be.equal(66); expect(result.substr(0, 2)).to.be.equal('0x'); done(); diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index 1c70dd3a6..6c589dffe 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -62,11 +62,17 @@ describe('LedgerSubprovider', () => { }); describe('direct method calls', () => { describe('success cases', () => { - it('returns a list of accounts', async () => { + it('returns defaut number of accounts', async () => { const accounts = await ledgerSubprovider.getAccountsAsync(); expect(accounts[0]).to.be.equal(FAKE_ADDRESS); expect(accounts.length).to.be.equal(10); }); + it('returns requested number of accounts', async () => { + const numberOfAccounts = 20; + const accounts = await ledgerSubprovider.getAccountsAsync(numberOfAccounts); + expect(accounts[0]).to.be.equal(FAKE_ADDRESS); + expect(accounts.length).to.be.equal(numberOfAccounts); + }); it('signs a personal message', async () => { const data = ethUtils.bufferToHex(ethUtils.toBuffer('hello world')); const ecSignatureHex = await ledgerSubprovider.signPersonalMessageAsync(data); -- cgit v1.2.3 From 02f82be094dbaf92a1ae6752b9f05dbf6188cf86 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 15:52:52 +0100 Subject: Add changelog update to subproviders package --- packages/subproviders/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index c2d590a35..e9899363e 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## v0.5.1 - _TBD, 2018_ + + * Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` + ## v0.5.0 - _February 16, 2018_ * Add EmptyWalletSubprovider and FakeGasEstimateSubprovider (#392) -- cgit v1.2.3 From 2bdd60ed725dab7ae892123060ebd9dd807cdb83 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 16:39:18 +0100 Subject: Add PR number to changelog entry --- packages/subproviders/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 0ae534746..c28fd564c 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -3,7 +3,7 @@ ## v0.6.0 - _TBD_ * Move web3 types from being a devDep to a dep since one cannot use this package without it (#429) - * Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` + * Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` (#432) ## v0.5.0 - _February 16, 2018_ -- cgit v1.2.3 From 925e133f509a9c422e0b1c45054687764d4d5208 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 16:42:16 +0100 Subject: Fix typo --- packages/subproviders/test/integration/ledger_subprovider_test.ts | 2 +- packages/subproviders/test/unit/ledger_subprovider_test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/test/integration/ledger_subprovider_test.ts b/packages/subproviders/test/integration/ledger_subprovider_test.ts index e17ededee..b052a76d2 100644 --- a/packages/subproviders/test/integration/ledger_subprovider_test.ts +++ b/packages/subproviders/test/integration/ledger_subprovider_test.ts @@ -26,7 +26,7 @@ describe('LedgerSubprovider', () => { }); }); describe('direct method calls', () => { - it('returns defaut number of accounts', async () => { + it('returns default number of accounts', async () => { const accounts = await ledgerSubprovider.getAccountsAsync(); expect(accounts[0]).to.not.be.an('undefined'); expect(accounts.length).to.be.equal(10); diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts index 6c589dffe..0d301bce9 100644 --- a/packages/subproviders/test/unit/ledger_subprovider_test.ts +++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts @@ -62,7 +62,7 @@ describe('LedgerSubprovider', () => { }); describe('direct method calls', () => { describe('success cases', () => { - it('returns defaut number of accounts', async () => { + it('returns default number of accounts', async () => { const accounts = await ledgerSubprovider.getAccountsAsync(); expect(accounts[0]).to.be.equal(FAKE_ADDRESS); expect(accounts.length).to.be.equal(10); -- cgit v1.2.3 From 47411b406d0bf37bdb1761897cfd09f9e1fee6de Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 17:02:50 +0100 Subject: Updated CHANGELOGS --- packages/subproviders/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index c28fd564c..7e1e006e3 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -1,6 +1,6 @@ # CHANGELOG -## v0.6.0 - _TBD_ +## v0.6.0 - _March 4, 2018_ * Move web3 types from being a devDep to a dep since one cannot use this package without it (#429) * Add `numberOfAccounts` param to `LedgerSubprovider` method `getAccountsAsync` (#432) -- cgit v1.2.3 From 65eb3997d93a666165a9df1cff25dbe3d0dd5712 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Sun, 4 Mar 2018 19:35:59 +0100 Subject: Publish - 0x.js@0.33.0 - @0xproject/abi-gen@0.2.4 - @0xproject/assert@0.1.0 - @0xproject/base-contract@0.0.2 - chai-as-promised-typescript-typings@0.0.10 - chai-typescript-typings@0.0.4 - @0xproject/connect@0.6.2 - contracts@2.1.14 - @0xproject/deployer@0.2.0 - @0xproject/dev-utils@0.2.0 - ethers-typescript-typings@0.0.2 - @0xproject/json-schemas@0.7.13 - @0xproject/monorepo-scripts@0.1.12 - @0xproject/subproviders@0.6.0 - @0xproject/testnet-faucets@1.0.15 - @0xproject/tslint-config@0.4.10 - @0xproject/types@0.3.0 - @0xproject/utils@0.4.0 - web3-typescript-typings@0.10.0 - @0xproject/web3-wrapper@0.2.0 - @0xproject/website@0.0.17 --- packages/subproviders/package.json | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 6b702fcb3..ec0642bce 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "0.5.0", + "version": "0.6.0", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "license": "Apache-2.0", @@ -18,9 +18,9 @@ "test:integration": "run-s clean build run_mocha_integration" }, "dependencies": { - "@0xproject/assert": "^0.0.20", - "@0xproject/types": "^0.2.3", - "@0xproject/utils": "^0.3.4", + "@0xproject/assert": "^0.1.0", + "@0xproject/types": "^0.3.0", + "@0xproject/utils": "^0.4.0", "bn.js": "^4.11.8", "es6-promisify": "^5.0.0", "ethereumjs-tx": "^1.3.3", @@ -30,20 +30,20 @@ "lodash": "^4.17.4", "semaphore-async-await": "^1.5.1", "web3": "^0.20.0", - "web3-typescript-typings": "^0.9.11", - "web3-provider-engine": "^13.0.1" + "web3-provider-engine": "^13.0.1", + "web3-typescript-typings": "^0.10.0" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.9", - "@0xproject/utils": "^0.3.4", + "@0xproject/tslint-config": "^0.4.10", + "@0xproject/utils": "^0.4.0", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", "awesome-typescript-loader": "^3.1.3", "chai": "^4.0.1", "chai-as-promised": "^7.1.0", - "chai-as-promised-typescript-typings": "^0.0.9", - "chai-typescript-typings": "^0.0.3", + "chai-as-promised-typescript-typings": "^0.0.10", + "chai-typescript-typings": "^0.0.4", "dirty-chai": "^2.0.1", "mocha": "^4.0.1", "npm-run-all": "^4.1.2", -- cgit v1.2.3 From 011bab3c80ec7b7a853e2e4b89473618f07e693d Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Mon, 5 Mar 2018 06:11:53 +0100 Subject: Add missing instructions to add external types to tsconfig.json after installing the package --- packages/subproviders/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/README.md b/packages/subproviders/README.md index 39e4a46e7..67a6a92d2 100644 --- a/packages/subproviders/README.md +++ b/packages/subproviders/README.md @@ -10,6 +10,14 @@ We have written up a [Wiki](https://0xproject.com/wiki#Web3-Provider-Examples) a yarn add @0xproject/subproviders ``` +If your project is in [TypeScript](https://www.typescriptlang.org/), add the following to your `tsconfig.json`: + +``` +"include": [ + "./node_modules/web3-typescript-typings/index.d.ts", +] +``` + ## Usage Simply import the subprovider you are interested in using: -- cgit v1.2.3