Skip to content

fix: replace debank total balance with backend portfolio summary - #12501

Merged
guanbinrui merged 3 commits into
developfrom
fix/replace-debank-total-balance
Oct 19, 2026
Merged

guanbinrui merged 3 commits into
developfrom
fix/replace-debank-total-balance

Conversation

@swkatmask

Copy link
Copy Markdown
Contributor

Description

The DeBank API key behind debank-proxy.r2d2.to is about to be rotated (usage spike / key leak). This removes the last /v1/user/total_balance call from the extension and moves the ENS panel's total balance to the Firefly backend summary:

  • New Firefly/Portfolio.ts provider: GET https://api.firefly.land/v1/wallet/portfolio/summary?address= (address lowercased to hit the same server cache), unwrapped via resolveFireflyResponseData.
  • useUserTotalBalance now calls it (query key renamed so stale caches are not reused).
  • Deleted DeBankFungibleToken.getTotalBalance and the orphaned UserTotalBalance type.

The total now includes Hyperliquid and Polymarket positions, so the displayed value can differ from the old DeBank figure by design. DeBank's other endpoints used by the extension (all_token_list, history, gas) are untouched and still go through the proxy.

Same change as DimensionDev/firefly-social#11024.

Closes # (NO_ISSUE)

Type of change

  • Code refactoring (Restructuring existing code w/o changing its observable behavior)

Previews

No visual change — same panel, same formatting, new data source.

Checklist

  • My code follows the style guidelines of this project.
  • I have performed a self-review of my own code.
    • I have removed all in development console.logs
    • I have removed all commented code.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have read Internationalization Guide and moved text fields to the i18n JSON file.

If this PR depends on external APIs:

  • I have configured those APIs with CORS headers to let extension requests get passed.
    • api.firefly.land is already in security/content-security-policy.json connect-src and already serves extension requests (used by Firefly/WalletHistory.ts and Firefly/RedPacket.ts).
  • I have delegated all web requests to the background service via the internal RPC bridge.
    • The new provider goes through the same fetchJSON helper as the DeBank call it replaces; the request path is unchanged.

@vercel

vercel Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
book Skipped Skipped Oct 19, 2026 4:31am UTC

Request Review

@swkatmask
swkatmask marked this pull request as ready for review October 19, 2026 03:15
- Use fetchCachedJSON to match the replaced DeBank call, so the ENS panel
  no longer refetches on every mount/focus.
- Throw on a missing or non-numeric total instead of crashing on undefined
  or rendering "$NaN".
- Reuse FireflyFarcasterAPI.Response for the envelope type.
- Export getWalletPortfolioTotalValue from the package entry and import it
  via @masknet/web3-providers in the hook.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@guanbinrui
guanbinrui merged commit 47b8fd7 into develop Oct 19, 2026
11 checks passed
@guanbinrui
guanbinrui deleted the fix/replace-debank-total-balance branch October 19, 2026 04:35

This branch was previously deployed

1 inactive deployment
Preview — ff2a6abe Deployed Oct 19, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants