Commit Graph

986 Commits

Author SHA1 Message Date
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
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