diff options
Diffstat (limited to 'ethclient')
-rw-r--r-- | ethclient/ethclient.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ethclient/ethclient.go b/ethclient/ethclient.go index 7f73ab113..87a912901 100644 --- a/ethclient/ethclient.go +++ b/ethclient/ethclient.go @@ -455,13 +455,13 @@ func (ec *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error) { // the current pending state of the backend blockchain. There is no guarantee that this is // the true gas limit requirement as other transactions may be added or removed by miners, // but it should provide a basis for setting a reasonable default. -func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (*big.Int, error) { - var hex hexutil.Big +func (ec *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error) { + var hex hexutil.Uint64 err := ec.c.CallContext(ctx, &hex, "eth_estimateGas", toCallArg(msg)) if err != nil { - return nil, err + return 0, err } - return (*big.Int)(&hex), nil + return uint64(hex), nil } // SendTransaction injects a signed transaction into the pending pool for execution. @@ -487,8 +487,8 @@ func toCallArg(msg ethereum.CallMsg) interface{} { if msg.Value != nil { arg["value"] = (*hexutil.Big)(msg.Value) } - if msg.Gas != nil { - arg["gas"] = (*hexutil.Big)(msg.Gas) + if msg.Gas != 0 { + arg["gas"] = hexutil.Uint64(msg.Gas) } if msg.GasPrice != nil { arg["gasPrice"] = (*hexutil.Big)(msg.GasPrice) |