-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathupdate_wallet.py
48 lines (41 loc) · 1.43 KB
/
update_wallet.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
import json
from jsonrpc import ServiceProxy
import constant
import config
wallets=dict();
#Add whattomine wallets
for coin in config.whattomine:
wallets[coin]=constant.whattomine_lookup[coin];
wallets[coin]['type']='whattomine';
print('Added whattomine.com wallet for %s'%(coin));
#Add remote wallets
for coin in config.remote_wallets:
wallets[coin]=config.remote_wallets[coin];
print('Added remote wallet for %s'%(coin));
#Scan for local wallets
print('Scanning local wallets...');
cnt=0;
for port in config.scan_ports:
access=ServiceProxy({'url':config.scan_api%port,'username':config.wallet_username,'password':config.wallet_password},timeout=5);
try:
info=access.help();
identified=False;
for coin in constant.wallets_key:
if info.find(constant.wallets_key[coin])>0:
identified=True;
if not(coin in wallets):
try:
print('Found %s wallet at port %d'%(coin,port));
wallets[coin]={'name':coin,'url':{'url':config.scan_api%port,'username':config.wallet_username,'password':config.wallet_password},'algorithm':constant.algo_lookup[coin],'type':'wallet'};
except:
print('error adding wallet');
if not identified:
print('Unidentified wallet: %s'%info);
except:
pass;
cnt=cnt+1;
#if (cnt*10)%len(config.scan_ports)==0:
# print('Progress: %d %%'%((cnt*100)/len(config.scan_ports)));
f=open('config/wallet.json','w');
json.dump(wallets,f);
f.close();