Skip to content

Derive the unshield claim summary from the list and decrypt queries - #474

Draft
alexshchur wants to merge 2 commits into
masterfrom
refactor/claim-summary-from-decrypt-queries
Draft

alexshchur wants to merge 2 commits into
masterfrom
refactor/claim-summary-from-decrypt-queries

Conversation

@alexshchur

Copy link
Copy Markdown
Contributor

Placeholder for a refactor of useCofheTokenClaimable and useCofheTokensClaimable. Blocked on #452.

Why

The claim summary today is computed inside its own query: it reads the claim list from chain, decrypts each pending claim imperatively through the client builder, and caches the reduced totals. That bypasses the per-handle decrypt queries the rest of @cofhe/react uses, so the plaintexts are not shared, and the summary has to carry the active ACP in its own key to stay correct (#435).

Plan

  • Read the raw claims through the existing ACP-independent list query.
  • Decrypt the unclaimed handles with useCofheDecryptForViewList (feat: useCofheDecryptFn, useCofheDecryptForTx and a configurable decrypt timeout #452), which already keys and caches per handle and per ACP.
  • Reduce list + decrypt results into UnshieldClaimsSummary in a useMemo; the multi-token hook flattens all handles into one decrypt list and regroups by token.
  • Remove the imperative decrypt loop, the summary query key, the ACP binding and the refetch-on-mount function added in fix(react): scope claim summaries by active ACP #435.
  • Keep the hooks' return shape (data, isFetching, refetch); isFetching will also cover the decrypts.

Transaction invalidation is unchanged: it already targets the list key prefix, and a handle's plaintext never needs invalidating.

@changeset-bot

changeset-bot Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 8befd24

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Vercel previews (commit 8befd24)

Project Deployment Updated
docs Visit Preview Nov 9, 2026 09:57 UTC
react Visit Preview Nov 9, 2026 09:55 UTC

This branch was successfully deployed

2 active deployments
Preview – docs — 8befd243 Deployed Nov 9, 2026 by github-actions[bot]
Preview – react — 8befd243 Deployed Nov 9, 2026 by github-actions[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.

1 participant