From 9f5e9eb38d7bf00ec24ce4ae09f910236f776641 Mon Sep 17 00:00:00 2001 From: Taylor Gerring Date: Thu, 5 Mar 2015 12:26:21 -0600 Subject: Resolve storage/storageat --- rpc/messages.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'rpc/messages.go') 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 } -- cgit