Exemplo n.º 1
0
 def test_create_new_wallet(self):
     passphrase = 'mypassphrase'
     password = '******'
     encrypt_file = True
     d = create_new_wallet(path=self.wallet_path,
                           passphrase=passphrase,
                           password=password,
                           encrypt_file=encrypt_file,
                           gap_limit=1)
     wallet = d['wallet']  # type: Standard_Wallet
     wallet.check_password(password)
     self.assertEqual(passphrase, wallet.keystore.get_passphrase(password))
     self.assertEqual(d['seed'], wallet.keystore.get_seed(password))
     self.assertEqual(encrypt_file, wallet.storage.is_encrypted())
Exemplo n.º 2
0
    def test_create_new_wallet(self):
        passphrase = 'mypassphrase'
        password = '******'
        encrypt_file = True
        d = create_new_wallet(path=self.wallet_path,
                              passphrase=passphrase,
                              password=password,
                              encrypt_file=encrypt_file,
                              gap_limit=1,
                              config=self.config)
        wallet = d['wallet']  # type: Standard_Wallet

        # lightning initialization
        self.assertTrue(wallet.db.get('lightning_xprv').startswith('zprv'))

        wallet.check_password(password)
        self.assertEqual(passphrase, wallet.keystore.get_passphrase(password))
        self.assertEqual(d['seed'], wallet.keystore.get_seed(password))
        self.assertEqual(encrypt_file, wallet.storage.is_encrypted())
Exemplo n.º 3
0
from electrum_mona.storage import WalletStorage
from electrum_mona.wallet import Wallet, create_new_wallet
from electrum_mona.commands import Commands

config = SimpleConfig({"testnet":
                       True})  # to use ~/.electrum-mona/testnet as datadir
constants.set_testnet()  # to set testnet magic bytes
daemon = Daemon(config, listen_jsonrpc=False)
network = daemon.network
assert network.asyncio_loop.is_running()

# 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):
    create_new_wallet(path=wallet_path, config=config)

# open wallet
storage = WalletStorage(wallet_path)
wallet = Wallet(storage, config=config)
wallet.start_network(network)

# you can use ~CLI commands by accessing command_runner
command_runner = Commands(config=config, daemon=daemon, network=network)
command_runner.wallet = wallet
print("balance", command_runner.getbalance())
print("addr", command_runner.getunusedaddress())
print(
    "gettx",
    command_runner.gettransaction(
        "1e9217f2772b7cb93ec71a3201c562e5c4f693c2b7fd0dd956e0c7e640bbb0d0"))
Exemplo n.º 4
0
from electrum_mona.storage import WalletStorage
from electrum_mona.wallet import Wallet, create_new_wallet
from electrum_mona.commands import Commands

config = SimpleConfig({"testnet":
                       True})  # to use ~/.electrum-mona/testnet as datadir
constants.set_testnet()  # to set testnet magic bytes
daemon = Daemon(config, listen_jsonrpc=False)
network = daemon.network
assert network.asyncio_loop.is_running()

# 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):
    create_new_wallet(path=wallet_path, segwit=True)

# open wallet
storage = WalletStorage(wallet_path)
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())
print(
    "gettx",
    command_runner.gettransaction(
        "1e9217f2772b7cb93ec71a3201c562e5c4f693c2b7fd0dd956e0c7e640bbb0d0"))