kvstore_utils
Utility class for KVStore-related operations.
Code Example
Module
class human_protocol_sdk.kvstore.kvstore_utils.KVStoreData(key, value)
Bases: object
__init__(key, value)
Initializes a KVStoreData instance.
Parameters:
key (
str
) – Keyvalue (
str
) – Value
class human_protocol_sdk.kvstore.kvstore_utils.KVStoreUtils
Bases: object
A utility class that provides additional KVStore-related functionalities.
static get(chain_id, address, key)
Gets the value of a key-value pair in the contract.
Parameters:
chain_id (
ChainId
) – Network in which the KVStore data has been deployedaddress (
str
) – The Ethereum address associated with the key-value pairkey (
str
) – The key of the key-value pair to get
Return type:
str
Returns: The value of the key-value pair if it exists
Example:
static get_file_url_and_verify_hash(chain_id, address, key='url')
Gets the URL value of the given entity, and verify its hash.
Parameters:
chain_id (
ChainId
) – Network in which the KVStore data has been deployedaddress (
str
) – Address from which to get the URL value.key (
Optional
[str
]) – Configurable URL key. url by default.
Return url: The URL value of the given address if exists, and the content is valid
Example:
Return type:
str
static get_kvstore_data(chain_id, address)
Returns the KVStore data for a given address.
Parameters:
chain_id (
ChainId
) – Network in which the KVStore data has been deployedaddress (
str
) – Address of the KVStore
Return type:
Optional
[List
[KVStoreData
]]Returns: List of KVStore data
Example:
static get_public_key(chain_id, address)
Gets the public key of the given entity, and verify its hash.
Parameters:
chain_id (
ChainId
) – Network in which the KVStore data has been deployedaddress (
str
) – Address from which to get the public key.
Return public_key: The public key of the given address if exists, and the content is valid
Example:
Return type:
str
Last updated