aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/args.go35
-rw-r--r--rpc/jeth.go2
2 files changed, 35 insertions, 2 deletions
diff --git a/rpc/args.go b/rpc/args.go
index 6c98d1267..686872a59 100644
--- a/rpc/args.go
+++ b/rpc/args.go
@@ -171,6 +171,41 @@ type NewSigArgs struct {
Data string
}
+func (args *NewSigArgs) UnmarshalJSON(b []byte) (err error) {
+ var obj []json.RawMessage
+ var ext struct {
+ From string
+ Data string
+ }
+
+ // Decode byte slice to array of RawMessages
+ if err := json.Unmarshal(b, &obj); err != nil {
+ return NewDecodeParamError(err.Error())
+ }
+
+ // Check for sufficient params
+ if len(obj) < 1 {
+ return NewInsufficientParamsError(len(obj), 1)
+ }
+
+ // Decode 0th RawMessage to temporary struct
+ if err := json.Unmarshal(obj[0], &ext); err != nil {
+ return NewDecodeParamError(err.Error())
+ }
+
+ if len(ext.From) == 0 {
+ return NewValidationError("from", "is required")
+ }
+
+ if len(ext.Data) == 0 {
+ return NewValidationError("data", "is required")
+ }
+
+ args.From = ext.From
+ args.Data = ext.Data
+ return nil
+}
+
func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
var obj []json.RawMessage
var ext struct {
diff --git a/rpc/jeth.go b/rpc/jeth.go
index 4739316b2..ad52b72d7 100644
--- a/rpc/jeth.go
+++ b/rpc/jeth.go
@@ -2,7 +2,6 @@ package rpc
import (
"encoding/json"
-
"github.com/ethereum/go-ethereum/jsre"
"github.com/robertkrimen/otto"
)
@@ -35,7 +34,6 @@ func (self *Jeth) Send(call otto.FunctionCall) (response otto.Value) {
}
jsonreq, err := json.Marshal(reqif)
-
var reqs []RpcRequest
batch := true
err = json.Unmarshal(jsonreq, &reqs)