aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorPéter Szilágyi <peterke@gmail.com>2015-04-17 21:45:44 +0800
committerPéter Szilágyi <peterke@gmail.com>2015-04-28 15:47:35 +0800
commit3563c59b12b0b8b5fd15847bf97d71dfd8416207 (patch)
treef059a2bcbd7edb25c595bbad30514828fc1a5282 /rpc/api.go
parent182d484aa70bcd5b22117f02333b1fd3b1535dcb (diff)
downloadgo-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.tar
go-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.tar.gz
go-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.tar.bz2
go-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.tar.lz
go-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.tar.xz
go-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.tar.zst
go-tangerine-3563c59b12b0b8b5fd15847bf97d71dfd8416207.zip
rpc, whisper, xeth: polish whisper RPC interface
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go17
1 files changed, 10 insertions, 7 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 5930a4c7b..614e08764 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -408,18 +408,18 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
*reply = newHexData(res)
case "shh_version":
*reply = api.xeth().WhisperVersion()
+
case "shh_post":
args := new(WhisperMessageArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
-
err := api.xeth().Whisper().Post(args.Payload, args.To, args.From, args.Topics, args.Priority, args.Ttl)
if err != nil {
return err
}
-
*reply = true
+
case "shh_newIdentity":
*reply = api.xeth().Whisper().NewIdentity()
// case "shh_removeIdentity":
@@ -434,32 +434,35 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
return err
}
*reply = api.xeth().Whisper().HasIdentity(args.Identity)
+
case "shh_newGroup", "shh_addToGroup":
return NewNotImplementedError(req.Method)
+
case "shh_newFilter":
args := new(WhisperFilterArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
- opts := new(xeth.Options)
- // opts.From = args.From
- opts.To = args.To
- opts.Topics = args.Topics
- id := api.xeth().NewWhisperFilter(opts)
+ id := api.xeth().NewWhisperFilter(args.To, args.From, args.Topics)
*reply = newHexNum(big.NewInt(int64(id)).Bytes())
+
case "shh_uninstallFilter":
args := new(FilterIdArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
*reply = api.xeth().UninstallWhisperFilter(args.Id)
+
case "shh_getFilterChanges":
+ // Retrieve all the new messages arrived since the last request
args := new(FilterIdArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
*reply = api.xeth().MessagesChanged(args.Id)
+
case "shh_getMessages":
+ // Retrieve all the cached messages matching a specific, existing filter
args := new(FilterIdArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err