Commit Graph

316 Commits

Author SHA1 Message Date
Ben Arc
e4dd0972a5 Wrong key int being returned 2022-03-08 22:15:45 +00:00
Ben Arc
c708cb1e2b Important fix to payment check 2022-03-07 18:27:03 +00:00
benarc
9bbf78e026 Assigned wallet var 2022-03-07 08:19:14 +00:00
benarc
d62ef0bb80 Added extra pay details 2022-03-07 08:08:08 +00:00
Arc
ef6d12fe10
Merge pull request #545 from talvasconcelos/fix/paymentsDecode
fix payments decode
2022-03-07 04:24:32 +00:00
Joseph Pentland
baf55afc28
api: Fix conversion from fiat to satoshis (#516)
Conversion to satoshis incorrectly used data.to as fiat currency rather
than data._from.
2022-03-01 23:11:39 +03:00
Tiago vasconcelos
eb7b369b6d fix payments decode 2022-02-22 16:45:35 +00:00
Arc
88df4266b7
Merge pull request #524 from lnbits/docs_api_add_unit_to_invoice
Fix fiat amount entry in invoice creation
2022-02-18 11:44:05 +00:00
Tiago vasconcelos
251ecb8f1d url_for params 2022-02-17 21:01:14 +00:00
callebtc
13a72d9a41 replace string with LNBITS_SITE_TITLE 2022-02-17 11:42:08 +01:00
callebtc
d559c604fa invoice without memo 2022-02-17 09:29:10 +01:00
callebtc
9fb30080ab black 2022-02-16 22:42:27 +01:00
callebtc
30ab519c3a amount is float and sats are int 2022-02-16 22:41:12 +01:00
callebtc
914b9f3ffe allow amounts >0 2022-02-16 22:23:26 +01:00
Arc
155c32504a
Update api.py 2022-02-14 11:31:42 +00:00
Arc
da6a2e772b
Revert "fix disapearing admin extension" 2022-02-10 09:56:02 +00:00
Tiago vasconcelos
4c18eb0b34 fix disapearing admin extension 2022-02-09 10:57:24 +00:00
Ben Arc
dab943baad fixed internal lnurl 2022-02-01 23:11:26 +00:00
Ben Arc
db734d4acd added hex 2022-02-01 23:04:40 +00:00
Ben Arc
3927545e32 fixed buggy lnurl checks 2022-02-01 21:22:20 +00:00
Ben Arc
3f0a855526 Black 2022-02-01 20:51:40 +00:00
Ben Arc
382622d5ac Fixed balance update not showing properly 2022-01-31 16:47:58 +00:00
Ben Arc
dbab181759 Admin users can credit accounts 2022-01-31 16:29:42 +00:00
benarc
228717195b back 2022-01-30 19:43:30 +00:00
Tiago Vasconcelos
918e9be7ed
Upgrade conversion endpoint (#491) 2022-01-14 09:19:30 -03:00
benarc
4e0e5b9956 Added conversion endpoint
Exposes fiat_amount_as_satoshis
2022-01-11 15:11:48 +00:00
benarc
4408f30285 removed print 2021-12-19 23:13:15 +00:00
benarc
fa23be7657 Added check fixed LNURL decode 2021-12-03 00:17:32 +00:00
benarc
69a4583203 wos debugging
lnurl debug

text identifier

text

try1

try2

debugging

more debug

...

....

hard code indentifier

.

more hard code

.

trying

revert

remove identifier

adding identifier...again

.

stupid

return text instead of json

htmlresponse

on more spin

.

added tag

revert to JSON return

.

ditch lnurl lib

.

..

..

clean prints
2021-12-01 21:55:04 +00:00
benarc
b9bc36fabf Merge remote-tracking branch 'origin/FastAPI' into FastAPI 2021-11-30 10:08:46 +00:00
Arc
b4ad8cb5b2
Merge pull request #443 from lnbits/fastapi_fix_lndrestwallet_fee_limit
(FastAPI) LNDRest fee limit
2021-11-30 09:04:01 +00:00
callebtc
12c2a04b2a LNDRest fee limit 2021-11-29 18:10:11 +01:00
Stefan Stammberger
3831bca9e2
fix: cleanup core/views/generic.py
* Fixed withdraw endpoint query params access
    was: request.query_params.get("usr")
    corrected: request.query_params.get("usr")
* Added missing response classes
* Removed old comments and commeted out code
* Deleted the unused auth_bearer.py file
2021-11-27 10:13:32 +01:00
benarc
56397026c8 Chore, applied black 2021-11-26 05:58:20 +00:00
Tiago vasconcelos
2b0bd43974 clean prints 2021-11-25 17:26:46 +00:00
Tiago vasconcelos
b33f0ecae2 request issues again 2021-11-25 17:24:03 +00:00
Tiago vasconcelos
ae50b909eb again 2021-11-25 17:19:49 +00:00
Tiago vasconcelos
98a55bf0df request client 2021-11-25 17:12:41 +00:00
Tiago vasconcelos
4fff5c3b7a missing request 2021-11-25 17:08:20 +00:00
benarc
b122debd8c Merge remote-tracking branch 'arcbtc/lnaddress' into FastAPI 2021-11-24 08:42:14 +00:00
benarc
267dea4f75 black 2021-11-12 04:14:55 +00:00
Ben Arc
cbc24a8fa5 Changed optional unit to sat 2021-11-09 22:25:20 +00:00
Ben Arc
1b46b61da9 changed see endpoint key back 2021-11-09 20:50:00 +00:00
Ben Arc
81d8d4e218 plugged few key issues 2021-11-09 17:44:05 +00:00
benarc
43e016633b fixed unit check 2021-11-03 12:09:39 +00:00
benarc
3750dcfd0e fixed descrhash check 2021-11-03 12:03:48 +00:00
benarc
abff990ec3 Changed lnbits wallet check to detail from message 2021-11-03 10:29:39 +00:00
benarc
c734526bc1 reverted exception 2021-11-03 10:12:14 +00:00
benarc
00ec6f2af3 added NOT_FOUND to check payment endpoint, rather than OK 2021-11-03 09:49:52 +00:00
benarc
9630d8b363 restored create invoice api endpoint 2021-11-02 16:29:15 +00:00
Tiago vasconcelos
aff29663af lnaddress_ext proposal untested 2021-10-29 16:43:26 +01:00
Tiago vasconcelos
a276764f12 wallet fiat conversion fix 2021-10-29 13:06:59 +01:00
Tiago vasconcelos
55023fa85b fix delete wallet 2021-10-25 19:26:21 +01:00
benarc
e03370188a Fixed payment checking 2021-10-22 00:41:30 +01:00
Ben Arc
19df2f888b Added decode lnurl and extra payment check 2021-10-20 03:59:24 +01:00
benarc
1d3bb016a2 I want them to turn black 2021-10-17 18:33:29 +01:00
Stefan Stammberger
c5d96d21e9
fix: core pay via lnurl endpoint 2021-09-19 13:25:39 +02:00
Stefan Stammberger
32ca6289df
fix: broken payment API implementation 2021-09-19 09:31:16 +02:00
Stefan Stammberger
3bae5c92c2
fix: /extensions endpoint 2021-09-11 20:44:22 +02:00
Stefan Stammberger
9e76668269
fix: send payments via Wallet UI 2021-09-11 11:47:05 +02:00
Stefan Stammberger
63d0242685
fix: more return types 2021-09-11 11:02:48 +02:00
Stefan Stammberger
fa08177317
fix: FastAPify how data or exceptions are returned
FastAPI handles returning HTTPStatus codes differently than Quart did
2021-09-10 21:40:14 +02:00
Stefan Stammberger
d9849d43d2
refactor: replace Trio with asyncio/uvloop 2021-08-30 19:55:02 +02:00
Stefan Stammberger
fe79709698
fix: several more API calls restored 2021-08-29 19:38:42 +02:00
Stefan Stammberger
3e5af8c1d1
refactor: purge Quart from the codebase
Most functionality is still broken
2021-08-27 20:54:42 +02:00
Stefan Stammberger
f119053953
fix: main page and creating a user and a wallet
The wallet page will still not renders correctly, but the backend does
create the user his first wallet.
2021-08-24 21:23:18 +02:00
Stefan Stammberger
6f38fdc39b
feat: move all non-api routes to their own router
This unclutters the docs page a bit by making html routes collapsible.
2021-08-23 21:17:46 +02:00
Ben Arc
e03eb3c82b Fixed formatting 2021-08-22 23:05:39 +01:00
Stefan Stammberger
938fc54af3
feat: switch from Quart to FastAPI part I 2021-08-22 20:07:24 +02:00
Ben Arc
2fb16d0382 Trying to add query params 2021-08-21 19:04:10 +01:00
Stefan Stammberger
d20c3ce119
fix: syntax errors 2021-08-21 12:14:23 +02:00
Ben Arc
bbdb96f4ac Converted views 2021-08-21 01:55:07 +01:00
Ben Arc
d3d24abb17 removed json_encoders 2021-08-21 00:39:31 +01:00
Ben Arc
c4b37c6508 Converted some core stuff 2021-08-20 21:31:01 +01:00
Stefan Stammberger
37a7950f0f
fix: syntax errors 2021-08-20 20:54:59 +02:00
Ben Arc
bfd9ca68e4 Broken, trying to convert 2021-08-18 21:40:50 +01:00
Ben Arc
0eccfb83f0 Trying list data validation 2021-08-16 20:30:11 +01:00
Ben Arc
1118b0ba56 Started converting endpoints 2021-08-16 19:27:39 +01:00
fiatjaf
8f2b42309d revert b7ed7fab59 2021-08-11 22:53:11 -03:00
Tiago Vasconcelos
b7ed7fab59
(TEMP) fix tickets not showing after payment (#292) 2021-08-11 13:52:54 -03:00
fiatjaf
a019d29b9b support pay-to-identifier. 2021-08-10 07:25:51 -03:00
Tiago vasconcelos
723c9ea3ab cleanup 2021-08-06 12:37:30 -03:00
Tiago vasconcelos
b3856d5aff allow wallet rename issue #141 2021-08-06 12:37:30 -03:00
Tiago vasconcelos
d582ee87e5 fix postgres not showing payments 2021-08-05 08:57:50 -03:00
fiatjaf
e0496fb244 fix postgres type translation bug and add some logs. 2021-08-01 10:30:27 -03:00
fiatjaf
2f309c9863 postgres support. 2021-07-02 17:34:31 -03:00
fiatjaf
6f88973f75 fail longpolling endpoint after 45 seconds.
this should fix a possible bug in which connections are left open forever or worse.
2021-06-23 17:21:53 -03:00
fiatjaf
688149fade add trio typing. 2021-06-20 21:17:32 -03:00
fiatjaf
f875dc7b63 "unit" optional on invoice creation, defaults to "sat" 2021-06-19 09:12:16 -03:00
Tiago vasconcelos
d91dbbcac3 allow invoices to be generated using Fiat values 2021-06-14 11:13:49 -03:00
oriolpont
37d9e30362 Change minWithdrawable from 1 msat to 1000 msats for the lnurl_full_withdraw
1 msat is fractional and thus unacceptable anyway. Also, when withdrawing from lnbits itself, this interferes with the input form to expect fractional 1.001 steps
2021-06-12 12:32:40 -03:00
fiatjaf
fc792f874b public api for checking an invoice status with longpolling. 2021-06-02 17:05:07 -03:00
fiatjaf
b06e1c8fa9 try-catch in pay_invoice on global lnurl-withdraw. 2021-06-01 13:28:05 -03:00
fiatjaf
2b21a4f479 g.nursery -> current_app.nursery 2021-05-06 12:41:44 -03:00
fiatjaf
cbeb888761 fix lnurlwallet flow. 2021-04-17 23:44:26 -03:00
fiatjaf
efd9c6917f lnurl balanceCheck and balanceNotify. 2021-04-17 23:21:19 -03:00
fiatjaf
0f998419e7 basic webmanifest thing, must be improved. 2021-04-13 11:50:30 -03:00
fiatjaf
fdf4f6c1ae catch errors in multiple places that might be destroying the async flow and causing lnbits to die silently. 2021-04-10 17:37:48 -03:00
fiatjaf
82731dc901 a special error for when payments fail. 2021-04-06 14:57:51 -03:00
fiatjaf
85011d23c3 fix sqlite database locked issues by using an async lock on the database and requiring explicit transaction control (or each command will be its own transaction). 2021-03-26 19:10:30 -03:00
fiatjaf
42bd5ea989 remove exception to black line-length and reformat. 2021-03-24 00:40:32 -03:00
fiatjaf
7e4a42e7ff stop doing the check_invoices thing on each call. do it once on lnbits starup and then rely on the invoices listener. 2021-03-21 17:57:33 -03:00
fiatjaf
f27c2ebc21 marginally improve the checkpending situation. 2021-03-21 17:11:00 -03:00
Kristjan
c082c953f3 black formatting 2020-12-31 18:50:16 +01:00
fiatjaf
1c922a5ddc finish webhooks for normal invoices with two extra columns. 2020-12-24 09:39:46 -03:00
fiatjaf
4623220316 specify webhooks from invoice creation and call them. 2020-12-24 09:39:46 -03:00
fiatjaf
d84915cb00 oops: formatting. 2020-11-21 23:23:11 -03:00
fiatjaf
d3fc52cd49 migrate to sqlalchemy-aio.
a big refactor that:

- fixes some issues that might have happened (or not) with asynchronous
    reactions to payments;
- paves the way to https://github.com/lnbits/lnbits/issues/121;
- uses more async/await notation which just looks nice; and
- makes it simple(r?) for one extension to modify stuff from other extensions.
2020-11-21 23:02:14 -03:00
fiatjaf
b794f8302d lnurl-auth: hashing_key -> linking_key. 2020-11-11 22:37:55 -03:00
fiatjaf
bb94dc6526 fix perform_lnurl error handling. 2020-11-11 02:40:41 -03:00
fiatjaf
d4e30356c7 fix: return "message" instead of "error" so it is handled better at the client. 2020-11-10 22:59:50 -03:00
fiatjaf
eaec3480e6 lnurl-auth from lnbits wallets to services. 2020-11-10 11:36:10 -03:00
fiatjaf
a773584f6f tags and extras metadata in payment details dialog. 2020-10-21 09:50:45 -03:00
fiatjaf
85ec111ff0 return proper error codes on /lnurlscan
so the notification works.
2020-10-20 23:19:23 -03:00
fiatjaf
9cb58833ad make httpx calls async when doing them from view functions.
this is important so lnbits can call itself without hanging forever.

and these functions are already async so it should have been this way since ever.
2020-10-15 13:04:56 -03:00
fiatjaf
be7d36214a use payments/sse on the core wallet UI.
still fallback to the invoice polling (now with a 5 seconds interval
because less than that is too annoying).

this fixes issues with /lnurlwallet invoices not getting paid in time,
so we update the UI automatically when they do get paid.

(see https://t.me/lnbits/7069)
2020-10-15 00:18:57 -03:00
fiatjaf
ec4b558638 fix: domain variable assignment in pay_lnurl. 2020-10-14 22:44:23 -03:00
fiatjaf
1529ebb689 lnurlpay comment. 2020-10-13 15:18:34 -03:00
fiatjaf
bcdc065cc0 mypy fixes. 2020-10-13 14:46:23 -03:00
fiatjaf
cf0bd7ece8 displaying lnurlpay success_actions. 2020-10-13 13:57:26 -03:00
fiatjaf
8d135489ab fix: invoice parsing JS bug from the lnurl implementation. 2020-10-12 23:21:45 -03:00
fiatjaf
69063190ab also catch httpx.ConnectError whenever we do catch httpx.RequestError. 2020-10-12 23:21:45 -03:00
fiatjaf
bc2207ba27 actually paying and withdrawing with lnurl. 2020-10-12 23:21:45 -03:00
fiatjaf
3cd15c40fc lnurl-pay and lnurl-withdraw UI. 2020-10-12 23:21:45 -03:00
fiatjaf
7a5159f293 send/create/scan buttons for clear LNURL support. 2020-10-12 23:21:45 -03:00
fiatjaf
2894944b1e pending=False on /sse payments. 2020-10-09 22:05:39 -03:00
fiatjaf
31820e041c /sse returns payment as objects instead of arrays. 2020-10-09 21:08:01 -03:00
fiatjaf
9185342c72 simplify environment variables required.
instead of multiple keys/macaroons with different permissions we request only one.
if someone wants to use lnbits with an invoice macaroon they're free to do it and
we will just fail on 'pay' methods, as before.

this also grandfathers the previous environment variables names so everything keeps
working without people having to change their setups.

in the meantime some bugs with lntxbot and c-lightning were fixed and the `requests`
dependency was eliminated because I can't organize myself into meaningful chunks of
changes.
2020-10-08 16:03:21 -03:00
fiatjaf
0b1f3c22e0 lndhub: fix "token" -> "refresh_token". 2020-10-06 21:53:43 -03:00
fiatjaf
c5352c0309 register channel listeners instead of callbacks.
makes for a little less black magic and more reasonable use of nurseries
and less unnecessary pseudo-requests.
2020-10-06 01:50:56 -03:00
fiatjaf
95e8573ff8 SSE endpoint for paid invoices.
also move very essential stuff from core/tasks.py to tasks.py so things
are more organized.
2020-10-06 00:40:18 -03:00
fiatjaf
5ead82f57c fix /lnurlwallet again. db.commit() and wait 3 seconds.
should finally fix https://github.com/lnbits/lnbits/issues/103
2020-10-05 20:33:01 -03:00
fiatjaf
9994e61615 migrate to trio so c-lightning sockets stop hanging. 2020-10-04 12:06:20 -03:00
fiatjaf
04222f1f01 basic invoice listeners. 2020-10-04 12:04:47 -03:00
fiatjaf
211ac0391b overengineered async fix for /lnurlwallet internal hanging. 2020-09-29 18:24:08 -03:00
fiatjaf
e0b8470d40 show unpaid invoices, balance calculated on server-side so isn't affected. 2020-09-29 15:43:11 -03:00
fiatjaf
39cd96594e pass appropriate parameters to create_payment on lnurlwallet. 2020-09-24 13:09:02 -03:00
fiatjaf
f01028eac7 migrate from flask to quart.
also remove all flaskiness from static file serving.
and reference all vendored scripts on the base tempĺate for simplicity.
2020-09-14 16:03:25 -03:00
fiatjaf
6210305791 checking pending invoices and payments from lndhub interface. 2020-09-12 21:55:13 -03:00
fiatjaf
4855e2cd3d make every request a database transaction. 2020-09-11 14:17:09 -03:00
fiatjaf
130beaf38a fix undeclared ok error. 2020-09-06 23:39:46 -03:00
Eneko Illarramendi
1bc5e144d3 refactor: clean up __init__ file following some Flask conventions
Flask extensions are loaded in a way that makes them easily reusable by blueprints.
In this commit we are also adding `environs` to manage .env and settings:
breaking changes!

- FLASK_APP=lnbits.app
- LNBITS_ALLOWED_USERS needs to be empty now to allow all users (NOT "all")
2020-09-06 21:06:01 -03:00
fiatjaf
4447a48724 deleting expired invoices based on their actual expiry date.
also fixes a possible bug that could have caused pending outgoing
payments to be deleted and affecting the balance. probably never happened.
2020-09-02 11:10:48 -03:00
fiatjaf
d2650d6e2c don't try to check payments that start with temp_ or internal_. 2020-09-02 11:10:48 -03:00
fiatjaf
bf3c44b3c4 extra fields on apipayments + index payments by payment_hash 2020-09-02 11:10:48 -03:00
fiatjaf
b4a6b45645 only check pending payments on "check_pending". 2020-08-31 22:55:19 -03:00
fiatjaf
fadddc995a get_wallet_payments with more fine-grained, explicit filters. 2020-08-31 22:16:19 -03:00
fiatjaf
660d56d400 run black on everything. 2020-08-30 23:19:43 -03:00
fiatjaf
24dc6e5415 fix validation rules so description_hash works. 2020-07-04 22:28:08 -03:00
fiatjaf
bc27293315 support description_hash across all APIs. 2020-07-03 20:04:04 -03:00
Eneko Illarramendi
aed2414f3a fix: show better errors when a LNURL-withdraw wallet cannot be created, closes #39 2020-05-18 06:33:02 +02:00
Eneko Illarramendi
8add56a24c feat: allow limiting the use of LNbits to some user uuids
The `LNBITS_ALLOWED_USERS` env var can be used to limit access
to the application to some uuids only. "all" gives open access.
UUIDs should be comma separated.
2020-05-09 22:30:33 +02:00
Eneko Illarramendi
083f7a0a8d chore: use standard library's HTTP status codes 2020-05-03 15:57:05 +02:00
Eneko Illarramendi
c3e337a319 fix: mypy errors 2020-04-26 16:58:29 +02:00
Eneko Illarramendi
97f4fabea1 fix: create temporal payments to keep balance updated 2020-04-24 14:56:10 +02:00
Eneko Illarramendi
897644956a feat: only dhow disclaimer if SERVICE_FEE has been set 2020-04-23 21:25:55 +02:00
Eneko Illarramendi
b1da103080 chore: minor tweaks 2020-04-21 23:47:21 +02:00
Eneko Illarramendi
d4c9043278 feat(core): delete expired payments 2020-04-17 21:13:57 +02:00
Eneko Illarramendi
fd4dddda6e chore: rename api-key-macaroon 2020-04-16 20:58:16 +02:00
Eneko Illarramendi
dd23b20090 chore: various tweaks 2020-04-16 20:58:16 +02:00
Eneko Illarramendi
af5269e239 refactor: add core.utils for creating and paying invoices
This methods can be used by extensions too.
2020-04-11 23:15:24 +02:00
Eneko Illarramendi
4397a6cab3 feat: use cerberus schemas to validate POST data 2020-04-11 20:16:54 +02:00
Eneko Illarramendi
649cc888ab refactor: /wallet tweaks 2020-04-01 22:18:46 +02:00
Eneko Illarramendi
d03785558b refactor: a wallet is a wallet is a wallet 2020-03-31 19:05:25 +02:00
Eneko Illarramendi
75d97ddfc1 refactor: camera ready 2020-03-10 23:12:22 +01:00
Eneko Illarramendi
49addb8d56 refactor: breaking bad 2020-03-08 23:00:41 +01:00