Commit Graph

72 Commits

Author SHA1 Message Date
Michael Bumann
436baeeccb Merge pull request #64 from getAlby/invoice-update-subscriptions
First draft to subscribe for LND invoice update
2022-01-23 00:22:46 +02:00
Michael Bumann
35e7da2f30 Search for correct state 2022-01-22 22:57:14 +01:00
Michael Bumann
af8c72d2c9 Store invoice expiry and use search for not expired invoices in the invoice subscription
When subscribing for invoice updates we only subscribe to not expired invoices.
We assume expired invoices will never get paid.
2022-01-22 21:11:19 +01:00
Michael Bumann
d90a695172 Context how do they work... 2022-01-22 13:32:15 +01:00
Michael Bumann
b54f04701f Start invoice subscription from the last unsettled invoice
We want to get updates starting from those invoices.
This allows us to catch up in case the app was offline while some invoices got settled
2022-01-22 13:24:51 +01:00
Michael Bumann
c75e703d80 Try reconnecting on invoice subscription errors 2022-01-22 12:57:00 +01:00
kiwiidb
366f66a2e2 use bun.Tx to avoid db locked err 2022-01-22 10:33:54 +01:00
Michael Bumann
71eabae443 Split up process invoice updates 2022-01-21 21:29:16 +01:00
Michael Bumann
12dbb48c8d First draft to subscribe for LND invoice update 2022-01-21 20:57:41 +01:00
Michael Bumann
3e088a7652 Pass invoice description hash string to LND 2022-01-21 17:40:52 +01:00
Michael Bumann
2606403489 Use tx to call do the db updates 2022-01-21 15:12:08 +01:00
Michael Bumann
43aba70dd8 Fix invoice preimages for internal payments
We create the preimage on incoming invoices. If it is an internal incoming payment (meaning from one user to another user) we use that preimage and save it on the outgoing invoice.
This makes sure we can give wallets the correct preimage for a payment request even though no lightning transaction happened
2022-01-21 13:56:02 +01:00
Michael Bumann
89acf29b24 cleanup 2022-01-21 12:25:19 +01:00
Michael Bumann
228edcbe39 Return user invoices
and maybe correctly encode the Buffers?
2022-01-21 11:49:08 +01:00
Michael Bumann
2097807c85 Support Amount values as string/integer in request JSON 2022-01-21 11:15:35 +01:00
Michael Bumann
289d7405f1 Rollback only in the SendPayment call
this one handles the transactions which is passed to the SendPaymentSync and SendInternalPayment call
2022-01-20 19:00:49 +01:00
Michael Bumann
9ed269dedf Split up functions for internal vs. external payments 2022-01-20 18:31:03 +01:00
Michael Bumann
7d955a1d7b Support self-payments
If the destination of the invoice is our node we only create internal transaction entries and do not call the underlaying lightning node
2022-01-20 16:50:26 +01:00
Michael Bumann
90a686677f Save invoice destination
And save the node pubkey in the service to make it usable
2022-01-20 15:41:50 +01:00
Michael Bumann
3a67f86a34 Merge main 2022-01-20 14:15:40 +01:00
Michael Bumann
6822b274e5 Add check payment endpoint 2022-01-20 13:58:46 +01:00
kiwiidb
d3466aa0cc remove pointer to interface 2022-01-20 13:24:59 +01:00
Michael Bumann
70a7e1a8eb Add DB constraints to check for user balances 2022-01-20 02:03:51 +01:00
Michael Bumann
d4183c100b Add payinvoice endpoint 2022-01-20 01:57:31 +01:00
Michael Bumann
1db6f77dd9 Add check payment endpoint 2022-01-19 22:11:24 +01:00
Michael Bumann
93e74d125f Merge pull request #53 from getAlby/user-service
User service for all user related functions
2022-01-19 22:41:00 +02:00
Michael Bumann
6a8d4bd52c Merge pull request #50 from getAlby/getinfo
Add /getinfo endpoint
2022-01-19 22:39:55 +02:00
Michael Bumann
7bd74a69d8 User service for all user related functions 2022-01-19 21:16:20 +01:00
Michael Bumann
f625ef7efc Implement addinvoice call 2022-01-19 19:43:29 +01:00
Michael Bumann
9e772a95a8 Add missing ln service 2022-01-19 17:48:43 +01:00
kiwiidb
2915d4a094 fix 2 bugs in create user func 2022-01-19 16:59:10 +01:00
kiwiidb
8eef14fccc move service functions to service package 2022-01-19 16:10:55 +01:00
kiwiidb
6a8061e55f split up service 2022-01-19 16:02:53 +01:00
kiwiidb
cbf3cecb32 refactor create endpoint 2022-01-19 15:40:41 +01:00
kiwiidb
18f65e4546 refactor payinvoice 2022-01-19 15:32:22 +01:00
kiwiidb
55fda4d3f4 refactor auth and addinvoice 2022-01-19 15:25:07 +01:00
kiwiidb
b8fb826ea5 move config to lib 2022-01-19 14:40:27 +01:00
kiwiidb
ecd4894673 refactor balance 2022-01-19 14:18:34 +01:00
kiwiidb
5c3e3b2a30 throw away useless context 2022-01-19 14:01:32 +01:00
kiwiidb
7a2baa6000 rename service file 2022-01-19 13:54:09 +01:00
kiwiidb
e22ab6ce49 rename context to service 2022-01-19 13:53:40 +01:00
Viktor Patchev
919affa2db Update package name to new repo 2022-01-18 10:42:53 +01:00
Michael Bumann
7c007791ec Setup LND connection 2022-01-17 22:37:40 +01:00
Michael Bumann
aabbfc33b5 Merge master and use correct lnd version 2022-01-17 18:45:47 +01:00
Viktor Patchev
2b1de4ba92 fix 2022-01-17 13:53:16 +01:00
Viktor Patchev
2bf39e0f97 Setup lnd grpc client 2022-01-17 12:53:47 +01:00
Michael Bumann
6478c6e0db Make JWT expiry configurable and require to set a JWT secret 2022-01-17 11:11:28 +01:00
Michael Bumann
1150ad6154 Merge remote-tracking branch 'getalby/main' into logging
* getalby/main:
  Minor fixes
2022-01-17 10:43:18 +01:00
Michael Bumann
f3a05ac268 Update log format
if no extension is given we add the date.
if an extension is given we use that path (assuming that's the exact file the user wants)
2022-01-17 10:39:14 +01:00
Michael Bumann
4cec10a999 Cleanup filename 2022-01-17 10:24:42 +01:00