Commit Graph

47 Commits

Author SHA1 Message Date
Pavol Rusnak
0de574e006 NUT-06: add urls field (#638) 2024-11-05 15:03:23 +01: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
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
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
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
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
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
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
findingsov
ac0ddd57a1 Update .env.example (#450)
* Update .env.example

Minor comment add suggestions..

* Update .env.example

* Update .env.example

* Update .env.example

* Update .env.example

* Update .env.example

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2024-02-21 11:13:34 +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
7dea6040cc add derivation paths to example (#389) 2024-01-19 18:15:08 +01:00
callebtc
84453f5dbe add CoreLightningRestWallet (#362)
* add CoreLightningRestWallet

* add macaroon loader

* add correct config
2023-11-16 09:50:34 -03:00
callebtc
45d3059c2d Mint: Add LndRest and regtest tests (#359)
* update

* working

* test with lnd

* update action

* cache poetry

* add lndrest

* enable regtest

* add regtests.yml

* poetry version

* add helpers

* save

* run legend regtest fork

* actually start

* use bash

* give rights

* remove cache?

* change order

* tests succeed with lndrestwallet

* check if wallet is set

* settings for regtest

* fix fakewallet test

* remove wacky balance check

* adjust permissions

* try with sudo

* adjust example

* remove eclair
2023-11-14 21:46:06 -03:00
dni ⚡
0a5beb75a2 [FEAT] Improve tests (#296)
* test cli arent async tests

* unused SERVER_ENDPOINT var

* async test werent marked async

* make test didnt use correct ports

* enable more verbose test logging

* refactor conftest variable

* not needed anymore are set in conftest

* using test_data now for conftest

* formatting

* comment out invalid hex

* remove test dir before creating it to be sure

* keep data from altest testrun and ad test_data to ignore

* ignore error for CI

* add duplicate env var

* fix confest

* Update pyproject.toml

* fix up tests

* short p2pk locktimes for faster tests

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
2023-08-06 18:35:34 +02:00
dni ⚡
ca2b8e7bd6 [FEAT] add pre-commit (#294)
* add pre-commit

* precommit formatting
2023-07-29 11:14:48 +02:00
callebtc
0b2468914d Determinstic secrets / ecash restore (#131)
* first working version but some sats go missing

* back at it

* make format

* restore to main

* move mint database

* fix some tests

* make format

* remove old _construct_outputs we reintroduced in merge with main

* add type annotations

* add wallet private key to tests

* wallet: load proofs

* fix tests

* _generate_secrets with deterministic generation (temporary)

* allow wallet initialization with custom private key

* add pk to wallet api test

* mint scope=module

* remove private_key from test_wallet.py to see if it helps with the github tests

* readd private keys to tests

* workflow without env

* add more private key!

* readd env

* ledger scope session

* add default private key for testing

* generate private keys if not available

* testing

* its working!!!

* first iteration of bip32 working

* get mint info and add many type annotations

* tests

* fix tests with bip32

* restore from multiple mints

* disable profiler

* make format

* failed POST /mint do not increment secret counter

* store derivation path in each token

* fix tests

* refactor migrations so private keys can be generated by the wallet with .with_db() classmethod

* start fixing tests

* all tests passing except those that need to set a specific private key

* bip39 mnemonic to seed - with db but restore doesnt work yet with custom seed

* mnemonic restore works

* enter mnemonic in cli

* fix tests to use different mnemonic

* properly ask user for seed input

* tests: dont ask for inputs

* try to fix tests

* fix cashu -d

* fixing

* bump version and add more text to mnemonic enter

* add more comments

* add many more comments and type annotations in the wallet

* dont print generated mnemonic and dont wait for input

* fix test

* does this fix tests?

* sigh....

* make format

* do not restore from an initialized wallet

* fix mnemonics

* fix nitpicks

* print wallet name if nonstandard wallet

* fix merge error and remove comments

* poetry lock and requirements

* remove unused code

* fix tests

* mnemonic.lower() and add keyset id if not present for backwards compat

* edit comment
2023-07-24 13:42:56 +02:00
callebtc
01d498309b [Wallet/mint] P2PK with timelocks (#270)
* p2pk with nostr privatekey and timelocks

* add p2pk

* fix test

* fix test with custom secret

* sign whole split transaction

* p2pk signature now commits to entire secret and thus to a nonce

* use schnorr signatures

* revamp P2SH and P2PK with new Secret model

* test p2pk

* add comments

* add nostr private key to tests

* fix nostr receive

* make format

* test redemption after timelock

* refactor Server.serialize()

* sign sha256(secret)

* add optional refund pubkey that triggers after timelock

* use nostr private key for now (including nsec parser)

* use nostr private key and fix tests

* bump version to 0.12.2
2023-07-02 01:56:05 +02:00
callebtc
4beaf8ff41 add http proxy option to wallet (#269) 2023-06-29 22:43:45 +02:00
callebtc
5c820f9469 fix typo (#239) 2023-05-26 12:51:36 +02:00
callebtc
f052e2e788 update .env example to reflect latest flags (#238) 2023-05-26 12:49:59 +02:00
calle
61078ce7c8 [Mint] add mint api tests (#189)
* add mint api tests

* add /info test and fix NUT-09 contact info strings

* add test mint api

* replace with requests
2023-05-02 00:43:49 +02:00
moonsettler
9525655dc1 Update .env.example (#181) 2023-04-27 15:25:14 +02:00
calle
47f886487c nut-09 mint info (#155)
* nut-09 mint info

* bump to 0.11.1

* make format
2023-04-01 00:47:27 +02:00
calle
4784163a0e bump version to 0.10.0 (#146) 2023-03-16 01:48:48 +01:00
calle
f3a31fd09e use settings module (#136)
* use settings module
2023-03-16 00:59:50 +01:00
calle
3333102327 lightning: add fakewallet (#134)
* lightning: add fakewallet

* make format

* fix mypy

* make backend configurable

* weird mypy
2023-03-07 17:49:27 +01:00
calle
5fdeecdc08 fix defaults for socks proxy and sat -> msat when ln is connected (#130) 2023-03-05 17:18:58 +01:00
calle
39e71b20d8 Mint database setting (#126)
* mint: new .env variable MINT_DATABASE

* make format
2023-03-05 11:13:55 +01:00
calle
5ec2c3604e Nostr bech32 dm (#109)
* nostr: bech32 keys and remember last DM check

* cump to 0.9.2

* make format
2023-02-13 23:19:19 +01:00
callebtc
8ad173e5fb add nostr relays to env example 2022-12-27 15:47:38 +01:00
callebtc
a9285e670d update config 2022-12-26 19:15:03 +01:00
callebtc
01c6e12b5a add nostr 2022-12-26 16:12:31 +01:00
callebtc
6fcc0741be env 2022-10-30 16:23:37 +01:00
callebtc
8222af9649 tor works 2022-10-29 20:51:30 +02:00
callebtc
d8cd648714 add tor 2022-10-29 18:07:13 +02:00
calle
118f564d44 Update .env.example 2022-10-07 22:44:14 +02:00
Vlad Stan
64028d559f feat: add MINT_URL env var for 3rd party mints 2022-10-07 21:53:04 +03:00
callebtc
43e7889cab use compressed secret 2022-09-22 11:52:40 +03:00
callebtc
80a696d097 pending 2022-09-21 17:07:25 +03:00
callebtc
5338c642cb fees fix 2022-09-17 01:54:05 +03:00
callebtc
c3ae92edd1 pay lightning works 2022-09-17 01:14:57 +03:00
callebtc
c409619aea works 2022-09-15 17:50:19 +03:00
callebtc
3b0ebf9f6b update 2022-09-13 21:55:42 +03:00
callebtc
0245ce00de env example 2022-09-13 21:36:58 +03:00