Commit Graph

926 Commits

Author SHA1 Message Date
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
whileunless
aced665d9e Add period at the end of the phrase (#681) 2024-12-19 17:48:19 +01:00
lollerfirst
d98d166df1 Support NUT-XX (signatures on quotes) for mint and wallet side (#670)
* nut-19 sign mint quote

* ephemeral key for quote

* `mint` adjustments + crypto/nut19.py

* wip: mint side working

* fix import

* post-merge fixups

* more fixes

* make format

* move nut19 to nuts directory

* `key` -> `privkey` and `pubkey`

* make format

* mint_info method for nut-19 support

* fix tests imports

* fix signature missing positional argument + fix db migration format not correctly escaped + pass in NUT-19 keypair to `request_mint` `request_mint_with_callback`

* make format

* fix `get_invoice_status`

* rename to xx

* nutxx -> nut20

* mypy

* remove `mint_quote_signature_required` as per spec

* wip edits

* clean up

* fix tests

* fix deprecated api tests

* fix redis tests

* fix cache tests

* fix regtest mint external

* fix mint regtest

* add test without signature

* test pubkeys in quotes

* wip

* add compat

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-12-15 00:39:53 +01:00
lollerfirst
399c201552 NUT-19: Cached Requests and Responses (#624)
* fast-api-cache setup

* testing the cache

* fix

* still not working

* asynccontextmanager

* move test

* use redis & custom caching setup (like CDK)

* make format

* poetry lock

* fix format string + log when a cached response is found

* log when a cahced response is found

* fix tests

* poetry lock

* try tests on github

* use docker compose

* maybe we dont need docker

* fix types

* create_task instead of run

* how about we start postgres

* mint features

* format

* remove deprecated setex call

* use global expiry for all cached routes

* refactor feature map and set default to 1 week

* refactor feature construction

* Cache NUT-19

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-12-03 16:03:01 +03:00
ok300
ee90d840ab Add HTTP compression middleware (#676)
* Add HTTP compression middleware

* Apply fixes from `make format`
2024-11-25 13:08:46 +01:00
callebtc
2b233fd67e fix: NUT-15 setting remove mpp boolean (#673)
* fix: NUT-15 setting remove mpp boolean

* remove mpp flag
2024-11-24 16:55:17 +01:00
callebtc
0a230a1aa3 catch websocket disconenct errors (#674) 2024-11-24 16:48:39 +01:00
callebtc
0e2bdb0438 recommend openssl for key generation (#678) 2024-11-22 17:47:03 +01:00
callebtc
c4b639b068 parse env example (#677) 2024-11-21 18:38:59 +01:00
callebtc
901b16713c add methods key to info endpoitn a la https://github.com/cashubtc/nuts/pull/190 (#672) 2024-11-15 16:21:54 +01:00
callebtc
6a4f1bdbe9 bump version to 0.16.3 (#669) 2024-11-14 14:55:22 +01:00
callebtc
91976634a1 format (#668) 2024-11-06 18:45:34 +01:00
callebtc
d8a90d4c80 turn on mpp by default (#667) 2024-11-05 15:40:17 +01:00
David Caseria
2ad6d831e9 Add FakeWallet invoice features tag for supported payment secret (#609) 2024-11-05 15:03:41 +01:00
Pavol Rusnak
0de574e006 NUT-06: add urls field (#638) 2024-11-05 15:03:23 +01:00
callebtc
602687b215 refactor pubkey extraction and set n_sigs=1 for refund spend path (#644) 2024-11-05 15:02:54 +01:00
lollerfirst
ed0d25dec7 [FIX] Wallet sort outputs before swapping (#648)
* sort proofs

* outputs-ordering

* mypy fix

* clean up

* test if output amounts are sorted

* clean up test

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-11-05 15:00:37 +01:00
elnosh
9cdfba52a3 add nut-14 as supported in info endpoint (#647) 2024-11-05 13:52:09 +01:00
lollerfirst
b5afdfd598 Wallet check payment hash (#649)
* check preimage

* make format

* adjust logs

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-11-05 13:51:53 +01:00
callebtc
80ff0f1a7c Fix db lock tests (#665)
* skip db lock check in regtests

* revert?

* try this

* do not dispose conftests

* remove return

* test this

* try auto

* dispose stuff

* try uri=true

* remove the other flag

* move test

* reduce tests

* reduce more

* keep one

* skip on github?

* only skip in regtest

* trigger again

* restore cashu/mint/ledger.py
2024-11-05 13:47:31 +01:00
callebtc
9456809a21 bump python version requirements in all files (#654) 2024-11-05 13:43:54 +01:00
callebtc
05547e3710 Mint: Turn off locking by default (#662)
* turn off locking by default

* fix test
2024-11-04 10:52:33 +01:00
callebtc
f98ed30483 bump version (#664) 2024-11-04 10:52:09 +01:00
callebtc
3f8f3e0aef state check compat with 0.15.0 (#661) 2024-11-04 10:49:22 +01:00
callebtc
872fdbf519 catch json error (#660) 2024-11-02 15:06:01 +01:00
callebtc
0b2a020ab6 Fix wallet backwards paid flag melt (#659)
* backwards compat for melt quote without state

* backwards compat for quote without state
2024-11-02 13:43:18 +01:00
callebtc
e9d4689b4b Chore: update dev dependencies (#658)
* update dev dependencies

* test

* revert tests

* fix event loop scope

* ruff format

* add old test

* remove custom event loop

* default loop scope

* skip earlier

* trigger

* trigger again
2024-11-01 15:07:56 +01:00
callebtc
92627399a5 Wallet: store quotes (#657)
* wallet_quotes_wip

* fix quote in db

* fix subscription test

* clean up api

* fix api tests

* fix balance check
2024-11-01 13:27:27 +01:00
elnosh
21418a114a sort split in split_wallet_state (#653) 2024-11-01 10:22:12 +01:00
elnosh
fc9ed7c1fb include preimage and change in response from melt quote state check (#656) 2024-11-01 10:20:51 +01:00
Damian
b8dd43deaa Mint: settle mint-melt on same mint with different units externally (#651)
* WIP settle different units externally

* mint melt externally different units

* deprecated route return only sat

* comment

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-10-30 21:59:57 +01:00
callebtc
48b0368ad2 Mint: LNbitsWallet add extra check for payment state (#601)
* add extra check for payment state

* improve error handling

* fix response

* add failure
2024-10-28 18:05:53 +01:00
callebtc
09d007ec88 Refactor conditions and fix HTLC multisig (#643)
* refactor conditions and fix htlc multisig

* restore db/write.py

* safer check for P2PK secrets for SIG_ALL

* comment cleanup
2024-10-22 14:02:45 +02:00
conduition
d12a8d1bde wait for uvicorn server to bind before running tests (#607)
* wait for uvicorn server to bind before running tests

Previously we had a simple `time.sleep(1)` call after `server.start()`
which was present to give the Mint's HTTP server time to spin up during
test runs. This meant that if the server took longer than 1s to start
on a dev's machine for any reason (even intermittently) then tests would
fail due to connection errors.

The fix is to use a simple repeated polling check which allows
the test runner to start only once the server is confirmed listening.

* fix linter errors

* prevent infinite loop

* specifically except httpx.ConnectError

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>

---------

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
2024-10-20 01:01:32 +02:00
callebtc
d2e96162f8 wallet can now handle PostMeltResponse_deprecated from v1 api (#642) 2024-10-19 14:26:57 +02:00
callebtc
4490cc6fce Add get quote API to wallet + check proof states in batches (#637)
* add get quote api to wallet

* wrong string

* test before pushing

* fix tests for deprecated api only

* sigh
2024-10-08 18:12:10 +02:00
callebtc
cd39e18916 Bump dependencies to latest versions (#636)
* bump dependencies

* ignore type for validation handler
2024-10-08 09:20:20 +02:00
callebtc
307d2d7a98 Halt melt on exception (#635)
* halt melt for payment status exception

* refactor

* less log

* add fakewallet test throwing exceptions
2024-10-06 17:51:54 +02:00
lollerfirst
c5ccf65e4d Bump SQLAlchemy to 2.0 (#626)
* `SQLALCHEMY_WARN_20=1` fixed all removed warnings.

* fix some mypy errors

* fix fetchone

* make format

* ignore annotations

* let's try like this?

* remove

* make format

* Update pyproject.toml

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>

* extract _mapping in fetchone() and fetchall() + fix poetry lock

* fix

* make format

* fix integer indexing of row fields

* Update cashu/mint/crud.py

---------

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-10-05 13:32:32 +02:00
callebtc
7fdca3b1a1 Fix: ledger requires deprecated paid flags in db + wallet disable base64 keysets by default (#634)
* wallet: deprecate base64 keysets by default

* readd deprecated paid to melt quotes as well

* readd paid flag removed in #622 before
2024-10-04 15:32:36 +02:00
Pavol Rusnak
75ffa39807 chore: modernize f-string usage (#627) 2024-10-04 14:11:00 +02:00