def __init__(self, hd_account_type, hd_master_key, non_hd_addr_list=[]): super().__init__() if isinstance(hd_account_type, str): if hd_account_type not in account_types: raise ValueError("hd_account_type must be one of %r." % account_types.keys()) else: self.account_type = account_types[hd_account_type] elif isinstance(hd_account_type, AccountType): self.account_type = hd_account_type else: raise TypeError("hd_account_type should be a str or AccountType object") self._num_used_addresses = {} self._num_used_accounts = 0 for i in range(self.max_accounts): self._num_used_addresses[i] = {0: 0, 1: 0} self.addr_list = non_hd_addr_list self.hd_master_key = hd_master_key for m in self.methods: setattr(self, m, MagicMock()) self._setup_balances()
ctx.exit(code=2) def _on_close(): try: ctx.obj['wallet'].sync_wallet_file() except: pass ctx.call_on_close(_on_close) @click.command(name="create") @click.option('--account-type', '-a', default=Two1Wallet.DEFAULT_ACCOUNT_TYPE, type=click.Choice(list(account_types.keys())), show_default=True, help='Type of account to create') @click.option('--testnet', '-tn', is_flag=True, help="Create a testnet wallet.") @click.pass_context @log_usage def create(ctx, account_type, testnet): """ Creates a new wallet """ # txn_data_provider and related params come from the # global context. passphrase = "" if ctx.obj['passphrase']:
rv = d.uninstall() if rv: msg = "walletd successfully uninstalled from init system." else: msg = "Unable to uninstall walletd!" except exceptions.DaemonizerError as e: msg = "Error: %s" % e logger.debug(msg) click.echo(msg) @click.command(name="create") @click.option('--account-type', '-a', default=Two1Wallet.DEFAULT_ACCOUNT_TYPE, type=click.Choice(list(account_types.keys())), show_default=True, help='Type of account to create') @click.option('--testnet', '-tn', is_flag=True, help="Create a testnet wallet.") @click.pass_context @log_usage def create(ctx, account_type, testnet): """ Creates a new wallet """ # txn_data_provider and related params come from the # global context. passphrase = "" if ctx.obj['passphrase']: # Let's prompt for a passphrase