From 7f257e258f5d5dedc9bc1edbd38180cc872bc2a0 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 2 Feb 2018 14:44:29 -0800 Subject: Change the InjectedWeb3Subprovider to accept Web3.Provider --- packages/subproviders/src/subproviders/injected_web3.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts index bd29acb22..238ba89f8 100644 --- a/packages/subproviders/src/subproviders/injected_web3.ts +++ b/packages/subproviders/src/subproviders/injected_web3.ts @@ -1,17 +1,16 @@ import * as _ from 'lodash'; import Web3 = require('web3'); -import Web3ProviderEngine = require('web3-provider-engine'); /* * This class implements the web3-provider-engine subprovider interface and forwards * requests involving user accounts (getAccounts, sendTransaction, etc...) to the injected - * web3 instance in their browser. + * MetamaskInpageProvider instance in their browser. * Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js */ export class InjectedWeb3Subprovider { private _injectedWeb3: Web3; - constructor(injectedWeb3: Web3) { - this._injectedWeb3 = injectedWeb3; + constructor(subprovider: Web3.Provider) { + this._injectedWeb3 = new Web3(subprovider); } public handleRequest( payload: Web3.JSONRPCRequestPayload, @@ -43,7 +42,7 @@ export class InjectedWeb3Subprovider { } // Required to implement this method despite not needing it for this subprovider // tslint:disable-next-line:prefer-function-over-method - public setEngine(engine: Web3ProviderEngine) { + public setEngine(engine: any) { // noop } } -- cgit v1.2.3 From 5aca3a2d7d8ebbdb0fcb2bcee771068a553dae8a Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Fri, 2 Feb 2018 14:53:44 -0800 Subject: Changelog --- packages/subproviders/CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/CHANGELOG.md b/packages/subproviders/CHANGELOG.md index 0469150c0..6ee8e2455 100644 --- a/packages/subproviders/CHANGELOG.md +++ b/packages/subproviders/CHANGELOG.md @@ -1,6 +1,10 @@ # CHANGELOG -## v0.4.0 - _January 28, 2017_ +## v0.4.0 - _Feburary 02, 2018_ + + * InjectedWeb3Subprovider accepts a Provider in the constructor, previously it was a Web3 object. + +## v0.3.5 - _January 28, 2018_ * Return a transaction hash from `_sendTransactionAsync` (#303) -- cgit v1.2.3 From 2205e2b9a0dab345a14724731098043d04827c4f Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 5 Feb 2018 22:29:42 +0100 Subject: Publish - 0x.js@0.32.0 - @0xproject/abi-gen@0.1.7 - @0xproject/assert@0.0.16 - @0xproject/connect@0.5.5 - contracts@2.1.9 - @0xproject/deployer@0.0.6 - @0xproject/dev-utils@0.0.10 - @0xproject/json-schemas@0.7.8 - @0xproject/monorepo-scripts@0.1.9 - @0xproject/subproviders@0.3.6 - @0xproject/testnet-faucets@1.0.10 - @0xproject/tslint-config@0.4.7 - @0xproject/types@0.1.9 - @0xproject/utils@0.3.0 - web3-typescript-typings@0.9.9 - @0xproject/web3-wrapper@0.1.10 - @0xproject/website@0.0.12 --- packages/subproviders/package.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json index 18ba247ea..4310f8d4a 100644 --- a/packages/subproviders/package.json +++ b/packages/subproviders/package.json @@ -1,6 +1,6 @@ { "name": "@0xproject/subproviders", - "version": "0.3.5", + "version": "0.3.6", "main": "lib/src/index.js", "types": "lib/src/index.d.ts", "license": "Apache-2.0", @@ -18,8 +18,8 @@ "test:integration": "run-s clean build run_mocha_integration" }, "dependencies": { - "@0xproject/assert": "^0.0.15", - "@0xproject/utils": "^0.2.4", + "@0xproject/assert": "^0.0.16", + "@0xproject/utils": "^0.3.0", "bn.js": "^4.11.8", "es6-promisify": "^5.0.0", "ethereumjs-tx": "^1.3.3", @@ -32,8 +32,8 @@ "web3-provider-engine": "^13.0.1" }, "devDependencies": { - "@0xproject/tslint-config": "^0.4.6", - "@0xproject/utils": "^0.2.4", + "@0xproject/tslint-config": "^0.4.7", + "@0xproject/utils": "^0.3.0", "@types/lodash": "^4.14.86", "@types/mocha": "^2.2.42", "@types/node": "^8.0.53", @@ -50,7 +50,7 @@ "types-bn": "^0.0.1", "types-ethereumjs-util": "0xproject/types-ethereumjs-util", "typescript": "2.7.1", - "web3-typescript-typings": "^0.9.8", + "web3-typescript-typings": "^0.9.9", "webpack": "^3.1.0" } } -- cgit v1.2.3 From 882816d60958f0e7d1b1aa06dc214ebdcfc53e2a Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 5 Feb 2018 13:46:59 -0800 Subject: Justify the any usage --- packages/subproviders/src/subproviders/injected_web3.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts index 238ba89f8..a74a6c4b2 100644 --- a/packages/subproviders/src/subproviders/injected_web3.ts +++ b/packages/subproviders/src/subproviders/injected_web3.ts @@ -4,7 +4,7 @@ import Web3 = require('web3'); /* * This class implements the web3-provider-engine subprovider interface and forwards * requests involving user accounts (getAccounts, sendTransaction, etc...) to the injected - * MetamaskInpageProvider instance in their browser. + * provider instance in their browser. * Source: https://github.com/MetaMask/provider-engine/blob/master/subproviders/subprovider.js */ export class InjectedWeb3Subprovider { @@ -41,6 +41,7 @@ export class InjectedWeb3Subprovider { } } // Required to implement this method despite not needing it for this subprovider + // This type is Web3ProviderEngine, but there is no need to import this for a noop. // tslint:disable-next-line:prefer-function-over-method public setEngine(engine: any) { // noop -- cgit v1.2.3 From d14ae70776e82c8a61e1c41219c40ec283890a8a Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 5 Feb 2018 13:55:01 -0800 Subject: Link to the wiki article in the README --- packages/subproviders/README.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'packages/subproviders') diff --git a/packages/subproviders/README.md b/packages/subproviders/README.md index d7b80f7ee..84cab5601 100644 --- a/packages/subproviders/README.md +++ b/packages/subproviders/README.md @@ -2,6 +2,8 @@ A few useful web3 subproviders including a LedgerSubprovider useful for adding Ledger Nano S support. +We have written up a [Wiki](https://0xproject.com/wiki#Web3-Provider-Examples) article detailing some use cases of this subprovider package. + ## Installation ``` -- cgit v1.2.3 From cf171d28c70c49541a30534d2593a623dd126f24 Mon Sep 17 00:00:00 2001 From: Jacob Evans Date: Mon, 5 Feb 2018 17:20:45 -0800 Subject: Reword comment on any --- packages/subproviders/src/subproviders/injected_web3.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'packages/subproviders') diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts index a74a6c4b2..0d70180c4 100644 --- a/packages/subproviders/src/subproviders/injected_web3.ts +++ b/packages/subproviders/src/subproviders/injected_web3.ts @@ -41,7 +41,8 @@ export class InjectedWeb3Subprovider { } } // Required to implement this method despite not needing it for this subprovider - // This type is Web3ProviderEngine, but there is no need to import this for a noop. + // The engine argument type should be Web3ProviderEngine, but we've decided to keep it as type any + // to remove the provider engine depdency given this method is a noop // tslint:disable-next-line:prefer-function-over-method public setEngine(engine: any) { // noop -- cgit v1.2.3