@human-protocol/sdk 3.0.0 → 3.0.1
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/README.md +23 -80
- package/dist/enums.d.ts +4 -0
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +6 -1
- package/dist/error.d.ts +7 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +8 -1
- package/dist/escrow.d.ts +90 -5
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +153 -37
- package/dist/graphql/queries/escrow.d.ts +1 -0
- package/dist/graphql/queries/escrow.d.ts.map +1 -1
- package/dist/graphql/queries/escrow.js +50 -9
- package/dist/graphql/queries/hmtoken.d.ts +1 -1
- package/dist/graphql/queries/hmtoken.d.ts.map +1 -1
- package/dist/graphql/queries/hmtoken.js +23 -7
- package/dist/graphql/queries/statistics.d.ts.map +1 -1
- package/dist/graphql/queries/statistics.js +2 -0
- package/dist/graphql/queries/transaction.d.ts.map +1 -1
- package/dist/graphql/queries/transaction.js +12 -7
- package/dist/graphql/types.d.ts +11 -0
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/interfaces.d.ts +15 -6
- 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 +64 -81
- package/dist/statistics.d.ts +28 -2
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +46 -1
- package/dist/transaction.d.ts +10 -4
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +36 -27
- package/package.json +5 -4
- package/src/enums.ts +5 -0
- package/src/error.ts +8 -0
- package/src/escrow.ts +197 -48
- package/src/graphql/queries/escrow.ts +53 -8
- package/src/graphql/queries/hmtoken.ts +23 -7
- package/src/graphql/queries/statistics.ts +2 -0
- package/src/graphql/queries/transaction.ts +12 -7
- package/src/graphql/types.ts +13 -0
- package/src/index.ts +2 -0
- package/src/interfaces.ts +17 -6
- package/src/kvstore.ts +1 -1
- package/src/operator.ts +79 -91
- package/src/statistics.ts +54 -2
- package/src/transaction.ts +40 -30
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.GET_ESCROWS_QUERY = exports.GET_ESCROW_BY_ADDRESS_QUERY = void 0;
|
|
6
|
+
exports.GET_STATUS_UPDATES_QUERY = exports.GET_ESCROWS_QUERY = exports.GET_ESCROW_BY_ADDRESS_QUERY = void 0;
|
|
7
7
|
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
8
|
const ESCROW_FRAGMENT = (0, graphql_tag_1.default) `
|
|
9
9
|
fragment EscrowFields on Escrow {
|
|
@@ -44,14 +44,14 @@ const GET_ESCROWS_QUERY = (filter) => {
|
|
|
44
44
|
const { launcher, jobRequesterId, reputationOracle, recordingOracle, exchangeOracle, status, from, to, } = filter;
|
|
45
45
|
const WHERE_CLAUSE = `
|
|
46
46
|
where: {
|
|
47
|
-
${launcher ? `launcher: $launcher
|
|
48
|
-
${jobRequesterId ? `jobRequesterId: $jobRequesterId
|
|
49
|
-
${reputationOracle ? `reputationOracle: $reputationOracle
|
|
50
|
-
${recordingOracle ? `recordingOracle: $recordingOracle
|
|
51
|
-
${exchangeOracle ? `exchangeOracle: $exchangeOracle
|
|
52
|
-
${status !== undefined ? `status: $status
|
|
53
|
-
${from ? `createdAt_gte: $from
|
|
54
|
-
${to ? `createdAt_lte: $to
|
|
47
|
+
${launcher ? `launcher: $launcher,` : ''}
|
|
48
|
+
${jobRequesterId ? `jobRequesterId: $jobRequesterId,` : ''}
|
|
49
|
+
${reputationOracle ? `reputationOracle: $reputationOracle,` : ''}
|
|
50
|
+
${recordingOracle ? `recordingOracle: $recordingOracle,` : ''}
|
|
51
|
+
${exchangeOracle ? `exchangeOracle: $exchangeOracle,` : ''}
|
|
52
|
+
${status !== undefined ? `status: $status,` : ''}
|
|
53
|
+
${from ? `createdAt_gte: $from,` : ''}
|
|
54
|
+
${to ? `createdAt_lte: $to,` : ''}
|
|
55
55
|
}
|
|
56
56
|
`;
|
|
57
57
|
return (0, graphql_tag_1.default) `
|
|
@@ -64,9 +64,16 @@ const GET_ESCROWS_QUERY = (filter) => {
|
|
|
64
64
|
$status: String
|
|
65
65
|
$from: Int
|
|
66
66
|
$to: Int
|
|
67
|
+
$orderDirection: String
|
|
68
|
+
$first: Int
|
|
69
|
+
$skip: Int
|
|
67
70
|
) {
|
|
68
71
|
escrows(
|
|
69
72
|
${WHERE_CLAUSE}
|
|
73
|
+
orderBy: createdAt,
|
|
74
|
+
orderDirection: $orderDirection,
|
|
75
|
+
first: $first,
|
|
76
|
+
skip: $skip
|
|
70
77
|
) {
|
|
71
78
|
...EscrowFields
|
|
72
79
|
}
|
|
@@ -75,3 +82,37 @@ const GET_ESCROWS_QUERY = (filter) => {
|
|
|
75
82
|
`;
|
|
76
83
|
};
|
|
77
84
|
exports.GET_ESCROWS_QUERY = GET_ESCROWS_QUERY;
|
|
85
|
+
const GET_STATUS_UPDATES_QUERY = (from, to, launcher) => {
|
|
86
|
+
const WHERE_CLAUSE = `
|
|
87
|
+
where: {
|
|
88
|
+
status_in: $status
|
|
89
|
+
${from ? `timestamp_gte: $from` : ''}
|
|
90
|
+
${to ? `timestamp_lte: $to` : ''}
|
|
91
|
+
${launcher ? `launcher: $launcher` : ''}
|
|
92
|
+
}
|
|
93
|
+
`;
|
|
94
|
+
return (0, graphql_tag_1.default) `
|
|
95
|
+
query getStatus(
|
|
96
|
+
$status: [String!]!
|
|
97
|
+
$from: Int
|
|
98
|
+
$to: Int
|
|
99
|
+
$launcher: String
|
|
100
|
+
$orderDirection: String
|
|
101
|
+
$first: Int
|
|
102
|
+
$skip: Int
|
|
103
|
+
) {
|
|
104
|
+
escrowStatusEvents(
|
|
105
|
+
${WHERE_CLAUSE}
|
|
106
|
+
orderBy: timestamp,
|
|
107
|
+
orderDirection: $orderDirection,
|
|
108
|
+
first: $first,
|
|
109
|
+
skip: $skip
|
|
110
|
+
) {
|
|
111
|
+
escrowAddress,
|
|
112
|
+
timestamp,
|
|
113
|
+
status,
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`;
|
|
117
|
+
};
|
|
118
|
+
exports.GET_STATUS_UPDATES_QUERY = GET_STATUS_UPDATES_QUERY;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const GET_HOLDERS_QUERY: import("graphql").DocumentNode;
|
|
1
|
+
export declare const GET_HOLDERS_QUERY: (address?: string) => import("graphql").DocumentNode;
|
|
2
2
|
//# sourceMappingURL=hmtoken.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hmtoken.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/hmtoken.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"hmtoken.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/hmtoken.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,iBAAiB,aAAc,MAAM,mCAuBjD,CAAC"}
|
|
@@ -11,11 +11,27 @@ const HOLDER_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
11
11
|
balance
|
|
12
12
|
}
|
|
13
13
|
`;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
const GET_HOLDERS_QUERY = (address) => {
|
|
15
|
+
const WHERE_CLAUSE = `
|
|
16
|
+
where: {
|
|
17
|
+
${address ? `address: $address,` : ''}
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
`;
|
|
20
|
+
return (0, graphql_tag_1.default) `
|
|
21
|
+
query GetHolders(
|
|
22
|
+
$address: String
|
|
23
|
+
$orderBy: String
|
|
24
|
+
$orderDirection: String
|
|
25
|
+
) {
|
|
26
|
+
holders(
|
|
27
|
+
${WHERE_CLAUSE}
|
|
28
|
+
orderBy: $orderBy,
|
|
29
|
+
orderDirection: $orderDirection
|
|
30
|
+
) {
|
|
31
|
+
...HolderFields
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
${HOLDER_FRAGMENT}
|
|
35
|
+
`;
|
|
36
|
+
};
|
|
37
|
+
exports.GET_HOLDERS_QUERY = GET_HOLDERS_QUERY;
|
|
@@ -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;AAEF,eAAO,MAAM,2BAA2B,gCAOvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAAY,iBAAiB,mCAyBjE,CAAC"}
|
|
@@ -49,6 +49,8 @@ const EVENT_DAY_DATA_FRAGMENT = (0, graphql_tag_1.default) `
|
|
|
49
49
|
dailyPayoutAmount
|
|
50
50
|
dailyHMTTransferCount
|
|
51
51
|
dailyHMTTransferAmount
|
|
52
|
+
dailyUniqueSenders
|
|
53
|
+
dailyUniqueReceivers
|
|
52
54
|
}
|
|
53
55
|
`;
|
|
54
56
|
exports.GET_HMTOKEN_STATISTICS_QUERY = (0, graphql_tag_1.default) `
|
|
@@ -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;AAc9D,eAAO,MAAM,sBAAsB,WAAY,mBAAmB,
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAc9D,eAAO,MAAM,sBAAsB,WAAY,mBAAmB,mCAuCjE,CAAC;AAEF,eAAO,MAAM,qBAAqB,gCAOjC,CAAC"}
|
|
@@ -20,12 +20,12 @@ const GET_TRANSACTIONS_QUERY = (filter) => {
|
|
|
20
20
|
const { startDate, endDate, startBlock, endBlock, fromAddress, toAddress } = filter;
|
|
21
21
|
const WHERE_CLAUSE = `
|
|
22
22
|
where: {
|
|
23
|
-
${fromAddress ? `from: $fromAddress
|
|
24
|
-
${toAddress ? `to: $toAddress
|
|
25
|
-
${startDate ? `timestamp_gte: $startDate
|
|
26
|
-
${endDate ? `timestamp_lte: $endDate
|
|
27
|
-
${startBlock ? `block_gte: $startBlock
|
|
28
|
-
${endBlock ? `block_lte: $endBlock
|
|
23
|
+
${fromAddress ? `from: $fromAddress,` : ''}
|
|
24
|
+
${toAddress ? `to: $toAddress,` : ''}
|
|
25
|
+
${startDate ? `timestamp_gte: $startDate,` : ''}
|
|
26
|
+
${endDate ? `timestamp_lte: $endDate,` : ''}
|
|
27
|
+
${startBlock ? `block_gte: $startBlock,` : ''}
|
|
28
|
+
${endBlock ? `block_lte: $endBlock,` : ''}
|
|
29
29
|
}
|
|
30
30
|
`;
|
|
31
31
|
return (0, graphql_tag_1.default) `
|
|
@@ -36,11 +36,16 @@ const GET_TRANSACTIONS_QUERY = (filter) => {
|
|
|
36
36
|
$endDate: Int
|
|
37
37
|
$startBlock: Int
|
|
38
38
|
$endBlock: Int
|
|
39
|
+
$orderDirection: String
|
|
40
|
+
$first: Int
|
|
41
|
+
$skip: Int
|
|
39
42
|
) {
|
|
40
43
|
transactions(
|
|
41
44
|
${WHERE_CLAUSE}
|
|
42
45
|
orderBy: timestamp,
|
|
43
|
-
orderDirection:
|
|
46
|
+
orderDirection: $orderDirection,
|
|
47
|
+
first: $first,
|
|
48
|
+
skip: $skip
|
|
44
49
|
) {
|
|
45
50
|
...TransactionFields
|
|
46
51
|
}
|
package/dist/graphql/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ChainId } from '../enums';
|
|
1
2
|
export type EscrowData = {
|
|
2
3
|
id: string;
|
|
3
4
|
address: string;
|
|
@@ -68,6 +69,8 @@ export type EventDayData = {
|
|
|
68
69
|
dailyPayoutAmount: string;
|
|
69
70
|
dailyHMTTransferCount: string;
|
|
70
71
|
dailyHMTTransferAmount: string;
|
|
72
|
+
dailyUniqueSenders: string;
|
|
73
|
+
dailyUniqueReceivers: string;
|
|
71
74
|
};
|
|
72
75
|
export type RewardAddedEventData = {
|
|
73
76
|
escrowAddress: string;
|
|
@@ -115,6 +118,8 @@ export type DailyHMTData = {
|
|
|
115
118
|
timestamp: Date;
|
|
116
119
|
totalTransactionAmount: bigint;
|
|
117
120
|
totalTransactionCount: number;
|
|
121
|
+
dailyUniqueSenders: number;
|
|
122
|
+
dailyUniqueReceivers: number;
|
|
118
123
|
};
|
|
119
124
|
export type HMTStatistics = {
|
|
120
125
|
totalTransferAmount: bigint;
|
|
@@ -136,6 +141,12 @@ export type DailyTaskData = {
|
|
|
136
141
|
export type TaskStatistics = {
|
|
137
142
|
dailyTasksData: DailyTaskData[];
|
|
138
143
|
};
|
|
144
|
+
export type StatusEvent = {
|
|
145
|
+
timestamp: number;
|
|
146
|
+
escrowAddress: string;
|
|
147
|
+
status: string;
|
|
148
|
+
chainId: ChainId;
|
|
149
|
+
};
|
|
139
150
|
export type KVStoreData = {
|
|
140
151
|
id: string;
|
|
141
152
|
address: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/graphql/types.ts"],"names":[],"mappings":"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C;CAC9B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;AAElD,MAAM,MAAM,aAAa,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/index.d.ts
CHANGED
|
@@ -5,9 +5,10 @@ import { EscrowClient, EscrowUtils } from './escrow';
|
|
|
5
5
|
import { StatisticsClient } from './statistics';
|
|
6
6
|
import { Encryption, EncryptionUtils } from './encryption';
|
|
7
7
|
import { OperatorUtils } from './operator';
|
|
8
|
+
import { TransactionUtils } from './transaction';
|
|
8
9
|
export * from './constants';
|
|
9
10
|
export * from './types';
|
|
10
11
|
export * from './enums';
|
|
11
12
|
export * from './interfaces';
|
|
12
|
-
export { StakingClient, StorageClient, KVStoreClient, EscrowClient, EscrowUtils, StatisticsClient, Encryption, EncryptionUtils, OperatorUtils, };
|
|
13
|
+
export { StakingClient, StorageClient, KVStoreClient, EscrowClient, EscrowUtils, StatisticsClient, Encryption, EncryptionUtils, OperatorUtils, TransactionUtils, };
|
|
13
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,aAAa,EACb,aAAa,EACb,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,eAAe,EACf,aAAa,EACb,gBAAgB,GACjB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ 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.OperatorUtils = exports.EncryptionUtils = exports.Encryption = exports.StatisticsClient = exports.EscrowUtils = exports.EscrowClient = exports.KVStoreClient = exports.StorageClient = exports.StakingClient = void 0;
|
|
17
|
+
exports.TransactionUtils = exports.OperatorUtils = exports.EncryptionUtils = exports.Encryption = exports.StatisticsClient = exports.EscrowUtils = exports.EscrowClient = exports.KVStoreClient = exports.StorageClient = exports.StakingClient = 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
|
const storage_1 = require("./storage");
|
|
@@ -31,6 +31,8 @@ Object.defineProperty(exports, "Encryption", { enumerable: true, get: function (
|
|
|
31
31
|
Object.defineProperty(exports, "EncryptionUtils", { enumerable: true, get: function () { return encryption_1.EncryptionUtils; } });
|
|
32
32
|
const operator_1 = require("./operator");
|
|
33
33
|
Object.defineProperty(exports, "OperatorUtils", { enumerable: true, get: function () { return operator_1.OperatorUtils; } });
|
|
34
|
+
const transaction_1 = require("./transaction");
|
|
35
|
+
Object.defineProperty(exports, "TransactionUtils", { enumerable: true, get: function () { return transaction_1.TransactionUtils; } });
|
|
34
36
|
__exportStar(require("./constants"), exports);
|
|
35
37
|
__exportStar(require("./types"), exports);
|
|
36
38
|
__exportStar(require("./enums"), exports);
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EscrowStatus } from './types';
|
|
2
|
-
import { ChainId } from './enums';
|
|
2
|
+
import { ChainId, OrderDirection } from './enums';
|
|
3
3
|
export interface IAllocation {
|
|
4
4
|
escrowAddress: string;
|
|
5
5
|
staker: string;
|
|
@@ -55,7 +55,7 @@ export interface IOperator {
|
|
|
55
55
|
export interface IOperatorSubgraph extends Omit<IOperator, 'jobTypes'> {
|
|
56
56
|
jobTypes?: string;
|
|
57
57
|
}
|
|
58
|
-
export interface IEscrowsFilter {
|
|
58
|
+
export interface IEscrowsFilter extends IPagination {
|
|
59
59
|
launcher?: string;
|
|
60
60
|
reputationOracle?: string;
|
|
61
61
|
recordingOracle?: string;
|
|
@@ -64,7 +64,7 @@ export interface IEscrowsFilter {
|
|
|
64
64
|
status?: EscrowStatus;
|
|
65
65
|
from?: Date;
|
|
66
66
|
to?: Date;
|
|
67
|
-
|
|
67
|
+
chainId: ChainId;
|
|
68
68
|
}
|
|
69
69
|
export interface IEscrowConfig {
|
|
70
70
|
recordingOracle: string;
|
|
@@ -87,6 +87,10 @@ export interface IStatisticsParams {
|
|
|
87
87
|
to?: Date;
|
|
88
88
|
limit?: number;
|
|
89
89
|
}
|
|
90
|
+
export interface IHMTHoldersParams {
|
|
91
|
+
address?: string;
|
|
92
|
+
orderDirection?: 'asc' | 'desc';
|
|
93
|
+
}
|
|
90
94
|
export interface IPayoutFilter {
|
|
91
95
|
escrowAddress?: string;
|
|
92
96
|
recipient?: string;
|
|
@@ -99,15 +103,15 @@ export interface IKVStore {
|
|
|
99
103
|
}
|
|
100
104
|
export interface ITransaction {
|
|
101
105
|
block: bigint;
|
|
102
|
-
|
|
106
|
+
txHash: string;
|
|
103
107
|
from: string;
|
|
104
108
|
to: string;
|
|
105
109
|
timestamp: bigint;
|
|
106
110
|
value: string;
|
|
107
111
|
method: string;
|
|
108
112
|
}
|
|
109
|
-
export interface ITransactionsFilter {
|
|
110
|
-
|
|
113
|
+
export interface ITransactionsFilter extends IPagination {
|
|
114
|
+
chainId: ChainId;
|
|
111
115
|
startBlock?: number;
|
|
112
116
|
endBlock?: number;
|
|
113
117
|
startDate?: Date;
|
|
@@ -115,4 +119,9 @@ export interface ITransactionsFilter {
|
|
|
115
119
|
fromAddress?: string;
|
|
116
120
|
toAddress?: string;
|
|
117
121
|
}
|
|
122
|
+
export interface IPagination {
|
|
123
|
+
first?: number;
|
|
124
|
+
skip?: number;
|
|
125
|
+
orderDirection?: OrderDirection;
|
|
126
|
+
}
|
|
118
127
|
//# sourceMappingURL=interfaces.d.ts.map
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,WAAW;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,M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AC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;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
|
@@ -278,7 +278,7 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
278
278
|
* import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
|
|
279
279
|
*
|
|
280
280
|
* const KVStoreAddresses = new KVStoreUtils.getData({
|
|
281
|
-
*
|
|
281
|
+
* network: ChainId.POLYGON_AMOY
|
|
282
282
|
* });
|
|
283
283
|
* ```
|
|
284
284
|
*/
|
package/dist/kvstore.js
CHANGED
|
@@ -415,7 +415,7 @@ exports.KVStoreClient = KVStoreClient;
|
|
|
415
415
|
* import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
|
|
416
416
|
*
|
|
417
417
|
* const KVStoreAddresses = new KVStoreUtils.getData({
|
|
418
|
-
*
|
|
418
|
+
* network: ChainId.POLYGON_AMOY
|
|
419
419
|
* });
|
|
420
420
|
* ```
|
|
421
421
|
*/
|
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;IAkCnB;;;;;;;;;;;;;;;;;OAiBG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,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;IAkCnB;;;;;;;;;;;;;;;;;OAiBG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAsC1E;;;;;;;;;;;;;OAaG;WACiB,6BAA6B,CAC/C,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAAC,SAAS,EAAE,CAAC;IA6BvB;;;;;;;;;;;;;;OAcG;WACiB,UAAU,CAC5B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,MAAM,GACrB,OAAO,CAAC,OAAO,EAAE,CAAC;CAuBtB"}
|
package/dist/operator.js
CHANGED
|
@@ -36,25 +36,23 @@ class OperatorUtils {
|
|
|
36
36
|
if (!networkData) {
|
|
37
37
|
throw error_1.ErrorUnsupportedChainID;
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
jobTypes = leader.jobTypes;
|
|
49
|
-
}
|
|
50
|
-
return {
|
|
51
|
-
...leader,
|
|
52
|
-
jobTypes,
|
|
53
|
-
};
|
|
39
|
+
const { leader } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), operator_1.GET_LEADER_QUERY, {
|
|
40
|
+
address: address.toLowerCase(),
|
|
41
|
+
});
|
|
42
|
+
if (!leader) {
|
|
43
|
+
return leader || null;
|
|
44
|
+
}
|
|
45
|
+
let jobTypes = [];
|
|
46
|
+
if (typeof leader.jobTypes === 'string') {
|
|
47
|
+
jobTypes = leader.jobTypes.split(',');
|
|
54
48
|
}
|
|
55
|
-
|
|
56
|
-
|
|
49
|
+
else if (Array.isArray(leader.jobTypes)) {
|
|
50
|
+
jobTypes = leader.jobTypes;
|
|
57
51
|
}
|
|
52
|
+
return {
|
|
53
|
+
...leader,
|
|
54
|
+
jobTypes,
|
|
55
|
+
};
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
58
|
* This function returns all the leader details of the protocol.
|
|
@@ -75,36 +73,31 @@ class OperatorUtils {
|
|
|
75
73
|
* ```
|
|
76
74
|
*/
|
|
77
75
|
static async getLeaders(filter) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
throw error_1.ErrorUnsupportedChainID;
|
|
83
|
-
}
|
|
84
|
-
const { leaders } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, operator_1.GET_LEADERS_QUERY)(filter), {
|
|
85
|
-
role: filter?.role,
|
|
86
|
-
});
|
|
87
|
-
if (!leaders) {
|
|
88
|
-
return [];
|
|
89
|
-
}
|
|
90
|
-
leaders_data = leaders_data.concat(leaders.map((leader) => {
|
|
91
|
-
let jobTypes = [];
|
|
92
|
-
if (typeof leader.jobTypes === 'string') {
|
|
93
|
-
jobTypes = leader.jobTypes.split(',');
|
|
94
|
-
}
|
|
95
|
-
else if (Array.isArray(leader.jobTypes)) {
|
|
96
|
-
jobTypes = leader.jobTypes;
|
|
97
|
-
}
|
|
98
|
-
return {
|
|
99
|
-
...leader,
|
|
100
|
-
jobTypes,
|
|
101
|
-
};
|
|
102
|
-
}));
|
|
103
|
-
return leaders_data;
|
|
76
|
+
let leaders_data = [];
|
|
77
|
+
const networkData = constants_1.NETWORKS[filter.chainId];
|
|
78
|
+
if (!networkData) {
|
|
79
|
+
throw error_1.ErrorUnsupportedChainID;
|
|
104
80
|
}
|
|
105
|
-
|
|
106
|
-
|
|
81
|
+
const { leaders } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, operator_1.GET_LEADERS_QUERY)(filter), {
|
|
82
|
+
role: filter?.role,
|
|
83
|
+
});
|
|
84
|
+
if (!leaders) {
|
|
85
|
+
return [];
|
|
107
86
|
}
|
|
87
|
+
leaders_data = leaders_data.concat(leaders.map((leader) => {
|
|
88
|
+
let jobTypes = [];
|
|
89
|
+
if (typeof leader.jobTypes === 'string') {
|
|
90
|
+
jobTypes = leader.jobTypes.split(',');
|
|
91
|
+
}
|
|
92
|
+
else if (Array.isArray(leader.jobTypes)) {
|
|
93
|
+
jobTypes = leader.jobTypes;
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
...leader,
|
|
97
|
+
jobTypes,
|
|
98
|
+
};
|
|
99
|
+
}));
|
|
100
|
+
return leaders_data;
|
|
108
101
|
}
|
|
109
102
|
/**
|
|
110
103
|
* Retrieves the reputation network operators of the specified address.
|
|
@@ -125,28 +118,23 @@ class OperatorUtils {
|
|
|
125
118
|
if (!networkData) {
|
|
126
119
|
throw error_1.ErrorUnsupportedChainID;
|
|
127
120
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
catch (e) {
|
|
148
|
-
return (0, utils_1.throwError)(e);
|
|
149
|
-
}
|
|
121
|
+
const { reputationNetwork } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), (0, operator_1.GET_REPUTATION_NETWORK_QUERY)(role), {
|
|
122
|
+
address: address.toLowerCase(),
|
|
123
|
+
role: role,
|
|
124
|
+
});
|
|
125
|
+
return reputationNetwork.operators.map((operator) => {
|
|
126
|
+
let jobTypes = [];
|
|
127
|
+
if (typeof operator.jobTypes === 'string') {
|
|
128
|
+
jobTypes = operator.jobTypes.split(',');
|
|
129
|
+
}
|
|
130
|
+
else if (Array.isArray(operator.jobTypes)) {
|
|
131
|
+
jobTypes = operator.jobTypes;
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
...operator,
|
|
135
|
+
jobTypes,
|
|
136
|
+
};
|
|
137
|
+
});
|
|
150
138
|
}
|
|
151
139
|
/**
|
|
152
140
|
* This function returns information about the rewards for a given slasher address.
|
|
@@ -171,20 +159,15 @@ class OperatorUtils {
|
|
|
171
159
|
if (!networkData) {
|
|
172
160
|
throw error_1.ErrorUnsupportedChainID;
|
|
173
161
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
catch (e) {
|
|
186
|
-
return (0, utils_1.throwError)(e);
|
|
187
|
-
}
|
|
162
|
+
const { rewardAddedEvents } = await (0, graphql_request_1.default)((0, utils_1.getSubgraphUrl)(networkData), reward_1.GET_REWARD_ADDED_EVENTS_QUERY, {
|
|
163
|
+
slasherAddress: slasherAddress.toLowerCase(),
|
|
164
|
+
});
|
|
165
|
+
return rewardAddedEvents.map((reward) => {
|
|
166
|
+
return {
|
|
167
|
+
escrowAddress: reward.escrow,
|
|
168
|
+
amount: reward.amount,
|
|
169
|
+
};
|
|
170
|
+
});
|
|
188
171
|
}
|
|
189
172
|
}
|
|
190
173
|
exports.OperatorUtils = OperatorUtils;
|
package/dist/statistics.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { EscrowStatistics, HMTStatistics, PaymentStatistics, WorkerStatistics } from './graphql';
|
|
2
|
-
import { IStatisticsParams } from './interfaces';
|
|
1
|
+
import { EscrowStatistics, HMTStatistics, PaymentStatistics, WorkerStatistics, HMTHolder } from './graphql';
|
|
2
|
+
import { IHMTHoldersParams, IStatisticsParams } from './interfaces';
|
|
3
3
|
import { NetworkData } from './types';
|
|
4
4
|
/**
|
|
5
5
|
* ## Introduction
|
|
@@ -292,5 +292,31 @@ export declare class StatisticsClient {
|
|
|
292
292
|
* ```
|
|
293
293
|
*/
|
|
294
294
|
getHMTStatistics(params?: IStatisticsParams): Promise<HMTStatistics>;
|
|
295
|
+
/**
|
|
296
|
+
* This function returns the holders of the HMToken with optional filters and ordering.
|
|
297
|
+
*
|
|
298
|
+
* **Input parameters**
|
|
299
|
+
*
|
|
300
|
+
* @param {IHMTHoldersParams} params HMT Holders params with filters and ordering
|
|
301
|
+
* @returns {HMTHolder[]} List of HMToken holders.
|
|
302
|
+
*
|
|
303
|
+
* **Code example**
|
|
304
|
+
*
|
|
305
|
+
* ```ts
|
|
306
|
+
* import { StatisticsClient, ChainId, NETWORKS } from '@human-protocol/sdk';
|
|
307
|
+
*
|
|
308
|
+
* const statisticsClient = new StatisticsClient(NETWORKS[ChainId.POLYGON_AMOY]);
|
|
309
|
+
*
|
|
310
|
+
* const hmtHolders = await statisticsClient.getHMTHolders({
|
|
311
|
+
* orderDirection: 'asc',
|
|
312
|
+
* });
|
|
313
|
+
*
|
|
314
|
+
* console.log('HMT holders:', hmtHolders.map((h) => ({
|
|
315
|
+
* ...h,
|
|
316
|
+
* balance: h.balance.toString(),
|
|
317
|
+
* })));
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
getHMTHolders(params?: IHMTHoldersParams): Promise<HMTHolder[]>;
|
|
295
321
|
}
|
|
296
322
|
//# sourceMappingURL=statistics.d.ts.map
|
package/dist/statistics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../src/statistics.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,gBAAgB,EAGhB,aAAa,EAEb,iBAAiB,EACjB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../src/statistics.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,gBAAgB,EAGhB,aAAa,EAEb,iBAAiB,EACjB,gBAAgB,EAEhB,SAAS,EACV,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,gBAAgB;IACpB,WAAW,EAAE,WAAW,CAAC;IACzB,WAAW,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;gBACS,WAAW,EAAE,WAAW;IAKpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IA6B5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC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