Commit Graph

908 Commits

Author SHA1 Message Date
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
callebtc
4d8b6a7a74 bump version to 0.16.1 (#633) 2024-10-04 14:02:46 +02:00
callebtc
b92999cb21 tests: add tests for event client manager (#632) 2024-10-04 13:11:23 +02:00
callebtc
ca7269e74e disable codecov status (#631) 2024-10-03 10:59:03 +02:00
callebtc
700320a8c4 Fix: wallet include fees in swap outputs for inputs of successive melt (#630)
* wallet: add fees to outputs for melt that requires a split

* add test that requires a swap

* verify test fails, will revert

* revert true

* hopefully fix the tests

* fix default fee selection

* cleanup and renamings

* cleanup coinselect function, estimate fees

* fix test

* add comments

* weird error
2024-10-03 09:50:23 +02:00
callebtc
f8f061f810 Fix: Unset pending melt quote by quote id (#629)
* unser melt quote based on quote id

* fixes for lnbits
2024-10-02 15:13:17 +02:00
callebtc
d8d3037cc5 WIP: New melt flow (#622)
* `PaymentResult`

* ledger: rely on PaymentResult instead of paid flag. Double check for payments marked pending.

* `None` is `PENDING`

* make format

* reflected changes API tests where `PaymentStatus` is used + reflected changes in lnbits

* reflect changes in blink backend and tests

* fix lnbits get_payment_status

* remove paid flag

* fix mypy

* remove more paid flags

* fix strike mypy

* green

* shorten all state checks

* fix

* fix some tests

* gimme 

* fix............

* fix lnbits

* fix error

* lightning refactor

* add more regtest tests

* add tests for pending state and failure

* shorten checks

* use match case for startup check - and remember modified checking_id from pay_invoice

* fix strike pending return

* new tests?

* refactor startup routine into get_melt_quote

* test with purge

* refactor blink

* cleanup responses

* blink: return checking_id on failure

* fix lndgrpc try except

* add more testing for melt branches

* speed things up a bit

* remove comments

* remove comments

* block pending melt quotes

* remove comments

---------

Co-authored-by: lollerfirst <lollerfirst@gmail.com>
2024-09-24 14:55:35 +02:00
Pavol Rusnak
25f0763f94 chore: run pyupgrade (#623)
- use `{...}` instead of `set([...])`
- do not use `class Foo(object):`, just use `class Foo:`
- do not specify default flags (`"r"`) for `open()`
2024-09-24 13:53:35 +02:00
Pavol Rusnak
870d75b205 feat: untangle MintMeltMethodSetting into MintMethodSetting and MeltMethodSetting (#617)
+ add description to MintMethodSetting
2024-09-22 15:57:17 +02:00
callebtc
637e4ba80c NUT-04: add description (#613)
* NUT-04: add description

* skip test for deprecated api

* fix for lndgrpc

* add test for cli

* add two random tests

* add max length to request model validator

* skip cli test with description for deprecated api

* add cli test for invoice command

* default value to None
2024-09-09 11:50:02 +02:00
callebtc
0287c02f97 sanitize mint URL before adding (#606) 2024-09-08 15:59:10 +02:00
callebtc
ef5aee92d6 NUT-06: add icon URL (#604)
* mint info icon

* Update cashu/core/models.py

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

* Update cashu/mint/router.py

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

* Update cashu/wallet/mint_info.py

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

* fix setting

---------

Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
2024-09-08 15:00:32 +02:00
Pavol Rusnak
9eb66a46d3 bump bip32 and coincurve dependencies (#612) 2024-09-08 14:08:50 +02:00
Pavol Rusnak
accfdfec8e implement nut-06 time (#611) 2024-09-04 11:15:27 +02:00
lollerfirst
77ba356499 CLN multinut test fix (#602) 2024-07-30 16:30:01 +02:00
callebtc
e14dc6d7ca strip URL (#605) 2024-07-29 17:27:59 +02:00
lollerfirst
d388508521 Mint: Talk to LND via gRPC (#595)
* protos + lnd_grpc.py + __init__ +  status method

* `create_invoice`

* `pay_invoice`, `pay_partial_invoice` and router pb2

* `get_invoice_status`

* channel keep-alive options

* Update lnd_grpc.py

* `get_payment_status` + make format

* `get_payment_quote` and `paid_invoices_stream`. This was suspiciously easy...

* download_and_build script modified to fix the imports on generated code

* pyproject with new dependencies

* update poetry.lock

* fixed errors in `pay_partial_invoice`

* update .env.example

* make format

* enable regtest

* update .env.example

* suggested fixes

* suggested changes pt.2

* Update cashu/core/settings.py

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-07-29 17:16:40 +02:00
callebtc
4d0d25f738 Remove base64 padding from serialized tokens (#600)
* serialize tokens without base64 padding

* fix tests
2024-07-26 11:53:21 +02:00
callebtc
125ce9e8db Remove unused coinselection (#597) 2024-07-24 07:17:54 +02:00