From 83d84235e09a913a6b1351d1612309dd656cbe24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Fri, 16 Feb 2018 13:07:26 +0100 Subject: [PATCH] Fix web3-subprovider to return subprovider (no longer async) --- packages/create-dapp/template/package.json | 2 +- packages/create-dapp/template/src/wallets.js | 4 ++-- packages/web3-subprovider/src/index.js | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/create-dapp/template/package.json b/packages/create-dapp/template/package.json index 59777d034..92e564ca5 100644 --- a/packages/create-dapp/template/package.json +++ b/packages/create-dapp/template/package.json @@ -8,7 +8,7 @@ "react-scripts": "1.1.0", "truffle-contract": "^3.0.3", "prop-types": "^15.2.0", - "@ledgerhq/web3-subprovider": "^4.0.0", + "@ledgerhq/web3-subprovider": "^4.1.0", "@ledgerhq/hw-transport-u2f": "^4.0.0", "web3": "^1.0.0-beta.29" }, diff --git a/packages/create-dapp/template/src/wallets.js b/packages/create-dapp/template/src/wallets.js index 37e9d05a3..dec86a4e2 100644 --- a/packages/create-dapp/template/src/wallets.js +++ b/packages/create-dapp/template/src/wallets.js @@ -20,10 +20,10 @@ export default [ { name: "Ledger device", // create a web3 with the ledger device - getWeb3: async () => { + getWeb3: () => { const engine = new ProviderEngine(); const getTransport = () => TransportU2F.create(); - const ledger = await createLedgerSubprovider(getTransport, { + const ledger = createLedgerSubprovider(getTransport, { networkId, accountsLength: 5 }); diff --git a/packages/web3-subprovider/src/index.js b/packages/web3-subprovider/src/index.js index 44d8f527d..1c3e78ce4 100644 --- a/packages/web3-subprovider/src/index.js +++ b/packages/web3-subprovider/src/index.js @@ -69,7 +69,7 @@ engine.addProvider(new RpcSubprovider({ rpcUrl })); engine.start(); const web3 = new Web3(engine); */ -export default async function createLedgerSubprovider( +export default function createLedgerSubprovider( getTransport: () => Transport<*>, options?: SubproviderOptions ): HookedWalletSubprovider { @@ -191,5 +191,6 @@ export default async function createLedgerSubprovider( .catch(err => callback(err, null)); } }); + return subprovider; }