diff --git a/geth.go b/geth.go new file mode 100644 index 0000000..80c8169 --- /dev/null +++ b/geth.go @@ -0,0 +1,25 @@ +package etherscan + +type geth struct { + Cli *Client + Module string +} + +func (c *Client) Geth() *geth { + return &geth{ + Cli: c, + Module: "proxy", + } +} + +// Returns the current price per gas in wei +func (g *geth) GasPrice() (price GasPrice, err error) { + err = g.Cli.call(g.Module, "eth_gasPrice", M{}, &price) + return +} + +// Returns the number of most recent block +func (g *geth) BlockNumber() (number BlockNumber, err error) { + err = g.Cli.call(g.Module, "eth_gasPrice", M{}, &number) + return +} diff --git a/response.go b/response.go index b1338d3..88dabef 100644 --- a/response.go +++ b/response.go @@ -136,3 +136,19 @@ type LatestPrice struct { ETHUSD float64 `json:"ethusd,string"` ETHUSDTimestamp Time `json:"ethusd_timestamp"` } + +type Geth struct { + Jsonrpc string `json:"jsonrpc"` + Id int64 `json:"id"` + Result interface{} `json:"result"` +} + +type GasPrice struct { + Geth + Result string `json:"result"` +} + +type BlockNumber struct { + Geth + Result string `json:"result"` +}