@human-protocol/sdk 3.0.7 → 3.0.8
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/constants.d.ts +1 -24
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +23 -64
- package/dist/encryption.d.ts +1 -1
- package/dist/encryption.js +18 -8
- package/dist/escrow.d.ts +20 -57
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +74 -88
- package/dist/graphql/queries/operator.js +2 -2
- package/dist/graphql/queries/statistics.d.ts.map +1 -1
- package/dist/graphql/queries/statistics.js +0 -2
- package/dist/graphql/queries/transaction.d.ts.map +1 -1
- package/dist/graphql/queries/transaction.js +23 -10
- package/dist/graphql/types.d.ts +0 -2
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/interfaces.d.ts +19 -10
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +1 -1
- package/dist/kvstore.js +1 -1
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +13 -0
- package/dist/staking.d.ts +3 -112
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +2 -170
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +3 -1
- package/dist/storage.js +17 -7
- package/dist/types.d.ts +17 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +8 -4
- package/src/constants.ts +23 -64
- package/src/encryption.ts +1 -1
- package/src/escrow.ts +119 -103
- package/src/graphql/queries/operator.ts +2 -2
- package/src/graphql/queries/statistics.ts +0 -2
- package/src/graphql/queries/transaction.ts +23 -13
- package/src/graphql/types.ts +0 -2
- package/src/interfaces.ts +19 -11
- package/src/kvstore.ts +1 -1
- package/src/operator.ts +21 -0
- package/src/staking.ts +2 -185
- package/src/statistics.ts +3 -1
- package/src/types.ts +18 -4
package/dist/escrow.js
CHANGED
|
@@ -99,7 +99,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
99
99
|
* **EscrowClient constructor**
|
|
100
100
|
*
|
|
101
101
|
* @param {ContractRunner} runner The Runner object to interact with the Ethereum network
|
|
102
|
-
* @param {NetworkData}
|
|
102
|
+
* @param {NetworkData} networkData The network information required to connect to the Escrow contract
|
|
103
103
|
*/
|
|
104
104
|
constructor(runner, networkData) {
|
|
105
105
|
super(runner, networkData);
|
|
@@ -272,57 +272,6 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
272
272
|
return (0, utils_1.throwError)(e);
|
|
273
273
|
}
|
|
274
274
|
}
|
|
275
|
-
/**
|
|
276
|
-
* This function creates and sets up an escrow.
|
|
277
|
-
*
|
|
278
|
-
* @param {string} tokenAddress Token address to use for pay outs.
|
|
279
|
-
* @param {string[]} trustedHandlers Array of addresses that can perform actions on the contract.
|
|
280
|
-
* @param {string} jobRequesterId Job Requester Id
|
|
281
|
-
* @param {IEscrowConfig} escrowConfig Configuration object with escrow settings.
|
|
282
|
-
* @returns {Promise<string>} Returns the address of the escrow created.
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* **Code example**
|
|
286
|
-
*
|
|
287
|
-
* ```ts
|
|
288
|
-
* import { ethers, Wallet, providers } from 'ethers';
|
|
289
|
-
* import { EscrowClient } from '@human-protocol/sdk';
|
|
290
|
-
*
|
|
291
|
-
* const rpcUrl = 'YOUR_RPC_URL';
|
|
292
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
293
|
-
*
|
|
294
|
-
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
295
|
-
* const signer = new Wallet(privateKey, provider);
|
|
296
|
-
* const escrowClient = await EscrowClient.build(signer);
|
|
297
|
-
*
|
|
298
|
-
* const tokenAddress = '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4';
|
|
299
|
-
* const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
|
|
300
|
-
* const jobRequesterId = "job-requester-id";
|
|
301
|
-
*
|
|
302
|
-
* const escrowConfig = {
|
|
303
|
-
* recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
304
|
-
* reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
305
|
-
* exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
306
|
-
* recordingOracleFee: bigint.from('10'),
|
|
307
|
-
* reputationOracleFee: bigint.from('10'),
|
|
308
|
-
* exchangeOracleFee: bigint.from('10'),
|
|
309
|
-
* manifestUrl: 'htttp://localhost/manifest.json',
|
|
310
|
-
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
311
|
-
* };
|
|
312
|
-
*
|
|
313
|
-
* const escrowAddress = await escrowClient.createAndSetupEscrow(tokenAddress, trustedHandlers, jobRequesterId, escrowConfig);
|
|
314
|
-
* ```
|
|
315
|
-
*/
|
|
316
|
-
async createAndSetupEscrow(tokenAddress, trustedHandlers, jobRequesterId, escrowConfig) {
|
|
317
|
-
try {
|
|
318
|
-
const escrowAddress = await this.createEscrow(tokenAddress, trustedHandlers, jobRequesterId);
|
|
319
|
-
await this.setup(escrowAddress, escrowConfig);
|
|
320
|
-
return escrowAddress;
|
|
321
|
-
}
|
|
322
|
-
catch (e) {
|
|
323
|
-
return (0, utils_1.throwError)(e);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
275
|
/**
|
|
327
276
|
* This function adds funds of the chosen token to the escrow.
|
|
328
277
|
*
|
|
@@ -473,6 +422,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
473
422
|
* @param {bigint[]} amounts Array of amounts the recipients will receive.
|
|
474
423
|
* @param {string} finalResultsUrl Final results file url.
|
|
475
424
|
* @param {string} finalResultsHash Final results file hash.
|
|
425
|
+
* @param {string} forceComplete Indicates if remaining balance should be transferred to the escrow creator (optional, defaults to false).
|
|
476
426
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
477
427
|
* @returns Returns void if successful. Throws error if any.
|
|
478
428
|
*
|
|
@@ -500,7 +450,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
500
450
|
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash);
|
|
501
451
|
* ```
|
|
502
452
|
*/
|
|
503
|
-
async bulkPayOut(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash, txOptions = {}) {
|
|
453
|
+
async bulkPayOut(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash, forceComplete = false, txOptions = {}) {
|
|
504
454
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
505
455
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
506
456
|
}
|
|
@@ -540,7 +490,12 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
540
490
|
}
|
|
541
491
|
try {
|
|
542
492
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
543
|
-
|
|
493
|
+
if (forceComplete) {
|
|
494
|
+
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, constants_1.DEFAULT_TX_ID, forceComplete, txOptions)).wait();
|
|
495
|
+
}
|
|
496
|
+
else {
|
|
497
|
+
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256)'](recipients, amounts, finalResultsUrl, finalResultsHash, constants_1.DEFAULT_TX_ID, txOptions)).wait();
|
|
498
|
+
}
|
|
544
499
|
return;
|
|
545
500
|
}
|
|
546
501
|
catch (e) {
|
|
@@ -614,9 +569,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
614
569
|
}
|
|
615
570
|
}
|
|
616
571
|
/**
|
|
617
|
-
* This function
|
|
572
|
+
* This function adds an array of addresses to the trusted handlers list.
|
|
618
573
|
*
|
|
619
574
|
* @param {string} escrowAddress Address of the escrow.
|
|
575
|
+
* @param {string[]} trustedHandlers Array of addresses of trusted handlers to add.
|
|
620
576
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
621
577
|
* @returns Returns void if successful. Throws error if any.
|
|
622
578
|
*
|
|
@@ -636,19 +592,28 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
636
592
|
* const signer = new Wallet(privateKey, provider);
|
|
637
593
|
* const escrowClient = await EscrowClient.build(signer);
|
|
638
594
|
*
|
|
639
|
-
*
|
|
595
|
+
* const trustedHandlers = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266']
|
|
596
|
+
* await escrowClient.addTrustedHandlers('0x62dD51230A30401C455c8398d06F85e4EaB6309f', trustedHandlers);
|
|
640
597
|
* ```
|
|
641
598
|
*/
|
|
642
|
-
async
|
|
599
|
+
async addTrustedHandlers(escrowAddress, trustedHandlers, txOptions = {}) {
|
|
643
600
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
644
601
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
645
602
|
}
|
|
603
|
+
if (trustedHandlers.length === 0) {
|
|
604
|
+
throw error_1.ErrorListOfHandlersCannotBeEmpty;
|
|
605
|
+
}
|
|
606
|
+
trustedHandlers.forEach((trustedHandler) => {
|
|
607
|
+
if (!ethers_1.ethers.isAddress(trustedHandler)) {
|
|
608
|
+
throw new error_1.InvalidEthereumAddressError(trustedHandler);
|
|
609
|
+
}
|
|
610
|
+
});
|
|
646
611
|
if (!(await this.escrowFactoryContract.hasEscrow(escrowAddress))) {
|
|
647
612
|
throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
|
|
648
613
|
}
|
|
649
614
|
try {
|
|
650
615
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
651
|
-
await (await escrowContract.
|
|
616
|
+
await (await escrowContract.addTrustedHandlers(trustedHandlers, txOptions)).wait();
|
|
652
617
|
return;
|
|
653
618
|
}
|
|
654
619
|
catch (e) {
|
|
@@ -656,20 +621,20 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
656
621
|
}
|
|
657
622
|
}
|
|
658
623
|
/**
|
|
659
|
-
* This function
|
|
624
|
+
* This function withdraws additional tokens in the escrow to the canceler.
|
|
660
625
|
*
|
|
661
|
-
* @param {string} escrowAddress Address of the escrow.
|
|
662
|
-
* @param {string
|
|
626
|
+
* @param {string} escrowAddress Address of the escrow to withdraw.
|
|
627
|
+
* @param {string} tokenAddress Address of the token to withdraw.
|
|
663
628
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
664
|
-
* @returns Returns
|
|
629
|
+
* @returns {EscrowWithdraw} Returns the escrow withdrawal data including transaction hash and withdrawal amount. Throws error if any.
|
|
665
630
|
*
|
|
666
631
|
*
|
|
667
632
|
* **Code example**
|
|
668
633
|
*
|
|
669
|
-
* > Only Job Launcher or trusted handler can call it.
|
|
634
|
+
* > Only Job Launcher or a trusted handler can call it.
|
|
670
635
|
*
|
|
671
636
|
* ```ts
|
|
672
|
-
* import { Wallet, providers } from 'ethers';
|
|
637
|
+
* import { ethers, Wallet, providers } from 'ethers';
|
|
673
638
|
* import { EscrowClient } from '@human-protocol/sdk';
|
|
674
639
|
*
|
|
675
640
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
@@ -679,29 +644,50 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
679
644
|
* const signer = new Wallet(privateKey, provider);
|
|
680
645
|
* const escrowClient = await EscrowClient.build(signer);
|
|
681
646
|
*
|
|
682
|
-
*
|
|
683
|
-
*
|
|
647
|
+
* await escrowClient.withdraw(
|
|
648
|
+
* '0x62dD51230A30401C455c8398d06F85e4EaB6309f',
|
|
649
|
+
* '0x0376D26246Eb35FF4F9924cF13E6C05fd0bD7Fb4'
|
|
650
|
+
* );
|
|
684
651
|
* ```
|
|
685
652
|
*/
|
|
686
|
-
async
|
|
653
|
+
async withdraw(escrowAddress, tokenAddress, txOptions = {}) {
|
|
687
654
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
688
655
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
689
656
|
}
|
|
690
|
-
if (
|
|
691
|
-
throw error_1.
|
|
657
|
+
if (!ethers_1.ethers.isAddress(tokenAddress)) {
|
|
658
|
+
throw error_1.ErrorInvalidTokenAddress;
|
|
692
659
|
}
|
|
693
|
-
trustedHandlers.forEach((trustedHandler) => {
|
|
694
|
-
if (!ethers_1.ethers.isAddress(trustedHandler)) {
|
|
695
|
-
throw new error_1.InvalidEthereumAddressError(trustedHandler);
|
|
696
|
-
}
|
|
697
|
-
});
|
|
698
660
|
if (!(await this.escrowFactoryContract.hasEscrow(escrowAddress))) {
|
|
699
661
|
throw error_1.ErrorEscrowAddressIsNotProvidedByFactory;
|
|
700
662
|
}
|
|
701
663
|
try {
|
|
702
664
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
703
|
-
await (await escrowContract.
|
|
704
|
-
|
|
665
|
+
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress, txOptions)).wait();
|
|
666
|
+
let amountTransferred = undefined;
|
|
667
|
+
const tokenContract = typechain_types_1.ERC20__factory.connect(tokenAddress, this.runner);
|
|
668
|
+
if (transactionReceipt)
|
|
669
|
+
for (const log of transactionReceipt.logs) {
|
|
670
|
+
if (log.address === tokenAddress) {
|
|
671
|
+
const parsedLog = tokenContract.interface.parseLog({
|
|
672
|
+
topics: log.topics,
|
|
673
|
+
data: log.data,
|
|
674
|
+
});
|
|
675
|
+
const from = parsedLog?.args[0];
|
|
676
|
+
if (parsedLog?.name === 'Transfer' && from === escrowAddress) {
|
|
677
|
+
amountTransferred = parsedLog?.args[2];
|
|
678
|
+
break;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
if (amountTransferred === undefined) {
|
|
683
|
+
throw error_1.ErrorTransferEventNotFoundInTransactionLogs;
|
|
684
|
+
}
|
|
685
|
+
const escrowWithdrawData = {
|
|
686
|
+
txHash: transactionReceipt?.hash || '',
|
|
687
|
+
tokenAddress,
|
|
688
|
+
amountWithdrawn: amountTransferred,
|
|
689
|
+
};
|
|
690
|
+
return escrowWithdrawData;
|
|
705
691
|
}
|
|
706
692
|
catch (e) {
|
|
707
693
|
return (0, utils_1.throwError)(e);
|
|
@@ -736,7 +722,13 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
736
722
|
}
|
|
737
723
|
try {
|
|
738
724
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
739
|
-
|
|
725
|
+
try {
|
|
726
|
+
return await escrowContract.remainingFunds();
|
|
727
|
+
}
|
|
728
|
+
catch {
|
|
729
|
+
// Use getBalance() method below if remainingFunds() is not available
|
|
730
|
+
}
|
|
731
|
+
return await escrowContract.getBalance();
|
|
740
732
|
}
|
|
741
733
|
catch (e) {
|
|
742
734
|
return (0, utils_1.throwError)(e);
|
|
@@ -1141,12 +1133,6 @@ __decorate([
|
|
|
1141
1133
|
__metadata("design:paramtypes", [String, Object, Object]),
|
|
1142
1134
|
__metadata("design:returntype", Promise)
|
|
1143
1135
|
], EscrowClient.prototype, "setup", null);
|
|
1144
|
-
__decorate([
|
|
1145
|
-
decorators_1.requiresSigner,
|
|
1146
|
-
__metadata("design:type", Function),
|
|
1147
|
-
__metadata("design:paramtypes", [String, Array, String, Object]),
|
|
1148
|
-
__metadata("design:returntype", Promise)
|
|
1149
|
-
], EscrowClient.prototype, "createAndSetupEscrow", null);
|
|
1150
1136
|
__decorate([
|
|
1151
1137
|
decorators_1.requiresSigner,
|
|
1152
1138
|
__metadata("design:type", Function),
|
|
@@ -1168,7 +1154,7 @@ __decorate([
|
|
|
1168
1154
|
__decorate([
|
|
1169
1155
|
decorators_1.requiresSigner,
|
|
1170
1156
|
__metadata("design:type", Function),
|
|
1171
|
-
__metadata("design:paramtypes", [String, Array, Array, String, String, Object]),
|
|
1157
|
+
__metadata("design:paramtypes", [String, Array, Array, String, String, Object, Object]),
|
|
1172
1158
|
__metadata("design:returntype", Promise)
|
|
1173
1159
|
], EscrowClient.prototype, "bulkPayOut", null);
|
|
1174
1160
|
__decorate([
|
|
@@ -1180,15 +1166,15 @@ __decorate([
|
|
|
1180
1166
|
__decorate([
|
|
1181
1167
|
decorators_1.requiresSigner,
|
|
1182
1168
|
__metadata("design:type", Function),
|
|
1183
|
-
__metadata("design:paramtypes", [String, Object]),
|
|
1169
|
+
__metadata("design:paramtypes", [String, Array, Object]),
|
|
1184
1170
|
__metadata("design:returntype", Promise)
|
|
1185
|
-
], EscrowClient.prototype, "
|
|
1171
|
+
], EscrowClient.prototype, "addTrustedHandlers", null);
|
|
1186
1172
|
__decorate([
|
|
1187
1173
|
decorators_1.requiresSigner,
|
|
1188
1174
|
__metadata("design:type", Function),
|
|
1189
|
-
__metadata("design:paramtypes", [String,
|
|
1175
|
+
__metadata("design:paramtypes", [String, String, Object]),
|
|
1190
1176
|
__metadata("design:returntype", Promise)
|
|
1191
|
-
], EscrowClient.prototype, "
|
|
1177
|
+
], EscrowClient.prototype, "withdraw", null);
|
|
1192
1178
|
/**
|
|
1193
1179
|
* ## Introduction
|
|
1194
1180
|
*
|
|
@@ -10,22 +10,22 @@ const LEADER_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
10
10
|
id
|
|
11
11
|
address
|
|
12
12
|
amountStaked
|
|
13
|
-
amountAllocated
|
|
14
13
|
amountLocked
|
|
15
14
|
lockedUntilTimestamp
|
|
16
15
|
amountWithdrawn
|
|
17
16
|
amountSlashed
|
|
18
|
-
reputation
|
|
19
17
|
reward
|
|
20
18
|
amountJobsProcessed
|
|
21
19
|
role
|
|
22
20
|
fee
|
|
23
21
|
publicKey
|
|
24
22
|
webhookUrl
|
|
23
|
+
website
|
|
25
24
|
url
|
|
26
25
|
jobTypes
|
|
27
26
|
registrationNeeded
|
|
28
27
|
registrationInstructions
|
|
28
|
+
reputationNetworks
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
31
|
const GET_LEADERS_QUERY = (filter) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/statistics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/statistics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAqDrD,eAAO,MAAM,4BAA4B,gCAOxC,CAAC;AAIF,eAAO,MAAM,2BAA2B,gCAOvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAAY,iBAAiB,mCA6BjE,CAAC"}
|
|
@@ -18,7 +18,6 @@ const HMTOKEN_STATISTICS_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
18
18
|
const ESCROW_STATISTICS_FRAGMENT = (0, graphql_tag_1.default) `
|
|
19
19
|
fragment EscrowStatisticsFields on EscrowStatistics {
|
|
20
20
|
fundEventCount
|
|
21
|
-
setupEventCount
|
|
22
21
|
storeResultsEventCount
|
|
23
22
|
bulkPayoutEventCount
|
|
24
23
|
pendingStatusEventCount
|
|
@@ -34,7 +33,6 @@ const EVENT_DAY_DATA_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
34
33
|
fragment EventDayDataFields on EventDayData {
|
|
35
34
|
timestamp
|
|
36
35
|
dailyFundEventCount
|
|
37
|
-
dailySetupEventCount
|
|
38
36
|
dailyStoreResultsEventCount
|
|
39
37
|
dailyBulkPayoutEventCount
|
|
40
38
|
dailyPendingStatusEventCount
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AA2B9D,eAAO,MAAM,sBAAsB,WAAY,mBAAmB,mCAkDjE,CAAC;AAEF,eAAO,MAAM,qBAAqB,gCAOjC,CAAC"}
|
|
@@ -14,6 +14,19 @@ const TRANSACTION_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
14
14
|
timestamp
|
|
15
15
|
value
|
|
16
16
|
method
|
|
17
|
+
receiver
|
|
18
|
+
escrow
|
|
19
|
+
token
|
|
20
|
+
internalTransactions {
|
|
21
|
+
from
|
|
22
|
+
id
|
|
23
|
+
to
|
|
24
|
+
value
|
|
25
|
+
receiver
|
|
26
|
+
escrow
|
|
27
|
+
token
|
|
28
|
+
method
|
|
29
|
+
}
|
|
17
30
|
}
|
|
18
31
|
`;
|
|
19
32
|
const GET_TRANSACTIONS_QUERY = (filter) => {
|
|
@@ -21,21 +34,21 @@ const GET_TRANSACTIONS_QUERY = (filter) => {
|
|
|
21
34
|
const addressCondition = fromAddress === toAddress
|
|
22
35
|
? `
|
|
23
36
|
${fromAddress ? `{ from: $fromAddress }` : ''}
|
|
24
|
-
${toAddress ? `{ to: $toAddress }` : ''}
|
|
37
|
+
${toAddress ? `{ or: [{ or: [{ to: $toAddress }, { receiver: $toAddress }] }, {internalTransactions_: { or: [{ to: $toAddress }, { receiver: $toAddress }] } }] }` : ''}
|
|
25
38
|
`
|
|
26
39
|
: `
|
|
27
|
-
${fromAddress ? `from: $fromAddress` : ''}
|
|
28
|
-
${toAddress ? `to: $toAddress` : ''}
|
|
40
|
+
${fromAddress ? `{ from: $fromAddress }` : ''}
|
|
41
|
+
${toAddress ? `{ or: [{ or: [{ to: $toAddress }, { receiver: $toAddress }] }, { internalTransactions_: { or: [{ to: $toAddress }, { receiver: $toAddress }] } }] }` : ''}
|
|
29
42
|
`;
|
|
30
43
|
const WHERE_CLAUSE = `
|
|
31
44
|
where: {
|
|
32
|
-
|
|
33
|
-
? `or: [ ${addressCondition} ],`
|
|
34
|
-
:
|
|
35
|
-
${
|
|
36
|
-
${
|
|
37
|
-
${
|
|
38
|
-
|
|
45
|
+
and: [
|
|
46
|
+
${fromAddress && fromAddress === toAddress ? `{or: [ ${addressCondition} ]},` : `${addressCondition}`}
|
|
47
|
+
${startDate ? `{timestamp_gte: $startDate},` : ''}
|
|
48
|
+
${endDate ? `{timestamp_lte: $endDate},` : ''}
|
|
49
|
+
${startBlock ? `{block_gte: $startBlock},` : ''}
|
|
50
|
+
${endBlock ? `{block_lte: $endBlock},` : ''}
|
|
51
|
+
]
|
|
39
52
|
}
|
|
40
53
|
`;
|
|
41
54
|
return (0, graphql_tag_1.default) `
|
package/dist/graphql/types.d.ts
CHANGED
|
@@ -37,7 +37,6 @@ export type HMTStatisticsData = {
|
|
|
37
37
|
};
|
|
38
38
|
export type EscrowStatisticsData = {
|
|
39
39
|
fundEventCount: string;
|
|
40
|
-
setupEventCount: string;
|
|
41
40
|
storeResultsEventCount: string;
|
|
42
41
|
bulkPayoutEventCount: string;
|
|
43
42
|
pendingStatusEventCount: string;
|
|
@@ -51,7 +50,6 @@ export type EscrowStatisticsData = {
|
|
|
51
50
|
export type EventDayData = {
|
|
52
51
|
timestamp: string;
|
|
53
52
|
dailyFundEventCount: string;
|
|
54
|
-
dailySetupEventCount: string;
|
|
55
53
|
dailyStoreResultsEventCount: string;
|
|
56
54
|
dailyBulkPayoutEventCount: string;
|
|
57
55
|
dailyPendingStatusEventCount: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graphql/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAEnC,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IA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,GAAG;IAC1B,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,cAAc,EAAE,aAAa,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,12 +1,5 @@
|
|
|
1
1
|
import { EscrowStatus } from './types';
|
|
2
2
|
import { ChainId, OrderDirection } from './enums';
|
|
3
|
-
export interface IAllocation {
|
|
4
|
-
escrowAddress: string;
|
|
5
|
-
staker: string;
|
|
6
|
-
tokens: bigint;
|
|
7
|
-
createdAt: bigint;
|
|
8
|
-
closedAt: bigint;
|
|
9
|
-
}
|
|
10
3
|
export interface IReward {
|
|
11
4
|
escrowAddress: string;
|
|
12
5
|
amount: bigint;
|
|
@@ -16,25 +9,28 @@ export interface ILeader {
|
|
|
16
9
|
chainId: ChainId;
|
|
17
10
|
address: string;
|
|
18
11
|
amountStaked: bigint;
|
|
19
|
-
amountAllocated: bigint;
|
|
20
12
|
amountLocked: bigint;
|
|
21
13
|
lockedUntilTimestamp: bigint;
|
|
22
14
|
amountWithdrawn: bigint;
|
|
23
15
|
amountSlashed: bigint;
|
|
24
|
-
reputation: bigint;
|
|
25
16
|
reward: bigint;
|
|
26
17
|
amountJobsProcessed: bigint;
|
|
27
18
|
role?: string;
|
|
28
19
|
fee?: bigint;
|
|
29
20
|
publicKey?: string;
|
|
30
21
|
webhookUrl?: string;
|
|
22
|
+
website?: string;
|
|
31
23
|
url?: string;
|
|
32
24
|
jobTypes?: string[];
|
|
33
25
|
registrationNeeded?: boolean;
|
|
34
26
|
registrationInstructions?: string;
|
|
27
|
+
reputationNetworks?: string[];
|
|
35
28
|
}
|
|
36
|
-
export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes'> {
|
|
29
|
+
export interface ILeaderSubgraph extends Omit<ILeader, 'jobTypes' | 'reputationNetworks' | 'chainId'> {
|
|
37
30
|
jobTypes?: string;
|
|
31
|
+
reputationNetworks?: {
|
|
32
|
+
address: string;
|
|
33
|
+
}[];
|
|
38
34
|
}
|
|
39
35
|
export interface ILeadersFilter {
|
|
40
36
|
chainId: ChainId;
|
|
@@ -103,6 +99,15 @@ export interface IKVStore {
|
|
|
103
99
|
key: string;
|
|
104
100
|
value: string;
|
|
105
101
|
}
|
|
102
|
+
export interface InternalTransaction {
|
|
103
|
+
from: string;
|
|
104
|
+
to: string;
|
|
105
|
+
value: string;
|
|
106
|
+
method: string;
|
|
107
|
+
receiver?: string;
|
|
108
|
+
escrow?: string;
|
|
109
|
+
token?: string;
|
|
110
|
+
}
|
|
106
111
|
export interface ITransaction {
|
|
107
112
|
block: bigint;
|
|
108
113
|
txHash: string;
|
|
@@ -111,6 +116,10 @@ export interface ITransaction {
|
|
|
111
116
|
timestamp: bigint;
|
|
112
117
|
value: string;
|
|
113
118
|
method: string;
|
|
119
|
+
receiver?: string;
|
|
120
|
+
escrow?: string;
|
|
121
|
+
token?: string;
|
|
122
|
+
internalTransactions: InternalTransaction[];
|
|
114
123
|
}
|
|
115
124
|
export interface ITransactionsFilter extends IPagination {
|
|
116
125
|
chainId: ChainId;
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/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,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oBAAoB,EAAE,mBAAmB,EAAE,CAAC;CAC7C;AAED,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACtD,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,IAAI,CAAC;IACjB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC"}
|
package/dist/kvstore.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
78
78
|
* **KVStoreClient constructor**
|
|
79
79
|
*
|
|
80
80
|
* @param {ContractRunner} runner - The Runner object to interact with the Ethereum network
|
|
81
|
-
* @param {NetworkData}
|
|
81
|
+
* @param {NetworkData} networkData - The network information required to connect to the KVStore contract
|
|
82
82
|
*/
|
|
83
83
|
constructor(runner: ContractRunner, networkData: NetworkData);
|
|
84
84
|
/**
|
package/dist/kvstore.js
CHANGED
|
@@ -96,7 +96,7 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
96
96
|
* **KVStoreClient constructor**
|
|
97
97
|
*
|
|
98
98
|
* @param {ContractRunner} runner - The Runner object to interact with the Ethereum network
|
|
99
|
-
* @param {NetworkData}
|
|
99
|
+
* @param {NetworkData} networkData - The network information required to connect to the KVStore contract
|
|
100
100
|
*/
|
|
101
101
|
constructor(runner, networkData) {
|
|
102
102
|
super(runner, networkData);
|
package/dist/operator.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EAEP,cAAc,EACd,SAAS,EAET,OAAO,EACR,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../src/operator.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,OAAO,EAEP,cAAc,EACd,SAAS,EAET,OAAO,EACR,MAAM,cAAc,CAAC;AAetB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAGlC,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;IA2CnB;;;;;;;;;;;;;;;;;OAiBG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAkD1E;;;;;;;;;;;;;OAaG;WACiB,6BAA6B,CAC/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC;IA+BvB;;;;;;;;;;;;;;OAcG;WACiB,UAAU,CAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,EAAE,CAAC;CAyBtB"}
|
package/dist/operator.js
CHANGED
|
@@ -43,15 +43,21 @@ class OperatorUtils {
|
|
|
43
43
|
return leader || null;
|
|
44
44
|
}
|
|
45
45
|
let jobTypes = [];
|
|
46
|
+
let reputationNetworks = [];
|
|
46
47
|
if (typeof leader.jobTypes === 'string') {
|
|
47
48
|
jobTypes = leader.jobTypes.split(',');
|
|
48
49
|
}
|
|
49
50
|
else if (Array.isArray(leader.jobTypes)) {
|
|
50
51
|
jobTypes = leader.jobTypes;
|
|
51
52
|
}
|
|
53
|
+
if (leader.reputationNetworks && Array.isArray(leader.reputationNetworks)) {
|
|
54
|
+
reputationNetworks = leader.reputationNetworks.map((network) => network.address);
|
|
55
|
+
}
|
|
52
56
|
return {
|
|
53
57
|
...leader,
|
|
54
58
|
jobTypes,
|
|
59
|
+
reputationNetworks,
|
|
60
|
+
chainId,
|
|
55
61
|
};
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
@@ -86,15 +92,22 @@ class OperatorUtils {
|
|
|
86
92
|
}
|
|
87
93
|
leaders_data = leaders_data.concat(leaders.map((leader) => {
|
|
88
94
|
let jobTypes = [];
|
|
95
|
+
let reputationNetworks = [];
|
|
89
96
|
if (typeof leader.jobTypes === 'string') {
|
|
90
97
|
jobTypes = leader.jobTypes.split(',');
|
|
91
98
|
}
|
|
92
99
|
else if (Array.isArray(leader.jobTypes)) {
|
|
93
100
|
jobTypes = leader.jobTypes;
|
|
94
101
|
}
|
|
102
|
+
if (leader.reputationNetworks &&
|
|
103
|
+
Array.isArray(leader.reputationNetworks)) {
|
|
104
|
+
reputationNetworks = leader.reputationNetworks.map((network) => network.address);
|
|
105
|
+
}
|
|
95
106
|
return {
|
|
96
107
|
...leader,
|
|
97
108
|
jobTypes,
|
|
109
|
+
reputationNetworks,
|
|
110
|
+
chainId: filter.chainId,
|
|
98
111
|
};
|
|
99
112
|
}));
|
|
100
113
|
return leaders_data;
|