Skip to content

docs(provider): explain how to compute the key of getStorageAt - #1737

Merged
PhilippeR26 merged 1 commit into
starknet-io:developfrom
PhilippeR26:docs/getStorageAt
Oct 26, 2026
Merged

PhilippeR26 merged 1 commit into
starknet-io:developfrom
PhilippeR26:docs/getStorageAt

Conversation

@PhilippeR26

@PhilippeR26 PhilippeR26 commented Oct 26, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation and Resolution

The JSDoc of getStorageAt told users to get the key "from getStorageVarAddress('<STORAGE_VARIABLE_NAME>') (WIP)". This function never existed in starknet.js. The JSDoc also did not describe responseFlags, and its @returns was wrong: the method returns an object, not the value itself.

This JSDoc is shown on 3 pages of the API docs: ProviderInterface, RpcProvider and WebSocketProvider.

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 mapping comments 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_BLOCK needs a node that uses RPC spec 0.10. With RPC spec 0.9, starknet.js does not send the flag, and last_update_block is 0.

Usage related changes

  • The JSDoc of getStorageAt explains how to compute the key: hash.starknetKeccak(name) for a variable that holds one felt, and the Cairo book for the other cases.
  • The JSDoc describes responseFlags, and lists the two fields of the result (value and last_update_block).
  • The JSDoc has an @example.

Development related changes

  • Removed two TODO comments with a dead link in __tests__/cairo1v2.test.ts and __tests__/cairo1v2_typed.test.ts. No test logic changed.

Checklist:

  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Linked the issues which this PR resolves
  • Documented the changes in code (API docs will be generated automatically)
  • All tests are passing

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.
@PhilippeR26
PhilippeR26 merged commit c473ed9 into starknet-io:develop Oct 26, 2026
9 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 11.4.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

[Proposal] storage vars abstraction for Cairo1 contracts

1 participant