mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-20 18:44:20 +01:00
fix: load mint with most recent keyset (#162)
This commit is contained in:
@@ -185,11 +185,11 @@ async def get_mint_wallet(ctx: Context):
|
|||||||
Helper function that asks the user for an input to select which mint they want to load.
|
Helper function that asks the user for an input to select which mint they want to load.
|
||||||
Useful for selecting the mint that the user wants to send tokens from.
|
Useful for selecting the mint that the user wants to send tokens from.
|
||||||
"""
|
"""
|
||||||
|
# we load a dummy wallet so we can check the balance per mint
|
||||||
wallet: Wallet = ctx.obj["WALLET"]
|
wallet: Wallet = ctx.obj["WALLET"]
|
||||||
await wallet.load_mint()
|
|
||||||
|
|
||||||
mint_balances = await wallet.balance_per_minturl()
|
mint_balances = await wallet.balance_per_minturl()
|
||||||
|
|
||||||
|
# if we have balances on more than one mint, we ask the user to select one
|
||||||
if len(mint_balances) > 1:
|
if len(mint_balances) > 1:
|
||||||
await print_mint_balances(ctx, wallet, show_mints=True)
|
await print_mint_balances(ctx, wallet, show_mints=True)
|
||||||
|
|
||||||
@@ -215,11 +215,7 @@ async def get_mint_wallet(ctx: Context):
|
|||||||
mint_wallet = Wallet(
|
mint_wallet = Wallet(
|
||||||
mint_url, os.path.join(settings.cashu_dir, ctx.obj["WALLET_NAME"])
|
mint_url, os.path.join(settings.cashu_dir, ctx.obj["WALLET_NAME"])
|
||||||
)
|
)
|
||||||
mint_keysets: WalletKeyset = await get_keyset(mint_url=mint_url, db=mint_wallet.db) # type: ignore
|
await mint_wallet.load_mint()
|
||||||
|
|
||||||
# load the keys
|
|
||||||
assert mint_keysets.id
|
|
||||||
await mint_wallet.load_mint(keyset_id=mint_keysets.id)
|
|
||||||
|
|
||||||
return mint_wallet
|
return mint_wallet
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user