aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api/web3_args.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-06-23 22:44:03 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-06-23 22:44:03 +0800
commit6b5532ab0d0e88f27af539840c58cbd6de13de90 (patch)
tree84f1856e1b3fb2fd927e6ef9c59983e4fb347a8c /rpc/api/web3_args.go
parent139439dcdc14e448bfdbd509bb135faa92337a28 (diff)
parent2b3957f3737b56622e38425a52caea2a836f8b63 (diff)
downloaddexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.tar
dexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.tar.gz
dexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.tar.bz2
dexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.tar.lz
dexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.tar.xz
dexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.tar.zst
dexon-6b5532ab0d0e88f27af539840c58cbd6de13de90.zip
Merge pull request #1279 from bas-vk/rpc-http
Integrate console and remove old rpc package structure
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
+}