KVStoreClient
Last updated
Last updated
/ / / KVStoreClient
.KVStoreClient
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 signerOrProvider
. To use this client, it is recommended to initialize it using the static build
method.
A Signer
or a Provider
should be passed depending on the use case of this module:
Signer: when the user wants to use this model in order to send transactions caling the contract functions.
Provider: when the user wants to use this model in order to get information from the contracts or subgraph.
Using private key(backend)
Using Wagmi(frontend)
↳ KVStoreClient
• new KVStoreClient(signerOrProvider
, networkData
, gasPriceMultiplier?
)
KVStoreClient constructor
Parameters
signerOrProvider
Signer
| Provider
The Signer or Provider object to interact with the Ethereum network
networkData
NetworkData
-
gasPriceMultiplier?
number
The multiplier to apply to the gas price
Overrides
Defined in
• Private
contract: KVStore
Defined in
• Protected
Optional
gasPriceMultiplier: number
Inherited from
Defined in
• networkData: NetworkData
Inherited from
Defined in
• Protected
signerOrProvider: Signer
| Provider
Inherited from
Defined in
▸ Protected
gasPriceOptions(): Promise
<Partial
<Overrides
>>
Adjust the gas price, and return as an option to be passed to a transaction
Returns
Promise
<Partial
<Overrides
>>
Returns the gas price options
Inherited from
Defined in
▸ get(address
, key
): Promise
<string
>
This function returns the value for a specified key and address.
Parameters
address
string
Address from which to get the key value.
key
string
Key to obtain the value.
Returns
Promise
<string
>
Value of the key.
Code example
Need to have available stake.
Defined in
▸ getURL(address
, urlKey?
): Promise
<string
>
This function returns the URL value for the given entity.
Parameters
address
string
undefined
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 exists, and the content is valid
Code example
Defined in
▸ set(key
, value
): Promise
<void
>
This function sets a key-value pair associated with the address that submits the transaction.
Parameters
key
string
Key of the key-value pair
value
string
Value of the key-value pair
Returns
Promise
<void
>
Returns void if successful. Throws error if any.
Code example
Need to have available stake.
Defined in
▸ setBulk(keys
, values
): Promise
<void
>
This function sets key-value pairs in bulk associated with the address that submits the transaction.
Parameters
keys
string
[]
Array of keys (keys and value must have the same order)
values
string
[]
Array of values
Returns
Promise
<void
>
Returns void if successful. Throws error if any.
Code example
Need to have available stake.
Defined in
▸ setURL(url
, urlKey?
): Promise
<void
>
This function sets a URL value for the address that submits the transaction.
Parameters
url
string
undefined
URL to set
urlKey
string
'url'
Configurable URL key. url
by default.
Returns
Promise
<void
>
Returns void if successful. Throws error if any.
Code example
Defined in
Creates an instance of KVStoreClient from a Signer or Provider.
Parameters
signerOrProvider
Signer
| Provider
The Signer or Provider object to interact with the Ethereum network
gasPriceMultiplier?
number
The multiplier to apply to the gas price
Returns
An instance of KVStoreClient
Throws
Thrown if the provider does not exist for the provided Signer
Throws
Thrown if the network's chainId is not supported
Defined in
.
.
.
.
.
▸ Static
build(signerOrProvider
, gasPriceMultiplier?
): Promise
<>
Promise
<>