This commit is contained in:
Péter Szilágyi 2016-03-31 16:46:52 +00:00
commit af059ce2da
3 changed files with 16 additions and 0 deletions

View file

@ -98,6 +98,11 @@ func NewPublicEthereumAPI(e *Ethereum) *PublicEthereumAPI {
return &PublicEthereumAPI{e, NewGasPriceOracle(e)} return &PublicEthereumAPI{e, NewGasPriceOracle(e)}
} }
// MinGasPrice returns te currently configured minimum gas price.
func (s *PublicEthereumAPI) MinGasPrice() *big.Int {
return s.gpo.MinimumPrice()
}
// GasPrice returns a suggestion for a gas price. // GasPrice returns a suggestion for a gas price.
func (s *PublicEthereumAPI) GasPrice() *big.Int { func (s *PublicEthereumAPI) GasPrice() *big.Int {
return s.gpo.SuggestPrice() return s.gpo.SuggestPrice()

View file

@ -194,6 +194,12 @@ func (self *GasPriceOracle) lowestPrice(block *types.Block) *big.Int {
return minPrice return minPrice
} }
// MinimumPrice returns the configured minimum price that the oracle will ever
// return. This can be used as a bottom limit on UIs for fee selection sliders.
func (self *GasPriceOracle) MinimumPrice() *big.Int {
return new(big.Int).Set(self.minPrice)
}
// SuggestPrice returns the recommended gas price. // SuggestPrice returns the recommended gas price.
func (self *GasPriceOracle) SuggestPrice() *big.Int { func (self *GasPriceOracle) SuggestPrice() *big.Int {
self.init() self.init()

View file

@ -251,6 +251,11 @@ web3._extend({
new web3._extend.Property({ new web3._extend.Property({
name: 'pendingTransactions', name: 'pendingTransactions',
getter: 'eth_pendingTransactions' getter: 'eth_pendingTransactions'
}),
new web3._extend.Property({
name: 'minGasPrice',
getter: 'eth_minGasPrice',
outputFormatter: web3._extend.formatters.outputBigNumberFormatter
}) })
] ]
}); });