feat: allow for multiple keys in snap_getState - #4125
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4125 +/- ##
=======================================
Coverage 98.59% 98.60%
=======================================
Files 429 429
Lines 12497 12509 +12
Branches 1976 1978 +2
=======================================
+ Hits 12322 12334 +12
Misses 175 175 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
hmalik88
marked this pull request as ready for review
September 17, 2026 16:58
FrederikBolding
approved these changes
Sep 21, 2026
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.
Description
Updates
snap_getStateto accept an array of keys in thekeyparameter, allowing a Snap to fetch multiple state values in a single call.Before
After
Behavior
keyis astring[], the result is aRecord<string, Json>mapping each key to its resolved value. Keys not found in state map tonull.Note
Medium Risk
Changes permitted state-read RPC validation and response shape for a new parameter form; backward compatible for string keys but affects Snap storage access semantics.
Overview
snap_getStatenow acceptskeyas either a dot-path string or a string array, so Snaps can read several state paths in one RPC call. With an array, the result is aRecord<string, Json>keyed by the requested paths; paths that are missing resolve tonull. Single-key and whole-state behavior is unchanged.The RPC layer validates array vs string
keyviaselectiveUnionandStateKeysStruct, and the internalgethelper builds the record while still enforcing forbidden-key checks on every path segment.GetStateParamsin the SDK is updated accordingly; the manage-state example and test-snaps UI (comma-separated keys) exercise the new shape, with unit and integration tests added.Reviewed by Cursor Bugbot for commit f9ec0f6. Bugbot is set up for automated code reviews on this repo. Configure here.