From c568263feaa3ed685238cb6b46fb671cb6efa90d Mon Sep 17 00:00:00 2001 From: Michael Bumann Date: Fri, 29 Mar 2019 12:08:07 +0100 Subject: [PATCH] update eth-provider to support different providers Ideally eth-provider checks which connection is available and uses the available one. frame => local node => infura But it seems there is still a bug and it raises an error if frame is not available. But at least we can use frame now for testnet/mainnet deployments --- package.json | 2 +- truffle.js | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 8906dbc..9d7f9ba 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "@aragon/kits-base": "^1.0.0", "@aragon/os": "^4.1.0", "async-each-series": "^1.1.0", - "eth-provider": "^0.2.1", + "eth-provider": "^0.2.2", "openzeppelin-solidity": "^2.2.0", "promptly": "^3.0.3", "solc": "^0.4.25" diff --git a/truffle.js b/truffle.js index 205fc3c..a162489 100644 --- a/truffle.js +++ b/truffle.js @@ -21,7 +21,14 @@ const providerForNetwork = (network) => ( if (settings) { return new HDWalletProviderPrivkey(settings.keys, settings.rpc) } else { - return provider('frame'); + let preset; + if (network === 'mainnet') { + preset = 'infura'; + } else { + let [first, ...rest] = network; + preset = `infura${first.toUpperCase()}${rest.join('')}`; + } + return provider('frame', 'local', preset); } } )