Repository navigation
docs(provider): explain how to compute the key of getStorageAt - #1737
Merged
Merged
Conversation
The JSDoc pointed to getStorageVarAddress(), a function that never existed. It now gives the key of a one-felt variable, links to the Cairo book for the other cases, documents responseFlags, and describes the returned object. The two TODO comments in the Cairo 1 tests are removed: they pointed to a dead link, and the feature they asked for will not be built.
Contributor
|
🎉 This PR is included in version 11.4.3 🎉 The release is available on: Your semantic-release bot 📦🚀 |
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.
Motivation and Resolution
The JSDoc of
getStorageAttold users to get the key "from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)". This function never existed in starknet.js. The JSDoc also did not describeresponseFlags, and its@returnswas wrong: the method returns an object, not the value itself.This JSDoc is shown on 3 pages of the API docs:
ProviderInterface,RpcProviderandWebSocketProvider.This PR rewrites the JSDoc. It explains how to compute the key of a variable that holds one felt, and links to the Cairo book for the other cases (structs,
Map,Vec, storage nodes...).It also removes two
TODO: Complex mappingcomments from the Cairo 1 tests. They pointed to a docs.starknet.io page that no longer exists (HTTP 404), and they were about the storage abstraction proposed in #646, which will not be built.Closes #646.
RPC version (if applicable)
Not applicable. The JSDoc now says that
INCLUDE_LAST_UPDATE_BLOCKneeds a node that uses RPC spec 0.10. With RPC spec 0.9, starknet.js does not send the flag, andlast_update_blockis 0.Usage related changes
getStorageAtexplains how to compute thekey:hash.starknetKeccak(name)for a variable that holds one felt, and the Cairo book for the other cases.responseFlags, and lists the two fields of the result (valueandlast_update_block).@example.Development related changes
TODOcomments with a dead link in__tests__/cairo1v2.test.tsand__tests__/cairo1v2_typed.test.ts. No test logic changed.Checklist: