From 135b7d9f5c31037728250eed21b8456ab999c8fe Mon Sep 17 00:00:00 2001 From: Nick Johnson Date: Tue, 16 Oct 2018 20:12:53 +0100 Subject: [PATCH] Add gasPrice API --- ethgraphql/main.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ethgraphql/main.go b/ethgraphql/main.go index 67a89749d7..89c778187d 100644 --- a/ethgraphql/main.go +++ b/ethgraphql/main.go @@ -1012,6 +1012,16 @@ func (r *Resolver) Logs(ctx context.Context, args struct{ Filter FilterCriteria return runFilter(ctx, r.node, filter) } +func (r *Resolver) GasPrice(ctx context.Context) (hexutil.Big, error) { + be, err := getBackend(r.node) + if err != nil { + return hexutil.Big{}, err + } + + price, err := be.SuggestPrice(ctx) + return hexutil.Big(*price), err +} + func NewHandler(n *node.Node) (http.Handler, error) { q := Resolver{n} @@ -1124,6 +1134,7 @@ func NewHandler(n *node.Node) (http.Handler, error) { call(data: CallData!, blockNumber: Long): CallResult estimateGas(data: CallData!, blockNumber: Long): Long! logs(filter: FilterCriteria!): [Log!]! + gasPrice: BigInt! } type Mutation {