diff --git a/graphql/graphql.go b/graphql/graphql.go index b3bcbd8a43..5569a52b80 100644 --- a/graphql/graphql.go +++ b/graphql/graphql.go @@ -945,6 +945,20 @@ func (p *Pending) EstimateGas(ctx context.Context, args struct { return ethapi.DoEstimateGas(ctx, p.backend, args.Data, rpc.PendingBlockNumber) } +func (p *Pending) EstimateGases(ctx context.Context, args struct { + Data *[]ethapi.CallArgs +}) (*[]hexutil.Uint64, error) { + ret := make([]hexutil.Uint64, 0, len(*args.Data)) + for _, call := range *args.Data { + estimatedGas, err := ethapi.DoEstimateGas(ctx, p.backend, call, rpc.PendingBlockNumber) + if err != nil { + return &ret, nil + } + ret = append(ret, estimatedGas) + } + return &ret, nil +} + // Resolver is the top-level object in the GraphQL hierarchy. type Resolver struct { backend *eth.EthAPIBackend diff --git a/graphql/schema.go b/graphql/schema.go index bd913d9aa6..a7c7d791ed 100644 --- a/graphql/schema.go +++ b/graphql/schema.go @@ -289,6 +289,7 @@ const schema string = ` # EstimateGas estimates the amount of gas that will be required for # successful execution of a transaction for the pending state. estimateGas(data: CallData!): Long! + estimateGases(data: [CallData!]): [Long!] } type Query {