Allow parameters value, gasPrice and gas to be passed to ETH estimateFee
This commit is contained in:
parent
dd2dc6b2ee
commit
e60c320ae7
@ -11,6 +11,7 @@ import (
|
|||||||
|
|
||||||
ethereum "github.com/ethereum/go-ethereum"
|
ethereum "github.com/ethereum/go-ethereum"
|
||||||
ethcommon "github.com/ethereum/go-ethereum/common"
|
ethcommon "github.com/ethereum/go-ethereum/common"
|
||||||
|
"github.com/ethereum/go-ethereum/common/hexutil"
|
||||||
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
ethtypes "github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/ethclient"
|
"github.com/ethereum/go-ethereum/ethclient"
|
||||||
"github.com/ethereum/go-ethereum/rpc"
|
"github.com/ethereum/go-ethereum/rpc"
|
||||||
@ -721,6 +722,18 @@ func (b *EthereumRPC) EthereumTypeEstimateGas(params map[string]interface{}) (ui
|
|||||||
if ok && len(s) > 0 {
|
if ok && len(s) > 0 {
|
||||||
msg.Data = ethcommon.FromHex(s)
|
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)
|
return b.client.EstimateGas(ctx, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -210,7 +210,7 @@
|
|||||||
var specific = document.getElementById('estimateFeeSpecific').value.trim();
|
var specific = document.getElementById('estimateFeeSpecific').value.trim();
|
||||||
if (specific) {
|
if (specific) {
|
||||||
// example for bitcoin type: {"conservative": false,"txsize":1234}
|
// 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)
|
specific = JSON.parse(specific)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user