dni ⚡
63ce506d29
fix: add cln unspecified error code bolt11 error to errorcodes ( #2503 )
...
{'code': -32602, 'message': 'Invalid bolt11: Prefix bc is not for regtest'}```
2024-05-16 09:59:54 +02:00
Vlad Stan
eae5002b69
fix: pay invoice status ( #2481 )
...
* fix: rest `pay_invoice` pending instead of failed
* fix: rpc `pay_invoice` pending instead of failed
* fix: return "failed" value for payment
* fix: handle failed status for LNbits funding source
* chore: `phoenixd` todo
* test: fix condition
* fix: wait for payment status to be updated
* fix: fail payment when explicit status provided
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
2024-05-10 11:49:50 +02:00
dni ⚡
4b4bed59cd
feat: corelightning maxfee
and custom pay command ( #2464 )
...
* feat: corelightning `maxfee` and custom pay command
we should use maxfee instead of calculating the ratio and pass it
through.
also make it possible to run a custom pay command
* change for cln rest aswell
2024-04-25 12:54:00 +02:00
Vlad Stan
4ac30116a9
feat: add settings.lnbits_running
( #2450 )
...
* feat: add `settings.lnbits_runing `
2024-04-22 12:33:53 +03:00
dni ⚡
6d5ad9e229
chore: adhere to ruff's "N" rules ( #2377 )
...
* chore: adhere to ruff's "N" rules
WARN: reinstall failing extensions!
bunch of more consistent variable naming. inspired by this issue.
https://github.com/lnbits/lnbits/issues/2308
* fixup! chore: adhere to ruff's "N" rules
* rename to funding_source
* skip jmeter
---------
Co-authored-by: Pavol Rusnak <pavol@rusnak.io>
2024-04-15 09:02:21 +02:00
Vlad Stan
bfda0b62da
test: add unit tests for wallets (funding sources) ( #2363 )
...
* test: initial commit
* feat: allow external label for `create_invoice` (useful for testing)
* chore: code format
* fix: ignore temp coverage files
* feat: add properties to the Status classes for a better readability
* fix: add extra validation for data
* fix: comment out bad `status.pending` (to be fixed in core)
* fix: 404 tests
* test: first draft of generic rest wallet tests
* test: migrate two more tests
* feat: add response type
* feat: test exceptions
* test: extract first `create_invoice` test
* chore: reminder
* add: error test
* chore: code format
* chore: experiment
* feat: adapt parsing
* refactor: data structure
* fix: some tests
* refactor: extract methods
* fix: make response uniform
* fix: test data
* chore: clean-up
* fix: uniform responses
* fix: user agent
* fix: user agent
* fix: user-agent again
* test: add `with error` test
* feat: customize test name
* fix: better exception handling for `status`
* fix: add `try-catch` for `raise_for_status`
* test: with no mocks
* chore: clean-up generalized tests
* chore: code format
* chore: code format
* chore: remove extracted tests
* test: add `create_invoice`: error test
* add: test for `create_invoice` with http 404
* test: extract `test_pay_invoice_ok`
* test: extract `test_pay_invoice_error_response`
* test: extract `test_pay_invoice_http_404`
* test: add "missing data"
* test: add `bad-json`
* test: add `no mocks` for `create_invoice`
* test: add `no mocks` for `pay_invoice`
* test: add `bad json` tests
* chore: re-order tests
* fix: response type
* test: add `missing data` test for `pay_imvoice`
* chore: re-order tests
* test: add `success` test for `get_invoice_status `
* feat: update test structure
* test: new status
* test: add more test
* fix: error handling
* chore: code clean-up
* test: add success test for `get_payment_status `
* test: add `pending` tests for `check_payment_status`
* chore: remove extracted tests
* test: add more tests
* test: add `no mocks` test
* fix: funding source loading
* refactor: extract `rest_wallet_fixtures_from_json` function
* chore: update comment
* feat: cover `cleanup` call also
* chore: code format
* refactor: start to extract data model
* refactor: extract mock class
* fix: typings
* refactor: improve typings
* chore: add some documentation
* chore: final clean-up
* chore: rename file
* chore: `poetry add --dev pytest_httpserver` (after rebase)
2024-04-08 12:18:21 +03:00
Vlad Stan
352fd23c0b
refactor: dev-friendly payment status name ( #2322 )
...
* refactor: dev-friendly payment status name
* refactor: change `PaymentStatus(True, ...)` to `PaymentSuccessStatus(...)`
2024-03-13 16:17:33 +01:00
callebtc
4c0bd132b1
bug: cln paymentstate check on error ( #2151 )
...
* CLN: paymentstate check on error
---------
Co-authored-by: dni ⚡ <office@dnilabs.com>
2024-03-12 13:56:36 +01:00
Pavol Rusnak
8eabf53642
introduce Wallet.normalize_endpoint to remove code duplication
2024-01-22 10:06:22 -06:00
Pavol Rusnak
824a8fa7c8
refactor __init__ functions of Wallets (funding sources)
...
- better error messages when a conf variable is not provided
- unify approaches among different source files
2024-01-22 10:06:22 -06:00
Pavol Rusnak
62b0e3fe89
set User-Agent when accessing external resources ( #2100 )
...
* set User-Agent when accessing external resources
* refactor User-Agent into settings.user_agent
2023-11-30 12:54:07 +00:00
callebtc
4dcf26bcb3
Update to c-lightning-REST v0.10.5 ( #2109 )
...
* Update to c-lightning-REST v0.10.5
* update invoice stream
2023-11-18 12:14:29 +01:00
dni ⚡
1646b087cf
adding bolt11 lib and removing bolt11.py from the codebase ( #1817 )
...
* add latest bolt11 lib
decode exception handling for create_payment
fix json response for decode
bugfix hexing description hash
improvement on bolt11 lib
update to bolt11 2.0.1
fix clnrest
* bolt 2.0.4
* refactor core/crud.py
* catch bolt11 erxception clnrest
2023-09-25 12:06:54 +02:00
dni ⚡
fee40d7321
[REFACTOR] core/__init__ to not have circular import issues ( #1876 )
...
* F541 fix
remove unused workflow and combine linters into one
add lnbits/static to ruff ignore
remote setupnode
ignore upgrades for mypy
ignore F401 for __init__ files
unused noqa
ignore upgrades for black
F821: undefine name
disabled and logged webhook_listener for opennode and lnpay because they are obvisouly not working
E402: module level import not at top of file
fixup
revert breaking changes wait for PR #1876
https://github.com/lnbits/lnbits/pull/1876
E721 fixes, only popped up for python3.9 not 3.10
[REFACTOR] core/__init__ to not have circular import issues
WIP
add db for backwards compat
fix pyright
make mypy happy again
pyright did not catch those, i think mypy got confused with relative imports. maybe we should use absolute ones everywhere
E402: module level import not at top of file
dont forget to add core_app
rebase on ruff pr
f
remo
format
* fix clnrest
* ignore E402 in conftest
* refactoring issues
---------
Co-authored-by: jacksn <jkranawetter05@gmail.com>
2023-09-12 11:25:05 +01:00
callebtc
3a653630f1
Wallets: add cln-rest ( #1775 )
...
* receive and pay works
* fix linter issues
* import Paymentstatus from core.models
* fix test real payment
* fix get_payment_status check in lnbits
* fix tests?
* simplify
* refactor AsyncClient
* inline import of get_wallet_class
fixes the previous cyclic import
* invoice stream working
* add notes as a reminder to get rid of labels when cln-rest supports payment_hash
* create Payment dummy classmethod
* remove unnecessary fields from dummy
* fixes tests?
* fix model
* fix cln bug (#1814 )
* auth header
* rename cln to corelightning
* add clnrest to admin_ui
* add to clnrest allowed sources
* add allowed sources to .env.example
* allow macaroon files
* add corelightning rest to workflow
* proper env names
* cleanup routine
* log wallet connection errors and fix macaroon clnrest
* print error on connection fails
* clnrest: handle disconnects faster
* fix test use of get_payment_status
* make format
* clnrest: add unhashed_description
* add unhashed_description to test
* description_hash test
* unhashed_description not supported by clnrest
* fix checking_id return in api_payments_create_invoice
* refactor test to use client instead of api_payments
* formatting, some errorlogging
* fix test 1
* fix other tests, paid statuses was missing
* error handling
* revert unnecessary changes (#1854 )
* apply review of motorina0
---------
Co-authored-by: jackstar12 <jkranawetter05@gmail.com>
Co-authored-by: jackstar12 <62219658+jackstar12@users.noreply.github.com>
Co-authored-by: dni ⚡ <office@dnilabs.com>
2023-08-23 08:59:39 +02:00