https://github.com/osoianmarcel/egpp
A Golang library used to fetch Ethereum Gas Prices from different gas price providers.
https://github.com/osoianmarcel/egpp
client ethereum gas go golang http library price providers
Last synced: 7 months ago
JSON representation
A Golang library used to fetch Ethereum Gas Prices from different gas price providers.
- Host: GitHub
- URL: https://github.com/osoianmarcel/egpp
- Owner: OsoianMarcel
- License: mit
- Created: 2020-04-12T19:31:40.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-05T20:04:46.000Z (almost 3 years ago)
- Last Synced: 2024-12-26T02:06:49.381Z (10 months ago)
- Topics: client, ethereum, gas, go, golang, http, library, price, providers
- Language: Go
- Homepage:
- Size: 16.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- License: LICENSE
Awesome Lists containing this project
README
# EGPP - Ethereum Gas Price Provider
A Golang library used to fetch **Ethereum Gas Prices** from different gas price providers.[](https://app.travis-ci.com/OsoianMarcel/egpp)
[](https://pkg.go.dev/github.com/OsoianMarcel/egpp)
[](https://github.com/OsoianMarcel/egpp/blob/master/LICENSE)## Basic example
```go
package mainimport (
"fmt"
"log""github.com/OsoianMarcel/egpp"
"github.com/OsoianMarcel/egpp/common"
"github.com/OsoianMarcel/egpp/providers/etherchain"
"github.com/OsoianMarcel/egpp/providers/ethergasstation"
"github.com/OsoianMarcel/egpp/providers/etherscan"
)func main() {
// Gas price providers
providers := []common.Provider{
ethergasstation.NewProvider(),
etherchain.NewProvider(),
etherscan.NewProvider(""),
}// Requests the gas price values from providers in order and returns the first successful result
gasPriceStruct, err := egpp.GetGasPriceWithFallback(providers)
if err != nil {
log.Fatal(err)
}fmt.Printf("%+v\n", gasPriceStruct)
// {Provider:Ether Gas Station Standard:9800 SafeLow:9200 Fast:14300 Fastest:14300}
}
```## Contribute
Contributions to the package are always welcome!
* Report any bugs or issues you find on the [issue tracker].
* You can grab the source code at the package's [Git repository].## License
All contents of this package are licensed under the [MIT license].
[issue tracker]: https://github.com/OsoianMarcel/egpp/issues
[Git repository]: https://github.com/OsoianMarcel/egpp
[MIT license]: LICENSE