KVStoreUtils
Last updated
Last updated
/ / KVStoreUtils
Utility class for KVStore-related operations.
Using private key (backend)
Returns
static
get(chainId
,address
,key
):Promise
<string
>
Gets the value of a key-value pair in the KVStore using the subgraph.
Parameters
chainId
Network in which the KVStore is deployed
address
string
Address from which to get the key value.
key
string
Key to obtain the value.
Returns
Promise
<string
>
Value of the key.
Throws
Thrown if the network's chainId is not supported
Throws
Thrown if the Address sent is invalid
Throws
Thrown if the key is empty
Code example
Defined in
static
getFileUrlAndVerifyHash(chainId
,address
,urlKey
):Promise
<string
>
Gets the URL value of the given entity, and verifies its hash.
Parameters
chainId
Network in which the KVStore is deployed
address
string
Address from which to get the URL value.
urlKey
string
= 'url'
Configurable URL key. url
by default.
Returns
Promise
<string
>
URL value for the given address if it exists, and the content is valid
Code example
Defined in
This function returns the KVStore data for a given address.
Parameters
chainId
Network in which the KVStore is deployed
address
string
Address of the KVStore
Returns
KVStore data
Throws
Thrown if the network's chainId is not supported
Throws
Thrown if the Address sent is invalid
Code example
Defined in
static
getPublicKey(chainId
,address
):Promise
<string
>
Gets the public key of the given entity, and verifies its hash.
Parameters
chainId
Network in which the KVStore is deployed
address
string
Address from which to get the public key.
Returns
Promise
<string
>
Public key for the given address if it exists, and the content is valid
Code example
Defined in
new KVStoreUtils():
static
getKVStoreData(chainId
, address
): Promise
<[]>
Promise
<[]>