Skip to content

A Golang library used to fetch Ethereum Gas Prices from different gas price providers.

License

Notifications You must be signed in to change notification settings

OsoianMarcel/egpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EGPP - Ethereum Gas Price Provider

A Golang library used to fetch Ethereum Gas Prices from different gas price providers.

Build Status GoDev license

Basic example

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}
}

Contribute

Contributions to the package are always welcome!

License

All contents of this package are licensed under the MIT license.

About

A Golang library used to fetch Ethereum Gas Prices from different gas price providers.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages