aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/web3_args.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2015-06-24 01:19:33 +0800
committerJeffrey Wilcke <geffobscura@gmail.com>2015-06-24 01:19:33 +0800
commit72e2613a9fe3205fa5a67b72b832e03b2357ee88 (patch)
treebbc987510d279d9e174ff8f684158d668131661e /rpc/api/web3_args.go
parent5daf8729be88eca87b302ebf7a46fc69cad0f6d0 (diff)
parent67e6f74e9af00ff011a6a02f18644804eb18cdaa (diff)
downloaddexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar
dexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.gz
dexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.bz2
dexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.lz
dexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.xz
dexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.tar.zst
dexon-72e2613a9fe3205fa5a67b72b832e03b2357ee88.zip
Merge branch 'release/0.9.32'
Diffstat (limited to 'rpc/api/web3_args.go')
-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
+}