Skip to content

Commit bae215e

Browse files
committed
Added defaultProvider option to omit specific Providers.
1 parent 54e6e57 commit bae215e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

packages/networks/src.ts/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,25 @@ function ethDefaultProvider(network: string | Network): Renetworkable {
2626
if (options == null) { options = { }; }
2727
const providerList: Array<any> = [];
2828

29-
if (providers.InfuraProvider) {
29+
if (providers.InfuraProvider && options.infura !== "-") {
3030
try {
3131
providerList.push(new providers.InfuraProvider(network, options.infura));
3232
} catch(error) { }
3333
}
3434

35-
if (providers.EtherscanProvider) {
35+
if (providers.EtherscanProvider && options.etherscan !== "-") {
3636
try {
3737
providerList.push(new providers.EtherscanProvider(network, options.etherscan));
3838
} catch(error) { }
3939
}
4040

41-
if (providers.AlchemyProvider) {
41+
if (providers.AlchemyProvider && options.alchemy !== "-") {
4242
try {
4343
providerList.push(new providers.AlchemyProvider(network, options.alchemy));
4444
} catch(error) { }
4545
}
4646

47-
if (providers.PocketProvider) {
47+
if (providers.PocketProvider && options.pocket !== "-") {
4848
// These networks are currently faulty on Pocket as their
4949
// network does not handle the Berlin hardfork, which is
5050
// live on these ones.
@@ -58,7 +58,7 @@ function ethDefaultProvider(network: string | Network): Renetworkable {
5858
} catch(error) { }
5959
}
6060

61-
if (providers.CloudflareProvider) {
61+
if (providers.CloudflareProvider && options.cloudflare !== "-") {
6262
try {
6363
providerList.push(new providers.CloudflareProvider(network));
6464
} catch(error) { }

0 commit comments

Comments
 (0)