Skip to content

Commit

Permalink
Merge pull request #552 from eco-stake/improve-keplr-gas-price-step
Browse files Browse the repository at this point in the history
Improve Keplr default gas price step
  • Loading branch information
tombeynon authored Jul 9, 2022
2 parents 0ee6fab + 72b0cf0 commit 69e3fd8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@
},
{
"name": "genesisl1",
"gasPrice": "200000el1",
"txTimeout": 120000
}
]
10 changes: 9 additions & 1 deletion src/utils/Network.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import _ from 'lodash'
import { multiply, pow, format, bignumber } from 'mathjs'
import {
GasPrice,
} from "@cosmjs/stargate";
import QueryClient from './QueryClient.mjs'
import SigningClient from './SigningClient.mjs'
import Validator from './Validator.mjs'
Expand Down Expand Up @@ -80,7 +83,12 @@ class Network {
this.authzSupport = this.chain.authzSupport
this.defaultGasPrice = format(bignumber(multiply(0.000000025, pow(10, this.decimals))), { notation: 'fixed', precision: 4}) + this.denom
this.gasPrice = this.data.gasPrice || this.defaultGasPrice
this.gasPriceStep = this.data.gasPriceStep
this.gasPriceAmount = GasPrice.fromString(this.gasPrice).amount.toString()
this.gasPriceStep = this.data.gasPriceStep || {
"low": multiply(this.gasPriceAmount, 0.5),
"average": multiply(this.gasPriceAmount, 1),
"high": multiply(this.gasPriceAmount, 2)
}
this.gasPricePrefer = this.data.gasPricePrefer
this.gasModifier = this.data.gasModifier || 1.5
this.txTimeout = this.data.txTimeout || 60_000
Expand Down

0 comments on commit 69e3fd8

Please sign in to comment.