-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_msig_fio.py
55 lines (51 loc) · 1.64 KB
/
check_msig_fio.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/python3
import requests
api = 'https://api.fiosweden.org'
proposer = 'lion4uxxfbqo'
def get_producers():
url = f"{api}/v1/chain/get_producers"
payload = {"limit":30,
"lower_bound":"",
"json":"true"}
response = requests.post(url,json=payload,timeout=10).json()
producer_accounts = {}
i = 1
for row in response["producers"]:
bp_acc = row['owner']
bp_readable = row['fio_address']
bp_readable_fixd = bp_readable.split("@")
producer_accounts.update({bp_acc:bp_readable_fixd[1]})
if i < 10:
delimiter = " | "
else:
delimiter = " | "
print(i,delimiter,row['owner']," | ",row['fio_address'])
i += 1
return producer_accounts
def check_msig():
url = f"{api}/v1/chain/get_table_rows"
payload = {
"code": "eosio.msig",
"table": "approvals2",
"scope": proposer,
"index_position": "",
"key_type": "",
"encode_type": "",
"upper_bound": "",
"lower_bound": "",
"json":"true"
}
response = requests.post(url,json=payload,timeout=10).json()
i = 1
prod_dick = get_producers()
for row in response["rows"]:
proposal_name = row['proposal_name']
signed_count = len(row['provided_approvals'])
bps_signed = []
for rows in row['provided_approvals']:
lvl = rows['level']
bp_acc = lvl['actor']
bps_signed.append(prod_dick[bp_acc])
print(proposal_name,' | ',signed_count,' Signed', bps_signed)
i += 1
check_msig()