-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwhisper.py
30 lines (20 loc) · 1006 Bytes
/
whisper.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import ethereumJSON
class WhisperAPI:
def __init__(self):
self.json = ethereumJSON.EthereumJSON()
def newIdentity(self):
return self.json.sendJSONRequest("shh_newIdentity")
def haveIdentity(self, identity):
return self.json.sendJSONRequest("shh_haveIdentity", identity)
def changed(self, filter_id):
return self.json.sendJSONRequest("shh_changed", filter_id)
def post(self, from_addr, topic, payload, ttl, priority):
return self.json.sendJSONRequest("shh_post", {"from":from_addr,
"topic":topic, "payload":payload, "ttl":ttl, "priority":priority })
def newFilter(self, topic):
return self.json.sendJSONRequest("shh_newFilter", {"topic":topic})
def uninstallFilter(self, filter_id):
return self.json.sendJSONRequest("shh_uninstallFilter", filter_id)
# Not implemented in cpp-ethereum 150224
def getMessages(self, filter_id):
return self.json.sendJSONRequest("shh_getMessages", filter_id)