aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
authorBas van Kervel <bas@ethdev.com>2015-06-16 21:16:06 +0800
committerBas van Kervel <bas@ethdev.com>2015-06-22 14:54:21 +0800
commit5fdf72b1abba65bcaed116791b6b8b70edb17e49 (patch)
tree9c1fcdda1ad60ec77cbcde7614b35a431ca7df7b /rpc
parentc3f6c322c07a96d3930c75d05ed3859e7d80ddbc (diff)
downloadgo-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.tar
go-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.tar.gz
go-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.tar.bz2
go-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.tar.lz
go-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.tar.xz
go-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.tar.zst
go-tangerine-5fdf72b1abba65bcaed116791b6b8b70edb17e49.zip
fixed web3 rpc test failures
Diffstat (limited to 'rpc')
-rw-r--r--rpc/api/web3_args.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/rpc/api/web3_args.go b/rpc/api/web3_args.go
index 5455a6c8e..38af7191e 100644
--- a/rpc/api/web3_args.go
+++ b/rpc/api/web3_args.go
@@ -1,5 +1,29 @@
package api
+import (
+ "encoding/json"
+
+ "github.com/ethereum/go-ethereum/rpc/shared"
+)
+
type Sha3Args struct {
Data string
}
+
+func (args *Sha3Args) UnmarshalJSON(b []byte) (err error) {
+ var obj []interface{}
+ if err := json.Unmarshal(b, &obj); err != nil {
+ return shared.NewDecodeParamError(err.Error())
+ }
+
+ if len(obj) < 1 {
+ return shared.NewInsufficientParamsError(len(obj), 1)
+ }
+
+ argstr, ok := obj[0].(string)
+ if !ok {
+ return shared.NewInvalidTypeError("data", "is not a string")
+ }
+ args.Data = argstr
+ return nil
+}