This commit is contained in:
callebtc
2022-09-19 00:27:00 +03:00
parent 088a0bc29f
commit afce11686c
3 changed files with 12 additions and 14 deletions

View File

@@ -123,18 +123,13 @@ class Database(Compat):
)
)
else:
if os.path.isdir(self.db_location):
if not os.path.exists(self.db_location):
print(f"Creating database directory: {self.db_location}")
os.makedirs(self.db_location)
self.path = os.path.join(self.db_location, f"{self.name}.sqlite3")
database_uri = f"sqlite:///{self.path}"
self.type = SQLITE
else:
print(f"Creating database directory: {self.db_location}")
if not os.path.exists(self.db_location):
os.makedirs(self.db_location)
# raise NotADirectoryError(
# f"db_location named {self.db_location} was not created"
# f" - please 'mkdir {self.db_location}' and try again"
# )
self.schema = self.name
if self.name.startswith("ext_"):
self.schema = self.name[4:]

View File

@@ -13,7 +13,7 @@ entry_points = {"console_scripts": ["cashu = wallet.cashu:cli"]}
setuptools.setup(
name="cashu",
version="0.1.6",
version="0.1.7",
description="Ecash wallet and mint with Bitcoin Lightning support",
long_description=long_description,
long_description_content_type="text/markdown",

View File

@@ -5,6 +5,7 @@ import base64
import json
import math
from functools import wraps
from pathlib import Path
import click
from bech32 import bech32_decode, bech32_encode, convertbits
@@ -45,7 +46,9 @@ def cli(
ctx.ensure_object(dict)
ctx.obj["HOST"] = host
ctx.obj["WALLET_NAME"] = walletname
ctx.obj["WALLET"] = Wallet(ctx.obj["HOST"], f"~/.cashu/{walletname}", walletname)
ctx.obj["WALLET"] = Wallet(
ctx.obj["HOST"], f"{str(Path.home())}/.cashu/{walletname}", walletname
)
pass
@@ -87,7 +90,7 @@ async def mint(ctx, amount: int, hash: str):
@cli.command("balance", help="See balance.")
@click.pass_context
@coro
async def receive(ctx):
async def balance(ctx):
wallet: Wallet = ctx.obj["WALLET"]
await init_wallet(wallet)
wallet.status()