1
0

adding new protocol (draft)

This commit is contained in:
thomasv
2012-03-12 17:55:33 +01:00
parent 6d51e3eae8
commit 0fc0bdd667
4 changed files with 159 additions and 98 deletions

View File

@@ -20,7 +20,6 @@ import re, sys, getpass
from optparse import OptionParser
from wallet import Wallet, SecretToASecret
from interface import Interface
from decimal import Decimal
@@ -43,11 +42,13 @@ if __name__ == '__main__':
parser.add_option("-r", "--remote", dest="remote_url", default=None, help="URL of a remote wallet")
options, args = parser.parse_args()
interface = Interface()
wallet = Wallet(interface)
wallet = Wallet()
wallet.set_path(options.wallet_path)
wallet.read()
wallet.remote_url = options.remote_url
interface = wallet.interface
if len(args)==0:
url = None
cmd = 'gui'
@@ -71,7 +72,7 @@ if __name__ == '__main__':
gui = gui.ElectrumGui(wallet)
try:
found = wallet.read()
found = wallet.file_exists
if not found:
found = gui.restore_or_create()
except BaseException, e:
@@ -90,14 +91,14 @@ if __name__ == '__main__':
if cmd not in known_commands:
cmd = 'help'
if not wallet.read() and cmd not in ['help','create','restore']:
if not wallet.file_exists and cmd not in ['help','create','restore']:
print "Wallet file not found."
print "Type 'electrum.py create' to create a new wallet, or provide a path to a wallet with the -d option"
sys.exit(0)
if cmd in ['create', 'restore']:
import mnemonic
if wallet.read():
if wallet.file_exists:
print "remove the existing wallet first!"
sys.exit(0)
password = getpass.getpass("Password (hit return if you do not wish to encrypt your wallet):")