@human-protocol/sdk 1.1.17 → 1.1.19
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.
- package/dist/base.d.ts +21 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +22 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -11
- package/dist/encryption.d.ts +31 -0
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +37 -0
- package/dist/error.d.ts +4 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +5 -1
- package/dist/escrow.d.ts +29 -15
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +89 -67
- package/dist/kvstore.d.ts +63 -6
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +121 -10
- package/dist/staking.d.ts +31 -15
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +65 -67
- package/dist/statistics.d.ts +3 -3
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +10 -10
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -0
- package/package.json +2 -1
- package/src/base.ts +25 -0
- package/src/constants.ts +18 -10
- package/src/encryption.ts +40 -0
- package/src/error.ts +4 -0
- package/src/escrow.ts +144 -139
- package/src/kvstore.ts +148 -10
- package/src/staking.ts +101 -70
- package/src/statistics.ts +11 -11
- package/src/storage.ts +1 -0
package/dist/kvstore.js
CHANGED
|
@@ -12,9 +12,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.KVStoreClient = void 0;
|
|
13
13
|
const typechain_types_1 = require("@human-protocol/core/typechain-types");
|
|
14
14
|
const ethers_1 = require("ethers");
|
|
15
|
+
const base_1 = require("./base");
|
|
15
16
|
const constants_1 = require("./constants");
|
|
16
17
|
const decorators_1 = require("./decorators");
|
|
17
18
|
const error_1 = require("./error");
|
|
19
|
+
const utils_1 = require("./utils");
|
|
18
20
|
/**
|
|
19
21
|
* ## Introduction
|
|
20
22
|
*
|
|
@@ -84,21 +86,22 @@ const error_1 = require("./error");
|
|
|
84
86
|
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
85
87
|
* ```
|
|
86
88
|
*/
|
|
87
|
-
class KVStoreClient {
|
|
89
|
+
class KVStoreClient extends base_1.BaseEthersClient {
|
|
88
90
|
/**
|
|
89
91
|
* **KVStoreClient constructor**
|
|
90
92
|
*
|
|
91
93
|
* @param {Signer | Provider} signerOrProvider - The Signer or Provider object to interact with the Ethereum network
|
|
92
94
|
* @param {NetworkData} network - The network information required to connect to the KVStore contract
|
|
93
95
|
*/
|
|
94
|
-
constructor(signerOrProvider,
|
|
95
|
-
|
|
96
|
-
this.
|
|
96
|
+
constructor(signerOrProvider, networkData) {
|
|
97
|
+
super(signerOrProvider, networkData);
|
|
98
|
+
this.contract = typechain_types_1.KVStore__factory.connect(networkData.kvstoreAddress, signerOrProvider);
|
|
97
99
|
}
|
|
98
100
|
/**
|
|
99
101
|
* Creates an instance of KVStoreClient from a Signer or Provider.
|
|
100
102
|
*
|
|
101
103
|
* @param {Signer | Provider} signerOrProvider - The Signer or Provider object to interact with the Ethereum network
|
|
104
|
+
*
|
|
102
105
|
* @returns {Promise<KVStoreClient>} - An instance of KVStoreClient
|
|
103
106
|
* @throws {ErrorProviderDoesNotExist} - Thrown if the provider does not exist for the provided Signer
|
|
104
107
|
* @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
|
|
@@ -126,6 +129,7 @@ class KVStoreClient {
|
|
|
126
129
|
*
|
|
127
130
|
* @param {string} key Key of the key-value pair
|
|
128
131
|
* @param {string} value Value of the key-value pair
|
|
132
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
129
133
|
* @returns Returns void if successful. Throws error if any.
|
|
130
134
|
*
|
|
131
135
|
*
|
|
@@ -147,13 +151,13 @@ class KVStoreClient {
|
|
|
147
151
|
* await kvstoreClient.set('Role', 'RecordingOracle');
|
|
148
152
|
* ```
|
|
149
153
|
*/
|
|
150
|
-
async set(key, value) {
|
|
154
|
+
async set(key, value, txOptions = {}) {
|
|
151
155
|
if (!ethers_1.Signer.isSigner(this.signerOrProvider))
|
|
152
156
|
throw error_1.ErrorSigner;
|
|
153
157
|
if (key === '')
|
|
154
158
|
throw error_1.ErrorKVStoreEmptyKey;
|
|
155
159
|
try {
|
|
156
|
-
await this.contract
|
|
160
|
+
await (await this.contract.set(key, value, txOptions)).wait();
|
|
157
161
|
}
|
|
158
162
|
catch (e) {
|
|
159
163
|
if (e instanceof Error)
|
|
@@ -165,6 +169,7 @@ class KVStoreClient {
|
|
|
165
169
|
*
|
|
166
170
|
* @param {string[]} keys Array of keys (keys and value must have the same order)
|
|
167
171
|
* @param {string[]} values Array of values
|
|
172
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
168
173
|
* @returns Returns void if successful. Throws error if any.
|
|
169
174
|
*
|
|
170
175
|
*
|
|
@@ -188,7 +193,7 @@ class KVStoreClient {
|
|
|
188
193
|
* await kvstoreClient.set(keys, values);
|
|
189
194
|
* ```
|
|
190
195
|
*/
|
|
191
|
-
async setBulk(keys, values) {
|
|
196
|
+
async setBulk(keys, values, txOptions = {}) {
|
|
192
197
|
if (!ethers_1.Signer.isSigner(this.signerOrProvider))
|
|
193
198
|
throw error_1.ErrorSigner;
|
|
194
199
|
if (keys.length !== values.length)
|
|
@@ -196,13 +201,57 @@ class KVStoreClient {
|
|
|
196
201
|
if (keys.includes(''))
|
|
197
202
|
throw error_1.ErrorKVStoreEmptyKey;
|
|
198
203
|
try {
|
|
199
|
-
await this.contract
|
|
204
|
+
await (await this.contract.setBulk(keys, values, txOptions)).wait();
|
|
200
205
|
}
|
|
201
206
|
catch (e) {
|
|
202
207
|
if (e instanceof Error)
|
|
203
208
|
throw Error(`Failed to set bulk values: ${e.message}`);
|
|
204
209
|
}
|
|
205
210
|
}
|
|
211
|
+
/**
|
|
212
|
+
* This function sets a URL value for the address that submits the transaction.
|
|
213
|
+
*
|
|
214
|
+
* @param {string} url URL to set
|
|
215
|
+
* @param {string | undefined} urlKey Configurable URL key. `url` by default.
|
|
216
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
217
|
+
* @returns Returns void if successful. Throws error if any.
|
|
218
|
+
*
|
|
219
|
+
*
|
|
220
|
+
* **Code example**
|
|
221
|
+
*
|
|
222
|
+
* ```ts
|
|
223
|
+
* import { Wallet, providers } from 'ethers';
|
|
224
|
+
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
225
|
+
*
|
|
226
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
227
|
+
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
228
|
+
*
|
|
229
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
230
|
+
* const signer = new Wallet(privateKey, provider);
|
|
231
|
+
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
232
|
+
*
|
|
233
|
+
* await kvstoreClient.setURL('example.com');
|
|
234
|
+
* await kvstoreClient.setURL('linkedin.com/example', 'linkedinUrl);
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
async setURL(url, urlKey = 'url', txOptions = {}) {
|
|
238
|
+
if (!ethers_1.Signer.isSigner(this.signerOrProvider)) {
|
|
239
|
+
throw error_1.ErrorSigner;
|
|
240
|
+
}
|
|
241
|
+
if (!(0, utils_1.isValidUrl)(url)) {
|
|
242
|
+
throw error_1.ErrorInvalidUrl;
|
|
243
|
+
}
|
|
244
|
+
const content = await fetch(url).then((res) => res.text());
|
|
245
|
+
const contentHash = ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(content));
|
|
246
|
+
const hashKey = urlKey + 'Hash';
|
|
247
|
+
try {
|
|
248
|
+
await (await this.contract.setBulk([urlKey, hashKey], [url, contentHash], txOptions)).wait();
|
|
249
|
+
}
|
|
250
|
+
catch (e) {
|
|
251
|
+
if (e instanceof Error)
|
|
252
|
+
throw Error(`Failed to set URL and hash: ${e.message}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
206
255
|
/**
|
|
207
256
|
* This function returns the value for a specified key and address.
|
|
208
257
|
*
|
|
@@ -242,17 +291,79 @@ class KVStoreClient {
|
|
|
242
291
|
return e;
|
|
243
292
|
}
|
|
244
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* This function returns the URL value for the given entity.
|
|
296
|
+
*
|
|
297
|
+
* @param {string} address Address from which to get the URL value.
|
|
298
|
+
* @param {string} urlKey Configurable URL key. `url` by default.
|
|
299
|
+
* @returns {string} URL value for the given address if exists, and the content is valid
|
|
300
|
+
*
|
|
301
|
+
*
|
|
302
|
+
* **Code example**
|
|
303
|
+
*
|
|
304
|
+
* ```ts
|
|
305
|
+
* import { providers } from 'ethers';
|
|
306
|
+
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
307
|
+
*
|
|
308
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
309
|
+
*
|
|
310
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
311
|
+
* const kvstoreClient = await KVStoreClient.build(provider);
|
|
312
|
+
*
|
|
313
|
+
* const url = await kvstoreClient.getURL('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266');
|
|
314
|
+
* const linkedinUrl = await kvstoreClient.getURL(
|
|
315
|
+
* '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
316
|
+
* 'linkedinUrl'
|
|
317
|
+
* );
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
async getURL(address, urlKey = 'url') {
|
|
321
|
+
if (!ethers_1.ethers.utils.isAddress(address))
|
|
322
|
+
throw error_1.ErrorInvalidAddress;
|
|
323
|
+
const hashKey = urlKey + 'Hash';
|
|
324
|
+
let url = '', hash = '';
|
|
325
|
+
try {
|
|
326
|
+
url = await this.contract?.get(address, urlKey);
|
|
327
|
+
}
|
|
328
|
+
catch (e) {
|
|
329
|
+
if (e instanceof Error)
|
|
330
|
+
throw Error(`Failed to get URL: ${e.message}`);
|
|
331
|
+
}
|
|
332
|
+
// Return empty string
|
|
333
|
+
if (!url?.length) {
|
|
334
|
+
return '';
|
|
335
|
+
}
|
|
336
|
+
try {
|
|
337
|
+
hash = await this.contract?.get(address, hashKey);
|
|
338
|
+
}
|
|
339
|
+
catch (e) {
|
|
340
|
+
if (e instanceof Error)
|
|
341
|
+
throw Error(`Failed to get Hash: ${e.message}`);
|
|
342
|
+
}
|
|
343
|
+
const content = await fetch(url).then((res) => res.text());
|
|
344
|
+
const contentHash = ethers_1.ethers.utils.keccak256(ethers_1.ethers.utils.toUtf8Bytes(content));
|
|
345
|
+
if (hash !== contentHash) {
|
|
346
|
+
throw error_1.ErrorInvalidHash;
|
|
347
|
+
}
|
|
348
|
+
return url;
|
|
349
|
+
}
|
|
245
350
|
}
|
|
246
351
|
__decorate([
|
|
247
352
|
decorators_1.requiresSigner,
|
|
248
353
|
__metadata("design:type", Function),
|
|
249
|
-
__metadata("design:paramtypes", [String, String]),
|
|
354
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
250
355
|
__metadata("design:returntype", Promise)
|
|
251
356
|
], KVStoreClient.prototype, "set", null);
|
|
252
357
|
__decorate([
|
|
253
358
|
decorators_1.requiresSigner,
|
|
254
359
|
__metadata("design:type", Function),
|
|
255
|
-
__metadata("design:paramtypes", [Array, Array]),
|
|
360
|
+
__metadata("design:paramtypes", [Array, Array, Object]),
|
|
256
361
|
__metadata("design:returntype", Promise)
|
|
257
362
|
], KVStoreClient.prototype, "setBulk", null);
|
|
363
|
+
__decorate([
|
|
364
|
+
decorators_1.requiresSigner,
|
|
365
|
+
__metadata("design:type", Function),
|
|
366
|
+
__metadata("design:paramtypes", [String, Object, Object]),
|
|
367
|
+
__metadata("design:returntype", Promise)
|
|
368
|
+
], KVStoreClient.prototype, "setURL", null);
|
|
258
369
|
exports.KVStoreClient = KVStoreClient;
|
package/dist/staking.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
|
-
import { EscrowFactory, HMToken, Staking } from '@human-protocol/core/typechain-types';
|
|
3
|
-
import { BigNumber, Signer } from 'ethers';
|
|
2
|
+
import { EscrowFactory, HMToken, RewardPool, Staking } from '@human-protocol/core/typechain-types';
|
|
3
|
+
import { BigNumber, Overrides, Signer } from 'ethers';
|
|
4
|
+
import { BaseEthersClient } from './base';
|
|
4
5
|
import { IAllocation, ILeader, ILeadersFilter, IReward } from './interfaces';
|
|
5
6
|
import { NetworkData } from './types';
|
|
6
7
|
/**
|
|
@@ -72,32 +73,40 @@ import { NetworkData } from './types';
|
|
|
72
73
|
* const stakingClient = await StakingClient.build(provider);
|
|
73
74
|
* ```
|
|
74
75
|
*/
|
|
75
|
-
export declare class StakingClient {
|
|
76
|
-
signerOrProvider: Signer | Provider;
|
|
77
|
-
network: NetworkData;
|
|
76
|
+
export declare class StakingClient extends BaseEthersClient {
|
|
78
77
|
tokenContract: HMToken;
|
|
79
78
|
stakingContract: Staking;
|
|
80
79
|
escrowFactoryContract: EscrowFactory;
|
|
80
|
+
rewardPoolContract: RewardPool;
|
|
81
81
|
/**
|
|
82
82
|
* **StakingClient constructor**
|
|
83
83
|
*
|
|
84
84
|
* @param {Signer | Provider} signerOrProvider - The Signer or Provider object to interact with the Ethereum network
|
|
85
85
|
* @param {NetworkData} network - The network information required to connect to the Staking contract
|
|
86
86
|
*/
|
|
87
|
-
constructor(signerOrProvider: Signer | Provider,
|
|
87
|
+
constructor(signerOrProvider: Signer | Provider, networkData: NetworkData);
|
|
88
88
|
/**
|
|
89
89
|
* Creates an instance of StakingClient from a Signer or Provider.
|
|
90
90
|
*
|
|
91
91
|
* @param {Signer | Provider} signerOrProvider - The Signer or Provider object to interact with the Ethereum network
|
|
92
|
+
* @param {number | undefined} gasPriceMultiplier - The multiplier to apply to the gas price
|
|
93
|
+
*
|
|
92
94
|
* @returns {Promise<StakingClient>} - An instance of StakingClient
|
|
93
95
|
* @throws {ErrorProviderDoesNotExist} - Thrown if the provider does not exist for the provided Signer
|
|
94
96
|
* @throws {ErrorUnsupportedChainID} - Thrown if the network's chainId is not supported
|
|
95
97
|
*/
|
|
96
98
|
static build(signerOrProvider: Signer | Provider): Promise<StakingClient>;
|
|
99
|
+
/**
|
|
100
|
+
* Check if escrow exists
|
|
101
|
+
*
|
|
102
|
+
* @param escrowAddress Escrow address to check against
|
|
103
|
+
*/
|
|
104
|
+
private checkValidEscrow;
|
|
97
105
|
/**
|
|
98
106
|
* This function approves the staking contract to transfer a specified amount of tokens when the user stakes. It increases the allowance for the staking contract.
|
|
99
107
|
*
|
|
100
108
|
* @param {BigNumber} amount Amount in WEI of tokens to approve for stake.
|
|
109
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
101
110
|
* @returns Returns void if successful. Throws error if any.
|
|
102
111
|
*
|
|
103
112
|
*
|
|
@@ -118,13 +127,14 @@ export declare class StakingClient {
|
|
|
118
127
|
* await stakingClient.approveStake(amount);
|
|
119
128
|
* ```
|
|
120
129
|
*/
|
|
121
|
-
approveStake(amount: BigNumber): Promise<void>;
|
|
130
|
+
approveStake(amount: BigNumber, txOptions?: Overrides): Promise<void>;
|
|
122
131
|
/**
|
|
123
132
|
* This function stakes a specified amount of tokens on a specific network.
|
|
124
133
|
*
|
|
125
134
|
* > `approveStake` must be called before
|
|
126
135
|
*
|
|
127
136
|
* @param {BigNumber} amount Amount in WEI of tokens to stake.
|
|
137
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
128
138
|
* @returns Returns void if successful. Throws error if any.
|
|
129
139
|
*
|
|
130
140
|
*
|
|
@@ -146,13 +156,14 @@ export declare class StakingClient {
|
|
|
146
156
|
* await stakingClient.approveStake(amount);
|
|
147
157
|
* ```
|
|
148
158
|
*/
|
|
149
|
-
stake(amount: BigNumber): Promise<void>;
|
|
159
|
+
stake(amount: BigNumber, txOptions?: Overrides): Promise<void>;
|
|
150
160
|
/**
|
|
151
161
|
* This function unstakes tokens from staking contract. The unstaked tokens stay locked for a period of time.
|
|
152
162
|
*
|
|
153
163
|
* > Must have tokens available to unstake
|
|
154
164
|
*
|
|
155
165
|
* @param {BigNumber} amount Amount in WEI of tokens to unstake.
|
|
166
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
156
167
|
* @returns Returns void if successful. Throws error if any.
|
|
157
168
|
*
|
|
158
169
|
*
|
|
@@ -173,12 +184,13 @@ export declare class StakingClient {
|
|
|
173
184
|
* await stakingClient.unstake(amount);
|
|
174
185
|
* ```
|
|
175
186
|
*/
|
|
176
|
-
unstake(amount: BigNumber): Promise<void>;
|
|
187
|
+
unstake(amount: BigNumber, txOptions?: Overrides): Promise<void>;
|
|
177
188
|
/**
|
|
178
189
|
* This function withdraws unstaked and non locked tokens form staking contract to the user wallet.
|
|
179
190
|
*
|
|
180
191
|
* > Must have tokens available to withdraw
|
|
181
192
|
*
|
|
193
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
182
194
|
* @returns Returns void if successful. Throws error if any.
|
|
183
195
|
*
|
|
184
196
|
*
|
|
@@ -198,13 +210,14 @@ export declare class StakingClient {
|
|
|
198
210
|
* await stakingClient.withdraw();
|
|
199
211
|
* ```
|
|
200
212
|
*/
|
|
201
|
-
withdraw(): Promise<void>;
|
|
213
|
+
withdraw(txOptions?: Overrides): Promise<void>;
|
|
202
214
|
/**
|
|
203
215
|
* This function reduces the allocated amount by an staker in an escrow and transfers those tokens to the reward pool. This allows the slasher to claim them later.
|
|
204
216
|
*
|
|
205
217
|
* @param {string} slasher Wallet address from who requested the slash
|
|
206
218
|
* @param {string} staker Wallet address from who is going to be slashed
|
|
207
219
|
* @param {string} escrowAddress Address of the escrow which allocation will be slashed
|
|
220
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
208
221
|
* @param {BigNumber} amount Amount in WEI of tokens to unstake.
|
|
209
222
|
* @returns Returns void if successful. Throws error if any.
|
|
210
223
|
*
|
|
@@ -226,13 +239,14 @@ export declare class StakingClient {
|
|
|
226
239
|
* await stakingClient.slash('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount);
|
|
227
240
|
* ```
|
|
228
241
|
*/
|
|
229
|
-
slash(slasher: string, staker: string, escrowAddress: string, amount: BigNumber): Promise<void>;
|
|
242
|
+
slash(slasher: string, staker: string, escrowAddress: string, amount: BigNumber, txOptions?: Overrides): Promise<void>;
|
|
230
243
|
/**
|
|
231
244
|
* This function allocates a portion of the staked tokens to a specific escrow.
|
|
232
245
|
*
|
|
233
246
|
* > Must have tokens staked
|
|
234
247
|
*
|
|
235
248
|
* @param {string} escrowAddress Address of the escrow contract to allocate in.
|
|
249
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
236
250
|
* @param {BigNumber} amount Amount in WEI of tokens to allocate.
|
|
237
251
|
* @returns Returns void if successful. Throws error if any.
|
|
238
252
|
*
|
|
@@ -254,7 +268,7 @@ export declare class StakingClient {
|
|
|
254
268
|
* await stakingClient.allocate('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount);
|
|
255
269
|
* ```
|
|
256
270
|
*/
|
|
257
|
-
allocate(escrowAddress: string, amount: BigNumber): Promise<void>;
|
|
271
|
+
allocate(escrowAddress: string, amount: BigNumber, txOptions?: Overrides): Promise<void>;
|
|
258
272
|
/**
|
|
259
273
|
* This function drops the allocation from a specific escrow.
|
|
260
274
|
*
|
|
@@ -262,6 +276,7 @@ export declare class StakingClient {
|
|
|
262
276
|
* > The escrow must be cancelled or completed.
|
|
263
277
|
*
|
|
264
278
|
* @param {string} escrowAddress Address of the escrow contract to close allocation from.
|
|
279
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
265
280
|
* @returns Returns void if successful. Throws error if any.
|
|
266
281
|
*
|
|
267
282
|
*
|
|
@@ -281,13 +296,14 @@ export declare class StakingClient {
|
|
|
281
296
|
* await stakingClient.closeAllocation('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
282
297
|
* ```
|
|
283
298
|
*/
|
|
284
|
-
closeAllocation(escrowAddress: string): Promise<void>;
|
|
299
|
+
closeAllocation(escrowAddress: string, txOptions?: Overrides): Promise<void>;
|
|
285
300
|
/**
|
|
286
301
|
* This function drops the allocation from a specific escrow.
|
|
287
302
|
*
|
|
288
303
|
* > The escrow must have rewards added
|
|
289
304
|
*
|
|
290
305
|
* @param {string} escrowAddress Escrow address from which rewards are distributed.
|
|
306
|
+
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
291
307
|
* @returns Returns void if successful. Throws error if any.
|
|
292
308
|
*
|
|
293
309
|
*
|
|
@@ -304,10 +320,10 @@ export declare class StakingClient {
|
|
|
304
320
|
* const signer = new Wallet(privateKey, provider);
|
|
305
321
|
* const stakingClient = await StakingClient.build(signer);
|
|
306
322
|
*
|
|
307
|
-
* await stakingClient.
|
|
323
|
+
* await stakingClient.distributeReward('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
308
324
|
* ```
|
|
309
325
|
*/
|
|
310
|
-
|
|
326
|
+
distributeReward(escrowAddress: string, txOptions?: Overrides): Promise<void>;
|
|
311
327
|
/**
|
|
312
328
|
* This function returns all the leader details of the protocol.
|
|
313
329
|
*
|
package/dist/staking.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../src/staking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D,OAAO,EACL,aAAa,EAEb,OAAO,
|
|
1
|
+
{"version":3,"file":"staking.d.ts","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