A Golang library used to fetch Ethereum Gas Prices from different gas price providers.
package main
import (
"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}
}
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.
All contents of this package are licensed under the MIT license.