Mint: blink fix fee estimation (#439)

* blink: fix fee esimation

* fix line length

* fix line length

* fix line length

* remove noqa
This commit is contained in:
callebtc
2024-02-18 12:24:41 +01:00
committed by GitHub
parent 48158cd497
commit ad906df788
3 changed files with 13 additions and 3 deletions

View File

@@ -49,7 +49,6 @@ async def test_blink_create_invoice():
}
}
}
respx.post(blink.endpoint).mock(return_value=Response(200, json=mock_response))
invoice = await blink.create_invoice(Amount(Unit.sat, 1000))
assert invoice.checking_id == invoice.payment_request
@@ -129,9 +128,18 @@ async def test_blink_get_payment_status():
@respx.mock
@pytest.mark.asyncio
async def test_blink_get_payment_quote():
# response says 1 sat fees but invoice * 0.5% is 5 sat so we expect 5 sat
mock_response = {"data": {"lnInvoiceFeeProbe": {"amount": 1}}}
respx.post(blink.endpoint).mock(return_value=Response(200, json=mock_response))
quote = await blink.get_payment_quote(payment_request)
assert quote.checking_id == payment_request
assert quote.amount == Amount(Unit.msat, 1000000) # msat
assert quote.fee == Amount(Unit.msat, 5000) # msat
# response says 10 sat fees but invoice * 0.5% is 5 sat so we expect 10 sat
mock_response = {"data": {"lnInvoiceFeeProbe": {"amount": 10}}}
respx.post(blink.endpoint).mock(return_value=Response(200, json=mock_response))
quote = await blink.get_payment_quote(payment_request)
assert quote.checking_id == payment_request
assert quote.amount == Amount(Unit.msat, 1000000) # msat
assert quote.fee == Amount(Unit.msat, 500000) # msat
assert quote.fee == Amount(Unit.msat, 10000) # msat