@human-protocol/sdk 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/base.d.ts +4 -5
  2. package/dist/base.d.ts.map +1 -1
  3. package/dist/base.js +4 -5
  4. package/dist/constants.js +6 -6
  5. package/dist/encryption.d.ts +68 -203
  6. package/dist/encryption.d.ts.map +1 -1
  7. package/dist/encryption.js +66 -202
  8. package/dist/error.d.ts +0 -24
  9. package/dist/error.d.ts.map +1 -1
  10. package/dist/error.js +2 -26
  11. package/dist/escrow.d.ts +427 -780
  12. package/dist/escrow.d.ts.map +1 -1
  13. package/dist/escrow.js +314 -684
  14. package/dist/graphql/queries/operator.d.ts.map +1 -1
  15. package/dist/graphql/queries/operator.js +3 -1
  16. package/dist/graphql/types.d.ts.map +1 -1
  17. package/dist/index.d.ts +3 -4
  18. package/dist/index.d.ts.map +1 -1
  19. package/dist/index.js +2 -4
  20. package/dist/kvstore.d.ts +119 -181
  21. package/dist/kvstore.d.ts.map +1 -1
  22. package/dist/kvstore.js +119 -182
  23. package/dist/operator.d.ts +59 -30
  24. package/dist/operator.d.ts.map +1 -1
  25. package/dist/operator.js +59 -30
  26. package/dist/staking.d.ts +135 -134
  27. package/dist/staking.d.ts.map +1 -1
  28. package/dist/staking.js +135 -134
  29. package/dist/statistics.d.ts +104 -134
  30. package/dist/statistics.d.ts.map +1 -1
  31. package/dist/statistics.js +119 -144
  32. package/dist/transaction.d.ts +36 -15
  33. package/dist/transaction.d.ts.map +1 -1
  34. package/dist/transaction.js +36 -15
  35. package/dist/types.d.ts +0 -54
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/utils.d.ts +31 -17
  38. package/dist/utils.d.ts.map +1 -1
  39. package/dist/utils.js +31 -17
  40. package/dist/worker.d.ts +35 -14
  41. package/dist/worker.d.ts.map +1 -1
  42. package/dist/worker.js +35 -14
  43. package/package.json +7 -24
  44. package/src/base.ts +4 -5
  45. package/src/constants.ts +6 -6
  46. package/src/encryption.ts +69 -203
  47. package/src/error.ts +0 -36
  48. package/src/escrow.ts +425 -780
  49. package/src/graphql/queries/operator.ts +3 -1
  50. package/src/graphql/types.ts +4 -2
  51. package/src/index.ts +4 -5
  52. package/src/kvstore.ts +120 -183
  53. package/src/operator.ts +59 -30
  54. package/src/staking.ts +135 -134
  55. package/src/statistics.ts +125 -146
  56. package/src/transaction.ts +36 -15
  57. package/src/types.ts +0 -57
  58. package/src/utils.ts +31 -17
  59. package/src/worker.ts +35 -14
  60. package/dist/storage.d.ts +0 -186
  61. package/dist/storage.d.ts.map +0 -1
  62. package/dist/storage.js +0 -319
  63. package/src/storage.ts +0 -313
@@ -1 +1 @@
1
- {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AA8BlD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,gBAAgB,mCA+BzD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,mCAsBzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
1
+ {"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgClD,eAAO,MAAM,iBAAiB,GAAI,QAAQ,gBAAgB,mCA+BzD,CAAC;AAEF,eAAO,MAAM,4BAA4B,GAAI,OAAO,MAAM,mCAsBzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
@@ -19,7 +19,9 @@ const LEADER_FRAGMENT = (0, graphql_tag_1.default) `
19
19
  jobTypes
20
20
  registrationNeeded
21
21
  registrationInstructions
22
- reputationNetworks
22
+ reputationNetworks {
23
+ address
24
+ }
23
25
  name
24
26
  category
25
27
  staker {
@@ -1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M,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
1
  import { StakingClient, StakingUtils } from './staking';
2
- import { StorageClient } from './storage';
3
2
  import { KVStoreClient, KVStoreUtils } from './kvstore';
4
3
  import { EscrowClient, EscrowUtils } from './escrow';
5
- import { StatisticsClient } from './statistics';
6
- import { Encryption, EncryptionUtils } from './encryption';
4
+ import { StatisticsUtils } from './statistics';
5
+ import { Encryption, EncryptionUtils, MessageDataType } from './encryption';
7
6
  import { OperatorUtils } from './operator';
8
7
  import { TransactionUtils } from './transaction';
9
8
  import { WorkerUtils } from './worker';
@@ -12,5 +11,5 @@ export * from './types';
12
11
  export * from './enums';
13
12
  export * from './interfaces';
14
13
  export { EthereumError, InvalidArgumentError, ReplacementUnderpriced, NumericFault, NonceExpired, TransactionReplaced, ContractExecutionError, InvalidEthereumAddressError, InvalidKeyError, } from './error';
15
- export { StakingClient, StorageClient, KVStoreClient, KVStoreUtils, EscrowClient, EscrowUtils, StatisticsClient, Encryption, EncryptionUtils, OperatorUtils, TransactionUtils, WorkerUtils, StakingUtils, };
14
+ export { StakingClient, KVStoreClient, KVStoreUtils, EscrowClient, EscrowUtils, StatisticsUtils, Encryption, EncryptionUtils, OperatorUtils, TransactionUtils, WorkerUtils, StakingUtils, MessageDataType, };
16
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UA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AAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,sBAAsB,EACtB,2BAA2B,EAC3B,eAAe,GAChB,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,eAAe,GAChB,CAAC"}
package/dist/index.js CHANGED
@@ -14,12 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.StakingUtils = exports.WorkerUtils = exports.TransactionUtils = exports.OperatorUtils = exports.EncryptionUtils = exports.Encryption = exports.StatisticsClient = exports.EscrowUtils = exports.EscrowClient = exports.KVStoreUtils = exports.KVStoreClient = exports.StorageClient = exports.StakingClient = exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = exports.EthereumError = void 0;
17
+ exports.StakingUtils = exports.WorkerUtils = exports.TransactionUtils = exports.OperatorUtils = exports.EncryptionUtils = exports.Encryption = exports.StatisticsUtils = exports.EscrowUtils = exports.EscrowClient = exports.KVStoreUtils = exports.KVStoreClient = exports.StakingClient = exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = exports.EthereumError = void 0;
18
18
  const staking_1 = require("./staking");
19
19
  Object.defineProperty(exports, "StakingClient", { enumerable: true, get: function () { return staking_1.StakingClient; } });
20
20
  Object.defineProperty(exports, "StakingUtils", { enumerable: true, get: function () { return staking_1.StakingUtils; } });
21
- const storage_1 = require("./storage");
22
- Object.defineProperty(exports, "StorageClient", { enumerable: true, get: function () { return storage_1.StorageClient; } });
23
21
  const kvstore_1 = require("./kvstore");
24
22
  Object.defineProperty(exports, "KVStoreClient", { enumerable: true, get: function () { return kvstore_1.KVStoreClient; } });
25
23
  Object.defineProperty(exports, "KVStoreUtils", { enumerable: true, get: function () { return kvstore_1.KVStoreUtils; } });
@@ -27,7 +25,7 @@ const escrow_1 = require("./escrow");
27
25
  Object.defineProperty(exports, "EscrowClient", { enumerable: true, get: function () { return escrow_1.EscrowClient; } });
28
26
  Object.defineProperty(exports, "EscrowUtils", { enumerable: true, get: function () { return escrow_1.EscrowUtils; } });
29
27
  const statistics_1 = require("./statistics");
30
- Object.defineProperty(exports, "StatisticsClient", { enumerable: true, get: function () { return statistics_1.StatisticsClient; } });
28
+ Object.defineProperty(exports, "StatisticsUtils", { enumerable: true, get: function () { return statistics_1.StatisticsUtils; } });
31
29
  const encryption_1 = require("./encryption");
32
30
  Object.defineProperty(exports, "Encryption", { enumerable: true, get: function () { return encryption_1.Encryption; } });
33
31
  Object.defineProperty(exports, "EncryptionUtils", { enumerable: true, get: function () { return encryption_1.EncryptionUtils; } });
package/dist/kvstore.d.ts CHANGED
@@ -1,15 +1,14 @@
1
+ import { KVStore } from '@human-protocol/core/typechain-types';
1
2
  import { ContractRunner, Overrides } from 'ethers';
2
3
  import { BaseEthersClient } from './base';
3
4
  import { ChainId } from './enums';
4
5
  import { NetworkData } from './types';
5
6
  import { IKVStore, SubgraphOptions } from './interfaces';
6
7
  /**
7
- * ## Introduction
8
- *
9
- * This client enables performing actions on KVStore contract and obtaining information from both the contracts and subgraph.
8
+ * Client for interacting with the KVStore contract.
10
9
  *
11
10
  * Internally, the SDK will use one network or another according to the network ID of the `runner`.
12
- * To use this client, it is recommended to initialize it using the static `build` method.
11
+ * To use this client, it is recommended to initialize it using the static [`build`](/ts/classes/KVStoreClient/#build) method.
13
12
  *
14
13
  * ```ts
15
14
  * static async build(runner: ContractRunner): Promise<KVStoreClient>;
@@ -20,37 +19,25 @@ import { IKVStore, SubgraphOptions } from './interfaces';
20
19
  * - **Signer**: when the user wants to use this model to send transactions calling the contract functions.
21
20
  * - **Provider**: when the user wants to use this model to get information from the contracts or subgraph.
22
21
  *
23
- * ## Installation
24
- *
25
- * ### npm
26
- * ```bash
27
- * npm install @human-protocol/sdk
28
- * ```
29
- *
30
- * ### yarn
31
- * ```bash
32
- * yarn install @human-protocol/sdk
33
- * ```
22
+ * @example
34
23
  *
35
- * ## Code example
24
+ * ###Using Signer
36
25
  *
37
- * ### Signer
38
- *
39
- * **Using private key (backend)**
26
+ * ####Using private key (backend)
40
27
  *
41
28
  * ```ts
42
29
  * import { KVStoreClient } from '@human-protocol/sdk';
43
- * import { Wallet, providers } from 'ethers';
30
+ * import { Wallet, JsonRpcProvider } from 'ethers';
44
31
  *
45
32
  * const rpcUrl = 'YOUR_RPC_URL';
46
33
  * const privateKey = 'YOUR_PRIVATE_KEY';
47
34
  *
48
- * const provider = new providers.JsonRpcProvider(rpcUrl);
35
+ * const provider = new JsonRpcProvider(rpcUrl);
49
36
  * const signer = new Wallet(privateKey, provider);
50
37
  * const kvstoreClient = await KVStoreClient.build(signer);
51
38
  * ```
52
39
  *
53
- * **Using Wagmi (frontend)**
40
+ * ####Using Wagmi (frontend)
54
41
  *
55
42
  * ```ts
56
43
  * import { useSigner, useChainId } from 'wagmi';
@@ -60,61 +47,61 @@ import { IKVStore, SubgraphOptions } from './interfaces';
60
47
  * const kvstoreClient = await KVStoreClient.build(signer);
61
48
  * ```
62
49
  *
63
- * ### Provider
50
+ * ###Using Provider
64
51
  *
65
52
  * ```ts
66
53
  * import { KVStoreClient } from '@human-protocol/sdk';
67
- * import { providers } from 'ethers';
54
+ * import { JsonRpcProvider } from 'ethers';
68
55
  *
69
56
  * const rpcUrl = 'YOUR_RPC_URL';
70
57
  *
71
- * const provider = new providers.JsonRpcProvider(rpcUrl);
58
+ * const provider = new JsonRpcProvider(rpcUrl);
72
59
  * const kvstoreClient = await KVStoreClient.build(provider);
73
60
  * ```
74
61
  */
75
62
  export declare class KVStoreClient extends BaseEthersClient {
76
- private contract;
63
+ contract: KVStore;
77
64
  /**
78
65
  * **KVStoreClient constructor**
79
66
  *
80
- * @param {ContractRunner} runner - The Runner object to interact with the Ethereum network
81
- * @param {NetworkData} networkData - The network information required to connect to the KVStore contract
67
+ * @param runner - The Runner object to interact with the Ethereum network
68
+ * @param networkData - The network information required to connect to the KVStore contract
82
69
  */
83
70
  constructor(runner: ContractRunner, networkData: NetworkData);
84
71
  /**
85
72
  * Creates an instance of KVStoreClient from a runner.
86
73
  *
87
- * @param {ContractRunner} runner - The Runner object to interact with the Ethereum network
88
- *
89
- * @returns {Promise<KVStoreClient>} - An instance of KVStoreClient
90
- * @throws {ErrorProviderDoesNotExist} - Thrown if the provider does not exist for the provided Signer
91
- * @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
92
- */
93
- static build(runner: ContractRunner): Promise<KVStoreClient>;
94
- /**
95
- * This function sets a key-value pair associated with the address that submits the transaction.
96
- *
97
- * @param {string} key Key of the key-value pair
98
- * @param {string} value Value of the key-value pair
99
- * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
100
- * @returns Returns void if successful. Throws error if any.
101
- *
102
- *
103
- * **Code example**
104
- *
105
- * > Need to have available stake.
74
+ * @param runner - The Runner object to interact with the Ethereum network
75
+ * @returns An instance of KVStoreClient
76
+ * @throws ErrorProviderDoesNotExist If the provider does not exist for the provided Signer
77
+ * @throws ErrorUnsupportedChainID If the network's chainId is not supported
106
78
  *
79
+ * @example
107
80
  * ```ts
108
- * import { Wallet, providers } from 'ethers';
109
81
  * import { KVStoreClient } from '@human-protocol/sdk';
82
+ * import { Wallet, JsonRpcProvider } from 'ethers';
110
83
  *
111
84
  * const rpcUrl = 'YOUR_RPC_URL';
112
85
  * const privateKey = 'YOUR_PRIVATE_KEY';
113
86
  *
114
- * const provider = new providers.JsonRpcProvider(rpcUrl);
87
+ * const provider = new JsonRpcProvider(rpcUrl);
115
88
  * const signer = new Wallet(privateKey, provider);
116
89
  * const kvstoreClient = await KVStoreClient.build(signer);
90
+ * ```
91
+ */
92
+ static build(runner: ContractRunner): Promise<KVStoreClient>;
93
+ /**
94
+ * This function sets a key-value pair associated with the address that submits the transaction.
95
+ *
96
+ * @param key - Key of the key-value pair
97
+ * @param value - Value of the key-value pair
98
+ * @param txOptions - Additional transaction parameters (optional, defaults to an empty object).
99
+ * @returns -
100
+ * @throws ErrorKVStoreEmptyKey If the key is empty
101
+ * @throws Error If the transaction fails
117
102
  *
103
+ * @example
104
+ * ```ts
118
105
  * await kvstoreClient.set('Role', 'RecordingOracle');
119
106
  * ```
120
107
  */
@@ -122,27 +109,16 @@ export declare class KVStoreClient extends BaseEthersClient {
122
109
  /**
123
110
  * This function sets key-value pairs in bulk associated with the address that submits the transaction.
124
111
  *
125
- * @param {string[]} keys Array of keys (keys and value must have the same order)
126
- * @param {string[]} values Array of values
127
- * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
128
- * @returns Returns void if successful. Throws error if any.
129
- *
130
- *
131
- * **Code example**
132
- *
133
- * > Need to have available stake.
112
+ * @param keys - Array of keys (keys and value must have the same order)
113
+ * @param values - Array of values
114
+ * @param txOptions - Additional transaction parameters (optional, defaults to an empty object).
115
+ * @returns -
116
+ * @throws ErrorKVStoreArrayLength If keys and values arrays have different lengths
117
+ * @throws ErrorKVStoreEmptyKey If any key is empty
118
+ * @throws Error If the transaction fails
134
119
  *
120
+ * @example
135
121
  * ```ts
136
- * import { Wallet, providers } from 'ethers';
137
- * import { KVStoreClient } from '@human-protocol/sdk';
138
- *
139
- * const rpcUrl = 'YOUR_RPC_URL';
140
- * const privateKey = 'YOUR_PRIVATE_KEY';
141
- *
142
- * const provider = new providers.JsonRpcProvider(rpcUrl);
143
- * const signer = new Wallet(privateKey, provider);
144
- * const kvstoreClient = await KVStoreClient.build(signer);
145
- *
146
122
  * const keys = ['role', 'webhook_url'];
147
123
  * const values = ['RecordingOracle', 'http://localhost'];
148
124
  * await kvstoreClient.setBulk(keys, values);
@@ -152,25 +128,15 @@ export declare class KVStoreClient extends BaseEthersClient {
152
128
  /**
153
129
  * Sets a URL value for the address that submits the transaction, and its hash.
154
130
  *
155
- * @param {string} url URL to set
156
- * @param {string | undefined} urlKey Configurable URL key. `url` by default.
157
- * @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
158
- * @returns Returns void if successful. Throws error if any.
159
- *
160
- *
161
- * **Code example**
131
+ * @param url - URL to set
132
+ * @param urlKey - Configurable URL key. `url` by default.
133
+ * @param txOptions - Additional transaction parameters (optional, defaults to an empty object).
134
+ * @returns -
135
+ * @throws ErrorInvalidUrl If the URL is invalid
136
+ * @throws Error If the transaction fails
162
137
  *
138
+ * @example
163
139
  * ```ts
164
- * import { Wallet, providers } from 'ethers';
165
- * import { KVStoreClient } from '@human-protocol/sdk';
166
- *
167
- * const rpcUrl = 'YOUR_RPC_URL';
168
- * const privateKey = 'YOUR_PRIVATE_KEY';
169
- *
170
- * const provider = new providers.JsonRpcProvider(rpcUrl);
171
- * const signer = new Wallet(privateKey, provider);
172
- * const kvstoreClient = await KVStoreClient.build(signer);
173
- *
174
140
  * await kvstoreClient.setFileUrlAndHash('example.com');
175
141
  * await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url');
176
142
  * ```
@@ -179,148 +145,120 @@ export declare class KVStoreClient extends BaseEthersClient {
179
145
  /**
180
146
  * Gets the value of a key-value pair in the contract.
181
147
  *
182
- * @param {string} address Address from which to get the key value.
183
- * @param {string} key Key to obtain the value.
184
- * @param {SubgraphOptions} options Optional configuration for subgraph requests.
185
- * @returns {string} Value of the key.
186
- *
187
- *
188
- * **Code example**
189
- *
190
- * > Need to have available stake.
148
+ * @param address - Address from which to get the key value.
149
+ * @param key - Key to obtain the value.
150
+ * @returns Value of the key.
151
+ * @throws ErrorKVStoreEmptyKey If the key is empty
152
+ * @throws ErrorInvalidAddress If the address is invalid
153
+ * @throws Error If the contract call fails
191
154
  *
155
+ * @example
192
156
  * ```ts
193
- * import { providers } from 'ethers';
194
- * import { KVStoreClient } from '@human-protocol/sdk';
195
- *
196
- * const rpcUrl = 'YOUR_RPC_URL';
197
- *
198
- * const provider = new providers.JsonRpcProvider(rpcUrl);
199
- * const kvstoreClient = await KVStoreClient.build(provider);
200
- *
201
157
  * const value = await kvstoreClient.get('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', 'Role');
158
+ * console.log('Value:', value);
202
159
  * ```
203
160
  */
204
161
  get(address: string, key: string): Promise<string>;
205
162
  }
206
163
  /**
207
- * ## Introduction
208
- *
209
- * Utility class for KVStore-related operations.
210
- *
211
- * ## Installation
212
- *
213
- * ### npm
214
- * ```bash
215
- * npm install @human-protocol/sdk
216
- * ```
217
- *
218
- * ### yarn
219
- * ```bash
220
- * yarn install @human-protocol/sdk
221
- * ```
222
- *
223
- * ## Code example
224
- *
225
- * ### Signer
226
- *
227
- * **Using private key (backend)**
164
+ * Utility helpers for KVStore-related queries.
228
165
  *
166
+ * @example
229
167
  * ```ts
230
168
  * import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
231
169
  *
232
- * const KVStoreAddresses = await KVStoreUtils.getKVStoreData(
170
+ * const kvStoreData = await KVStoreUtils.getKVStoreData(
233
171
  * ChainId.POLYGON_AMOY,
234
172
  * "0x1234567890123456789012345678901234567890"
235
173
  * );
174
+ * console.log('KVStore data:', kvStoreData);
236
175
  * ```
237
176
  */
238
177
  export declare class KVStoreUtils {
239
178
  /**
240
179
  * This function returns the KVStore data for a given address.
241
180
  *
242
- * @param {ChainId} chainId Network in which the KVStore is deployed
243
- * @param {string} address Address of the KVStore
244
- * @param {SubgraphOptions} options Optional configuration for subgraph requests.
245
- * @returns {Promise<IKVStore[]>} KVStore data
246
- * @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
247
- * @throws {ErrorInvalidAddress} - Thrown if the Address sent is invalid
248
- *
249
- * **Code example**
181
+ * @param chainId - Network in which the KVStore is deployed
182
+ * @param address - Address of the KVStore
183
+ * @param options - Optional configuration for subgraph requests.
184
+ * @returns KVStore data
185
+ * @throws ErrorUnsupportedChainID If the network's chainId is not supported
186
+ * @throws ErrorInvalidAddress If the address is invalid
250
187
  *
188
+ * @example
251
189
  * ```ts
252
- * import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
253
- *
254
- * const kvStoreData = await KVStoreUtils.getKVStoreData(ChainId.POLYGON_AMOY, "0x1234567890123456789012345678901234567890");
255
- * console.log(kvStoreData);
190
+ * const kvStoreData = await KVStoreUtils.getKVStoreData(
191
+ * ChainId.POLYGON_AMOY,
192
+ * "0x1234567890123456789012345678901234567890"
193
+ * );
194
+ * console.log('KVStore data:', kvStoreData);
256
195
  * ```
257
196
  */
258
197
  static getKVStoreData(chainId: ChainId, address: string, options?: SubgraphOptions): Promise<IKVStore[]>;
259
198
  /**
260
199
  * Gets the value of a key-value pair in the KVStore using the subgraph.
261
200
  *
262
- * @param {ChainId} chainId Network in which the KVStore is deployed
263
- * @param {string} address Address from which to get the key value.
264
- * @param {string} key Key to obtain the value.
265
- * @param {SubgraphOptions} options Optional configuration for subgraph requests.
266
- * @returns {Promise<string>} Value of the key.
267
- * @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
268
- * @throws {ErrorInvalidAddress} - Thrown if the Address sent is invalid
269
- * @throws {ErrorKVStoreEmptyKey} - Thrown if the key is empty
270
- *
271
- * **Code example**
272
- *
201
+ * @param chainId - Network in which the KVStore is deployed
202
+ * @param address - Address from which to get the key value.
203
+ * @param key - Key to obtain the value.
204
+ * @param options - Optional configuration for subgraph requests.
205
+ * @returns Value of the key.
206
+ * @throws ErrorUnsupportedChainID If the network's chainId is not supported
207
+ * @throws ErrorInvalidAddress If the address is invalid
208
+ * @throws ErrorKVStoreEmptyKey If the key is empty
209
+ * @throws InvalidKeyError If the key is not found
210
+ *
211
+ * @example
273
212
  * ```ts
274
- * import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
275
- *
276
- * const chainId = ChainId.POLYGON_AMOY;
277
- * const address = '0x1234567890123456789012345678901234567890';
278
- * const key = 'role';
279
- *
280
- * const value = await KVStoreUtils.get(chainId, address, key);
281
- * console.log(value);
213
+ * const value = await KVStoreUtils.get(
214
+ * ChainId.POLYGON_AMOY,
215
+ * '0x1234567890123456789012345678901234567890',
216
+ * 'role'
217
+ * );
218
+ * console.log('Value:', value);
282
219
  * ```
283
220
  */
284
221
  static get(chainId: ChainId, address: string, key: string, options?: SubgraphOptions): Promise<string>;
285
222
  /**
286
223
  * Gets the URL value of the given entity, and verifies its hash.
287
224
  *
288
- * @param {ChainId} chainId Network in which the KVStore is deployed
289
- * @param {string} address Address from which to get the URL value.
290
- * @param {string} urlKey Configurable URL key. `url` by default.
291
- * @param {SubgraphOptions} options Optional configuration for subgraph requests.
292
- * @returns {Promise<string>} URL value for the given address if it exists, and the content is valid
293
- *
294
- * **Code example**
225
+ * @param chainId - Network in which the KVStore is deployed
226
+ * @param address - Address from which to get the URL value.
227
+ * @param urlKey - Configurable URL key. `url` by default.
228
+ * @param options - Optional configuration for subgraph requests.
229
+ * @returns URL value for the given address if it exists, and the content is valid
230
+ * @throws ErrorInvalidAddress If the address is invalid
231
+ * @throws ErrorInvalidHash If the hash verification fails
232
+ * @throws Error If fetching URL or hash fails
295
233
  *
234
+ * @example
296
235
  * ```ts
297
- * import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
298
- *
299
- * const chainId = ChainId.POLYGON_AMOY;
300
- * const address = '0x1234567890123456789012345678901234567890';
301
- *
302
- * const url = await KVStoreUtils.getFileUrlAndVerifyHash(chainId, address);
303
- * console.log(url);
236
+ * const url = await KVStoreUtils.getFileUrlAndVerifyHash(
237
+ * ChainId.POLYGON_AMOY,
238
+ * '0x1234567890123456789012345678901234567890'
239
+ * );
240
+ * console.log('Verified URL:', url);
304
241
  * ```
305
242
  */
306
243
  static getFileUrlAndVerifyHash(chainId: ChainId, address: string, urlKey?: string, options?: SubgraphOptions): Promise<string>;
307
244
  /**
308
245
  * Gets the public key of the given entity, and verifies its hash.
309
246
  *
310
- * @param {ChainId} chainId Network in which the KVStore is deployed
311
- * @param {string} address Address from which to get the public key.
312
- * @returns {Promise<string>} Public key for the given address if it exists, and the content is valid
313
- *
314
- * **Code example**
247
+ * @param chainId - Network in which the KVStore is deployed
248
+ * @param address - Address from which to get the public key.
249
+ * @param options - Optional configuration for subgraph requests.
250
+ * @returns Public key for the given address if it exists, and the content is valid
251
+ * @throws ErrorInvalidAddress If the address is invalid
252
+ * @throws ErrorInvalidHash If the hash verification fails
253
+ * @throws Error If fetching the public key fails
315
254
  *
255
+ * @example
316
256
  * ```ts
317
- * import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
318
- *
319
- * const chainId = ChainId.POLYGON_AMOY;
320
- * const address = '0x1234567890123456789012345678901234567890';
321
- *
322
- * const publicKey = await KVStoreUtils.getPublicKey(chainId, address);
323
- * console.log(publicKey);
257
+ * const publicKey = await KVStoreUtils.getPublicKey(
258
+ * ChainId.POLYGON_AMOY,
259
+ * '0x1234567890123456789012345678901234567890'
260
+ * );
261
+ * console.log('Public key:', publicKey);
324
262
  * ```
325
263
  */
326
264
  static getPublicKey(chainId: ChainId, address: string, options?: SubgraphOptions): Promise<string>;
@@ -1 +1 @@
1
- {"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAWlC,OAAO,EA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