Commit Graph

866 Commits

Author SHA1 Message Date
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
callebtc
40e60c0e9b Mint: enable LNbitsWallet invoice stream (#594)
* enable lnbits invoice stream

* fix stream
2024-07-20 15:06:05 +02:00
callebtc
8675745e98 Add docker compose instructions (#591) 2024-07-18 00:38:43 +02:00
callebtc
040ee12d54 Edit README.md (#590) 2024-07-17 14:14:36 +02:00
lollerfirst
efdfecc182 Fix race condition (#586)
* `_set_proofs_pending` performs DB related "proofs are spendable" check inside the lock.

* move _verify_spent_proofs_and_set_pending to write.py

* edit logging

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-07-17 14:04:17 +02:00
callebtc
71580a5e60 Fix parsing of old format contact field in wallet (#589)
* wallet parse contact field if its old format

* default checks for contacts
2024-07-17 11:48:40 +02:00
callebtc
c6f236494f Fix NUT-17 settings entry for NUT-06 (#587)
* Fix NUT-17 settings entry for NUT-06

* Wallet: fix mint info deserialization
2024-07-16 17:38:19 +02:00
callebtc
21f339ca2b NUT-06: Mint contact info (#585)
* Implement NUT-06 change: https://github.com/cashubtc/nuts/pull/117

* wallet deserialize

* ignore contact info for deprecated v0 response
2024-07-15 14:11:54 +02:00
elnosh
f32099bce7 Wallet: default to SIG_INPUTS in P2PK lock (#584) 2024-07-13 03:25:23 +02:00
callebtc
99382242dc Instructions for .env (#582) 2024-07-12 19:01:19 +02:00
callebtc
a019fb76fc codecov: ignore cashu/nostr (#378)
* codecov: ignore cashu/nostr

* adjust codecov call in regtest
2024-07-12 18:59:06 +02:00
callebtc
069e9476d4 StrikeWallet: support USDT (#583)
* Strike: add error message if currency is not present

* small print

* try USDT
2024-07-12 18:44:33 +02:00
callebtc
c52a4c26fb More information (#581) 2024-07-12 18:04:56 +02:00
callebtc
3077ca4c7d Wallet: add CLI flag --force-swap flag and force swapping all inactive keysets (#580)
* Wallet: add flag --force-swap to send command

* Reame split to swap across codebase

* rename remaining splits to swap

* fix restore index with multiple keysets

* fix wallet api restore
2024-07-11 23:08:36 +02:00
callebtc
77697c52ee Fix loading b64 keysets and add option to set b64 inactive in WalletSettings (#579)
* Mint: fix loading b64 keysets and Wallet: option to set b64 inactive

* typo

* readd include fees flag (unused)

* fix test to respect new default False flag

* fix default flag for regtest
2024-07-11 15:25:16 +02:00
callebtc
1660005bef Fix receive -a to receive all pending tokens (#578)
* catch error if receive -a doesnt work with a certain mint

* receive pending tokens from multiple mints

* receive pending from all mints and catch exceptions
2024-07-11 12:55:36 +02:00
callebtc
26b94951fc Fix Tokenv4 handling of base64 keysets (#575)
* wip: handle tokenv4 if the keyset is base64

* wip

* Tokens now dataclasses

* Deserialize DLEQ from string

* add tokenv3/v4 base64 keyset ID tests

* fix cli
2024-07-10 14:12:03 +02:00
callebtc
8eea541b74 update requirements and docker build (#572) 2024-07-09 16:36:24 +02:00
callebtc
eccbf6f789 bump version to 0.16.0 (#573) 2024-07-09 16:36:09 +02:00
callebtc
539054a7c9 refactor db transactions (#571) 2024-07-09 15:46:19 +02:00
callebtc
51ae82bee8 fix: cashu send --lock (#570) 2024-07-08 19:47:11 +02:00
callebtc
6a0a370ba5 Mint: table locks (#566)
* clean up db

* db: table lock

* db.table_with_schema

* fix encrypt.py

* postgres nowait

* add timeout to lock

* melt quote state in db

* kinda working

* kinda working with postgres

* remove dispose

* getting there

* porperly clean up db for tests

* faster tests

* configure connection pooling

* try github with connection pool

* invoice dispatcher does not lock db

* fakewallet: pay_if_regtest waits

* pay fakewallet invoices

* add more

* faster

* slower

* pay_if_regtest async

* do not lock the invoice dispatcher

* test: do I get disk I/O errors if we disable the invoice_callback_dispatcher?

* fix fake so it workss without a callback dispatchert

* test on github

* readd tasks

* refactor

* increase time for lock invoice disatcher

* try avoiding a race

* remove task

* github actions: test regtest with postgres

* mint per module

* no connection pool for testing

* enable pool

* do not resend paid event

* reuse connection

* close db connections

* sessions

* enable debug

* dispose engine

* disable connection pool for tests

* enable connection pool for postgres only

* clean up shutdown routine

* remove wait for lightning fakewallet lightning invoice

* cancel invoice listener tasks on shutdown

* fakewallet conftest: decrease outgoing delay

* delay payment and set postgres only if needed

* disable fail fast for regtest

* clean up regtest.yml

* change order of tests_db.py

* row-specific mint_quote locking

* refactor

* fix lock statement

* refactor swap

* refactor

* remove psycopg2

* add connection string example to .env.example

* remove unnecessary pay

* shorter sleep in test_wallet_subscription_swap
2024-07-08 18:05:57 +02:00
callebtc
af636db545 update poetry.lock (#567) 2024-07-01 11:17:46 +02:00
lollerfirst
ca272bc20f Mint: Add clnrest.py Lightning backend (#551)
* log cln error

* return a string

* update corelightningrest to work with latest ver using rune

* fix mpp spec and backend support check

* refactor validation in ledger

* remove weird error

* fix mpp melt model

* corelightningrest.py: Added Multi-Mint payout support
lndrest.py: fix `quote.amount` is not always in sats + better checks

* small fix

* Fix quote.unit str2unit conversion + add missing imports

* settings enable mpp corelightning (default false)

* small fix

* fix `paid_invoice_stream`

* make format

* handle runes

* load rune

* rename to MINT_CORELIGHTNING_REST_RUNE

* try without cert

* port

* try except callback dispatcher

* clean up cln-rest streaming parser

* conftest: mint_corelightning_enable_mpp

* enable mpp in regtest.yaml

* fix error handling clnrest, remove lndrest changes

* CLNRest + CoreLightningRest

* clean up corelightningrest and get last index before starting the stream

* clean up

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
Co-authored-by: Richard Bensberg <r@coinbatsu.com>
2024-06-30 20:36:19 +02:00
callebtc
2739c3127a TokenV4 CBOR serialization (#502)
* WIP: cashuB with CBOR

* working

* tokenv4 works

* fix mypy
2024-06-30 14:36:44 +02:00
callebtc
1d8b5cd5ca Fix: Nut 05 mint response model (#564)
* change response model of NUT-05 to include payment_preimage and change (NUT-08)

* fix tests

* crud: same expiry as timestamp

* fix expiry handling

* add api tests to check new models
2024-06-27 14:35:03 +02:00
callebtc
8af1b61b30 default witness is None, closes #559 (#563) 2024-06-26 23:38:57 +02:00
callebtc
541324b2bd warning messages (#562) 2024-06-26 16:34:36 +02:00
elliedev80
6946bed8c3 add MINT_LND_REST_CERT_VERIFY env bool that when set to False allow to skip certificate validation for LND api call (#535)
* LND Backend
 - Add MINT_LND_REST_CERT_VERIFY bool variable that when set to False allows
   verify=False for httpx and ignore LND selfsigned certificate validation

 On branch main
 Your branch is up to date with 'origin/main'.

 Changes to be committed:
	modified:   .env.example
	modified:   cashu/core/settings.py
	modified:   cashu/lightning/lndrest.py

* Update .env.example

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-06-26 15:03:19 +02:00
callebtc
1766b6e92e [Mint] Add support for BTC and EUR in StrikeWallet backend, add EUR to FakeWallet (#561)
* strike for btc and eur

* strike works with eur

* backend check
2024-06-26 14:50:39 +02:00
callebtc
6b38ef6c29 NUT-04 and NUT-05: Add state field to quotes (#560)
* wip adding states, tests failing

* add state field to quotes

* responses from quotes

* store correct state

* cleaner test

* fix swap check

* oops
2024-06-26 03:06:01 +02:00
callebtc
e846acf946 Mint: add websockets for quote updates (#413)
* add websockets for quote updates

* add test (not working)

* wip: emit events to everyone

* wip: emit events to everyone

* wip, lots of things broken but invoice callback works

* wip

* add wip files

* tests almost passing

* add task

* refactor nut constants

* startup fix

* works with old mints

* wip cli

* fix mypy

* remove automatic invoice test now with websockets

* remove comment

* better logging

* send back response

* add rate limiter to websocket

* add rate limiter to subscriptions

* refactor websocket ratelimit

* websocket tests

* subscription kinds

* doesnt start

* remove circular import

* update

* fix mypy

* move test file in test because it fails if it runs later... dunno why

* adjust websocket NUT-06 settings

* local import and small fix

* disable websockets in CLI if "no_check" is selected

* move subscription test to where it was

* check proof state with callback, add tests

* tests: run mint fixture per module instead of per session

* subscription command name fix

* test per session again

* update test race conditions

* fix tests

* clean up

* tmp

* fix db issues and remove cached secrets

* fix tests

* blindly try pipeline

* remove comments

* comments
2024-06-25 19:20:03 +02:00
callebtc
75987beaf1 Fix false mpp payment handling of unsupported backends (#547)
* fix mpp spec and backend support check

* refactor validation in ledger

* remove weird error

* fix mpp melt model
2024-06-16 17:16:10 +02:00
callebtc
2fae0ba2e2 use integer division as per https://github.com/cashubtc/nuts/pull/126\#discussion_r1625244955 (#549) 2024-06-16 17:11:07 +02:00
callebtc
d30b1a2777 Add fees (#503)
* wip

* wip

* model

* refactor wallet transactions

* refactor wallet

* sending with fees works and outputs fill up the wallet

* wip work

* ok

* comments

* receive with amount=0

* correctly import postmeltrequest

* fix melt amount

* tests working

* remove mint_loaded decorator in deprecated wallet api

* wallet works with units

* refactor: melt_quote

* fix fees

* add file

* fees for melt inputs

* set default input fee for internal quotes to 0

* fix coinselect

* coin selection working

* yo

* fix all tests

* clean up

* last commit added fees for inputs for melt transactions - this commit adds a blanace too low exception

* fix fee return and melt quote max allowed amount check during creation of melt quote

* clean up code

* add tests for fees

* add melt tests

* update wallet fee information
2024-06-15 16:22:41 +02:00
callebtc
d80280e35d startup: do not print postgres connection string, closes #523 (#540) 2024-06-05 13:11:51 +02:00
callebtc
61cf7def24 Multinut LND (#492)
* amount in melt request

* apply fee limit

* more error handling

* wip: signal flag in /info

* clean up multinut

* decode mypy error lndrest

* fix test

* fix tests

* signal feature and blindmessages_deprecated

* setting

* fix blindedsignature method

* fix tests

* mint info file

* test mpp with lnd regtest

* nuts optionsl mint
 info

* try to enable mpp with lnd

* test mpp with third payment
2024-05-22 22:52:26 +02:00
callebtc
71b4051373 refactor melt quote (#530) 2024-05-22 16:52:08 +02:00
callebtc
52fbfc4b21 add testnut to readme (#522) 2024-04-25 10:16:08 +02:00
callebtc
7c8e93ff3a [CI] prevent pypi upload on pre-releases (#520)
* prevent pypi upload on pre-releases

* only on release
2024-04-19 12:28:48 +02:00
findingsov
72ad903200 Update startup.py, check blink key (#516)
Missing blink key here-added:

for key, value in settings.dict().items():
    if key in [
        "mint_private_key",
        "mint_seed_decryption_key",
        "nostr_private_key",
        "mint_lnbits_key",
        "mint_blink_key",
2024-04-19 12:00:22 +02:00
callebtc
fa3e2fd130 default setting for mint_derivation_path_list (#515) 2024-04-16 17:44:36 +02:00
callebtc
bd2a14fa43 [Wallet] Fix regression bug for mint request (#513)
* fix regression bug for mint request

* expiry is absolute time
2024-04-16 10:28:07 +02:00