Commit Graph

770 Commits

Author SHA1 Message Date
callebtc
9c3949d197 Mint: fix Blink multiple failed attempts (#440)
* fix: blink multiple failed attempts

* fix line length again
2024-02-18 19:26:10 +01:00
callebtc
ad906df788 Mint: blink fix fee estimation (#439)
* blink: fix fee esimation

* fix line length

* fix line length

* fix line length

* remove noqa
2024-02-18 12:24:41 +01:00
callebtc
48158cd497 update ruff (#437)
* update ruff

* test

* update ruff

* update pyproject
2024-02-17 21:43:26 +01:00
callebtc
c4f4f3ccf2 Revert "Dev: Update ruff precommit hooks (#434)" (#436)
This reverts commit fca2a6cb4b.
2024-02-17 21:33:16 +01:00
callebtc
fca2a6cb4b Dev: Update ruff precommit hooks (#434)
* update ruff

* test

* update ruff

* only ruff check

* CI rename
2024-02-17 21:22:07 +01:00
callebtc
c285d48edf Add Blink backend (#433)
* wip blink

* Blink working

* check fee correctly

* add comment

* unfix lnbits

* unit test blink backend

* make format

* mypy

* settings

* add error if blink key not set
2024-02-17 20:51:37 +01:00
callebtc
94db0fc4c6 Docker: use python 3.10 (#432)
* Docker: use python 3.10

* Add Docker workflow

* Build always

* add all
2024-02-17 12:02:26 +01:00
callebtc
d1540ccb5b wallet: add batch size setting (#431) 2024-02-16 15:22:41 +01:00
Steffen
1397c46ff4 add missing disabled-flag to nut4 (#426)
* add missing disabled-flag to nut4

* Update cashu/mint/router.py

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-02-16 14:07:44 +01:00
callebtc
afbde83ae2 wallet print on json deseriliaztion error and batch invalidation of proofs (#430) 2024-02-16 12:11:39 +01:00
callebtc
3f090c1691 Mint: add expiry to quotes, closes #385 (#429)
* add expiry to quotes, closes #385

* fix wallet deprecated mock with expiry

* expiry is an optional field
2024-02-16 11:40:46 +01:00
callebtc
ecad95715f readd db backup (#424) 2024-02-15 15:58:40 +01:00
callebtc
e251e8a9ea no backup (#423) 2024-02-15 14:01:06 +01:00
callebtc
d168b4b516 do not migrate in the beginning (#422) 2024-02-15 13:30:53 +01:00
callebtc
7c644e1835 Adjust new domain separator (#421)
* adjust new domain separator

* Update cashu/core/crypto/b_dhke.py

Co-authored-by: Lagrang3 <32647090+Lagrang3@users.noreply.github.com>

* slightly adjust comment

---------

Co-authored-by: Lagrang3 <32647090+Lagrang3@users.noreply.github.com>
2024-02-15 09:45:45 +01:00
callebtc
464c0e0ea4 DB backups before migrations (#420)
* make backups before migrations

* database tests

* postgres db backup with location string

* ignore version in pg_dump and throw warning

* install latest pg_dump

* install latest

* pg update?

* remove test from github

* skip for postgres on github actions
2024-02-11 20:23:43 +01:00
callebtc
6fd66b9d72 Mint: check that test db is different from main db (#419)
* check that test db is different from main db

* make format
2024-02-11 17:31:56 +01:00
callebtc
f74f18c9ca Github CI with Postgres (#417)
* with postgres

* postgres test explicit

* make format

* start postgres only if needed

* remove if again

* print db

* db in matrix

* delete schema

* use new env var MINT_TEST_DATABASE for tests

* add db path to regtest
2024-02-11 15:52:02 +01:00
callebtc
78de84f3eb drop balance views during migration (#416) 2024-02-11 13:49:28 +01:00
callebtc
ac8e21a3a4 relative import all (#415) 2024-02-11 12:51:44 +01:00
callebtc
a2b9ac8f14 relative import (#414) 2024-02-11 12:46:53 +01:00
callebtc
6db4604f99 Mint: store Y in db (#412)
* storage y db

* for proofs_pending as well

* pending check with Y

* fix pending table

* test_race_pending

* skip race condition test on github

* skip test on github actions

* move test_cli.py -> test_wallet_cli.py

* get full proof from memory

* add domain separation wallet
2024-02-10 22:52:55 +01:00
callebtc
1de7abf032 mint: do not print all keysets (#410) 2024-02-05 23:23:52 +01:00
callebtc
7574b13229 Mint: option to not duplicate keysets (#409)
* option to not duplicate keysets

* test also settings
2024-02-05 23:19:31 +01:00
callebtc
087ee957a5 remove column check during migration (#408) 2024-02-05 18:43:11 +01:00
callebtc
f8f167fe23 Mint: fix lnbits migration (#407)
* fix lnbits migration

* save without format

* make format
2024-02-05 17:52:47 +01:00
callebtc
e02e4bbf49 mint: add seed decrypt (#403)
* mint: add seed decrypt

* add mint seed decryoption and migration tool
2024-02-05 16:22:53 +01:00
callebtc
30b6e8aa56 not null constaint (#402) 2024-02-02 22:09:06 +01:00
sj-fisher
d9f1ea0275 Update how to disable lightning for tests (#367) 2024-02-02 21:46:10 +01:00
callebtc
6ddce571a0 Keysets per seed and postgres (#400)
* allow generation of keys per seed phrase

* emit errors correctly

* parse timestamps for melt and mint quotes correctly

* error messages

* adjust error message

* postgres works

* prepare postgres tests

* timestamps refactor

* add command to key activation

* generate keys per seed

* add keyset tests

* keyest uniqueness constaint on (derivation_path, seed)

* add tables ony if not exists

* log leve
2024-02-02 21:25:02 +01:00
callebtc
bc2b555c16 sign outputs as bytes (#399) 2024-01-25 23:22:16 +01:00
callebtc
7b5192c27a fix: do not serialize-deserialize secret for p2pk signature check (#398) 2024-01-25 20:56:41 +01:00
callebtc
b307c4db79 Ngutech21-fix-get-quote-api (#397)
* fix: v1 mint-quote api in router

* fix get mint quote

* test new endpoints

---------

Co-authored-by: ngutech21 <ngutech21@pm.me>
2024-01-24 22:02:25 +01:00
callebtc
2645eb51bc fix melt requiring outputs 2024-01-21 22:02:04 +01:00
callebtc
911886892d skip amount refactor (#394) 2024-01-21 20:52:15 +01:00
callebtc
a2709703f5 skip change output amount verification during melt (#393)
* skip change output amount verification during melt

* make format
2024-01-21 20:45:40 +01:00
callebtc
7dea6040cc add derivation paths to example (#389) 2024-01-19 18:15:08 +01:00
callebtc
a518274f7e Nutshell cleanup wishlist (#332)
* fix keys

* fix tests

* backwards compatible api upgrade

* upgrade seems to work

* fix tests

* add deprecated api functions

* add more tests of backwards compat

* add test serialization for nut00

* remove a redundant test

* move mint and melt to new api

* mypy works

* CI: mypy --check-untyped-defs

* add deprecated router

* add hints and remove logs

* fix tests

* cleanup

* use new mint and melt endpoints

* tests passing?

* fix mypy

* make format

* make format

* make format

* commit

* errors gone

* save

* adjust the API

* store quotes in db

* make mypy happy

* add fakewallet settings

* remove LIGHTNING=True and pass quote id for melt

* format

* tests passing

* add CoreLightningRestWallet

* add macaroon loader

* add correct config

* preimage -> proof

* move wallet.status() to cli.helpers.print_status()

* remove statuses from tests

* remove

* make format

* Use httpx in deprecated wallet

* fix cln interface

* create invoice before quote

* internal transactions and deprecated api testing

* fix tests

* add deprecated API tests

* fastapi type hints break things

* fix duplicate wallet error

* make format

* update poetry in CI to 1.7.1

* precommit restore

* remove bolt11

* oops

* default poetry

* store fee reserve for melt quotes and refactor melt()

* works?

* make format

* test

* finally

* fix deprecated models

* rename v1 endpoints to bolt11

* raise restore and check to v1, bump version to 0.15.0

* add version byte to keyset id

* remove redundant fields in json

* checks

* generate bip32 keyset wip

* migrate old keysets

* load duplicate keys

* duplicate old keysets

* revert router changes

* add deprecated /check and /restore endpoints

* try except invalidate

* parse unit from derivation path, adjust keyset id calculation with bytes

* remove keyest id from functions again and rely on self.keyset_id

* mosts tests work

* mint loads multiple derivation paths

* make format

* properly print units

* fix tests

* wallet works with multiple units

* add strike wallet and choose backend dynamically

* fix mypy

* add get_payment_quote to lightning backends

* make format

* fix startup

* fix lnbitswallet

* fix tests

* LightningWallet -> LightningBackend

* remove comments

* make format

* remove msat conversion

* add Amount type

* fix regtest

* use melt_quote as argument for pay_invoice

* test old api

* fees in sats

* fix deprecated fees

* fixes

* print balance correctly

* internally index keyset response by int

* add pydantic validation to input models

* add timestamps to mint db

* store timestamps for invoices, promises, proofs_used

* fix wallet migration

* rotate keys correctly for testing

* remove print

* update latest keyset

* fix tests

* fix test

* make format

* make format with correct black version

* remove nsat and cheese

* test against deprecated mint

* fix tests?

* actually use env var

* mint run with env vars

* moar test

* cleanup

* simplify tests, load all keys

* try out testing with internal invoices

* fix internal melt test

* fix test

* deprecated checkfees expects appropriate fees

* adjust comment

* drop lightning table

* split migration for testing for now, remove it later

* remove unused lightning table

* skip_private_key -> skip_db_read

* throw error on migration error

* reorder

* fix migrations

* fix lnbits fee return value negative

* fix typo

* comments

* add type

* make format

* split must use correct amount

* fix tests

* test deprecated api with internal/external melts

* do not split if not necessary

* refactor

* fix test

* make format with new black

* cleanup and add comments

* add quote state check endpoints

* fix deprecated wallet response

* split -> swap endpoint

* make format

* add expiry to quotes, get quote endpoints, and adjust to nut review comments

* allow overpayment of melt

* add lightning wallet tests

* commiting to save

* fix tests a bit

* make format

* remove comments

* get mint info

* check_spendable default False, and return payment quote checking id

* make format

* bump version in pyproject

* update to /v1/checkstate

* make format

* fix mint api checks

* return witness on /v1/checkstate

* no failfast

* try fail-fast: false in ci.yaml

* fix db lookup

* clean up literals
2024-01-08 00:57:15 +01:00
callebtc
375b27833a fix missing dleq proof in db (#380) 2023-12-06 13:04:47 +01:00
callebtc
e6ed8fdb46 Mint: verify outputs first during mint (#379)
* verify outputs first during mint

* verify outputs during melt as well
2023-12-03 19:57:49 +01:00
callebtc
7d4ed959e3 Mint/verify_outputs_not_already_signed (#377)
* test output duplication in mint

* add comments to the db connection reuse
2023-12-03 19:26:07 +01:00
callebtc
6c8b1a858f Wallet/fix_nostr_timeout (#376)
* fix nostr receive

* split with amount pre 0.13

* drop 0.13.0 amount with split compatibility
2023-12-03 01:56:58 +01:00
callebtc
74c9317277 mint: fix postgres migrations (#375) 2023-12-03 00:02:05 +01:00
callebtc
34a2e7e5da Mint: invalidate and generate promises in single db transaction for split (#374)
* test for spending output again

* first gernerate (which can fail) then invalidate (db and memory)

* use external get_db_connection function to be compatible with existing Database class in LNbits
2023-12-02 22:54:28 +01:00
callebtc
0ec3af9bf1 Test/mint_add_verification_balance (#373)
* add verification balance

* verify input and outputs amounts before flow

* adjust tests
2023-12-02 18:55:19 +01:00
callebtc
bb51567e72 add test private key (#372) 2023-11-29 17:56:13 -03:00
callebtc
063a9d296d docker mint listen on 0.0.0.0 (#371) 2023-11-29 17:55:18 -03:00
callebtc
fa5193cd8f index on db and read spent proofs from db (#370)
* index on db and read spent proofs from db

* add benchmark for testing

* remove benchmark

* add option to disable cached secrets

* disable python 3.9 tests
2023-11-26 06:07:38 -03:00
callebtc
bff30d493d tests failing? (#369) 2023-11-24 15:26:42 -03:00
callebtc
f7d0126805 Fix: Cast keyset keys (amount) to int (#368)
* load keys as integers

* add tests

* make format

* revert format from newer branch
2023-11-24 14:47:36 -03:00