aboutsummaryrefslogtreecommitdiffstats
path: root/rpc/api.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-28 16:54:05 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-28 16:54:05 +0800
commita05c420371aa56657b86ba3dce6ebb087adb708d (patch)
tree3e0853dcff756c503764d0f73c1757c585be2aa9 /rpc/api.go
parent182d484aa70bcd5b22117f02333b1fd3b1535dcb (diff)
parent978ffd3097242a5faeb7b23b9c72590170004dc6 (diff)
downloadgo-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.tar
go-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.tar.gz
go-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.tar.bz2
go-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.tar.lz
go-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.tar.xz
go-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.tar.zst
go-tangerine-a05c420371aa56657b86ba3dce6ebb087adb708d.zip
Merge pull request #738 from karalabe/whisper-cleanup
Whisper cleanup, part 3
Diffstat (limited to 'rpc/api.go')
-rw-r--r--rpc/api.go36
1 files changed, 19 insertions, 17 deletions
diff --git a/rpc/api.go b/rpc/api.go
index 5930a4c7b..4a9eb5963 100644
--- a/rpc/api.go
+++ b/rpc/api.go
@@ -406,65 +406,67 @@ func (api *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) err
res, _ := api.xeth().DbGet([]byte(args.Database + args.Key))
*reply = newHexData(res)
+
case "shh_version":
+ // Retrieves the currently running whisper protocol version
*reply = api.xeth().WhisperVersion()
+
case "shh_post":
+ // Injects a new message into the whisper network
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":
+ // Creates a new whisper identity to use for sending/receiving messages
*reply = api.xeth().Whisper().NewIdentity()
- // case "shh_removeIdentity":
- // args := new(WhisperIdentityArgs)
- // if err := json.Unmarshal(req.Params, &args); err != nil {
- // return err
- // }
- // *reply = api.xeth().Whisper().RemoveIdentity(args.Identity)
+
case "shh_hasIdentity":
+ // Checks if an identity if owned or not
args := new(WhisperIdentityArgs)
if err := json.Unmarshal(req.Params, &args); err != nil {
return err
}
*reply = api.xeth().Whisper().HasIdentity(args.Identity)
- case "shh_newGroup", "shh_addToGroup":
- return NewNotImplementedError(req.Method)
+
case "shh_newFilter":
+ // Create a new filter to watch and match messages with
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":
+ // Remove an existing filter watching messages
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)
+ *reply = api.xeth().WhisperMessagesChanged(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
}
- *reply = api.xeth().Whisper().Messages(args.Id)
+ *reply = api.xeth().WhisperMessages(args.Id)
// case "eth_register":
// // Placeholder for actual type