forked from nanmu42/etherscan-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgas_tracker.go
More file actions
27 lines (23 loc) · 727 Bytes
/
gas_tracker.go
File metadata and controls
27 lines (23 loc) · 727 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/*
* Copyright (c) 2022 Avi Misra
*
* Use of this work is governed by a MIT License.
* You may find a license copy in project root.
*/
package etherscan
import "time"
// GasEstiamte gets estiamted confirmation time (in seconds) at the given gas price
func (c *Client) GasEstimate(gasPrice int) (confirmationTimeInSec time.Duration, err error) {
params := M{"gasPrice": gasPrice}
var confTime string
err = c.call("gastracker", "gasestimate", params, &confTime)
if err != nil {
return
}
return time.ParseDuration(confTime + "s")
}
// GasOracle gets suggested gas prices (in Gwei)
func (c *Client) GasOracle() (gasPrices GasPrices, err error) {
err = c.call("gastracker", "gasoracle", M{}, &gasPrices)
return
}