Commit Graph

834 Commits

Author SHA1 Message Date
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
Caleb Beery
bb7730694d Refactored the request mint wallet method to generate the invoice from a returned MintQuoteResponse. (#507) 2024-04-15 18:43:13 +02:00
callebtc
bdaed8451c [Mint] Migrate duplicate keysets to db (#511)
* wip

* remove all deprecated keyset tests

* fix more tests

* fixups
2024-04-15 00:33:23 +02:00
Caleb Beery
26afd71d89 Restore wallet now restores tokens for all mint keysets. (#509) 2024-04-13 10:31:05 +02:00
callebtc
19de10bfea [Refactor] Mint: remove output.id optional (#504)
* remove output.id optional

* asserts

* wip

* wip

* working
2024-04-10 12:23:53 +02:00
Guilherme Pereira
3b2f1aa6f4 Issue #313: allow checking pending invoices (#493)
* Update deprecated datetime

* Add options to Invoices cli
With these options, we are able to return:
1) all invoices (this is the default);
2) pending invoices (paid False, out False);
3) paid invoices;
4) and unpaid invoices.

* make format

* Fix mypy error with datetime

* sort imports

* Remove unneeded unit when printing out info

* Fix wrong method doc

* Try to mint pending invoices

* make pre-commit

* Refactor --tests flag to --mint
The default will be false, i.e., if the user does not
pass in the --mint flag, it will not try to mint
the pending invoice.

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-04-03 17:51:15 +02:00
callebtc
b8ad0e0a8f Mint: Recover pending melts at startup (#499)
* wip works with fakewallet

* startup refactor

* add tests

* regtest tests for pending melts

* wip CLN

* remove db migration

* remove foreign key relation to keyset id

* fix: get_promise from db and restore DLEQs

* test: check for keyset not found error

* fix migrations

* lower-case all db column names

* add more tests for regtest

* simlate failure for lightning

* test wallet spent state with hodl invoices

* retry

* regtest with postgres

* retry postgres

* add sleeps

* longer sleep on github

* more sleep for github sigh

* increase sleep ffs

* add sleep loop

* try something

* do not pay with wallet but with ledger

* fix lnbits pending state

* fix pipeline to use fake admin from docker
2024-04-03 17:14:21 +02:00
callebtc
1f1daca232 Add test for NUT-12 (#498) 2024-03-29 22:34:51 +01:00
callebtc
b41b485f05 change sponsor link (#496) 2024-03-27 20:29:48 +01:00
callebtc
4ff9e6de5d bump version to 0.15.2 (#495) 2024-03-26 22:01:09 +01:00
findingsov
f7ad912b13 Update .env.example, add MINT_MAX_BALANCE (#474)
Changed MINT_MAX_PEG_IN/OUT defaults to 10000

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-03-26 16:04:07 +01:00
callebtc
e040479795 Fix CLNRest return model (#494)
* returs different model

* new way to get local balance
2024-03-26 12:00:13 +01:00
callebtc
3feb02312e fix: fakewallet payment fee unit (#490) 2024-03-23 03:08:13 +01:00
callebtc
adeec000a7 Mint: Add slowapi (#481)
* Add slowapi

* fix startup

* adjust settings

* add rate limits to tx routes

* elastic
2024-03-23 02:25:19 +01:00
callebtc
b288a6d50e Refactor: melt quote unit validation (#489)
* refactor: mint quote validation

* convert amount in Lightning backend for later validation

* fix blink amount return tests

* retry tests

* fix conftest fakewallet

* fix start
2024-03-23 01:16:28 +01:00
callebtc
3ba1e81fcb Mint: Fakewallet support for USD (#488)
* fakewallet usd wip

* FakeWallet support for USD

* fix api return for receive

* use MINT_BACKEND_BOLT11_SAT everywhere
2024-03-22 12:11:40 +01:00
callebtc
f4621345f3 Use PostRestoreRequest for all restore operations (#483)
* use PostRestoreRequest for all restore operations

* refactor: unit method verification
2024-03-21 22:59:47 +01:00
callebtc
df2c81ee89 NUTs: info endpoint method settings (#487)
* adjust info endpoint settings

* respect MINT_MAX_PEG_IN MINT_MAX_PEG_OUT settings
2024-03-21 14:53:47 +01:00
callebtc
e93837f2ea Add PyPi pipeline (#482)
* add pypi pipeline

* build and publish

* prepare inputs

* matrix strategy

* matrix

* install only whl

* try upload should error

* try token

* retry token

* use token directly

* no poetry config

* try again

* upload on release

* bump
2024-03-17 15:42:30 +01:00
callebtc
30cdb81041 Melt quotes use case-insensitive request (#479)
* use lowerstr melt quote

* case insensitive melt quotes
2024-03-16 18:45:53 +01:00
callebtc
86b8f5811f Mint: lookup internal quote settlement by request (#478) 2024-03-16 17:14:50 +01:00
callebtc
e7b1e0c0ed Batch update Y columns in proofs_used and proofs_pending tables (#475)
* mint: migration 16 batch update

* migrate: only if data exists
2024-03-16 10:56:51 +01:00
callebtc
7ecf14f87b Tests: mint restore api test (#473)
* tests: mint restore api test

* skipifs for deprecated tests

* use correct secret counter for tests

* docker only on release
2024-03-14 13:17:05 +01:00
callebtc
5ba19a17cf Seed encrypt: init mint with encrypted keys after migration (#472)
* seed encrypt: init mint with encrypted keys after migration

* adjust build pipeline
2024-03-14 12:48:24 +01:00
callebtc
752ab3c4c5 Fix seed encrypt migration (#405)
* print

* print before ledger

* print

* remove decryption

* make format
2024-03-14 12:21:21 +01:00
thesimplekid
6cb967fc02 fix: mint and melt quote expiry time (#453) 2024-03-14 12:17:42 +01:00
findingsov
f4777aad3e Update .env.example (#455)
StrikeWallet is StrikeUSDWallet, changed in 2 places, and added that it's usd only (in case it's not obvious).
2024-03-14 12:16:33 +01:00
callebtc
150195d66a Token state check with Y (#468)
* Token state check with Y

* remove backwards compat for v1
2024-03-12 15:53:18 +01:00
callebtc
4f52973908 Update PostRestoreResponse class to use "signatures" instead of "promises" (#467)
* update nut-09 endpoint

* add to deprecated router and wallet
2024-03-12 15:52:20 +01:00
callebtc
ff1e7597d1 Merge both h2c tests and add tests for deterministic blinding factor generation (#466) 2024-03-04 15:34:51 +01:00
callebtc
72573865ad Add checkout latest tag (#465) 2024-03-03 12:20:59 +01:00
callebtc
29be002495 Wallet: deprecate old h2c (#459)
* wallet: deprecate old hash to curve

* fix order

* added migration: untested

* recompute Y always
2024-02-26 23:07:13 +01:00
callebtc
53cd8ff016 bump version to 0.15.1 (#461) 2024-02-26 01:50:37 +01:00