Skip to content

v1.0.0

Compare
Choose a tag to compare
@hrharder hrharder released this 03 Feb 17:53
· 2 commits to master since this release
8d9b0d9

Overview

Package gas provides two main ways to fetch a gas price from the ETH Gas Station API.

  1. Fetch the current recommended price for a given priority level with a new API call each time
    • Use gas.SuggestGasPrice for a specific priority level
    • Use gas.SuggestFastGasPrice to fetch the fast priority level (no arguments)
  2. Create a new GasPriceSuggester which maintains a cache of results for a user-defined duration
    • Use gas.NewGasPriceSuggester and specify a max result age
    • Use the returned function to fetch new gas prices, or use the cache based on how old the results are

New in v1

  • Adds a closure (NewGasPriceSuggester outer function) that allows user-defined max result age
    • Powered by gasPriceManager which maintains result cache, with max age
    • Thread safe inner function (of type GasPriceSuggester)
    • Adds tests for gasPriceManager which emulate functionality of NewGasPriceSuggester
  • Use float64 type for ETH Gas Station API results rather than json.Number
    • Allows simplification of private parsing method

Notes

  • Thanks to @jalextowle for the initial implementation of NewGasPriceSuggester