diff options
Diffstat (limited to 'rpc/api.go')
-rw-r--r-- | rpc/api.go | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/rpc/api.go b/rpc/api.go index 6b37acb03..e35395734 100644 --- a/rpc/api.go +++ b/rpc/api.go @@ -182,7 +182,21 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err nonce = args.Nonce.String() } - v, err := api.xeth().Transact(args.From, args.To, nonce, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data) + var gas string + if args.Gas == nil { + gas = "" + } else { + gas = args.Gas.String() + } + + var gasprice string + if args.GasPrice == nil { + gasprice = "" + } else { + gasprice = args.GasPrice.String() + } + + v, err := api.xeth().Transact(args.From, args.To, nonce, args.Value.String(), gas, gasprice, args.Data) if err != nil { return err } @@ -603,5 +617,19 @@ func (api *EthereumApi) doCall(params json.RawMessage) (string, string, error) { return "", "", err } - return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), args.Gas.String(), args.GasPrice.String(), args.Data) + var gas string + if args.Gas == nil { + gas = "" + } else { + gas = args.Gas.String() + } + + var gasprice string + if args.GasPrice == nil { + gasprice = "" + } else { + gasprice = args.GasPrice.String() + } + + return api.xethAtStateNum(args.BlockNumber).Call(args.From, args.To, args.Value.String(), gas, gasprice, args.Data) } |