pub struct Layout { /* private fields */ }Expand description
A parsed storage layout.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn from_json(s: &str) -> Result<Self>
pub fn from_json(s: &str) -> Result<Self>
Accepts either a bare storageLayout object or a whole forge/hardhat
artifact that contains one.
Sourcepub fn from_artifact(path: impl AsRef<Path>) -> Result<Self>
pub fn from_artifact(path: impl AsRef<Path>) -> Result<Self>
Layout::from_json on the contents of path.
Sourcepub fn fields(&self) -> impl Iterator<Item = &StorageEntry>
pub fn fields(&self) -> impl Iterator<Item = &StorageEntry>
Top-level variables in declaration order.
Sourcepub fn locate(&self, path: &str) -> Result<Location>
pub fn locate(&self, path: &str) -> Result<Location>
Resolve a dotted/indexed path to its storage location.
Sourcepub fn decode(&self, loc: &Location, word: B256) -> Value
pub fn decode(&self, loc: &Location, word: B256) -> Value
Decode the value at loc out of a full 32-byte storage word.
Sourcepub fn kind_of(&self, path: &str) -> Result<PathKind>
pub fn kind_of(&self, path: &str) -> Result<PathKind>
What kind of thing a path names — a leaf value, or a container that
takes another path segment. Drives the Node view proxy.
Sourcepub fn decode_typed(&self, loc: &Location, word: B256) -> (ValueKind, Value)
pub fn decode_typed(&self, loc: &Location, word: B256) -> (ValueKind, Value)
Decode with an explicit kind, so callers that marshal across a language boundary know what the text is.
Sourcepub fn typescript(&self, name: &str) -> String
pub fn typescript(&self, name: &str) -> String
TypeScript declaration of the contract’s storage as the Node view
exposes it: bigint for integers, boolean, string for addresses
and bytes, nested objects for structs, index signatures for mappings
and arrays. name is the interface name.