add gasPriceOracleConfig
This commit is contained in:
parent
f6a4e93a23
commit
72a665a19a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tx-manager",
|
||||
"version": "0.2.9",
|
||||
"version": "0.3.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -23,7 +23,7 @@
|
||||
"dependencies": {
|
||||
"async-mutex": "^0.2.4",
|
||||
"ethers": "^5.0.17",
|
||||
"gas-price-oracle": "^0.2.2",
|
||||
"gas-price-oracle": "^0.3.1",
|
||||
"web3-core-promievent": "^1.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
@ -18,14 +18,14 @@ const defaultConfig = {
|
||||
}
|
||||
|
||||
class TxManager {
|
||||
constructor({ privateKey, rpcUrl, broadcastNodes = [], config = {} }) {
|
||||
constructor({ privateKey, rpcUrl, broadcastNodes = [], config = {}, gasPriceOracleConfig = {} }) {
|
||||
this.config = Object.assign({ ...defaultConfig }, config)
|
||||
this._privateKey = privateKey.startsWith('0x') ? privateKey : '0x' + privateKey
|
||||
this._provider = new ethers.providers.JsonRpcProvider(rpcUrl)
|
||||
this._wallet = new ethers.Wallet(this._privateKey, this._provider)
|
||||
this.address = this._wallet.address
|
||||
this._broadcastNodes = broadcastNodes
|
||||
this._gasPriceOracle = new GasPriceOracle({ defaultRpc: rpcUrl })
|
||||
this._gasPriceOracle = new GasPriceOracle({ defaultRpc: rpcUrl, ...gasPriceOracleConfig })
|
||||
this._mutex = new Mutex()
|
||||
this._nonce = null
|
||||
}
|
||||
|
@ -1141,10 +1141,10 @@ functional-red-black-tree@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
|
||||
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=
|
||||
|
||||
gas-price-oracle@^0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.2.2.tgz#32c57a9aa6bc69152be96812880232efebfecbc6"
|
||||
integrity sha512-I4+rLbc7C1vgYXV+cYY0MKeqdZVna2hXpNfD2fcIvf/wIgvtIYmG9gsmhiaYGSgOE2RSPUs2xf/W4K2nJOoNuQ==
|
||||
gas-price-oracle@^0.3.1:
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/gas-price-oracle/-/gas-price-oracle-0.3.1.tgz#4977de5edfa49ae17defad0e0d06f9a67bdf2cc6"
|
||||
integrity sha512-v82AEeQVnO4lGKoJbRqLI9YdOVoImBorYDSOMTGZZAF+RNC89fdTsbhLQVsI/1Zsduqcpiz4VqlQ/4I8wwCbAg==
|
||||
dependencies:
|
||||
axios "^0.19.2"
|
||||
bignumber.js "^9.0.0"
|
||||
|
Loading…
Reference in New Issue
Block a user