boltz extension v2, recurring swaps (#981)

* add status to statusdialog

* first commits for boltz update

* formatting

* add latest boltz-clien package

* big refactor, depending on boltz_client package, clean up, mypy issues, not tested yet

* blacking, sorting and stuff

* remove unused req_wrap helper

* remove api docs from frontend

* bug: frontend boltz limits error

* clean up buttons

* update to boltz-client 0.0.8

* fix tests to poetry version 1.3.1

* update requirements

* formatting

* recurring swap works now, need more finetuning

* add exceptions for multiple auto swaps and swapping in with active auto swap

* black

* auto reverse swap actually works :)

* remove swap status dialogs

* update to boltz_client 0.0.9

* update to boltz-client 0.1.1, and fix startup

* update requirement.txt for boltz-client

* fixup columns in table, remove unused payment.extra, change deezy label

* remove balance check for auto swap out

* update boltzc-lient to 0.1.2, fix mypy issue inside boltz package

* nitpicks calle tasks.py

* calle nitpicks crud

* calle nitpicks crud

* refactor

* fix formatting

* circular import

* black :)

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
dni ⚡ 2023-01-19 10:30:47 +01:00 committed by GitHub
parent d8b5e3872b
commit d89a6a337a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 1380 additions and 1782 deletions

View file

@ -1,17 +1,6 @@
import asyncio
import json
import secrets
import pytest
import pytest_asyncio
from lnbits.core.crud import create_account, create_wallet, get_wallet
from lnbits.extensions.boltz.boltz import create_reverse_swap, create_swap
from lnbits.extensions.boltz.models import (
CreateReverseSubmarineSwap,
CreateSubmarineSwap,
)
from tests.mocks import WALLET
from lnbits.extensions.boltz.models import CreateReverseSubmarineSwap
@pytest_asyncio.fixture(scope="session")
@ -22,4 +11,4 @@ async def reverse_swap(from_wallet):
onchain_address="bcrt1q4vfyszl4p8cuvqh07fyhtxve5fxq8e2ux5gx43",
amount=20_000,
)
return await create_reverse_swap(data)
return data

View file

@ -1,7 +1,6 @@
import pytest
import pytest_asyncio
from tests.helpers import is_fake, is_regtest
from tests.helpers import is_fake
@pytest.mark.asyncio

View file

@ -1,31 +0,0 @@
import asyncio
import pytest
import pytest_asyncio
from lnbits.extensions.boltz.boltz import create_reverse_swap, create_swap
from lnbits.extensions.boltz.crud import (
create_reverse_submarine_swap,
create_submarine_swap,
get_reverse_submarine_swap,
get_submarine_swap,
)
from tests.extensions.boltz.conftest import reverse_swap
from tests.helpers import is_fake, is_regtest
@pytest.mark.asyncio
@pytest.mark.skipif(is_fake, reason="this test is only passes in regtest")
async def test_create_reverse_swap(client, reverse_swap):
swap, wait_for_onchain = reverse_swap
assert swap.status == "pending"
assert swap.id is not None
assert swap.boltz_id is not None
assert swap.claim_privkey is not None
assert swap.onchain_address is not None
assert swap.lockup_address is not None
newswap = await create_reverse_submarine_swap(swap)
await wait_for_onchain
newswap = await get_reverse_submarine_swap(swap.id)
assert newswap is not None
assert newswap.status == "complete"