@human-protocol/sdk 3.0.7 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.d.ts +2 -25
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +25 -66
- package/dist/decorators.js +1 -1
- package/dist/encryption.d.ts +21 -29
- package/dist/encryption.d.ts.map +1 -1
- package/dist/encryption.js +34 -36
- package/dist/error.d.ts +31 -28
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +36 -33
- package/dist/escrow.d.ts +118 -112
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +254 -180
- package/dist/graphql/queries/operator.d.ts.map +1 -1
- package/dist/graphql/queries/operator.js +15 -7
- 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 +29 -12
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +16 -16
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +16 -16
- package/dist/operator.d.ts +11 -10
- package/dist/operator.d.ts.map +1 -1
- package/dist/operator.js +36 -11
- package/dist/staking.d.ts +26 -118
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +46 -173
- package/dist/statistics.d.ts +10 -29
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +13 -30
- package/dist/storage.d.ts +13 -18
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +30 -25
- package/dist/transaction.js +1 -1
- package/dist/types.d.ts +23 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/utils.d.ts +0 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +0 -1
- package/package.json +8 -4
- package/src/constants.ts +25 -66
- package/src/decorators.ts +1 -1
- package/src/encryption.ts +21 -29
- package/src/error.ts +39 -37
- package/src/escrow.ts +360 -216
- package/src/graphql/queries/operator.ts +15 -7
- 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 +30 -13
- package/src/kvstore.ts +17 -17
- package/src/operator.ts +47 -12
- package/src/staking.ts +53 -187
- package/src/statistics.ts +13 -30
- package/src/storage.ts +13 -18
- package/src/transaction.ts +2 -2
- package/src/types.ts +24 -6
- package/src/utils.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA0BhD,eAAO,MAAM,iBAAiB,WAAY,cAAc,
|
|
1
|
+
{"version":3,"file":"operator.d.ts","sourceRoot":"","sources":["../../../src/graphql/queries/operator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AA0BhD,eAAO,MAAM,iBAAiB,WAAY,cAAc,mCA+BvD,CAAC;AAEF,eAAO,MAAM,4BAA4B,UAAW,MAAM,mCA0BzD,CAAC;AAEF,eAAO,MAAM,gBAAgB,gCAO5B,CAAC"}
|
|
@@ -10,39 +10,47 @@ 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) => {
|
|
32
|
-
const {
|
|
32
|
+
const { roles, minAmountStaked } = filter;
|
|
33
33
|
const WHERE_CLAUSE = `
|
|
34
34
|
where: {
|
|
35
|
-
${
|
|
35
|
+
${minAmountStaked ? `amountStaked_gte: $minAmountStaked` : ''}
|
|
36
|
+
${roles ? `role_in: $roles` : ''}
|
|
36
37
|
}
|
|
37
38
|
`;
|
|
38
39
|
return (0, graphql_tag_1.default) `
|
|
39
40
|
query getLeaders(
|
|
40
|
-
$
|
|
41
|
+
$minAmountStaked: Int,
|
|
42
|
+
$roles: [String!]
|
|
43
|
+
$first: Int
|
|
44
|
+
$skip: Int
|
|
45
|
+
$orderBy: String
|
|
46
|
+
$orderDirection: String
|
|
41
47
|
) {
|
|
42
48
|
leaders(
|
|
43
49
|
${WHERE_CLAUSE}
|
|
44
|
-
|
|
45
|
-
|
|
50
|
+
first: $first
|
|
51
|
+
skip: $skip
|
|
52
|
+
orderBy: $orderBy
|
|
53
|
+
orderDirection: $orderDirection
|
|
46
54
|
) {
|
|
47
55
|
...LeaderFields
|
|
48
56
|
}
|
|
@@ -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;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM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AAM,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,29 +9,34 @@ 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
|
-
export interface ILeadersFilter {
|
|
35
|
+
export interface ILeadersFilter extends IPagination {
|
|
40
36
|
chainId: ChainId;
|
|
41
|
-
|
|
37
|
+
roles?: string[];
|
|
38
|
+
minAmountStaked?: number;
|
|
39
|
+
orderBy?: string;
|
|
42
40
|
}
|
|
43
41
|
export interface IReputationNetwork {
|
|
44
42
|
id: string;
|
|
@@ -103,6 +101,15 @@ export interface IKVStore {
|
|
|
103
101
|
key: string;
|
|
104
102
|
value: string;
|
|
105
103
|
}
|
|
104
|
+
export interface InternalTransaction {
|
|
105
|
+
from: string;
|
|
106
|
+
to: string;
|
|
107
|
+
value: string;
|
|
108
|
+
method: string;
|
|
109
|
+
receiver?: string;
|
|
110
|
+
escrow?: string;
|
|
111
|
+
token?: string;
|
|
112
|
+
}
|
|
106
113
|
export interface ITransaction {
|
|
107
114
|
block: bigint;
|
|
108
115
|
txHash: string;
|
|
@@ -111,6 +118,10 @@ export interface ITransaction {
|
|
|
111
118
|
timestamp: bigint;
|
|
112
119
|
value: string;
|
|
113
120
|
method: string;
|
|
121
|
+
receiver?: string;
|
|
122
|
+
escrow?: string;
|
|
123
|
+
token?: string;
|
|
124
|
+
internalTransactions: InternalTransaction[];
|
|
114
125
|
}
|
|
115
126
|
export interface ITransactionsFilter extends IPagination {
|
|
116
127
|
chainId: ChainId;
|
|
@@ -126,4 +137,10 @@ export interface IPagination {
|
|
|
126
137
|
skip?: number;
|
|
127
138
|
orderDirection?: OrderDirection;
|
|
128
139
|
}
|
|
140
|
+
export interface StakerInfo {
|
|
141
|
+
stakedAmount: bigint;
|
|
142
|
+
lockedAmount: bigint;
|
|
143
|
+
lockedUntil: bigint;
|
|
144
|
+
withdrawableAmount: bigint;
|
|
145
|
+
}
|
|
129
146
|
//# 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,cAAc,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,WAAW,
|
|
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,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,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,OAAO,EA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C;CAChB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;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;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;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B"}
|
package/dist/kvstore.d.ts
CHANGED
|
@@ -6,19 +6,19 @@ import { IKVStore } from './interfaces';
|
|
|
6
6
|
/**
|
|
7
7
|
* ## Introduction
|
|
8
8
|
*
|
|
9
|
-
* This client enables
|
|
9
|
+
* This client enables performing actions on KVStore contract and obtaining information from both the contracts and subgraph.
|
|
10
10
|
*
|
|
11
11
|
* Internally, the SDK will use one network or another according to the network ID of the `runner`.
|
|
12
12
|
* To use this client, it is recommended to initialize it using the static `build` method.
|
|
13
13
|
*
|
|
14
14
|
* ```ts
|
|
15
|
-
* static async build(runner: ContractRunner)
|
|
15
|
+
* static async build(runner: ContractRunner): Promise<KVStoreClient>;
|
|
16
16
|
* ```
|
|
17
17
|
*
|
|
18
18
|
* A `Signer` or a `Provider` should be passed depending on the use case of this module:
|
|
19
19
|
*
|
|
20
|
-
* - **Signer**: when the user wants to use this model
|
|
21
|
-
* - **Provider**: when the user wants to use this model
|
|
20
|
+
* - **Signer**: when the user wants to use this model to send transactions calling the contract functions.
|
|
21
|
+
* - **Provider**: when the user wants to use this model to get information from the contracts or subgraph.
|
|
22
22
|
*
|
|
23
23
|
* ## Installation
|
|
24
24
|
*
|
|
@@ -36,21 +36,21 @@ import { IKVStore } from './interfaces';
|
|
|
36
36
|
*
|
|
37
37
|
* ### Signer
|
|
38
38
|
*
|
|
39
|
-
* **Using private key(backend)**
|
|
39
|
+
* **Using private key (backend)**
|
|
40
40
|
*
|
|
41
41
|
* ```ts
|
|
42
42
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
43
43
|
* import { Wallet, providers } from 'ethers';
|
|
44
44
|
*
|
|
45
45
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
46
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
46
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
47
47
|
*
|
|
48
48
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
49
49
|
* const signer = new Wallet(privateKey, provider);
|
|
50
50
|
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
|
-
* **Using Wagmi(frontend)**
|
|
53
|
+
* **Using Wagmi (frontend)**
|
|
54
54
|
*
|
|
55
55
|
* ```ts
|
|
56
56
|
* import { useSigner, useChainId } from 'wagmi';
|
|
@@ -69,7 +69,7 @@ import { IKVStore } from './interfaces';
|
|
|
69
69
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
70
70
|
*
|
|
71
71
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
72
|
-
* const kvstoreClient = await KVStoreClient.build(
|
|
72
|
+
* const kvstoreClient = await KVStoreClient.build(provider);
|
|
73
73
|
* ```
|
|
74
74
|
*/
|
|
75
75
|
export declare class KVStoreClient extends BaseEthersClient {
|
|
@@ -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
|
/**
|
|
@@ -109,7 +109,7 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
109
109
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
110
110
|
*
|
|
111
111
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
112
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
112
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
113
113
|
*
|
|
114
114
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
115
115
|
* const signer = new Wallet(privateKey, provider);
|
|
@@ -137,7 +137,7 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
137
137
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
138
138
|
*
|
|
139
139
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
140
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
140
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
141
141
|
*
|
|
142
142
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
143
143
|
* const signer = new Wallet(privateKey, provider);
|
|
@@ -145,7 +145,7 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
145
145
|
*
|
|
146
146
|
* const keys = ['role', 'webhook_url'];
|
|
147
147
|
* const values = ['RecordingOracle', 'http://localhost'];
|
|
148
|
-
* await kvstoreClient.
|
|
148
|
+
* await kvstoreClient.setBulk(keys, values);
|
|
149
149
|
* ```
|
|
150
150
|
*/
|
|
151
151
|
setBulk(keys: string[], values: string[], txOptions?: Overrides): Promise<void>;
|
|
@@ -165,14 +165,14 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
165
165
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
166
166
|
*
|
|
167
167
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
168
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
168
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
169
169
|
*
|
|
170
170
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
171
171
|
* const signer = new Wallet(privateKey, provider);
|
|
172
172
|
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
173
173
|
*
|
|
174
174
|
* await kvstoreClient.setFileUrlAndHash('example.com');
|
|
175
|
-
* await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url);
|
|
175
|
+
* await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url');
|
|
176
176
|
* ```
|
|
177
177
|
*/
|
|
178
178
|
setFileUrlAndHash(url: string, urlKey?: string, txOptions?: Overrides): Promise<void>;
|
|
@@ -203,9 +203,9 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
203
203
|
* ```ts
|
|
204
204
|
* import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
|
|
205
205
|
*
|
|
206
|
-
* const KVStoreAddresses =
|
|
206
|
+
* const KVStoreAddresses = await KVStoreUtils.getKVStoreData(
|
|
207
207
|
* ChainId.POLYGON_AMOY,
|
|
208
|
-
* "0x1234567890123456789012345678901234567890"
|
|
208
|
+
* "0x1234567890123456789012345678901234567890"
|
|
209
209
|
* );
|
|
210
210
|
* ```
|
|
211
211
|
*/
|
package/dist/kvstore.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAYlC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,qBAAa,aAAc,SAAQ,gBAAgB;IACjD,OAAO,CAAC,QAAQ,CAAU;IAE1B;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;IAS5D;;;;;;;;OAQG;WACiB,KAAK,CAAC,MAAM,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"kvstore.d.ts","sourceRoot":"","sources":["../src/kvstore.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAU,MAAM,QAAQ,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAYlC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAOtC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AAEH,qBAAa,aAAc,SAAQ,gBAAgB;IACjD,OAAO,CAAC,QAAQ,CAAU;IAE1B;;;;;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O,CAAC,MAAM,CAAC;CAenB"}
|
package/dist/kvstore.js
CHANGED
|
@@ -25,19 +25,19 @@ const kvstore_1 = require("./graphql/queries/kvstore");
|
|
|
25
25
|
/**
|
|
26
26
|
* ## Introduction
|
|
27
27
|
*
|
|
28
|
-
* This client enables
|
|
28
|
+
* This client enables performing actions on KVStore contract and obtaining information from both the contracts and subgraph.
|
|
29
29
|
*
|
|
30
30
|
* Internally, the SDK will use one network or another according to the network ID of the `runner`.
|
|
31
31
|
* To use this client, it is recommended to initialize it using the static `build` method.
|
|
32
32
|
*
|
|
33
33
|
* ```ts
|
|
34
|
-
* static async build(runner: ContractRunner)
|
|
34
|
+
* static async build(runner: ContractRunner): Promise<KVStoreClient>;
|
|
35
35
|
* ```
|
|
36
36
|
*
|
|
37
37
|
* A `Signer` or a `Provider` should be passed depending on the use case of this module:
|
|
38
38
|
*
|
|
39
|
-
* - **Signer**: when the user wants to use this model
|
|
40
|
-
* - **Provider**: when the user wants to use this model
|
|
39
|
+
* - **Signer**: when the user wants to use this model to send transactions calling the contract functions.
|
|
40
|
+
* - **Provider**: when the user wants to use this model to get information from the contracts or subgraph.
|
|
41
41
|
*
|
|
42
42
|
* ## Installation
|
|
43
43
|
*
|
|
@@ -55,21 +55,21 @@ const kvstore_1 = require("./graphql/queries/kvstore");
|
|
|
55
55
|
*
|
|
56
56
|
* ### Signer
|
|
57
57
|
*
|
|
58
|
-
* **Using private key(backend)**
|
|
58
|
+
* **Using private key (backend)**
|
|
59
59
|
*
|
|
60
60
|
* ```ts
|
|
61
61
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
62
62
|
* import { Wallet, providers } from 'ethers';
|
|
63
63
|
*
|
|
64
64
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
65
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
65
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
66
66
|
*
|
|
67
67
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
68
68
|
* const signer = new Wallet(privateKey, provider);
|
|
69
69
|
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
70
70
|
* ```
|
|
71
71
|
*
|
|
72
|
-
* **Using Wagmi(frontend)**
|
|
72
|
+
* **Using Wagmi (frontend)**
|
|
73
73
|
*
|
|
74
74
|
* ```ts
|
|
75
75
|
* import { useSigner, useChainId } from 'wagmi';
|
|
@@ -88,7 +88,7 @@ const kvstore_1 = require("./graphql/queries/kvstore");
|
|
|
88
88
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
89
89
|
*
|
|
90
90
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
91
|
-
* const kvstoreClient = await KVStoreClient.build(
|
|
91
|
+
* const kvstoreClient = await KVStoreClient.build(provider);
|
|
92
92
|
* ```
|
|
93
93
|
*/
|
|
94
94
|
class KVStoreClient extends base_1.BaseEthersClient {
|
|
@@ -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);
|
|
@@ -141,7 +141,7 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
141
141
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
142
142
|
*
|
|
143
143
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
144
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
144
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
145
145
|
*
|
|
146
146
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
147
147
|
* const signer = new Wallet(privateKey, provider);
|
|
@@ -179,7 +179,7 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
179
179
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
180
180
|
*
|
|
181
181
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
182
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
182
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
183
183
|
*
|
|
184
184
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
185
185
|
* const signer = new Wallet(privateKey, provider);
|
|
@@ -187,7 +187,7 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
187
187
|
*
|
|
188
188
|
* const keys = ['role', 'webhook_url'];
|
|
189
189
|
* const values = ['RecordingOracle', 'http://localhost'];
|
|
190
|
-
* await kvstoreClient.
|
|
190
|
+
* await kvstoreClient.setBulk(keys, values);
|
|
191
191
|
* ```
|
|
192
192
|
*/
|
|
193
193
|
async setBulk(keys, values, txOptions = {}) {
|
|
@@ -219,14 +219,14 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
219
219
|
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
220
220
|
*
|
|
221
221
|
* const rpcUrl = 'YOUR_RPC_URL';
|
|
222
|
-
* const privateKey = 'YOUR_PRIVATE_KEY'
|
|
222
|
+
* const privateKey = 'YOUR_PRIVATE_KEY';
|
|
223
223
|
*
|
|
224
224
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
225
225
|
* const signer = new Wallet(privateKey, provider);
|
|
226
226
|
* const kvstoreClient = await KVStoreClient.build(signer);
|
|
227
227
|
*
|
|
228
228
|
* await kvstoreClient.setFileUrlAndHash('example.com');
|
|
229
|
-
* await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url);
|
|
229
|
+
* await kvstoreClient.setFileUrlAndHash('linkedin.com/example', 'linkedin_url');
|
|
230
230
|
* ```
|
|
231
231
|
*/
|
|
232
232
|
async setFileUrlAndHash(url, urlKey = 'url', txOptions = {}) {
|
|
@@ -290,9 +290,9 @@ __decorate([
|
|
|
290
290
|
* ```ts
|
|
291
291
|
* import { ChainId, KVStoreUtils } from '@human-protocol/sdk';
|
|
292
292
|
*
|
|
293
|
-
* const KVStoreAddresses =
|
|
293
|
+
* const KVStoreAddresses = await KVStoreUtils.getKVStoreData(
|
|
294
294
|
* ChainId.POLYGON_AMOY,
|
|
295
|
-
* "0x1234567890123456789012345678901234567890"
|
|
295
|
+
* "0x1234567890123456789012345678901234567890"
|
|
296
296
|
* );
|
|
297
297
|
* ```
|
|
298
298
|
*/
|
package/dist/operator.d.ts
CHANGED
|
@@ -4,9 +4,9 @@ export declare class OperatorUtils {
|
|
|
4
4
|
/**
|
|
5
5
|
* This function returns the leader data for the given address.
|
|
6
6
|
*
|
|
7
|
+
* @param {ChainId} chainId Network in which the leader is deployed
|
|
7
8
|
* @param {string} address Leader address.
|
|
8
|
-
* @returns {ILeader} Returns the leader details.
|
|
9
|
-
*
|
|
9
|
+
* @returns {Promise<ILeader>} Returns the leader details.
|
|
10
10
|
*
|
|
11
11
|
* **Code example**
|
|
12
12
|
*
|
|
@@ -21,13 +21,12 @@ export declare class OperatorUtils {
|
|
|
21
21
|
* This function returns all the leader details of the protocol.
|
|
22
22
|
*
|
|
23
23
|
* @param {ILeadersFilter} filter Filter for the leaders.
|
|
24
|
-
* @returns {ILeader[]} Returns an array with all the leader details.
|
|
25
|
-
*
|
|
24
|
+
* @returns {Promise<ILeader[]>} Returns an array with all the leader details.
|
|
26
25
|
*
|
|
27
26
|
* **Code example**
|
|
28
27
|
*
|
|
29
28
|
* ```ts
|
|
30
|
-
* import { OperatorUtils } from '@human-protocol/sdk';
|
|
29
|
+
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
31
30
|
*
|
|
32
31
|
* const filter: ILeadersFilter = {
|
|
33
32
|
* chainId: ChainId.POLYGON
|
|
@@ -39,12 +38,14 @@ export declare class OperatorUtils {
|
|
|
39
38
|
/**
|
|
40
39
|
* Retrieves the reputation network operators of the specified address.
|
|
41
40
|
*
|
|
42
|
-
* @param {
|
|
41
|
+
* @param {ChainId} chainId Network in which the reputation network is deployed
|
|
42
|
+
* @param {string} address Address of the reputation oracle.
|
|
43
43
|
* @param {string} [role] - (Optional) Role of the operator.
|
|
44
44
|
* @returns {Promise<IOperator[]>} - Returns an array of operator details.
|
|
45
45
|
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
46
|
+
* **Code example**
|
|
47
|
+
*
|
|
48
|
+
* ```ts
|
|
48
49
|
* import { OperatorUtils, ChainId } from '@human-protocol/sdk';
|
|
49
50
|
*
|
|
50
51
|
* const operators = await OperatorUtils.getReputationNetworkOperators(ChainId.POLYGON_AMOY, '0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
@@ -54,9 +55,9 @@ export declare class OperatorUtils {
|
|
|
54
55
|
/**
|
|
55
56
|
* This function returns information about the rewards for a given slasher address.
|
|
56
57
|
*
|
|
58
|
+
* @param {ChainId} chainId Network in which the rewards are deployed
|
|
57
59
|
* @param {string} slasherAddress Slasher address.
|
|
58
|
-
* @returns {IReward[]} Returns an array of Reward objects that contain the rewards earned by the user through slashing other users.
|
|
59
|
-
*
|
|
60
|
+
* @returns {Promise<IReward[]>} Returns an array of Reward objects that contain the rewards earned by the user through slashing other users.
|
|
60
61
|
*
|
|
61
62
|
* **Code example**
|
|
62
63
|
*
|
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,
|
|
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,EAAkB,MAAM,SAAS,CAAC;AAGlD,qBAAa,aAAa;IACxB;;;;;;;;;;;;;;OAcG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC;IA2CnB;;;;;;;;;;;;;;;;OAgBG;WACiB,UAAU,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IA+D1E;;;;;;;;;;;;;;;OAeG;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"}
|