Skip to content

Commit

Permalink
add providerETH and source url from config #21
Browse files Browse the repository at this point in the history
  • Loading branch information
zemse committed May 27, 2020
1 parent 45229ac commit 3712752
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ global.consoleLog = (...input) => {
}
};

const providerEsn: ethers.providers.JsonRpcProvider = new ethers.providers.JsonRpcProvider(
process.env.ESN_URL
);

global.providerEsn = providerEsn;

global.peerList = new PeerList();

// TODO use minimist package in this case
Expand Down Expand Up @@ -50,6 +44,15 @@ global.config = {
: null,
};

// loading providers
global.providerEsn = new ethers.providers.JsonRpcProvider(
global.config.ESN_URL.toString()
);
global.providerETH = new ethers.providers.JsonRpcProvider(
global.config.ETH_URL.toString()
);

// loading wallet
if (
typeof global.config.KEYSTORE_PATH === 'string' &&
typeof global.config.KEYSTORE_PASSWORD_PATH === 'string'
Expand Down
1 change: 1 addition & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare global {
interface Global {
consoleLog: (...input: any) => void;
providerEsn: ethers.providers.JsonRpcProvider;
providerETH: ethers.providers.JsonRpcProvider;
config: {
ETH_URL: URLMask;
ESN_URL: URLMask;
Expand Down

0 comments on commit 3712752

Please sign in to comment.