Skip to content

chore(solana): use shared cache utils - #292

Open
taran-a wants to merge 1 commit into
feat/move-cache-into-shared-libfrom
chore/solana-use-shared-cache-utils
Open

chore(solana): use shared cache utils#292
taran-a wants to merge 1 commit into
feat/move-cache-into-shared-libfrom
chore/solana-use-shared-cache-utils

Conversation

@taran-a

@taran-a taran-a commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Explanation

Migrates the Solana snap to the shared caching utilities in @metamask/snap-networks-utils and removes its local copies (src/core/caching/).

Behavioral changes:

  • Cache keys for fetchJsonParsedAccount and fetchMint are now built from only the result-affecting, serializable config parts (commitment and minContextSlot) instead of the whole FetchAccountConfig object. Previously abortSignal ended up in the cache key (making it both unstable and non-serializable); it is now excluded from the key and not forwarded to the cached fetch, since it only affects cancellation. Keys are therefore more stable (more cache hits for equivalent requests).
  • Both cached wrappers now call the SDK function directly with an explicitly-deconstructed config rather than wrapping an internal closure, and the SDK's account result types (not statically Serializable) are asserted cache-safe via an intersection with Serializable.
  • Error logging: shared useCache takes an optional logger (default silent); call sites pass the snap logger to preserve current output.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

@taran-a
taran-a requested review from a team as code owners September 8, 2026 16:01
@sonarqubecloud

sonarqubecloud Bot commented Sep 8, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant