New Transactions Layer (layer between api/nip-47 handlers and LN clients)
Creating a transaction will internall call the LNClient to create the transaction, then save it to our DB with additional metadata, such as the app the transaction was made for.
LNClient
(TBC) checkUnsettledTransaction(s) functions can be used for backends that do not receive events for updates. Alternative: background sync task
Database
New transaction table with additional data than the old payment table, notably:
type incoming or outgoing
state which can be used to ensure budgets are not exceeded
metadata JSON-encoded transaction metadata
TODOs:
[x] update all transaction related usages of lnclient to go through transactions service
[ ] Test payment timeouts correctly apply to transactions
[x] Add fees to budget calculation
[ ] Keysend
[ ] Test payment metadata
[ ] Review unique constraints
[ ] Duplicate payments for the same payment hash are possible if a payment fails and we retry - or should we update the existing record? then there can be a constraint: appId + paymentHash
[ ] Should the internal wallet have it's own app ID?
[ ] NIP-47 notifier receives a notification of a payment, but we do not know the app ID - test both for apps and global view
[ ] notifier should be updated to check if the transaction app ID matches the app ID, or it's an app with a global view
[x] remove old payments table
[ ] review it's ok NOT to migrate transaction history. I would email all early users and let them know.
nothing here yet ( ͡° ͜ʖ ͡°)
see https://github.com/getAlby/nostr-wallet-connect-next/issues/548
Breaking Changes
Payments
table is deleted as part of the migration.What this enables
Changes
Architecture
checkUnsettledTransaction
(s) functions can be used for backends that do not receive events for updates. Alternative: background sync taskDatabase
type
incoming or outgoingstate
which can be used to ensure budgets are not exceededmetadata
JSON-encoded transaction metadataTODOs:
To move to new issue: