From 32a712e1db9702ae5efc588fc6a1853723dde259 Mon Sep 17 00:00:00 2001 From: Ayanami Date: Tue, 7 Jun 2022 15:38:55 +0900 Subject: [PATCH] Customizable ethers provider --- src/TxManager.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/TxManager.js b/src/TxManager.js index d6d4864..bb796dd 100644 --- a/src/TxManager.js +++ b/src/TxManager.js @@ -21,10 +21,10 @@ const defaultConfig = { } class TxManager { - constructor({ privateKey, rpcUrl, broadcastNodes = [], config = {}, gasPriceOracleConfig = {} }) { + constructor({ privateKey, rpcUrl, broadcastNodes = [], config = {}, gasPriceOracleConfig = {}, provider }) { this.config = Object.assign({ ...defaultConfig }, config) this._privateKey = privateKey.startsWith('0x') ? privateKey : '0x' + privateKey - this._provider = new ethers.providers.JsonRpcProvider(rpcUrl) + this._provider = provider || new ethers.providers.JsonRpcProvider(rpcUrl) this._wallet = new ethers.Wallet(this._privateKey, this._provider) this.address = this._wallet.address this._broadcastNodes = broadcastNodes