aboutsummaryrefslogtreecommitdiffstats
path: root/rpc
diff options
context:
space:
mode:
Diffstat (limited to 'rpc')
-rw-r--r--rpc/message.go15
-rw-r--r--rpc/packages.go23
2 files changed, 38 insertions, 0 deletions
diff --git a/rpc/message.go b/rpc/message.go
index 524d7fc84..1935bf1e2 100644
--- a/rpc/message.go
+++ b/rpc/message.go
@@ -201,6 +201,21 @@ func (req *RpcRequest) ToGetCodeAtArgs() (*GetCodeAtArgs, error) {
return args, nil
}
+func (req *RpcRequest) ToCompileArgs() (string, error) {
+ if len(req.Params) < 1 {
+ return "", NewErrorResponse(ErrorArguments)
+ }
+
+ var args string
+ err := json.Unmarshal(req.Params[0], &args)
+ if err != nil {
+ return "", NewErrorResponse(ErrorDecodeArgs)
+ }
+
+ rpclogger.DebugDetailf("%T %v", args, args)
+ return args, nil
+}
+
func (req *RpcRequest) ToFilterArgs() (*FilterOptions, error) {
if len(req.Params) < 1 {
return nil, NewErrorResponse(ErrorArguments)
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 {