Commit graph

8 commits

Author SHA1 Message Date
Anshuman
1d3f9ecd41
feat: suffix balance/amount fields with explicit unit (Sat or Msat) (#2153)
* feat: add both Sat and Msat companion fields for all ambiguous balance/amount properties

* feat: add sat and msat companion fields to backend API responses

* chore: align frontend types and other missing fields

* chore: keep old formula for calculating total fee sat

* chore: remove unnecessary balance assignments in cashu and phoenix

* chore: add deprecated comment to non unit fields

* chore: rename callers and variable to specify units

* chore: remove msat fields for channel size and liquidity fields

* chore: drop msat fields from onchain channel size and liquidity responses

* chore: further changes

* chore: remove amount msat field onchain tx

* chore: remove msats from onchain balance response

* chore: remove msat fields for swaps

* chore: remove msat fields for punishment reserves

* chore: simplify rebalancing fee calculation

* chore: remove unnecessary fields

* chore: mark deprecated fields in frontend types

---------

Co-authored-by: im-adithya <imadithyavardhan@gmail.com>
2026-04-17 13:53:28 +05:30
Adithya Vardhan
3aa167a7c4
fix: add err handling to db queries (#2064)
* fix: add err handling to db queries

* chore: add error handling to GetApp

* chore: wrap the original error

* fix: retrieve balance after err != nil check

* chore: minor code cleanup

* chore: add error handling to app permission listing in GetApp

* chore: convert GetBudgetUsageSat to GetBudgetUsage

* chore: add tests for GetBudgetUsage

* chore: separate budget window tests

---------

Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
2026-02-27 16:31:25 +07:00
Adithya Vardhan
a2af8fd598
fix: return optional total balance in list apps response for subwallets (#2057)
* fix: return optional total balance in list apps response for subwallets

* chore: add error handling to subwallet balance query

* chore: add METADATA_APPSTORE_APP_ID_KEY constant

* chore: add MAX_FREE_SUBWALLETS constant

* chore: use subwallet query and total count for limit check
2026-02-26 12:25:06 +05:30
Roman D
df9393194a
feat: PostgreSQL support (#922)
* feat: enable Postgres connections

* feat: implement migration templates

* feat: convert sqlite-specific migrations to migration templates; adjust SQL syntax

* fix: add migration to fix postgres incompatibilities in the DB schema

* fix: correct SQL syntax for comparisons in the transactions service

* feat: database migration tool

* chore: update tests for testing with Postgres

* fix: update test

* fix: explicitly store mock timestamps in UTC

* chore: add txdb to go.mod and run tidy

* fix: serialize concurrent transactions when running tests with txdb

* chore: update README to mention postgres

* fix: use timestamptz in Postgres

* test: add Github action for testing the backend with Postgres

* chore: fix migration name and add comments

* docs: add db migration notes to README

* fix: address PR feedback

* fix: rename the cmd/migrate tool to cmd/db_migrate

* feat: add schema check in the DB migration tool

* test: use testdb instead of txdb for testing with Postgresql

* fix: fix tests after merge

* chore: comment out unused VACUUM in migrations

* fix: reset Postgres sequences after migrating data

* docs: update migrate command in readme

* fix: do not allow backup for migration when postgres is enabled

* chore: add debug logs for db backend type

* chore: use Logrus instead of slog for db_migrate

* fix: initialize logger in the keys tests

* test: add db_migrate test

* fix: use transaction object in db_migrate function

* fix: txlock in db migration test

---------

Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
2025-01-16 17:17:24 +07:00
Roland
188e7c6fa6
fix: fee limits for LND and LDK, isolated balance calculation (#937) 2025-01-06 23:08:09 +07:00
Jeremy Klein
430c9fe9d2
Add get_budget implementation (#726)
* Add get_budget implementation

* Always granted scope

* Don't show always_granted in the UI or save it in the DB.

* chore: get budget feedback

- replace always granted scope with always granted method list
- return nil for budget renews at for "never" budget renewal
- add extra tests

* fix: add omitempty to renews_at in get_budget response

---------

Co-authored-by: Roland Bewick <roland.bewick@gmail.com>
2024-10-28 13:28:27 +07:00
Roland
f63429f5e5
chore: add transaction indexes, make fees non-nullable (#305) 2024-07-22 11:45:11 +07:00
Roland
1391119eb9
Feat: dynamic budgets (#226)
* feat: add transactions table

* feat: add transactions service with makeinvoice method

* feat: use internal transactions WIP

* feat: check unsettled transactions

* feat: use transactions service in nip47 package WIP

* feat: use transactions service in NIP-47 handlers

* fix: transaction list colors

* fix: tests

* chore: remove old payments table

* fix: return budget usage as sats

* feat: use internal transactions table for keysend payments

* feat: consume nwc_payment_received event in transaction service (WIP)

* feat: update existing transaction from nwc_payment_received event in transactions service

* feat: update existing transaction from nwc_payment_sent event in transactions service

* feat: handle async payment failed events in transactions service

* fix: tests

* feat: correctly implement NIP-47 NOT_FOUND error code

* feat: intercept self payments

* feat: isolated balance and visibility

* feat: validate keysend payment does not exceed app internal balance

* feat: budget check in transactions service, correctly pass payment errors to NIP-47 response

also reduce query duplication

* fix: order transactions when looking up transaction

* feat: add fee reserves to unsettled outgoing transactions

* chore: rename app permissions max amount field

* chore: rename transaction amount values to be clearly millisats

* chore: merge balance type and visibility into isolated property on apps table

* chore: move duplicated permission check from nip-47 controllers to handler

* fix: app name in transaction list

* Feat: permissions revamp v2 (#273)

* feat: revamp permissions component

* chore: changes

* chore: changes

* chore: add view mode for show app screen

* chore: further changes

* feat: new illustration for linking account (#254)

* feat: new illustration for linking account

* fix: update paths

* fix: icon props (#256)

* fix: use date from frontend

* chore: add expiryselect component

* chore: further changes

* chore: further changes

* chore: add date-fns for date picker

* chore: further changes

* chore: further changes

* fix: add central LDK gossip node to help gossip new public channels (#262)

* fix: make dialog responsive (#258)

* chore: further changes

* typo

* chore: spacing issues

* chore: use scopes from capabilities

* chore: change scope type descriptions

* chore: styling fixes

* chore: fix typings

* chore: budget renewal component

* fix: LDK mark channel as inactive and show error if counterparty forwarding info missing (#267)

fix: mark channel as inactive and show error if counterparty forwarding info missing

* chore: remove unnecessary dark classes (#255)

* fix: links to open first channel in sidebar and onboarding checklist (#268)

* feat: improve migrate node UI (#269)

* fix: migrate node copy (#270)

* fix: stop nostr when app is shutdown and use context to stop lnclient (#271)

* fix: permissions revamp WIP

* feat: basic isolated apps UI

* fix: new app connection, edit app connection, deep linking

---------

Co-authored-by: im-adithya <imadithyavardhan@gmail.com>
Co-authored-by: René Aaron <100827540+reneaaron@users.noreply.github.com>
Co-authored-by: Michael Bumann <hello@michaelbumann.com>

* fix: make transactions table ID autoincrement

* fix: do not send unrelated notifications to isolated apps

* fix: nip-47 notifications not receiving updated transaction state

* fix: migrate existing tables to have autoincrementing primary keys (#274)

* fix: migrate existing tables to have autoincrementing primary keys

* fix: recreate request and response event tables after apps

* fix: remove null from request_events app_id

* fix: do not crash when reloading app created page

* chore: update pragma commands, add busy_timeout

* fix: remove unnecessary migration of user_configs table

* chore: update comment on autoincrement migration

* feat: sqlite database config improvements

* fix: autoincrement migration to delete unlinked app permissions

* chore: update tests for dynamic budgets (WIP)

* fix: get balance tests

* chore: add extra event handler tests

* chore: add extra event handler test

* chore: add extra multi_pay_invoice tests

* chore: transactions service tests (WIP)

* chore: add transactions service payment tests

* chore: add tests for self payments

* fix: notifications tests

* chore: add notifications tests for transactions service

* chore: add fee reserve tests for transactions service

* chore: add list transactions tests

* chore: add keysend tests for transactions service

* feat: subscribe for payments and invoices (#281)

* fix: db transaction should be passed as pointer

* feat(lnd): subscribe for payments and invoices

* chore: rearrange check for settled

* chore: remove TODO

* chore: retry on error and add select

* chore: publish payment failed event

* chore: use json logging

* feat: add lnd notification types

* chore: remove sleep

* fix: incorrect key on transaction list items

* fix: test

* fix: disable isolated app type on non-supported backends

---------

Co-authored-by: im-adithya <imadithyavardhan@gmail.com>
Co-authored-by: René Aaron <100827540+reneaaron@users.noreply.github.com>
Co-authored-by: Michael Bumann <hello@michaelbumann.com>
2024-07-19 23:30:22 +07:00