aboutsummaryrefslogtreecommitdiffstats
path: root/packages/dev-utils
diff options
context:
space:
mode:
Diffstat (limited to 'packages/dev-utils')
-rw-r--r--packages/dev-utils/CHANGELOG.json9
-rw-r--r--packages/dev-utils/src/web3_factory.ts6
2 files changed, 14 insertions, 1 deletions
diff --git a/packages/dev-utils/CHANGELOG.json b/packages/dev-utils/CHANGELOG.json
index b5dd3732d..8faf71d6a 100644
--- a/packages/dev-utils/CHANGELOG.json
+++ b/packages/dev-utils/CHANGELOG.json
@@ -1,5 +1,14 @@
[
{
+ "version": "0.3.6",
+ "changes": [
+ {
+ "note": "Allow an rpcURL to be set in Web3Config (for testnet RPC endpoints)",
+ "pr": 524
+ }
+ ]
+ },
+ {
"timestamp": 1523462196,
"version": "0.3.5",
"changes": [
diff --git a/packages/dev-utils/src/web3_factory.ts b/packages/dev-utils/src/web3_factory.ts
index f45c36930..68348d671 100644
--- a/packages/dev-utils/src/web3_factory.ts
+++ b/packages/dev-utils/src/web3_factory.ts
@@ -26,6 +26,7 @@ import * as Web3 from 'web3';
export interface Web3Config {
hasAddresses?: boolean; // default: true
shouldUseInProcessGanache?: boolean; // default: false
+ rpcUrl?: string; // default: localhost:8545
}
export const web3Factory = {
@@ -53,6 +54,9 @@ export const web3Factory = {
};
const shouldUseInProcessGanache = !!config.shouldUseInProcessGanache;
if (shouldUseInProcessGanache) {
+ if (!_.isUndefined(config.rpcUrl)) {
+ throw new Error('Cannot use both GanacheSubrovider and RPCSubprovider');
+ }
provider.addProvider(
new GanacheSubprovider({
logger,
@@ -65,7 +69,7 @@ export const web3Factory = {
} else {
provider.addProvider(
new RpcSubprovider({
- rpcUrl: constants.RPC_URL,
+ rpcUrl: config.rpcUrl || constants.RPC_URL,
}),
);
}