Merge branch 'master' of github.com:kvhnuke/go-ethereum

This commit is contained in:
Kosala Hemachandra 2020-05-11 18:05:08 -07:00
commit 63d500a926
No known key found for this signature in database
GPG key ID: 619BCBDAA716E153
2 changed files with 15 additions and 0 deletions

View file

@ -895,6 +895,20 @@ func (p *Pending) EstimateGas(ctx context.Context, args struct {
return gas, err
}
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 ethapi.Backend

View file

@ -292,6 +292,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 {