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

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