Storage
StorageKey
¶
A StorageKey instance is a representation of a single state entry.
Substrate uses a simple key-value data store implemented as a database-backed, modified Merkle tree. All of Substrate's higher-level storage abstractions are built on top of this simple key-value store.
create_from_data(data: bytes, runtime_config: RuntimeConfigurationObject, metadata: GenericMetadataVersioned, value_scale_type: str = None, pallet: str = None, storage_function: str = None) -> StorageKey
classmethod
¶
Create a StorageKey instance providing raw storage key bytes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
required | |
runtime_config |
RuntimeConfigurationObject
|
required | |
metadata |
GenericMetadataVersioned
|
required | |
value_scale_type |
str
|
None
|
|
pallet |
str
|
None
|
|
storage_function |
str
|
None
|
Returns:
Type | Description |
---|---|
StorageKey
|
create_from_storage_function(pallet: str, storage_function: str, params: list, runtime_config: RuntimeConfigurationObject, metadata: GenericMetadataVersioned) -> StorageKey
classmethod
¶
Create a StorageKey instance providing storage function details
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pallet |
str
|
required | |
storage_function |
str
|
required | |
params |
list
|
required | |
runtime_config |
RuntimeConfigurationObject
|
required | |
metadata |
GenericMetadataVersioned
|
required |
Returns:
Type | Description |
---|---|
StorageKey
|
to_hex() -> str
¶
Returns a Hex-string representation of current StorageKey data
Returns:
Type | Description |
---|---|
str
|
Hex string |
generate() -> bytes
¶
Generate a storage key for current specified pallet/function/params
Returns:
Type | Description |
---|---|
bytes
|
decode_scale_value(data: Optional[ScaleBytes] = None) -> ScaleType
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
Optional[ScaleBytes]
|
None
|