mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-27 15:31:31 +00:00
add get_completions to wallet
This commit is contained in:
parent
4d7b68658b
commit
f77311328a
2 changed files with 12 additions and 6 deletions
|
@ -1105,12 +1105,7 @@ class ElectrumWindow(QMainWindow):
|
||||||
self.from_list.addTopLevelItem(QTreeWidgetItem( [format(item), self.format_amount(item['value']) ]))
|
self.from_list.addTopLevelItem(QTreeWidgetItem( [format(item), self.format_amount(item['value']) ]))
|
||||||
|
|
||||||
def update_completions(self):
|
def update_completions(self):
|
||||||
l = []
|
l = self.wallet.get_completions()
|
||||||
for addr,label in self.wallet.labels.items():
|
|
||||||
if addr in self.wallet.addressbook:
|
|
||||||
l.append( label + ' <' + addr + '>')
|
|
||||||
|
|
||||||
run_hook('update_completions', l)
|
|
||||||
self.completions.setStringList(l)
|
self.completions.setStringList(l)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,17 @@ class Abstract_Wallet(object):
|
||||||
self.addressbook.remove(addr)
|
self.addressbook.remove(addr)
|
||||||
self.storage.put('contacts', list(self.addressbook), True)
|
self.storage.put('contacts', list(self.addressbook), True)
|
||||||
|
|
||||||
|
def get_completions(self):
|
||||||
|
l = []
|
||||||
|
for x in self.addressbook:
|
||||||
|
if bitcoin.is_address(x):
|
||||||
|
label = self.labels.get(x)
|
||||||
|
if label:
|
||||||
|
l.append( label + ' <' + x + '>')
|
||||||
|
else:
|
||||||
|
l.append(x)
|
||||||
|
return l
|
||||||
|
|
||||||
def get_num_tx(self, address):
|
def get_num_tx(self, address):
|
||||||
""" return number of transactions where address is involved """
|
""" return number of transactions where address is involved """
|
||||||
return len(self.history.get(address, []))
|
return len(self.history.get(address, []))
|
||||||
|
|
Loading…
Add table
Reference in a new issue