Commit Graph

966 Commits

Author SHA1 Message Date
Olindo Task
bbfb63b34e Add verbose request logging feature to wallet (#758)
* Add verbose request logging feature to wallet

* add verbose cli tests

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-06-24 22:31:40 +02:00
callebtc
48823d673d Mint: adjust mint melt settings (#764)
* adjust mint melt settings

* .env.example

* ge=0, closes #756
2025-06-01 12:24:37 +02:00
iwarp
67b7ea6b72 Another changes for LNbits API (#739)
* pending -> status; sse -> websocket

* paid_invoices_stream only for incoming

* fix backward compatibility

* loop

* 'retro-compatible' paid invoice stream

---------

Co-authored-by: lollerfirst <lollerfirst@gmail.com>
2025-06-01 12:20:03 +02:00
callebtc
266685bde0 add NUT-23 to list (#763) 2025-06-01 00:11:54 +02:00
callebtc
3e32dc40e3 add msat support for strike backend (#755) 2025-05-18 15:48:15 +02:00
callebtc
53126456a5 Fix readme links (#753)
* fix readme links

* improve readme
2025-05-14 13:04:53 +02:00
callebtc
c6f7ab1e79 ledger watchdog: disable the abort queue for now (#754) 2025-05-14 13:04:28 +02:00
callebtc
081a30ea68 bump version to 0.17.0 (#751) 2025-05-13 18:01:20 +02:00
callebtc
cbf5b725d9 check for migration first (#750) 2025-05-11 21:34:34 +02:00
callebtc
fc0e3fe663 Mint: watchdog balance log and killswitch (#705)
* wip store balance

* store balances in watchdog worker

* move mint_auth_database setting

* auth db

* balances returned as Amount (instead of int)

* add test for balance change on invoice receive

* fix 1 test

* cancel tasks on shutdown

* watchdog can now abort

* remove wallet api server

* fix lndgrpc

* fix lnbits balance

* disable watchdog

* balance lnbits msat

* test db watcher with its own database connection

* init superclass only once

* wip: log balance in keysets table

* check max balance using new keyset balance

* fix test

* fix another test

* store fees in keysets

* format

* cleanup

* shorter

* add keyset migration to auth server

* fix fakewallet

* fix db tests

* fix postgres problems during migration 26 (mint)

* fix cln

* ledger

* working with pending

* super fast watchdog, errors

* test new pipeline

* delete walletapi

* delete unneeded files

* revert workflows
2025-05-11 20:29:13 +02:00
callebtc
38bdb9ce76 Tests: split wallet test from mint test pipeline (#748)
* split wallet test from mint test pipeline

* regtest mint and wallet

* fix

* fix

* move mint tests

* real invoice in regtest mpp
2025-05-11 14:14:49 +02:00
lollerfirst
619d06f0ab [PATCH] LND use_mission_control + exclude failing channels (#738)
* lnd_grpc multinut patch

* lndrest multinut patch

* mypy fixes

* fixes non escaped double quotes in error messages formats

* fix

* fix debug log with correct hops number

* correctly escape "hops"

* remove `ignored_pairs` constraint

* Apply suggestions from code review

change some error logs to debug

* add tests and some cleanup

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-05-10 15:45:15 +02:00
callebtc
3d21443c3c bump to 0.16.6 (#747) 2025-05-10 15:31:56 +02:00
callebtc
2135b96706 Testing: check if pipeline gets stuck because of startup task (#745)
* lets check if this gets stuck with postgres or not

* check if it works if I add sleeps

* replace startup_ledger with await ledger._check_pending_proofs_and_melt_quotes() in tests

* fix typo to trigger tests again
2025-05-10 15:04:56 +02:00
callebtc
0d127f0477 .env.example for mint TOS (#746) 2025-05-10 12:18:56 +02:00
callebtc
4869a280ca add new init test to mint (#743) 2025-05-09 22:06:27 +02:00
callebtc
dc1dccb5e8 Wallet: Fix cli mpp off (#741)
* fix

* tests
2025-05-08 18:01:11 +02:00
callebtc
7a18ac8712 reorganize docker compose files for redis and keycloak (#736) 2025-04-26 00:45:39 +02:00
callebtc
7f962ce63e Wallet: add Wallet.get_melt_proof(), recover reserved state in failed Wallet.melt() (#730)
* manage state of proofs

* test set proofs unreserved

* melt recovers state on error

* fix wallet test

* fix tests

* fix another test

* get_mint_quote returns MintQuote

* fix tests

* refactor

* fix deprecated tests

* add new unset type
2025-04-25 13:12:45 +02:00
lollerfirst
213d5b1eee Mint Keyset Rotation (#734)
* move keysets methods into newly created `LedgerKeysets` + `maybe_update_derivation_path` on init

* keyset rotation

* fix error

* make format

* format

* test keyset rotation + fix bug

* format

* fix for multiple specified derivation paths

* specify return value
2025-04-25 11:37:49 +02:00
callebtc
7abfc68cfa SIG_ALL signature flag for P2PK (#735)
* n_sigs_refund working, tests added

* update requirements

* wip sigall

* wip

* sigall works

* add signatures for refund

* add mint p2pk tests

* add more p2pk tests

* fix tests

* sign htlc pubkeys as well

* fix htlc and add new test

* fix regtest

* fix new tests with deprecated

* remove asserts

* comments

* new wallet p2pk tests

* getting there

* add more tests

* fixes

* refactor htlc and p2pk validation

* reduce code

* melt with sigall

* fix htlcs

* fix deprecated api tests

* Update cashu/mint/conditions.py

Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com>

* refactor sigall validation

---------

Co-authored-by: lollerfirst <43107113+lollerfirst@users.noreply.github.com>
2025-04-25 11:37:19 +02:00
iwarp
8d94d1097b fix getting the PR (#732) 2025-04-20 16:21:52 +07:00
callebtc
e1220d2329 Cjbeery24/mint copy: Invoice checker background tasks (#722)
* #616: Removed blocking call from ledger startup. Instead added it to a background task that repeats every hour.

* make task interval configurable, remember task and cancel it on shutdown

* comments

* add sleep to tests because the background task is async

---------

Co-authored-by: Caleb Beery <cjbeery@gmail.com>
2025-04-10 21:25:18 +07:00
callebtc
76e2601efd Add terms of service URL to MintInformation class (#715)
* add tos_url according to https://github.com/cashubtc/nuts/pull/205

* add tos_url everywhere
2025-03-28 16:11:04 +01:00
callebtc
f783493e1a Fix mint migrations: Fill in missing keyset IDs in proofs and promises (#729)
* mint migrations: fill in missing keyset ids in proofs and promises

* do not throw exception

* add error where proofs are missing an id but no keyset was found

* fix balance view initialization
2025-03-27 11:33:20 +01:00
callebtc
bae4855915 NUT-04/05: add amount, unit, request to melt and mint quote responses (#719)
* add amount, unit, request to melt and mint responses

* make new fields optional to not break compat with old mints

* make new flags optional for backwards compat
2025-03-08 18:23:34 +00:00
Ofek Lev
3ab1e1dfb2 Upgrade coincurve to version 21.0.0 (#721) 2025-03-08 18:05:29 +00:00
Houdini
7b3f5d01d0 Allow arbitrary denominations in wallet minting (#684)
- Update `mint` method to use allowed amounts from the mint
- Add `get_allowed_amounts` method to fetch supported denominations
- Modify `test_mint_amounts_wrong_order` to expect new error message

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-03-06 20:15:14 +01:00
lollerfirst
72ac35405c [NUT-15] LND: Try Multiple Routes (#692)
* try multiple routes

* fix

* Lnd gRPC
2025-03-06 00:05:13 +01:00
callebtc
9305905a85 Add LightningPaymentFailedError exception (#706)
* add error code

* fix test
2025-03-06 00:04:37 +01:00
lollerfirst
f72a3f260f [FIX] NUT-15 mpp amount in millisats (#703)
* fix lndrest

* fix clnrest

* fix clnrest and lndrest

* lnd grpc fix

* wallet

* convert amount to millisats in CLI pay invoice

* fix tests

* format

* fix kw arg in regtest test

* fix payment quote validation check

* clean comment

* avoid overwriting variable

* deprecated response with amount

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-03-05 23:47:03 +01:00
findingsov
8555c020d4 Update README.md-install nutshell into nutshell dir (#713) 2025-03-05 14:35:05 +01:00
findingsov
2107c806c6 Update README.md - Add Redis info? (#714)
* Update README.md - Add Redis info?

Add some Redis info (maybe not all this is needed?)

* use redis docker compose

* clean up

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-03-04 12:49:51 +01:00
lollerfirst
77de51f336 add cli decode + fix crash when mint is offline (#709) 2025-03-04 12:38:47 +01:00
lollerfirst
0c40bbbc08 Balance Views Grouped By Keyset (#652)
* balance view per keyset + relative changes.
    Still lacking: settings changes

* import unit

* fix 0 balance

* settings

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-02-17 12:55:28 +01:00
callebtc
23a706d873 Set correct blink min fee (#701)
* min fee

* fix tests

* amount_split test
2025-02-13 15:53:26 +01:00
lollerfirst
ec3db81cee Update Error Codes (#702)
* add new error codes

* use the new errors in the code

* fix unsorted import

* fix test wallet
2025-02-13 15:35:06 +01:00
callebtc
a0ef44dba0 Blind authentication (#675)
* auth server

* cleaning up

* auth ledger class

* class variables -> instance variables

* annotations

* add models and api route

* custom amount and api prefix

* add auth db

* blind auth token working

* jwt working

* clean up

* JWT works

* using openid connect server

* use oauth server with password flow

* new realm

* add keycloak docker

* hopefully not garbage

* auth works

* auth kinda working

* fix cli

* auth works for send and receive

* pass auth_db to Wallet

* auth in info

* refactor

* fix supported

* cache mint info

* fix settings and endpoints

* add description to .env.example

* track changes for openid connect client

* store mint in db

* store credentials

* clean up v1_api.py

* load mint info into auth wallet

* fix first login

* authenticate if refresh token fails

* clear auth also middleware

* use regex

* add cli command

* pw works

* persist keyset amounts

* add errors.py

* do not start auth server if disabled in config

* upadte poetry

* disvoery url

* fix test

* support device code flow

* adopt latest spec changes

* fix code flow

* mint max bat dynamic

* mypy ignore

* fix test

* do not serialize amount in authproof

* all auth flows working

* fix tests

* submodule

* refactor

* test

* dont sleep

* test

* add wallet auth tests

* test differently

* test only keycloak for now

* fix creds

* daemon

* fix test

* install everything

* install jinja

* delete wallet for every test

* auth: use global rate limiter

* test auth rate limit

* keycloak hostname

* move keycloak test data

* reactivate all tests

* add readme

* load proofs

* remove unused code

* remove unused code

* implement change suggestions by ok300

* add error codes

* test errors
2025-01-29 22:48:51 -06:00
callebtc
b67ffd8705 bump to 0.16.5 (#699) 2025-01-29 15:25:31 -06:00
lollerfirst
e9952e59ed [FIX] Reject Internal MPP Melt Quote Requests (#697)
* fix

* fix the fix

* make sure the mpp is supported before testing

* adjust message

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2025-01-29 14:00:35 -06:00
callebtc
320c70060e wallet fix: load proofs before receiving (#698) 2025-01-29 13:32:57 -06:00
lollerfirst
ea96fab9e3 [FIX] Specs conformant error codes (#693)
* error codes must follow spec

* make format
2025-01-21 17:36:22 -06:00
callebtc
4e7917fb20 Fix Redis teardown logic based on usage (#696)
* fix: tear down redis only if used

* fix: close redis only if its used
2025-01-21 17:35:24 -06:00
callebtc
ad7c6b8e0b Issue NUT-08 overpaid Lightning fees for melt quote checks on startup (#688)
* startup: do not rollback unknown melt quote states

* fix: provide overpaid fees on startup

* fix: check if outputs in db

* fix test: expect melt quote pending if payment state is unknown

* fix up comment
2025-01-21 17:28:41 -06:00
Pavol Rusnak
2f19485ad6 config cleanup regarding MPP (#689)
* remove MINT_LND_ENABLE_MPP from .env.example

since it is now default

* remove MINT_LND_ENABLE_MPP from CI regtest workflow

since it is now default

* enable MINT_CLNREST_ENABLE_MPP for CI regtest workflow

by removing false assignment, since it is now default
2025-01-13 14:52:11 -06:00
Pavol Rusnak
09deef107d chore: use poetry the latest 1.8.x poetry consistently (#691) 2025-01-13 09:53:42 -06:00
Pavol Rusnak
2a855920a7 update asyncpg 0.29.0 -> 0.30.0 to make Python 3.13 happy (#690)
asyncpg 0.29.0 is not compatible with Python 3.13
2025-01-13 09:52:32 -06:00
callebtc
d77376b367 restart redis docker (#687) 2025-01-04 00:06:52 +01:00
callebtc
c108bb1935 add NUT-19 example (#686) 2025-01-03 23:50:01 +01:00
callebtc
5e5a1a57d9 bump to 0.16.4 (#685) 2025-01-03 22:45:16 +01:00