mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-30 08:51:32 +00:00
Merge branch 'master' of git://github.com/spesmilo/electrum
This commit is contained in:
commit
adcda6153d
4 changed files with 35 additions and 16 deletions
4
electrum
4
electrum
|
@ -71,6 +71,7 @@ def arg_parser():
|
||||||
parser.add_option("-g", "--gui", dest="gui", help="User interface: qt, lite, gtk, text or stdio")
|
parser.add_option("-g", "--gui", dest="gui", help="User interface: qt, lite, gtk, text or stdio")
|
||||||
parser.add_option("-w", "--wallet", dest="wallet_path", help="wallet path (default: electrum.dat)")
|
parser.add_option("-w", "--wallet", dest="wallet_path", help="wallet path (default: electrum.dat)")
|
||||||
parser.add_option("-o", "--offline", action="store_true", dest="offline", default=False, help="remain offline")
|
parser.add_option("-o", "--offline", action="store_true", dest="offline", default=False, help="remain offline")
|
||||||
|
parser.add_option("-C", "--concealed", action="store_true", dest="concealed", default=False, help="don't echo seed to console when restoring")
|
||||||
parser.add_option("-a", "--all", action="store_true", dest="show_all", default=False, help="show all addresses")
|
parser.add_option("-a", "--all", action="store_true", dest="show_all", default=False, help="show all addresses")
|
||||||
parser.add_option("-l", "--labels", action="store_true", dest="show_labels", default=False, help="show the labels of listed addresses")
|
parser.add_option("-l", "--labels", action="store_true", dest="show_labels", default=False, help="show the labels of listed addresses")
|
||||||
parser.add_option("-f", "--fee", dest="tx_fee", default=None, help="set tx fee")
|
parser.add_option("-f", "--fee", dest="tx_fee", default=None, help="set tx fee")
|
||||||
|
@ -209,7 +210,8 @@ if __name__ == '__main__':
|
||||||
if gap: wallet.change_gap_limit(int(gap))
|
if gap: wallet.change_gap_limit(int(gap))
|
||||||
|
|
||||||
if cmd.name == 'restore':
|
if cmd.name == 'restore':
|
||||||
seed = raw_input("seed:")
|
import getpass
|
||||||
|
seed = getpass.getpass(prompt = "seed:", stream = None) if options.concealed else raw_input("seed:")
|
||||||
try:
|
try:
|
||||||
seed.decode('hex')
|
seed.decode('hex')
|
||||||
except:
|
except:
|
||||||
|
|
38
gui/gtk.py
38
gui/gtk.py
|
@ -242,8 +242,9 @@ def run_network_dialog( network, parent ):
|
||||||
import random
|
import random
|
||||||
status = "Please choose a server.\nSelect cancel if you are offline."
|
status = "Please choose a server.\nSelect cancel if you are offline."
|
||||||
|
|
||||||
server = interface.server
|
if network.is_connected():
|
||||||
host, port, protocol = server.split(':')
|
server = interface.server
|
||||||
|
host, port, protocol = server.split(':')
|
||||||
|
|
||||||
servers = network.get_servers()
|
servers = network.get_servers()
|
||||||
|
|
||||||
|
@ -261,7 +262,10 @@ def run_network_dialog( network, parent ):
|
||||||
host_box.pack_start(host_label, False, False, 10)
|
host_box.pack_start(host_label, False, False, 10)
|
||||||
host_entry = gtk.Entry()
|
host_entry = gtk.Entry()
|
||||||
host_entry.set_size_request(200,-1)
|
host_entry.set_size_request(200,-1)
|
||||||
host_entry.set_text(server)
|
if network.is_connected():
|
||||||
|
host_entry.set_text(server)
|
||||||
|
else:
|
||||||
|
host_entry.set_text("Not Connected")
|
||||||
host_entry.show()
|
host_entry.show()
|
||||||
host_box.pack_start(host_entry, False, False, 10)
|
host_box.pack_start(host_entry, False, False, 10)
|
||||||
add_help_button(host_box, 'The name, port number and protocol of your Electrum server, separated by a colon. Example: "ecdsa.org:50002:s". Some servers allow you to connect through http (port 80) or https (port 443)')
|
add_help_button(host_box, 'The name, port number and protocol of your Electrum server, separated by a colon. Example: "ecdsa.org:50002:s". Some servers allow you to connect through http (port 80) or https (port 443)')
|
||||||
|
@ -300,7 +304,8 @@ def run_network_dialog( network, parent ):
|
||||||
host_entry.set_text( host + ':' + port + ':' + protocol)
|
host_entry.set_text( host + ':' + port + ':' + protocol)
|
||||||
|
|
||||||
combobox.connect("changed", lambda x:set_protocol('tshg'[combobox.get_active()]))
|
combobox.connect("changed", lambda x:set_protocol('tshg'[combobox.get_active()]))
|
||||||
set_combobox(protocol)
|
if network.is_connected():
|
||||||
|
set_combobox(protocol)
|
||||||
|
|
||||||
server_list = gtk.ListStore(str)
|
server_list = gtk.ListStore(str)
|
||||||
for host in servers.keys():
|
for host in servers.keys():
|
||||||
|
@ -898,8 +903,7 @@ class ElectrumWindow:
|
||||||
cell.set_property('editable', True)
|
cell.set_property('editable', True)
|
||||||
def edited_cb(cell, path, new_text, h_list):
|
def edited_cb(cell, path, new_text, h_list):
|
||||||
tx = h_list.get_value( h_list.get_iter(path), 0)
|
tx = h_list.get_value( h_list.get_iter(path), 0)
|
||||||
self.wallet.labels[tx] = new_text
|
self.wallet.set_label(tx,new_text)
|
||||||
self.wallet.save()
|
|
||||||
self.update_history_tab()
|
self.update_history_tab()
|
||||||
cell.connect('edited', edited_cb, self.history_list)
|
cell.connect('edited', edited_cb, self.history_list)
|
||||||
def editing_started(cell, entry, path, h_list):
|
def editing_started(cell, entry, path, h_list):
|
||||||
|
@ -942,7 +946,7 @@ class ElectrumWindow:
|
||||||
|
|
||||||
|
|
||||||
def create_recv_tab(self):
|
def create_recv_tab(self):
|
||||||
self.recv_list = gtk.ListStore(str, str, str)
|
self.recv_list = gtk.ListStore(str, str, str, str)
|
||||||
self.add_tab( self.make_address_list(True), 'Receive')
|
self.add_tab( self.make_address_list(True), 'Receive')
|
||||||
self.update_receiving_tab()
|
self.update_receiving_tab()
|
||||||
|
|
||||||
|
@ -974,8 +978,7 @@ class ElectrumWindow:
|
||||||
cell.set_property('editable', True)
|
cell.set_property('editable', True)
|
||||||
def edited_cb2(cell, path, new_text, liststore):
|
def edited_cb2(cell, path, new_text, liststore):
|
||||||
address = liststore.get_value( liststore.get_iter(path), 0)
|
address = liststore.get_value( liststore.get_iter(path), 0)
|
||||||
self.wallet.labels[address] = new_text
|
self.wallet.set_label(address, new_text)
|
||||||
self.wallet.save()
|
|
||||||
self.update_receiving_tab()
|
self.update_receiving_tab()
|
||||||
self.update_sending_tab()
|
self.update_sending_tab()
|
||||||
self.update_history_tab()
|
self.update_history_tab()
|
||||||
|
@ -989,6 +992,13 @@ class ElectrumWindow:
|
||||||
tvcolumn.pack_start(cell, True)
|
tvcolumn.pack_start(cell, True)
|
||||||
tvcolumn.add_attribute(cell, 'text', 2)
|
tvcolumn.add_attribute(cell, 'text', 2)
|
||||||
|
|
||||||
|
if is_recv:
|
||||||
|
tvcolumn = gtk.TreeViewColumn('Type')
|
||||||
|
treeview.append_column(tvcolumn)
|
||||||
|
cell = gtk.CellRendererText()
|
||||||
|
tvcolumn.pack_start(cell, True)
|
||||||
|
tvcolumn.add_attribute(cell, 'text', 3)
|
||||||
|
|
||||||
scroll = gtk.ScrolledWindow()
|
scroll = gtk.ScrolledWindow()
|
||||||
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||||
scroll.add(treeview)
|
scroll.add(treeview)
|
||||||
|
@ -1102,12 +1112,16 @@ class ElectrumWindow:
|
||||||
def update_receiving_tab(self):
|
def update_receiving_tab(self):
|
||||||
self.recv_list.clear()
|
self.recv_list.clear()
|
||||||
for address in self.wallet.addresses(True):
|
for address in self.wallet.addresses(True):
|
||||||
if self.wallet.is_change(address):continue
|
Type = "R"
|
||||||
|
if self.wallet.is_change(address): Type = "C"
|
||||||
|
if address in self.wallet.imported_keys.keys(): Type = "I"
|
||||||
|
if address in self.wallet.frozen_addresses: Type = Type + "F"
|
||||||
|
if address in self.wallet.prioritized_addresses: Type = Type + "P"
|
||||||
label = self.wallet.labels.get(address)
|
label = self.wallet.labels.get(address)
|
||||||
h = self.wallet.history.get(address,[])
|
h = self.wallet.history.get(address,[])
|
||||||
n = len(h)
|
n = len(h)
|
||||||
tx = "None" if n==0 else "%d"%n
|
tx = "0" if n==0 else "%d"%n
|
||||||
self.recv_list.append((address, label, tx ))
|
self.recv_list.append((address, label, tx, Type ))
|
||||||
|
|
||||||
def update_sending_tab(self):
|
def update_sending_tab(self):
|
||||||
# detect addresses that are not mine in history, add them here...
|
# detect addresses that are not mine in history, add them here...
|
||||||
|
|
|
@ -1124,8 +1124,9 @@ class ElectrumWindow(QMainWindow):
|
||||||
menu.addAction(_("Copy to clipboard"), lambda: self.app.clipboard().setText(addr))
|
menu.addAction(_("Copy to clipboard"), lambda: self.app.clipboard().setText(addr))
|
||||||
menu.addAction(_("QR code"), lambda: self.show_qrcode("bitcoin:" + addr, _("Address")) )
|
menu.addAction(_("QR code"), lambda: self.show_qrcode("bitcoin:" + addr, _("Address")) )
|
||||||
menu.addAction(_("Edit label"), lambda: self.edit_label(True))
|
menu.addAction(_("Edit label"), lambda: self.edit_label(True))
|
||||||
menu.addAction(_("Private key"), lambda: self.show_private_key(addr))
|
if self.wallet.seed:
|
||||||
menu.addAction(_("Sign message"), lambda: self.sign_message(addr))
|
menu.addAction(_("Private key"), lambda: self.show_private_key(addr))
|
||||||
|
menu.addAction(_("Sign message"), lambda: self.sign_message(addr))
|
||||||
if addr in self.wallet.imported_keys:
|
if addr in self.wallet.imported_keys:
|
||||||
menu.addAction(_("Remove from wallet"), lambda: self.delete_imported_key(addr))
|
menu.addAction(_("Remove from wallet"), lambda: self.delete_imported_key(addr))
|
||||||
|
|
||||||
|
|
|
@ -347,6 +347,7 @@ class Wallet:
|
||||||
|
|
||||||
if not c0:
|
if not c0:
|
||||||
self.seed_version = 4
|
self.seed_version = 4
|
||||||
|
self.storage.put('seed_version', self.seed_version, True)
|
||||||
self.create_old_account(K0)
|
self.create_old_account(K0)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -355,6 +356,7 @@ class Wallet:
|
||||||
"m/0'/": (c0, K0, cK0),
|
"m/0'/": (c0, K0, cK0),
|
||||||
}
|
}
|
||||||
self.storage.put('master_public_keys', self.master_public_keys, True)
|
self.storage.put('master_public_keys', self.master_public_keys, True)
|
||||||
|
self.storage.put('seed_version', self.seed_version, True)
|
||||||
self.create_account('1','Main account')
|
self.create_account('1','Main account')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue