mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-22 19:34:18 +01:00
Add fees (#503)
* wip * wip * model * refactor wallet transactions * refactor wallet * sending with fees works and outputs fill up the wallet * wip work * ok * comments * receive with amount=0 * correctly import postmeltrequest * fix melt amount * tests working * remove mint_loaded decorator in deprecated wallet api * wallet works with units * refactor: melt_quote * fix fees * add file * fees for melt inputs * set default input fee for internal quotes to 0 * fix coinselect * coin selection working * yo * fix all tests * clean up * last commit added fees for inputs for melt transactions - this commit adds a blanace too low exception * fix fee return and melt quote max allowed amount check during creation of melt quote * clean up code * add tests for fees * add melt tests * update wallet fee information
This commit is contained in:
@@ -12,7 +12,7 @@ from ...wallet.wallet import Wallet as Wallet
|
||||
|
||||
async def print_balance(ctx: Context):
|
||||
wallet: Wallet = ctx.obj["WALLET"]
|
||||
await wallet.load_proofs(reload=True, unit=wallet.unit)
|
||||
await wallet.load_proofs(reload=True)
|
||||
print(f"Balance: {wallet.unit.str(wallet.available_balance)}")
|
||||
|
||||
|
||||
@@ -24,11 +24,11 @@ async def get_unit_wallet(ctx: Context, force_select: bool = False):
|
||||
force_select (bool, optional): Force the user to select a unit. Defaults to False.
|
||||
"""
|
||||
wallet: Wallet = ctx.obj["WALLET"]
|
||||
await wallet.load_proofs(reload=True, unit=False)
|
||||
await wallet.load_proofs(reload=False)
|
||||
# show balances per unit
|
||||
unit_balances = wallet.balance_per_unit()
|
||||
if ctx.obj["UNIT"] in [u.name for u in unit_balances] and not force_select:
|
||||
wallet.unit = Unit[ctx.obj["UNIT"]]
|
||||
if wallet.unit in [unit_balances.keys()] and not force_select:
|
||||
return wallet
|
||||
elif len(unit_balances) > 1 and not ctx.obj["UNIT"]:
|
||||
print(f"You have balances in {len(unit_balances)} units:")
|
||||
print("")
|
||||
@@ -68,7 +68,7 @@ async def get_mint_wallet(ctx: Context, force_select: bool = False):
|
||||
"""
|
||||
# we load a dummy wallet so we can check the balance per mint
|
||||
wallet: Wallet = ctx.obj["WALLET"]
|
||||
await wallet.load_proofs(reload=True)
|
||||
await wallet.load_proofs(reload=False)
|
||||
mint_balances = await wallet.balance_per_minturl()
|
||||
|
||||
if ctx.obj["HOST"] not in mint_balances and not force_select:
|
||||
@@ -102,6 +102,7 @@ async def get_mint_wallet(ctx: Context, force_select: bool = False):
|
||||
mint_url,
|
||||
os.path.join(settings.cashu_dir, ctx.obj["WALLET_NAME"]),
|
||||
name=wallet.name,
|
||||
unit=wallet.unit.name,
|
||||
)
|
||||
await mint_wallet.load_proofs(reload=True)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user