mirror of
https://github.com/tornadocash/tx-manager.git
synced 2024-12-04 23:05:16 +01:00
Customizable ethers provider
This commit is contained in:
parent
142ce883b4
commit
32a712e1db
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user