internal/ethapi: fix nil deref + fix estimateGas console bindings (#21601)

* tried to fix

* fix for js api

* fix for nil pointer ex

* rev space

* rev space

* input call formatter
pull/21603/head
Marius van der Wijden 4 years ago committed by GitHub
parent e5defccd58
commit c1544423d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      internal/ethapi/api.go
  2. 7
      internal/web3ext/web3ext.go

@ -963,6 +963,9 @@ func DoEstimateGas(ctx context.Context, b Backend, args CallArgs, blockNrOrHash
if err != nil { if err != nil {
return 0, err return 0, err
} }
if block == nil {
return 0, errors.New("block not found")
}
hi = block.GasLimit() hi = block.GasLimit()
} }
// Recap the highest gas limit with account's available balance. // Recap the highest gas limit with account's available balance.

@ -500,6 +500,13 @@ web3._extend({
params: 1, params: 1,
inputFormatter: [web3._extend.formatters.inputTransactionFormatter] inputFormatter: [web3._extend.formatters.inputTransactionFormatter]
}), }),
new web3._extend.Method({
name: 'estimateGas',
call: 'eth_estimateGas',
params: 2,
inputFormatter: [web3._extend.formatters.inputCallFormatter, web3._extend.formatters.inputBlockNumberFormatter],
outputFormatter: web3._extend.utils.toDecimal
}),
new web3._extend.Method({ new web3._extend.Method({
name: 'submitTransaction', name: 'submitTransaction',
call: 'eth_submitTransaction', call: 'eth_submitTransaction',

Loading…
Cancel
Save