Last updated
Last updated
This client enables to perform actions on KVStore contract and obtain information from both the contracts and subgraph.
Internally, the SDK will use one network or another according to the network ID of the web3. To use this client, you need to create Web3 instance, and configure default account, as well as some middlewares.
With Signer
Without Signer (For read operations only)
Bases: object
A class used to manage kvstore on the HUMAN network.
Initializes a KVStore instance.
Parameters: web3 (Web3
) – The Web3 object
Gets the value of a key-value pair in the contract.
Parameters:
address (str
) – The Ethereum address associated with the key-value pair
key (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:
Gets the URL value of the given entity, and verify its hash.
Parameters:
address (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
Gets the public key of the given entity, and verify its hash.
Parameters: address (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
Sets the value of a key-value pair in the contract.
Parameters:
key (str
) – The key of the key-value pair to set
value (str
) – The value of the key-value pair to set
tx_options (Optional
[TxParams
]) – (Optional) Additional transaction parameters
Return type: None
Returns: None
Example:
Sets multiple key-value pairs in the contract.
Parameters:
keys (List
[str
]) – A list of keys to set
values (List
[str
]) – A list of values to set
tx_options (Optional
[TxParams
]) – (Optional) Additional transaction parameters
Return type: None
Returns: None
Example:
Sets a URL value for the address that submits the transaction, and its hash.
Parameters:
url (str
) – URL to set
key (Optional
[str
]) – Configurable URL key. url by default.
tx_options (Optional
[TxParams
]) – (Optional) Additional transaction parameters
Return type: None
Returns: None
Example:
Bases: Exception
Raises when some error happens when interacting with kvstore.
Raises: – If an error occurs while validating URL, or handling transaction