KVStoreUtils
@human-protocol/sdk • Docs
@human-protocol/sdk / kvstore / KVStoreUtils
Class: KVStoreUtils
Introduction
Utility class for KVStore-related operations.
Installation
npm
npm install @human-protocol/sdk
yarn
yarn install @human-protocol/sdk
Code example
Signer
Using private key (backend)
import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
const KVStoreAddresses = new KVStoreUtils.getData({
networks: [ChainId.POLYGON_AMOY]
});
Constructors
new KVStoreUtils()
new KVStoreUtils():
KVStoreUtils
Returns
Methods
getKVStoreData()
static
getKVStoreData(chainId
,address
):Promise
<IKVStore
[]>
This function returns the KVStore data for a given address.
This uses Subgraph
Input parameters
enum ChainId {
ALL = -1,
MAINNET = 1,
RINKEBY = 4,
GOERLI = 5,
BSC_MAINNET = 56,
BSC_TESTNET = 97,
POLYGON = 137,
POLYGON_MUMBAI = 80001,
POLYGON_AMOY = 80002,
MOONBEAM = 1284,
MOONBASE_ALPHA = 1287,
AVALANCHE = 43114,
AVALANCHE_TESTNET = 43113,
CELO = 42220,
CELO_ALFAJORES = 44787,
LOCALHOST = 1338,
}
interface IKVStore {
key: string;
value: string;
}
Parameters
• chainId: ChainId
Network in which the KVStore is deployed
• address: string
Address of the KVStore
Returns
Promise
<IKVStore
[]>
KVStore data
Code example
import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
const kvStoreData = await KVStoreUtils.getKVStoreData(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
console.log(kvStoreData);
Source
Last updated