key: value
structure.
add_item(item_type, item)
Adds a new key-value pair to the on-chain storage. If the item is not already a string, it will be automatically JSON-serialized before storage.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
item_type | string | Required | Required | Key used to categorize or identify the item. Max 64 bytes. |
item | object | Required | Required | Value to store. Automatically JSON-serialized if not a string. Max 256 bytes. |
Add Item Code Examples
get_item(item_type, address)
Retrieves a stored item by its key for the specified address. Returns the decoded value as a string. Cross-chain storage querying:- Substrate: Uses the existing Substrate API connection directly to query storage
- EVM: Automatically uses the SDK’s
base_url
to create a temporary Substrate connection.
Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
item_type | string | Required | Required | Key used to search for the stored item. |
address | string | Required* | Required* | Address of the wallet that owns the stored item. |
Get Item Code Examples
update_item(item_type, item)
Updates an existing item in on-chain storage by replacing its value with a new one. The item will be automatically JSON-serialized if it’s not already a string.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
item_type | string | Required | Required | Key of the existing item to update. |
item | object | Required | Required | New value to store. Automatically JSON-serialized if not a string. |
Update Item Code Examples
remove_item(item_type)
Removes an existing key-value pair from on-chain storage.Parameter | Type | EVM | Substrate | Description |
---|---|---|---|---|
item_type | string | Required | Required | The key representing the pair to be removed. |