@human-protocol/sdk 1.1.11 → 1.1.13
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 +2 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +14 -14
- package/dist/error.d.ts +8 -0
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +10 -2
- package/dist/escrow.d.ts +31 -11
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +133 -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 +18 -2
- package/dist/graphql/queries/index.d.ts +1 -0
- package/dist/graphql/queries/index.d.ts.map +1 -1
- package/dist/graphql/queries/index.js +1 -0
- package/dist/graphql/queries/payout.d.ts +3 -0
- package/dist/graphql/queries/payout.d.ts.map +1 -0
- package/dist/graphql/queries/payout.js +49 -0
- package/dist/graphql/queries/staking.d.ts +4 -0
- package/dist/graphql/queries/staking.d.ts.map +1 -0
- package/dist/graphql/queries/staking.js +58 -0
- package/dist/graphql/queries/statistics.d.ts.map +1 -1
- package/dist/graphql/queries/statistics.js +10 -2
- package/dist/graphql/types.d.ts +24 -2
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/interfaces.d.ts +34 -9
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/staking.d.ts +8 -8
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +16 -38
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +2 -8
- package/dist/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +3 -0
- package/dist/types.d.ts +18 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/constants.ts +16 -14
- package/src/error.ts +14 -0
- package/src/escrow.ts +189 -46
- package/src/graphql/queries/escrow.ts +26 -2
- package/src/graphql/queries/index.ts +1 -0
- package/src/graphql/queries/payout.ts +47 -0
- package/src/graphql/queries/staking.ts +57 -0
- package/src/graphql/queries/statistics.ts +10 -2
- package/src/graphql/types.ts +29 -2
- package/src/index.ts +2 -1
- package/src/interfaces.ts +35 -14
- package/src/staking.ts +23 -53
- package/src/statistics.ts +2 -12
- package/src/storage.ts +3 -0
- package/src/types.ts +20 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GET_PAYOUTS_QUERY = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const PAYOUT_FRAGMENT = (0, graphql_tag_1.default) `
|
|
9
|
+
fragment PayoutFields on Payout {
|
|
10
|
+
id
|
|
11
|
+
escrowAddress
|
|
12
|
+
recipient
|
|
13
|
+
amount
|
|
14
|
+
createdAt
|
|
15
|
+
}
|
|
16
|
+
`;
|
|
17
|
+
const GET_PAYOUTS_QUERY = (filter) => {
|
|
18
|
+
const { escrowAddress, recipient, from, to } = filter;
|
|
19
|
+
const WHERE_CLAUSE = `
|
|
20
|
+
where: {
|
|
21
|
+
${escrowAddress ? `escrowAddress: $escrowAddress` : ''}
|
|
22
|
+
${recipient ? `recipient: $recipient` : ''}
|
|
23
|
+
${from ? `createdAt_gte: $from` : ''}
|
|
24
|
+
${to ? `createdAt_lt: $to` : ''}
|
|
25
|
+
}
|
|
26
|
+
`;
|
|
27
|
+
const LIMIT_CLAUSE = `
|
|
28
|
+
first: 1000
|
|
29
|
+
`;
|
|
30
|
+
return (0, graphql_tag_1.default) `
|
|
31
|
+
query getPayouts(
|
|
32
|
+
$escrowAddress: String
|
|
33
|
+
$recipient: String
|
|
34
|
+
$from: Int
|
|
35
|
+
$to: Int
|
|
36
|
+
) {
|
|
37
|
+
payouts(
|
|
38
|
+
${WHERE_CLAUSE}
|
|
39
|
+
orderBy: createdAt,
|
|
40
|
+
orderDirection: desc,
|
|
41
|
+
${LIMIT_CLAUSE}
|
|
42
|
+
) {
|
|
43
|
+
...PayoutFields
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
${PAYOUT_FRAGMENT}
|
|
47
|
+
`;
|
|
48
|
+
};
|
|
49
|
+
exports.GET_PAYOUTS_QUERY = GET_PAYOUTS_QUERY;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"staking.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/staking.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAuBhD,eAAO,MAAM,iBAAiB,WAAY,cAAc,mCAuBvD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.GET_LEADER_QUERY = exports.GET_LEADERS_QUERY = void 0;
|
|
7
|
+
const graphql_tag_1 = __importDefault(require("graphql-tag"));
|
|
8
|
+
const LEADER_FRAGMENT = (0, graphql_tag_1.default) `
|
|
9
|
+
fragment LeaderFields on Leader {
|
|
10
|
+
id
|
|
11
|
+
address
|
|
12
|
+
amountStaked
|
|
13
|
+
amountAllocated
|
|
14
|
+
amountLocked
|
|
15
|
+
lockedUntilTimestamp
|
|
16
|
+
amountWithdrawn
|
|
17
|
+
amountSlashed
|
|
18
|
+
reputation
|
|
19
|
+
reward
|
|
20
|
+
amountJobsLaunched
|
|
21
|
+
role
|
|
22
|
+
fee
|
|
23
|
+
publicKey
|
|
24
|
+
webhookUrl
|
|
25
|
+
url
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
const GET_LEADERS_QUERY = (filter) => {
|
|
29
|
+
const { role } = filter;
|
|
30
|
+
const WHERE_CLAUSE = `
|
|
31
|
+
where: {
|
|
32
|
+
${role ? `role: $role` : ''}
|
|
33
|
+
}
|
|
34
|
+
`;
|
|
35
|
+
return (0, graphql_tag_1.default) `
|
|
36
|
+
query getLeaders(
|
|
37
|
+
$role: String
|
|
38
|
+
) {
|
|
39
|
+
leaders(
|
|
40
|
+
${WHERE_CLAUSE}
|
|
41
|
+
orderBy: amountStaked,
|
|
42
|
+
orderDirection: desc,
|
|
43
|
+
) {
|
|
44
|
+
...LeaderFields
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
${LEADER_FRAGMENT}
|
|
48
|
+
`;
|
|
49
|
+
};
|
|
50
|
+
exports.GET_LEADERS_QUERY = GET_LEADERS_QUERY;
|
|
51
|
+
exports.GET_LEADER_QUERY = (0, graphql_tag_1.default) `
|
|
52
|
+
query getLeader($address: String!) {
|
|
53
|
+
leader(id: $address) {
|
|
54
|
+
...LeaderFields
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
${LEADER_FRAGMENT}
|
|
58
|
+
`;
|
|
@@ -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;AAmDrD,eAAO,MAAM,4BAA4B,gCAOxC,CAAC;AAEF,eAAO,MAAM,2BAA2B,gCAOvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAAY,iBAAiB,
|
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/statistics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAmDrD,eAAO,MAAM,4BAA4B,gCAOxC,CAAC;AAEF,eAAO,MAAM,2BAA2B,gCAOvC,CAAC;AAEF,eAAO,MAAM,wBAAwB,WAAY,iBAAiB,mCAyBjE,CAAC"}
|
|
@@ -68,16 +68,24 @@ exports.GET_ESCROW_STATISTICS_QUERY = (0, graphql_tag_1.default) `
|
|
|
68
68
|
${ESCROW_STATISTICS_FRAGMENT}
|
|
69
69
|
`;
|
|
70
70
|
const GET_EVENT_DAY_DATA_QUERY = (params) => {
|
|
71
|
-
const { from, to } = params;
|
|
71
|
+
const { from, to, limit } = params;
|
|
72
72
|
const WHERE_CLAUSE = `
|
|
73
73
|
where: {
|
|
74
74
|
${from !== undefined ? `timestamp_gte: $from` : ''}
|
|
75
75
|
${to !== undefined ? `timestamp_lte: $to` : ''}
|
|
76
76
|
}
|
|
77
|
+
`;
|
|
78
|
+
const LIMIT_CLAUSE = `
|
|
79
|
+
first: ${limit ? `$limit` : `1000`}
|
|
77
80
|
`;
|
|
78
81
|
return (0, graphql_tag_1.default) `
|
|
79
82
|
query GetEscrowDayData($from: Int, $to: Int) {
|
|
80
|
-
eventDayDatas(
|
|
83
|
+
eventDayDatas(
|
|
84
|
+
${WHERE_CLAUSE},
|
|
85
|
+
orderBy: timestamp,
|
|
86
|
+
orderDirection: desc,
|
|
87
|
+
${LIMIT_CLAUSE}
|
|
88
|
+
) {
|
|
81
89
|
...EventDayDataFields
|
|
82
90
|
}
|
|
83
91
|
}
|
package/dist/graphql/types.d.ts
CHANGED
|
@@ -15,10 +15,20 @@ export type EscrowData = {
|
|
|
15
15
|
recordingOracleFee?: string;
|
|
16
16
|
reputationOracle?: string;
|
|
17
17
|
reputationOracleFee?: string;
|
|
18
|
+
exchangeOracle?: string;
|
|
19
|
+
exchangeOracleFee?: string;
|
|
18
20
|
status: string;
|
|
19
21
|
token: string;
|
|
20
22
|
totalFundedAmount: string;
|
|
21
23
|
createdAt: string;
|
|
24
|
+
chainId: number;
|
|
25
|
+
};
|
|
26
|
+
export type PayoutData = {
|
|
27
|
+
id: string;
|
|
28
|
+
escrowAddress: string;
|
|
29
|
+
recipient: string;
|
|
30
|
+
amount: string;
|
|
31
|
+
createdAt: string;
|
|
22
32
|
};
|
|
23
33
|
export type HMTStatisticsData = {
|
|
24
34
|
totalTransferEventCount: string;
|
|
@@ -81,7 +91,6 @@ export type EscrowStatistics = {
|
|
|
81
91
|
export type DailyWorkerData = {
|
|
82
92
|
timestamp: Date;
|
|
83
93
|
activeWorkers: number;
|
|
84
|
-
averageJobsSolved: number;
|
|
85
94
|
};
|
|
86
95
|
export type WorkerStatistics = {
|
|
87
96
|
dailyWorkersData: DailyWorkerData[];
|
|
@@ -90,7 +99,6 @@ export type DailyPaymentData = {
|
|
|
90
99
|
timestamp: Date;
|
|
91
100
|
totalAmountPaid: BigNumber;
|
|
92
101
|
totalCount: number;
|
|
93
|
-
averageAmountPerJob: BigNumber;
|
|
94
102
|
averageAmountPerWorker: BigNumber;
|
|
95
103
|
};
|
|
96
104
|
export type PaymentStatistics = {
|
|
@@ -111,8 +119,22 @@ export type DailyHMTData = {
|
|
|
111
119
|
};
|
|
112
120
|
export type HMTStatistics = {
|
|
113
121
|
totalTransferAmount: BigNumber;
|
|
122
|
+
totalTransferCount: number;
|
|
114
123
|
totalHolders: number;
|
|
115
124
|
holders: HMTHolder[];
|
|
116
125
|
dailyHMTData: DailyHMTData[];
|
|
117
126
|
};
|
|
127
|
+
export type IMDataEntity = {
|
|
128
|
+
served: number;
|
|
129
|
+
solved: number;
|
|
130
|
+
};
|
|
131
|
+
export type IMData = Record<string, IMDataEntity>;
|
|
132
|
+
export type DailyTaskData = {
|
|
133
|
+
timestamp: Date;
|
|
134
|
+
tasksTotal: number;
|
|
135
|
+
tasksSolved: number;
|
|
136
|
+
};
|
|
137
|
+
export type TaskStatistics = {
|
|
138
|
+
dailyTasksData: DailyTaskData[];
|
|
139
|
+
};
|
|
118
140
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
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IACzB,SAAS,EAAE,IAAI,CAAC;IAChB,sBAAsB,EAAE,SAAS,CAAC;IAClC,qBAAqB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,mBAAmB,EAAE,SAAS,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,SAAS,EAAE,CAAC;IACrB,YAAY,EAAE,YAAY,EAAE,CAAC;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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { StakingClient } from './staking';
|
|
2
2
|
import { StorageClient } from './storage';
|
|
3
3
|
import { KVStoreClient } from './kvstore';
|
|
4
|
-
import { EscrowClient } from './escrow';
|
|
4
|
+
import { EscrowClient, EscrowUtils } from './escrow';
|
|
5
5
|
import { StatisticsClient } from './statistics';
|
|
6
6
|
export * from './constants';
|
|
7
7
|
export * from './types';
|
|
8
8
|
export * from './enums';
|
|
9
9
|
export * from './interfaces';
|
|
10
|
-
export { StakingClient, StorageClient, KVStoreClient, EscrowClient, StatisticsClient, };
|
|
10
|
+
export { StakingClient, StorageClient, KVStoreClient, EscrowClient, EscrowUtils, StatisticsClient, };
|
|
11
11
|
//# 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,MAAM,UAAU,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;AAEhD,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,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.StatisticsClient = exports.EscrowClient = exports.KVStoreClient = exports.StorageClient = exports.StakingClient = void 0;
|
|
17
|
+
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");
|
|
@@ -23,6 +23,7 @@ const kvstore_1 = require("./kvstore");
|
|
|
23
23
|
Object.defineProperty(exports, "KVStoreClient", { enumerable: true, get: function () { return kvstore_1.KVStoreClient; } });
|
|
24
24
|
const escrow_1 = require("./escrow");
|
|
25
25
|
Object.defineProperty(exports, "EscrowClient", { enumerable: true, get: function () { return escrow_1.EscrowClient; } });
|
|
26
|
+
Object.defineProperty(exports, "EscrowUtils", { enumerable: true, get: function () { return escrow_1.EscrowUtils; } });
|
|
26
27
|
const statistics_1 = require("./statistics");
|
|
27
28
|
Object.defineProperty(exports, "StatisticsClient", { enumerable: true, get: function () { return statistics_1.StatisticsClient; } });
|
|
28
29
|
__exportStar(require("./constants"), exports);
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BigNumber } from 'ethers';
|
|
2
|
+
import { EscrowStatus } from './types';
|
|
3
|
+
import { ChainId } from './enums';
|
|
2
4
|
export interface IAllocation {
|
|
3
5
|
escrowAddress: string;
|
|
4
6
|
staker: string;
|
|
@@ -10,28 +12,45 @@ export interface IReward {
|
|
|
10
12
|
escrowAddress: string;
|
|
11
13
|
amount: BigNumber;
|
|
12
14
|
}
|
|
13
|
-
export interface
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
export interface ILeader {
|
|
16
|
+
id: string;
|
|
17
|
+
address: string;
|
|
18
|
+
amountStaked: BigNumber;
|
|
19
|
+
amountAllocated: BigNumber;
|
|
20
|
+
amountLocked: BigNumber;
|
|
21
|
+
lockedUntilTimestamp: BigNumber;
|
|
22
|
+
amountWithdrawn: BigNumber;
|
|
23
|
+
amountSlashed: BigNumber;
|
|
24
|
+
reputation: BigNumber;
|
|
25
|
+
reward: BigNumber;
|
|
26
|
+
amountJobsLaunched: BigNumber;
|
|
27
|
+
role?: string;
|
|
28
|
+
fee?: BigNumber;
|
|
29
|
+
publicKey?: string;
|
|
30
|
+
webhookUrl?: string;
|
|
31
|
+
url?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface ILeadersFilter {
|
|
34
|
+
role?: string;
|
|
20
35
|
}
|
|
21
|
-
type EscrowStatus = 'Launched' | 'Pending' | 'Partial' | 'Paid' | 'Complete' | 'Cancelled';
|
|
22
36
|
export interface IEscrowsFilter {
|
|
23
37
|
launcher?: string;
|
|
24
38
|
reputationOracle?: string;
|
|
25
39
|
recordingOracle?: string;
|
|
40
|
+
exchangeOracle?: string;
|
|
41
|
+
jobRequesterId?: string;
|
|
26
42
|
status?: EscrowStatus;
|
|
27
43
|
from?: Date;
|
|
28
44
|
to?: Date;
|
|
45
|
+
networks: ChainId[];
|
|
29
46
|
}
|
|
30
47
|
export interface IEscrowConfig {
|
|
31
48
|
recordingOracle: string;
|
|
32
49
|
reputationOracle: string;
|
|
50
|
+
exchangeOracle: string;
|
|
33
51
|
recordingOracleFee: BigNumber;
|
|
34
52
|
reputationOracleFee: BigNumber;
|
|
53
|
+
exchangeOracleFee: BigNumber;
|
|
35
54
|
manifestUrl: string;
|
|
36
55
|
manifestHash: string;
|
|
37
56
|
}
|
|
@@ -44,6 +63,12 @@ export interface IKeyPair {
|
|
|
44
63
|
export interface IStatisticsParams {
|
|
45
64
|
from?: Date;
|
|
46
65
|
to?: Date;
|
|
66
|
+
limit?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface IPayoutFilter {
|
|
69
|
+
escrowAddress?: string;
|
|
70
|
+
recipient?: string;
|
|
71
|
+
from?: Date;
|
|
72
|
+
to?: Date;
|
|
47
73
|
}
|
|
48
|
-
export {};
|
|
49
74
|
//# sourceMappingURL=interfaces.d.ts.map
|
package/dist/interfaces.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../src/inter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M,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,SAAS,CAAC;IAC9B,mBAAmB,EAAE,SAAS,CAAC;IAC/B,iBAAiB,EAAE,SAAS,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,QAAQ;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;CACX"}
|
package/dist/staking.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Provider } from '@ethersproject/abstract-provider';
|
|
2
2
|
import { EscrowFactory, HMToken, Staking } from '@human-protocol/core/typechain-types';
|
|
3
3
|
import { BigNumber, Signer } from 'ethers';
|
|
4
|
-
import { IAllocation,
|
|
4
|
+
import { IAllocation, ILeader, ILeadersFilter, IReward } from './interfaces';
|
|
5
5
|
import { NetworkData } from './types';
|
|
6
6
|
export declare class StakingClient {
|
|
7
7
|
signerOrProvider: Signer | Provider;
|
|
@@ -96,20 +96,20 @@ export declare class StakingClient {
|
|
|
96
96
|
*/
|
|
97
97
|
distributeRewards(escrowAddress: string): Promise<void>;
|
|
98
98
|
/**
|
|
99
|
-
* **Returns the
|
|
99
|
+
* **Returns the leader details for a given address**
|
|
100
100
|
*
|
|
101
|
-
* @param {string}
|
|
102
|
-
* @returns {Promise<
|
|
101
|
+
* @param {string} address - Leader address
|
|
102
|
+
* @returns {Promise<ILeader>} - Return leader details
|
|
103
103
|
* @throws {Error} - An error object if an error occurred, result otherwise
|
|
104
104
|
*/
|
|
105
|
-
|
|
105
|
+
getLeader(address: string): Promise<ILeader>;
|
|
106
106
|
/**
|
|
107
|
-
* **Returns the
|
|
107
|
+
* **Returns the leaders data **
|
|
108
108
|
*
|
|
109
|
-
* @returns {Promise<
|
|
109
|
+
* @returns {Promise<ILeader[]>} - Return an array with leaders data
|
|
110
110
|
* @throws {Error} - An error object if an error occurred, results otherwise
|
|
111
111
|
*/
|
|
112
|
-
|
|
112
|
+
getLeaders(filter?: ILeadersFilter): Promise<ILeader[]>;
|
|
113
113
|
/**
|
|
114
114
|
* **Returns information about the allocation of the specified escrow.*
|
|
115
115
|
*
|
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,EAIP,OAAO,EAER,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"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Q,CACnB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,IAAI,CAAC;IAyBhB;;;;;;OAMG;IAEU,eAAe,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiBlE;;;;;;OAMG;IAEU,iBAAiB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAsBpE;;;;;;OAMG;IACU,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAkBzD;;;;;OAKG;IACU,UAAU,CAAC,MAAM,GAAE,cAAmB,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAcxE;;;;;;OAMG;IACU,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAiBvE;;;;;;OAMG;IACU,UAAU,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;CAsBpE"}
|
package/dist/staking.js
CHANGED
|
@@ -21,6 +21,7 @@ const decorators_1 = require("./decorators");
|
|
|
21
21
|
const error_1 = require("./error");
|
|
22
22
|
const utils_1 = require("./utils");
|
|
23
23
|
const reward_1 = require("./graphql/queries/reward");
|
|
24
|
+
const staking_1 = require("./graphql/queries/staking");
|
|
24
25
|
class StakingClient {
|
|
25
26
|
/**
|
|
26
27
|
* **StakingClient constructor**
|
|
@@ -257,61 +258,38 @@ class StakingClient {
|
|
|
257
258
|
}
|
|
258
259
|
}
|
|
259
260
|
/**
|
|
260
|
-
* **Returns the
|
|
261
|
+
* **Returns the leader details for a given address**
|
|
261
262
|
*
|
|
262
|
-
* @param {string}
|
|
263
|
-
* @returns {Promise<
|
|
263
|
+
* @param {string} address - Leader address
|
|
264
|
+
* @returns {Promise<ILeader>} - Return leader details
|
|
264
265
|
* @throws {Error} - An error object if an error occurred, result otherwise
|
|
265
266
|
*/
|
|
266
|
-
async
|
|
267
|
-
if (!ethers_1.ethers.utils.isAddress(
|
|
267
|
+
async getLeader(address) {
|
|
268
|
+
if (!ethers_1.ethers.utils.isAddress(address)) {
|
|
268
269
|
throw error_1.ErrorInvalidStakerAddressProvided;
|
|
269
270
|
}
|
|
270
271
|
try {
|
|
271
|
-
const
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
.sub(tokensLocked);
|
|
276
|
-
return {
|
|
277
|
-
staker,
|
|
278
|
-
tokensStaked,
|
|
279
|
-
tokensAllocated,
|
|
280
|
-
tokensLocked,
|
|
281
|
-
tokensLockedUntil,
|
|
282
|
-
tokensAvailable,
|
|
283
|
-
};
|
|
272
|
+
const { leader } = await (0, graphql_request_1.default)(this.network.subgraphUrl, staking_1.GET_LEADER_QUERY, {
|
|
273
|
+
address,
|
|
274
|
+
});
|
|
275
|
+
return leader;
|
|
284
276
|
}
|
|
285
277
|
catch (e) {
|
|
286
278
|
return (0, utils_1.throwError)(e);
|
|
287
279
|
}
|
|
288
280
|
}
|
|
289
281
|
/**
|
|
290
|
-
* **Returns the
|
|
282
|
+
* **Returns the leaders data **
|
|
291
283
|
*
|
|
292
|
-
* @returns {Promise<
|
|
284
|
+
* @returns {Promise<ILeader[]>} - Return an array with leaders data
|
|
293
285
|
* @throws {Error} - An error object if an error occurred, results otherwise
|
|
294
286
|
*/
|
|
295
|
-
async
|
|
287
|
+
async getLeaders(filter = {}) {
|
|
296
288
|
try {
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
throw error_1.ErrorStakingGetStakers;
|
|
300
|
-
}
|
|
301
|
-
return result[1].map((staker, index) => {
|
|
302
|
-
const tokensStaked = ethers_1.BigNumber.from(staker.tokensStaked), tokensAllocated = ethers_1.BigNumber.from(staker.tokensAllocated), tokensLocked = ethers_1.BigNumber.from(staker.tokensLocked), tokensLockedUntil = ethers_1.BigNumber.from(staker.tokensLockedUntil);
|
|
303
|
-
const tokensAvailable = tokensStaked
|
|
304
|
-
.sub(tokensAllocated)
|
|
305
|
-
.sub(tokensLocked);
|
|
306
|
-
return {
|
|
307
|
-
staker: result[0][index],
|
|
308
|
-
tokensStaked,
|
|
309
|
-
tokensAllocated,
|
|
310
|
-
tokensLocked,
|
|
311
|
-
tokensLockedUntil,
|
|
312
|
-
tokensAvailable,
|
|
313
|
-
};
|
|
289
|
+
const { leaders } = await (0, graphql_request_1.default)(this.network.subgraphUrl, (0, staking_1.GET_LEADERS_QUERY)(filter), {
|
|
290
|
+
role: filter.role,
|
|
314
291
|
});
|
|
292
|
+
return leaders;
|
|
315
293
|
}
|
|
316
294
|
catch (e) {
|
|
317
295
|
return (0, utils_1.throwError)(e);
|
package/dist/statistics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../src/statistics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statistics.d.ts","sourceRoot":"","sources":["../src/statistics.ts"],"names":[],"mappings":"AAIA,OAAO,EAKL,gBAAgB,EAGhB,aAAa,EAEb,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGtC,qBAAa,gBAAgB;IACpB,OAAO,EAAE,WAAW,CAAC;IAE5B;;;;OAIG;gBACS,OAAO,EAAE,WAAW;IAIhC;;;;;;OAMG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IA6B5B;;;;;;OAMG;IACG,mBAAmB,CACvB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC;IAoB5B;;;;;;OAMG;IACG,oBAAoB,CACxB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,iBAAiB,CAAC;IA2B7B;;;;;;OAMG;IACG,gBAAgB,CACpB,MAAM,GAAE,iBAAsB,GAC7B,OAAO,CAAC,aAAa,CAAC;CAuC1B"}
|
package/dist/statistics.js
CHANGED
|
@@ -5,10 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.StatisticsClient = void 0;
|
|
7
7
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
8
|
+
const ethers_1 = require("ethers");
|
|
8
9
|
const graphql_request_1 = __importDefault(require("graphql-request"));
|
|
9
10
|
const graphql_1 = require("./graphql");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
11
|
-
const ethers_1 = require("ethers");
|
|
12
12
|
class StatisticsClient {
|
|
13
13
|
/**
|
|
14
14
|
* **StatisticsClient constructor**
|
|
@@ -65,10 +65,6 @@ class StatisticsClient {
|
|
|
65
65
|
dailyWorkersData: eventDayDatas.map((eventDayData) => ({
|
|
66
66
|
timestamp: new Date(+eventDayData.timestamp * 1000),
|
|
67
67
|
activeWorkers: +eventDayData.dailyWorkerCount,
|
|
68
|
-
averageJobsSolved: eventDayData.dailyWorkerCount === '0'
|
|
69
|
-
? 0
|
|
70
|
-
: +eventDayData.dailyBulkPayoutEventCount /
|
|
71
|
-
+eventDayData.dailyWorkerCount,
|
|
72
68
|
})),
|
|
73
69
|
};
|
|
74
70
|
}
|
|
@@ -94,9 +90,6 @@ class StatisticsClient {
|
|
|
94
90
|
timestamp: new Date(+eventDayData.timestamp * 1000),
|
|
95
91
|
totalAmountPaid: ethers_1.BigNumber.from(eventDayData.dailyPayoutAmount),
|
|
96
92
|
totalCount: +eventDayData.dailyPayoutCount,
|
|
97
|
-
averageAmountPerJob: eventDayData.dailyBulkPayoutEventCount === '0'
|
|
98
|
-
? ethers_1.BigNumber.from(0)
|
|
99
|
-
: ethers_1.BigNumber.from(eventDayData.dailyPayoutAmount).div(eventDayData.dailyBulkPayoutEventCount),
|
|
100
93
|
averageAmountPerWorker: eventDayData.dailyWorkerCount === '0'
|
|
101
94
|
? ethers_1.BigNumber.from(0)
|
|
102
95
|
: ethers_1.BigNumber.from(eventDayData.dailyPayoutAmount).div(eventDayData.dailyWorkerCount),
|
|
@@ -124,6 +117,7 @@ class StatisticsClient {
|
|
|
124
117
|
});
|
|
125
118
|
return {
|
|
126
119
|
totalTransferAmount: ethers_1.BigNumber.from(hmtokenStatistics.totalValueTransfered),
|
|
120
|
+
totalTransferCount: Number(hmtokenStatistics.totalTransferEventCount),
|
|
127
121
|
totalHolders: +hmtokenStatistics.holders,
|
|
128
122
|
holders: holders.map((holder) => ({
|
|
129
123
|
address: holder.address,
|
package/dist/storage.d.ts
CHANGED
package/dist/storage.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxE,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAgB;IAEpC;;;;;OAKG;gBACS,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,kBAAkB;IAcnE;;;;;OAKG;IACU,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAoB1E;;;;;OAKG;WACiB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAsBlE;;;;;;OAMG;IACU,WAAW,CACtB,KAAK,EAAE,GAAG,EAAE,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,EAAE,CAAC;IAkCxB;;;;;OAKG;IACU,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3D;;;;;OAKG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAqB5D"}
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../src/storage.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAIxE;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,YAAY,CAAgB;IAEpC;;;;;OAKG;gBACS,MAAM,EAAE,aAAa,EAAE,WAAW,CAAC,EAAE,kBAAkB;IAcnE;;;;;OAKG;IACU,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAoB1E;;;;;OAKG;WACiB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC;IAsBlE;;;;;;OAMG;IACU,WAAW,CACtB,KAAK,EAAE,GAAG,EAAE,EACZ,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,UAAU,EAAE,CAAC;IAkCxB;;;;;OAKG;IACU,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3D;;;;;OAKG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAqB5D"}
|
package/dist/storage.js
CHANGED
|
@@ -34,6 +34,9 @@ const Minio = __importStar(require("minio"));
|
|
|
34
34
|
const error_1 = require("./error");
|
|
35
35
|
const utils_1 = require("./utils");
|
|
36
36
|
const constants_1 = require("./constants");
|
|
37
|
+
/**
|
|
38
|
+
* @deprecated StorageClient is deprecated. Use Minio.Client directly.
|
|
39
|
+
*/
|
|
37
40
|
class StorageClient {
|
|
38
41
|
/**
|
|
39
42
|
* **Storage client constructor**
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BigNumber } from 'ethers';
|
|
1
2
|
/**
|
|
2
3
|
* Enum for escrow statuses.
|
|
3
4
|
* @readonly
|
|
@@ -32,6 +33,7 @@ export declare enum EscrowStatus {
|
|
|
32
33
|
/**
|
|
33
34
|
* AWS/GCP cloud storage access data
|
|
34
35
|
* @readonly
|
|
36
|
+
* @deprecated StorageClient is deprecated. Use Minio.Client directly.
|
|
35
37
|
*/
|
|
36
38
|
export type StorageCredentials = {
|
|
37
39
|
/**
|
|
@@ -43,6 +45,9 @@ export type StorageCredentials = {
|
|
|
43
45
|
*/
|
|
44
46
|
secretKey: string;
|
|
45
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* @deprecated StorageClient is deprecated. Use Minio.Client directly.
|
|
50
|
+
*/
|
|
46
51
|
export type StorageParams = {
|
|
47
52
|
/**
|
|
48
53
|
* Request endPoint
|
|
@@ -128,4 +133,17 @@ export type NetworkData = {
|
|
|
128
133
|
*/
|
|
129
134
|
oldFactoryAddress: string;
|
|
130
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* Represents the response data for an escrow cancellation.
|
|
138
|
+
*/
|
|
139
|
+
export type EscrowCancel = {
|
|
140
|
+
/**
|
|
141
|
+
* The hash of the transaction associated with the escrow cancellation.
|
|
142
|
+
*/
|
|
143
|
+
txHash: string;
|
|
144
|
+
/**
|
|
145
|
+
* The amount refunded in the escrow cancellation.
|
|
146
|
+
*/
|
|
147
|
+
amountRefunded: BigNumber;
|
|
148
|
+
};
|
|
131
149
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,oBAAY,YAAY;IACtB;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,OAAO,IAAA;IACP;;OAEG;IACH,IAAI,IAAA;IACJ;;OAEG;IACH,QAAQ,IAAA;IACR;;OAEG;IACH,SAA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