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
This commit is contained in:
bumi 2019-03-29 12:08:07 +01:00
parent 38079d07db
commit c568263fea
2 changed files with 9 additions and 2 deletions

View File

@ -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"

View File

@ -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);
}
}
)