Пример #1
0
    def __init__(self,
                 usr_addr_list,
                 minconf,
                 showempty,
                 showbtcaddrs,
                 all_labels,
                 wallet=None):

        self.wallet = wallet or TrackingWallet(mode='w')
        tw_dict = self.wallet.mmid_ordered_dict
        self.total = g.proto.coin_amt('0')

        from mmgen.obj import CoinAddr
        for mmid, d in list(tw_dict.items()):
            #			if d['confirmations'] < minconf: continue # cannot get confirmations for eth account
            label = TwLabel(mmid + ' ' + d['comment'], on_fail='raise')
            if usr_addr_list and (label.mmid not in usr_addr_list): continue
            bal = self.wallet.get_balance(d['addr'])
            if bal == 0 and not showempty:
                if not label.comment: continue
                if not all_labels: continue
            self[label.mmid] = {'amt': g.proto.coin_amt('0'), 'lbl': label}
            if showbtcaddrs:
                self[label.mmid]['addr'] = CoinAddr(d['addr'])
            self[label.mmid]['lbl'].mmid.confs = None
            self[label.mmid]['amt'] += bal
            self.total += bal
Пример #2
0
	def get_unspent_rpc(self):
		rpc_init()
		return map(lambda d: {
				'account': TwLabel(d['mmid']+' '+d['comment'],on_fail='raise'),
				'address': d['addr'],
				'amount': self.get_addr_bal(d['addr']),
				'confirmations': 0, # TODO
				}, TrackingWallet().sorted_list())
Пример #3
0
	async def get_unspent_rpc(self):
		wl = self.wallet.sorted_list
		if self.addrs:
			wl = [d for d in wl if d['addr'] in self.addrs]
		return [{
				'account': TwLabel(self.proto,d['mmid']+' '+d['comment']),
				'address': d['addr'],
				'amount': await self.wallet.get_balance(d['addr']),
				'confirmations': 0, # TODO
				} for d in wl]
Пример #4
0
		infile,
		('',' (batch mode)')[bool(opt.batch)]))

if not al.data[0].addr.is_for_chain(g.chain):
	die(2,'Address{} not compatible with {} chain!'.format((' list','')[bool(opt.address)],g.chain))

for n,e in enumerate(al.data):
	if e.idx:
		label = '{}:{}'.format(al.al_id,e.idx)
		if e.label: label += ' ' + e.label
		m = label
	else:
		label = '{}:{}'.format(g.proto.base_coin.lower(),e.addr)
		m = 'non-'+g.proj_name

	label = TwLabel(label)

	if opt.batch:
		if n == 0: arg_list = []
		arg_list.append((e.addr,label,False))
		continue

	msg_data = ('{}/{}:'.format(n+1,al.num_addrs),e.addr,'({})'.format(m))

	if opt.rescan:
		t = threading.Thread(target=import_address,args=[e.addr,label,True])
		t.daemon = True
		t.start()
		start = int(time.time())
		while True:
			if t.is_alive():