diff --git a/src/global.ts b/src/global.ts index 37749f0..458664a 100644 --- a/src/global.ts +++ b/src/global.ts @@ -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 @@ -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' diff --git a/src/types/global.d.ts b/src/types/global.d.ts index 91df02d..2f7b370 100644 --- a/src/types/global.d.ts +++ b/src/types/global.d.ts @@ -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;