commit 7b9047d8d6a0c78798f5d94f0fc17cb79b2a84cd
parent b34e1634b696dfec58019bb996d80305150105a7
Author: SomberNight <somber.night@protonmail.com>
Date: Thu, 28 Feb 2019 20:22:23 +0100
scripts: simplify quick_start
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/electrum/scripts/quick_start.py b/electrum/scripts/quick_start.py
@@ -4,7 +4,7 @@ from electrum.simple_config import SimpleConfig
from electrum import constants
from electrum.daemon import Daemon
from electrum.storage import WalletStorage
-from electrum.wallet import Wallet
+from electrum.wallet import Wallet, create_new_wallet
from electrum.commands import Commands
@@ -14,14 +14,11 @@ daemon = Daemon(config, listen_jsonrpc=False)
network = daemon.network
assert network.asyncio_loop.is_running()
-command_runner = Commands(config, wallet=None, network=network)
-
# get wallet on disk
wallet_dir = os.path.dirname(config.get_wallet_path())
wallet_path = os.path.join(wallet_dir, "test_wallet")
if not os.path.exists(wallet_path):
- config.set_key('wallet_path', wallet_path)
- command_runner.create(segwit=True)
+ create_new_wallet(path=wallet_path, segwit=True)
# open wallet
storage = WalletStorage(wallet_path)
@@ -29,6 +26,7 @@ wallet = Wallet(storage)
wallet.start_network(network)
# you can use ~CLI commands by accessing command_runner
+command_runner = Commands(config, wallet=None, network=network)
command_runner.wallet = wallet
print("balance", command_runner.getbalance())
print("addr", command_runner.getunusedaddress())