diff --git a/bchain/coins/eth/ethrpc.go b/bchain/coins/eth/ethrpc.go index a2568aad..21878ddd 100644 --- a/bchain/coins/eth/ethrpc.go +++ b/bchain/coins/eth/ethrpc.go @@ -11,6 +11,7 @@ import ( ethereum "github.com/ethereum/go-ethereum" ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" "github.com/ethereum/go-ethereum/rpc" @@ -721,6 +722,18 @@ func (b *EthereumRPC) EthereumTypeEstimateGas(params map[string]interface{}) (ui if ok && len(s) > 0 { msg.Data = ethcommon.FromHex(s) } + s, ok = getStringFromMap("value", params) + if ok && len(s) > 0 { + msg.Value, _ = hexutil.DecodeBig(s) + } + s, ok = getStringFromMap("gas", params) + if ok && len(s) > 0 { + msg.Gas, _ = hexutil.DecodeUint64(s) + } + s, ok = getStringFromMap("gasPrice", params) + if ok && len(s) > 0 { + msg.GasPrice, _ = hexutil.DecodeBig(s) + } return b.client.EstimateGas(ctx, msg) } diff --git a/static/test-websocket.html b/static/test-websocket.html index be41e09f..05fabb48 100644 --- a/static/test-websocket.html +++ b/static/test-websocket.html @@ -210,7 +210,7 @@ var specific = document.getElementById('estimateFeeSpecific').value.trim(); if (specific) { // example for bitcoin type: {"conservative": false,"txsize":1234} - // example for ethereum type: {"from":"0x65513ecd11fd3a5b1fefdcc6a500b025008405a2","to":"0x65513ecd11fd3a5b1fefdcc6a500b025008405a2","data":"0xabcd"} + // example for ethereum type: {"from":"0x65513ecd11fd3a5b1fefdcc6a500b025008405a2","to":"0x65513ecd11fd3a5b1fefdcc6a500b025008405a2","data":"0xabcd","gasPrice":"0x30d40","value":"0x1234"} specific = JSON.parse(specific) } else {