diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-06 02:26:21 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-03-06 02:26:21 +0800 |
commit | 9f5e9eb38d7bf00ec24ce4ae09f910236f776641 (patch) | |
tree | 2ca472a6993fb6d1e437a8ff03b75a120b0c26b8 /rpc/messages.go | |
parent | a6599404e49387af8cc5302b7f22005133af4ebf (diff) | |
download | go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.tar go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.tar.gz go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.tar.bz2 go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.tar.lz go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.tar.xz go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.tar.zst go-tangerine-9f5e9eb38d7bf00ec24ce4ae09f910236f776641.zip |
Resolve storage/storageat
Diffstat (limited to 'rpc/messages.go')
-rw-r--r-- | rpc/messages.go | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/rpc/messages.go b/rpc/messages.go index b37d8229d..3ab99d2c5 100644 --- a/rpc/messages.go +++ b/rpc/messages.go @@ -120,23 +120,31 @@ func (req *RpcRequest) ToPushTxArgs() (*PushTxArgs, error) { return args, nil } -func (req *RpcRequest) ToGetStateArgs() (*GetStateArgs, error) { - if len(req.Params) < 1 { +func (req *RpcRequest) ToGetStorageAtArgs() (*GetStorageAtArgs, error) { + if len(req.Params) < 2 { return nil, errArguments } - args := new(GetStateArgs) - // TODO need to pass both arguments - r := bytes.NewReader(req.Params[0]) - err := json.NewDecoder(r).Decode(args) - if err != nil { + args := new(GetStorageAtArgs) + var arg0, arg1 string + + r0 := bytes.NewReader(req.Params[0]) + if err := json.NewDecoder(r0).Decode(arg0); err != nil { return nil, errDecodeArgs } + r1 := bytes.NewReader(req.Params[1]) + if err := json.NewDecoder(r1).Decode(arg1); err != nil { + return nil, errDecodeArgs + } + + args.Address = arg0 + args.Key = arg1 + return args, nil } -func (req *RpcRequest) ToStorageAtArgs() (*GetStorageArgs, error) { +func (req *RpcRequest) ToStorageArgs() (*GetStorageArgs, error) { if len(req.Params) < 1 { return nil, errArguments } |