Repository navigation
feat(addon-sdk): expose net worth, the one read that includes credit cards - #1797
Open
Bubbles840 wants to merge 1 commit into
Open
Bubbles840 wants to merge 1 commit into
Bubbles840 wants to merge 1 commit into
Conversation
…cards Addons had no way to read a credit card's balance. `getLatestValuations()` covers holdings accounts only, and CREDIT_CARD is not a holdings account type. `Account.balance` looked like the answer but is never populated: the backend account model has no balance field, so it was always undefined while typed `number`. - `PortfolioAPI.getNetWorth(date?)` forwards the existing net worth read (`GET /net-worth`), whose balance sheet itemises every account, including `CREDIT_CARD:<accountId>` liabilities. Wired through the permission list (`portfolio` category), the bridge, the iframe allow-list, and the permission descriptions shown to users. - `Account.balance` is optional and deprecated in the SDK and frontend types, pointing to valuations or net worth. - Docs: a Portfolio API net-worth entry with the card-balance recipe. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Helgust
added a commit
to Helgust/wealthfolio-plus
that referenced
this pull request
Sep 27, 2026
projectionlab-gaps.md compares the addon with ProjectionLab down to form fields and lists overlaps with Wealthfolio and its open PRs (wealthfolio#1687 loan terms, wealthfolio#1261 ownership, wealthfolio#1797 getNetWorth). wealthfolio-plan.md adds phase 5 (gates, five slices, what stays out) and its progress: the decisions per slice, sources checked against BOE, the ledger snapshot kept for plans of phases 1-4. user-guide.md covers amounts per month, other income, one-time events, loan terms, variable rates and prepayments, lettings and the IRPF paid the next year.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
An addon cannot read a credit card's balance.
ctx.api.portfolio.getLatestValuations()covers holdings accounts only (holdings_account_ids), andCREDIT_CARDdoes not support the Holdings purpose. A card is silently absent from the result.Account.balancelooks like the answer, but the backendAccountmodel has no balance field. It is typednumberin the SDK and is alwaysundefinedat runtime.A budgeting addon that checks balances against a bank feed therefore cannot check cards at all. The workaround is summing the ledger outside the SDK.
Change
PortfolioAPI.getNetWorth(date?)forwards the existing net worth read,GET /net-worth, which the app already uses. Its balance sheet itemises every account, includingCREDIT_CARD:<accountId>liabilities, and a card in credit appears asCASH:<accountId>. No backend change.portfoliopermission category, the bridge, the iframeALLOWED_API_METHODS, and the permission descriptions users see.Account.balanceis now optional and@deprecatedin the SDK and frontend types, with a pointer to valuations or net worth. Nothing in the app reads it as a real value: two synthetic account objects set it to 0, and the edit modal already defaults it with?? 0.Validation
tsc --noEmitpasses for both the SDK and the frontend.vitestpasses forsrc/addons,src/pages/settings/addonsandsrc/adapters(246 tests).I have read and agree to the CLA.
🤖 Generated with Claude Code