Wallet: Lightning interface (#318)

* mint does not start yet

* fix import

* revert mint db migrations

* handle zero fee case

* cli: adjust fee message

* wallet: replace requests with httpx

* clean up

* rename http client decorator

* fix pending check in main, todo: TEST PROXIES WITH HTTPX

* fix up

* use httpx for nostr as well

* update packages to same versions as https://github.com/lnbits/lnbits/pull/1609/files

* fix proof deserialization

* check for string

* tests passing

* adjust wallet api tests

* lockfile

* add correct responses to Lightning interface and delete melt_id for proofs for which the payent has failed

* fix create_invoice checking_id response

* migrations atomic

* proofs are stored automatically when created

* make format

* use bolt11 lib

* stricter type checking

* add fee response to payments

* assert fees in test_melt

* test that mint_id and melt_id is stored correctly in proofs and proofs_used

* remove traces

* refactor: Lightning interface into own file and LedgerCrud with typing

* fix tests

* fix payment response

* rename variable
This commit is contained in:
callebtc
2023-10-21 14:38:16 +02:00
committed by GitHub
parent 8a4813aee6
commit 0490f20932
41 changed files with 1899 additions and 1664 deletions

View File

@@ -66,14 +66,14 @@ async def test_get_keyset(ledger: Ledger):
@pytest.mark.asyncio
async def test_mint(ledger: Ledger):
invoice, payment_hash = await ledger.request_mint(8)
invoice, id = await ledger.request_mint(8)
blinded_messages_mock = [
BlindedMessage(
amount=8,
B_="02634a2c2b34bec9e8a4aba4361f6bf202d7fa2365379b0840afe249a7a9d71239",
)
]
promises = await ledger.mint(blinded_messages_mock, hash=payment_hash)
promises = await ledger.mint(blinded_messages_mock, id=id)
assert len(promises)
assert promises[0].amount == 8
assert (
@@ -84,7 +84,7 @@ async def test_mint(ledger: Ledger):
@pytest.mark.asyncio
async def test_mint_invalid_blinded_message(ledger: Ledger):
invoice, payment_hash = await ledger.request_mint(8)
invoice, id = await ledger.request_mint(8)
blinded_messages_mock_invalid_key = [
BlindedMessage(
amount=8,
@@ -92,7 +92,7 @@ async def test_mint_invalid_blinded_message(ledger: Ledger):
)
]
await assert_err(
ledger.mint(blinded_messages_mock_invalid_key, hash=payment_hash),
ledger.mint(blinded_messages_mock_invalid_key, id=id),
"invalid public key",
)