-
Notifications
You must be signed in to change notification settings - Fork 4
/
listrooms.py
executable file
·31 lines (26 loc) · 1.12 KB
/
listrooms.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
30
31
#!/usr/bin/env python3
import sys
import ast
import getconf
# construct daemon url
CHAIN = input('Chain:')
RPCURL = getconf.def_credentials(CHAIN)
oraclelist_result = getconf.oracleslist_rpc(CHAIN)
for oracle_txid in oraclelist_result:
oraclesinfo_result = getconf.oraclesinfo_rpc(CHAIN, oracle_txid)
description = oraclesinfo_result['description']
name = oraclesinfo_result['name']
if description[0:4] == 'CHAT':
print('[' + name + ': ' + description[5:] + ']: ' + oracle_txid)
if description[0:5] == 'DCHAT':
creator_pubkey = description[6:]
#print('creator_pubkey', creator_pubkey)
try:
latest_batons = getconf.get_latest_batontxids(CHAIN, oracle_txid)
latest_creator_baton = latest_batons[creator_pubkey]
#print('creatorbaton', latest_creator_baton)
oraclessamples_result = getconf.oraclessamples_rpc(CHAIN, oracle_txid, latest_creator_baton, 1)
message_list = ast.literal_eval(oraclessamples_result['samples'][0][0])
print('[' + name + ': ' + message_list[1] + ']: ' + oracle_txid)
except:
continue