diff options
author | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-20 01:41:50 +0800 |
---|---|---|
committer | Taylor Gerring <taylor.gerring@gmail.com> | 2015-02-20 01:41:50 +0800 |
commit | 605dd3a9820bb74be883afe3cb0e462aca40b32d (patch) | |
tree | 7a77f0f41ad1582b32080f5623fa4d7b5dce3020 /rpc/packages.go | |
parent | dba4f3122e83a66edc1fa089c5d69f789b07a6b3 (diff) | |
download | go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.tar go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.tar.gz go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.tar.bz2 go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.tar.lz go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.tar.xz go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.tar.zst go-tangerine-605dd3a9820bb74be883afe3cb0e462aca40b32d.zip |
Add serpent compilation to RPC
Diffstat (limited to 'rpc/packages.go')
-rw-r--r-- | rpc/packages.go | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/rpc/packages.go b/rpc/packages.go index 216321dba..c969f58cc 100644 --- a/rpc/packages.go +++ b/rpc/packages.go @@ -300,6 +300,21 @@ func (p *EthereumApi) GetCodeAt(args *GetCodeAtArgs, reply *interface{}) error { return nil } +func (p *EthereumApi) GetCompilers(reply *interface{}) error { + c := []string{"serpent"} + *reply = c + return nil +} + +func (p *EthereumApi) CompileSerpent(script string, reply *interface{}) error { + res, err := ethutil.Compile(script, false) + if err != nil { + return err + } + *reply = res + return nil +} + func (p *EthereumApi) Sha3(args *Sha3Args, reply *interface{}) error { *reply = toHex(crypto.Sha3(fromHex(args.Data))) return nil @@ -490,6 +505,14 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error return err } return p.WatchTx(args, reply) + case "eth_compilers": + return p.GetCompilers(reply) + case "eth_serpent": + args, err := req.ToCompileArgs() + if err != nil { + return err + } + return p.CompileSerpent(args, reply) case "web3_sha3": args, err := req.ToSha3Args() if err != nil { |