diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-13 23:27:36 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-01-13 23:27:36 +0800 |
commit | 961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc (patch) | |
tree | fa9deabbbce89ad263a996cc5bd4cf5893bf38e5 /rpc/message.go | |
parent | b178414a475aa48764622487223237a7d28edd46 (diff) | |
download | go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.tar go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.tar.gz go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.tar.bz2 go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.tar.lz go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.tar.xz go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.tar.zst go-tangerine-961e4da7d885a6d5d00fc7c3ab2e11c80c9eeecc.zip |
Add support for CodeAt
Diffstat (limited to 'rpc/message.go')
-rw-r--r-- | rpc/message.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rpc/message.go b/rpc/message.go index 03e9625ac..91fbde99b 100644 --- a/rpc/message.go +++ b/rpc/message.go @@ -147,6 +147,21 @@ func (req *RpcRequest) ToGetBalanceArgs() (*GetBalanceArgs, error) { return args, nil } +func (req *RpcRequest) ToGetCodeAtArgs() (*GetCodeAtArgs, error) { + if len(req.Params) < 1 { + return nil, NewErrorResponse(ErrorArguments) + } + + args := new(GetCodeAtArgs) + r := bytes.NewReader(req.Params[0]) + err := json.NewDecoder(r).Decode(args) + if err != nil { + return nil, NewErrorResponse(ErrorDecodeArgs) + } + jsonlogger.DebugDetailf("%T %v", args, args) + return args, nil +} + // func NewSuccessRes(object JsonResponse) string { // e := SuccessRes{Error: false, Result: object} // res, err := json.Marshal(e) |