@human-protocol/sdk 4.1.5 → 4.3.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/base.d.ts +10 -1
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +21 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +10 -8
- package/dist/error.d.ts +2 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +3 -3
- package/dist/escrow.d.ts +6 -6
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +23 -24
- package/dist/graphql/queries/escrow.js +1 -1
- package/dist/interfaces.d.ts +2 -2
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +25 -0
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +42 -3
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +6 -5
- package/dist/utils.d.ts +7 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +17 -1
- package/package.json +6 -6
- package/src/base.ts +23 -1
- package/src/constants.ts +10 -7
- package/src/error.ts +2 -2
- package/src/escrow.ts +44 -27
- package/src/graphql/queries/escrow.ts +1 -1
- package/src/interfaces.ts +2 -2
- package/src/kvstore.ts +47 -3
- package/src/staking.ts +18 -5
- package/src/utils.ts +15 -0
package/dist/base.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContractRunner } from 'ethers';
|
|
1
|
+
import { ContractRunner, Overrides } from 'ethers';
|
|
2
2
|
import { NetworkData } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* ## Introduction
|
|
@@ -16,5 +16,14 @@ export declare abstract class BaseEthersClient {
|
|
|
16
16
|
* @param {NetworkData} networkData The network information required to connect to the contracts
|
|
17
17
|
*/
|
|
18
18
|
constructor(runner: ContractRunner, networkData: NetworkData);
|
|
19
|
+
/**
|
|
20
|
+
* Internal helper to enrich transaction overrides with network specific defaults.
|
|
21
|
+
*
|
|
22
|
+
* Aurora networks use a fixed gas price. We always override any user provided
|
|
23
|
+
* gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
|
|
24
|
+
* or tx failures due to an unexpected value. For other networks the user
|
|
25
|
+
* supplied fee parameters are left untouched.
|
|
26
|
+
*/
|
|
27
|
+
protected applyTxDefaults(txOptions?: Overrides): Overrides;
|
|
19
28
|
}
|
|
20
29
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAItC;;;;;GAKG;AACH,8BAAsB,gBAAgB;IACpC,SAAS,CAAC,MAAM,EAAE,cAAc,CAAC;IAC1B,WAAW,EAAE,WAAW,CAAC;IAEhC;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;IAK5D;;;;;;;OAOG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,GAAE,SAAc,GAAG,SAAS;CAWhE"}
|
package/dist/base.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseEthersClient = void 0;
|
|
4
|
+
const enums_1 = require("./enums");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
4
6
|
/**
|
|
5
7
|
* ## Introduction
|
|
6
8
|
*
|
|
@@ -18,5 +20,24 @@ class BaseEthersClient {
|
|
|
18
20
|
this.networkData = networkData;
|
|
19
21
|
this.runner = runner;
|
|
20
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Internal helper to enrich transaction overrides with network specific defaults.
|
|
25
|
+
*
|
|
26
|
+
* Aurora networks use a fixed gas price. We always override any user provided
|
|
27
|
+
* gasPrice with the canonical DEFAULT_AURORA_GAS_PRICE to avoid mismatches
|
|
28
|
+
* or tx failures due to an unexpected value. For other networks the user
|
|
29
|
+
* supplied fee parameters are left untouched.
|
|
30
|
+
*/
|
|
31
|
+
applyTxDefaults(txOptions = {}) {
|
|
32
|
+
if (this.networkData.chainId === enums_1.ChainId.AURORA_TESTNET) {
|
|
33
|
+
return {
|
|
34
|
+
...txOptions,
|
|
35
|
+
gasPrice: constants_1.DEFAULT_AURORA_GAS_PRICE,
|
|
36
|
+
maxFeePerGas: undefined,
|
|
37
|
+
maxPriorityFeePerGas: undefined,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return txOptions;
|
|
41
|
+
}
|
|
21
42
|
}
|
|
22
43
|
exports.BaseEthersClient = BaseEthersClient;
|
package/dist/constants.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const DEFAULT_ENDPOINT = "localhost";
|
|
|
5
5
|
export declare const DEFAULT_REGION = "eu";
|
|
6
6
|
export declare const DEFAULT_PORT = 9000;
|
|
7
7
|
export declare const DEFAULT_USE_SSL = false;
|
|
8
|
+
export declare const DEFAULT_AURORA_GAS_PRICE: bigint;
|
|
8
9
|
export declare enum HttpStatus {
|
|
9
10
|
OK = 200,
|
|
10
11
|
CREATED = 201,
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC,eAAO,MAAM,qBAAqB,0BAA0B,CAAC;AAE7D,eAAO,MAAM,gBAAgB,cAAc,CAAC;AAE5C,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,eAAO,MAAM,YAAY,OAAO,CAAC;AAEjC,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC,eAAO,MAAM,wBAAwB,QAAoC,CAAC;AAE1E,oBAAY,UAAU;IACpB,EAAE,MAAM;IACR,OAAO,MAAM;IACb,WAAW,MAAM;IACjB,YAAY,MAAM;IAClB,gBAAgB,MAAM;IACtB,SAAS,MAAM;IACf,SAAS,MAAM;IACf,qBAAqB,MAAM;CAC5B;AAED,eAAO,MAAM,QAAQ,EAAE;KACpB,OAAO,IAAI,OAAO,CAAC,CAAC,EAAE,WAAW;CA0HnC,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;CAavB,CAAC;AAEF,eAAO,MAAM,IAAI;;;;;CAKhB,CAAC;AAEF,eAAO,MAAM,4BAA4B,uBAAuB,CAAC;AAEjE,eAAO,MAAM,4BAA4B,KAAK,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ESCROW_BULK_PAYOUT_MAX_ITEMS = exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
|
|
3
|
+
exports.ESCROW_BULK_PAYOUT_MAX_ITEMS = exports.SUBGRAPH_API_KEY_PLACEHOLDER = exports.Role = exports.KVStoreKeys = exports.NETWORKS = exports.HttpStatus = exports.DEFAULT_AURORA_GAS_PRICE = exports.DEFAULT_USE_SSL = exports.DEFAULT_PORT = exports.DEFAULT_REGION = exports.DEFAULT_ENDPOINT = exports.DEFAULT_PUBLIC_BUCKET = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
4
5
|
const enums_1 = require("./enums");
|
|
5
6
|
exports.DEFAULT_PUBLIC_BUCKET = 'escrow-public-results';
|
|
6
7
|
exports.DEFAULT_ENDPOINT = 'localhost';
|
|
7
8
|
exports.DEFAULT_REGION = 'eu';
|
|
8
9
|
exports.DEFAULT_PORT = 9000;
|
|
9
10
|
exports.DEFAULT_USE_SSL = false;
|
|
11
|
+
exports.DEFAULT_AURORA_GAS_PRICE = ethers_1.ethers.parseUnits('0.07', 'gwei');
|
|
10
12
|
var HttpStatus;
|
|
11
13
|
(function (HttpStatus) {
|
|
12
14
|
HttpStatus[HttpStatus["OK"] = 200] = "OK";
|
|
@@ -28,7 +30,7 @@ exports.NETWORKS = {
|
|
|
28
30
|
stakingAddress: '0xEf6Da3aB52c33925Be3F84038193a7e1331F51E6',
|
|
29
31
|
kvstoreAddress: '0xB6d36B1CDaD50302BCB3DB43bAb0D349458e1b8D',
|
|
30
32
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/ethereum/version/latest',
|
|
31
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
33
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQwp4Rr2J4UbPFykb9eXg2t7GPcGRS6WT7QzExZtv32jK',
|
|
32
34
|
oldSubgraphUrl: '',
|
|
33
35
|
oldFactoryAddress: '',
|
|
34
36
|
},
|
|
@@ -41,7 +43,7 @@ exports.NETWORKS = {
|
|
|
41
43
|
stakingAddress: '0x2163e3A40032Af1C359ac731deaB48258b317890',
|
|
42
44
|
kvstoreAddress: '0xCc0AF0635aa19fE799B6aFDBe28fcFAeA7f00a60',
|
|
43
45
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/sepolia/version/latest',
|
|
44
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
46
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmURrhnEXimGnRzjeN3B4VMmioUeBHUBg4WJ7KZzJ7em8g',
|
|
45
47
|
oldSubgraphUrl: '',
|
|
46
48
|
oldFactoryAddress: '',
|
|
47
49
|
},
|
|
@@ -54,7 +56,7 @@ exports.NETWORKS = {
|
|
|
54
56
|
stakingAddress: '0xE24e5C08E28331D24758b69A5E9f383D2bDD1c98',
|
|
55
57
|
kvstoreAddress: '0x21A0C4CED7aE447fCf87D9FE3A29FA9B3AB20Ff1',
|
|
56
58
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc/version/latest',
|
|
57
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
59
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT2VoBLjAfc4pQzDmeCGra6weoLuk2jPRgnRz5iSMUw1t',
|
|
58
60
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsc',
|
|
59
61
|
oldFactoryAddress: '0xc88bC422cAAb2ac8812de03176402dbcA09533f4',
|
|
60
62
|
},
|
|
@@ -67,7 +69,7 @@ exports.NETWORKS = {
|
|
|
67
69
|
stakingAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
68
70
|
kvstoreAddress: '0x32e27177BA6Ea91cf28dfd91a0Da9822A4b74EcF',
|
|
69
71
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/bsc-testnet/version/latest',
|
|
70
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
72
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmZHqbiyAAwrmqsVJLhTEdejVGYJpXfJAkJXUw7C2VV1TD',
|
|
71
73
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/bsctest',
|
|
72
74
|
oldFactoryAddress: '0xaae6a2646c1f88763e62e0cd08ad050ea66ac46f',
|
|
73
75
|
},
|
|
@@ -80,7 +82,7 @@ exports.NETWORKS = {
|
|
|
80
82
|
stakingAddress: '0x01D115E9E8bF0C58318793624CC662a030D07F1D',
|
|
81
83
|
kvstoreAddress: '0xbcB28672F826a50B03EE91B28145EAbddA73B2eD',
|
|
82
84
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/polygon/version/latest',
|
|
83
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
85
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmT72ecfx6Zaje21kLNi17kDJTpPKFYvzQETDyLpQgDrPu',
|
|
84
86
|
oldSubgraphUrl: 'https://api.thegraph.com/subgraphs/name/humanprotocol/polygon',
|
|
85
87
|
oldFactoryAddress: '0x45eBc3eAE6DA485097054ae10BA1A0f8e8c7f794',
|
|
86
88
|
},
|
|
@@ -93,7 +95,7 @@ exports.NETWORKS = {
|
|
|
93
95
|
stakingAddress: '0xffE496683F842a923110415b7278ded3F265f2C5',
|
|
94
96
|
kvstoreAddress: '0x724AeFC243EdacCA27EAB86D3ec5a76Af4436Fc7',
|
|
95
97
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
96
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
98
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmeeE9bVkat1mkbQg1R6SXLuLadXxoNCY5b7CEQkmu6cQi',
|
|
97
99
|
oldSubgraphUrl: '',
|
|
98
100
|
oldFactoryAddress: '',
|
|
99
101
|
},
|
|
@@ -106,7 +108,7 @@ exports.NETWORKS = {
|
|
|
106
108
|
stakingAddress: '0x7457d26a3C70Bd71F7557C773b303c1dB82BBB68',
|
|
107
109
|
kvstoreAddress: '0xD6D347ba6987519B4e42EcED43dF98eFf5465a23',
|
|
108
110
|
subgraphUrl: 'https://api.studio.thegraph.com/query/74256/amoy/version/latest',
|
|
109
|
-
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/
|
|
111
|
+
subgraphUrlApiKey: 'https://gateway-arbitrum.network.thegraph.com/api/[SUBGRAPH_API_KEY]/deployments/id/QmQiLaFKusXLzKrpZvQDg7vETLhdfPgzWJN3Uxp3bE9K9W',
|
|
110
112
|
oldSubgraphUrl: '',
|
|
111
113
|
oldFactoryAddress: '',
|
|
112
114
|
},
|
package/dist/error.d.ts
CHANGED
|
@@ -131,9 +131,9 @@ export declare const ErrorManifestFileDoesNotExist: Error;
|
|
|
131
131
|
*/
|
|
132
132
|
export declare const ErrorInvalidUrl: Error;
|
|
133
133
|
/**
|
|
134
|
-
* @constant {Error} -
|
|
134
|
+
* @constant {Error} - Invalid manifest.
|
|
135
135
|
*/
|
|
136
|
-
export declare const
|
|
136
|
+
export declare const ErrorInvalidManifest: Error;
|
|
137
137
|
/**
|
|
138
138
|
* @constant {Error} - List of handlers cannot be empty.
|
|
139
139
|
*/
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAA2C,CAAC;AAE5E;;GAEG;AACH,eAAO,MAAM,gCAAgC,OAE5C,CAAC;AAEF;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
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorTooManyRecipients = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.
|
|
3
|
+
exports.EthereumError = exports.WarnSubgraphApiKeyNotProvided = exports.ErrorUnsupportedStatus = exports.ErrorInvalidHash = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorTooManyRecipients = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorInvalidManifest = exports.ErrorInvalidUrl = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = exports.ErrorCannotUseDateAndBlockSimultaneously = exports.ErrorInvalidHashProvided = exports.ErrorInvalidStakerAddressProvided = exports.ErrorInvalidSlasherAddressProvided = exports.ErrorInvalidStakingValueSign = exports.ErrorInvalidStakingValueType = exports.ErrorStakingValueMustBePositive = exports.ErrorInvalidExchangeOracleAddressProvided = exports.ErrorInvalidReputationOracleAddressProvided = exports.ErrorInvalidRecordingOracleAddressProvided = exports.ErrorInvalidTokenAddress = exports.ErrorInvalidAddress = exports.ErrorKVStoreArrayLength = exports.ErrorKVStoreEmptyKey = exports.ErrorStorageFileNotUploaded = exports.ErrorStorageFileNotFound = exports.ErrorStorageBucketNotFound = exports.ErrorStorageCredentialsMissing = exports.ErrorStorageClientNotExists = exports.ErrorStorageClientNotInitialized = exports.ErrorStakingMissing = void 0;
|
|
4
4
|
exports.InvalidKeyError = exports.InvalidEthereumAddressError = exports.ContractExecutionError = exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @constant {Error} - The Staking contract is missing.
|
|
@@ -135,9 +135,9 @@ exports.ErrorManifestFileDoesNotExist = new Error('Manifest file does not exist'
|
|
|
135
135
|
*/
|
|
136
136
|
exports.ErrorInvalidUrl = new Error('Invalid URL string');
|
|
137
137
|
/**
|
|
138
|
-
* @constant {Error} -
|
|
138
|
+
* @constant {Error} - Invalid manifest.
|
|
139
139
|
*/
|
|
140
|
-
exports.
|
|
140
|
+
exports.ErrorInvalidManifest = new Error('Invalid manifest');
|
|
141
141
|
/**
|
|
142
142
|
* @constant {Error} - List of handlers cannot be empty.
|
|
143
143
|
*/
|
package/dist/escrow.d.ts
CHANGED
|
@@ -162,7 +162,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
162
162
|
* recordingOracleFee: BigInt('10'),
|
|
163
163
|
* reputationOracleFee: BigInt('10'),
|
|
164
164
|
* exchangeOracleFee: BigInt('10'),
|
|
165
|
-
*
|
|
165
|
+
* manifest: 'http://localhost/manifest.json',
|
|
166
166
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
167
167
|
* };
|
|
168
168
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
@@ -463,7 +463,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
463
463
|
*/
|
|
464
464
|
getManifestHash(escrowAddress: string): Promise<string>;
|
|
465
465
|
/**
|
|
466
|
-
* This function returns the manifest
|
|
466
|
+
* This function returns the manifest. Could be a URL or a JSON string.
|
|
467
467
|
*
|
|
468
468
|
* @param {string} escrowAddress Address of the escrow.
|
|
469
469
|
* @returns {Promise<string>} Url of the manifest.
|
|
@@ -479,10 +479,10 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
479
479
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
480
480
|
* const escrowClient = await EscrowClient.build(provider);
|
|
481
481
|
*
|
|
482
|
-
* const
|
|
482
|
+
* const manifest = await escrowClient.getManifest('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
483
483
|
* ```
|
|
484
484
|
*/
|
|
485
|
-
|
|
485
|
+
getManifest(escrowAddress: string): Promise<string>;
|
|
486
486
|
/**
|
|
487
487
|
* This function returns the results file URL.
|
|
488
488
|
*
|
|
@@ -772,7 +772,7 @@ export declare class EscrowUtils {
|
|
|
772
772
|
* intermediateResultsUrl?: string;
|
|
773
773
|
* launcher: string;
|
|
774
774
|
* manifestHash?: string;
|
|
775
|
-
*
|
|
775
|
+
* manifest?: string;
|
|
776
776
|
* recordingOracle?: string;
|
|
777
777
|
* reputationOracle?: string;
|
|
778
778
|
* exchangeOracle?: string;
|
|
@@ -835,7 +835,7 @@ export declare class EscrowUtils {
|
|
|
835
835
|
* intermediateResultsUrl?: string;
|
|
836
836
|
* launcher: string;
|
|
837
837
|
* manifestHash?: string;
|
|
838
|
-
*
|
|
838
|
+
* manifest?: string;
|
|
839
839
|
* recordingOracle?: string;
|
|
840
840
|
* reputationOracle?: string;
|
|
841
841
|
* exchangeOracle?: string;
|
package/dist/escrow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AA0BlD,OAAO,EAML,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,wBAAwB,EACxB,MAAM,EACP,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAkB,MAAM,QAAQ,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAkB,MAAM,SAAS,CAAC;AA0BlD,OAAO,EAML,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,OAAO,EACP,aAAa,EACb,cAAc,EACd,aAAa,EACb,kBAAkB,EACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,WAAW,EACX,wBAAwB,EACxB,MAAM,EACP,MAAM,SAAS,CAAC;AASjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,qBAAqB,CAAgB;IAE7C;;;;;OAKG;gBACS,MAAM,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DG;WACiB,SAAS,CAC3B,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,OAAO,CAAC;IAoBnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuDG;WACiB,eAAe,CACjC,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAAC,WAAW,EAAE,CAAC;IA+DzB;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;WACiB,UAAU,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;CAiCzE"}
|
package/dist/escrow.js
CHANGED
|
@@ -180,7 +180,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
182
|
try {
|
|
183
|
-
const result = await (await this.escrowFactoryContract.createEscrow(tokenAddress, trustedHandlers, jobRequesterId, txOptions)).wait();
|
|
183
|
+
const result = await (await this.escrowFactoryContract.createEscrow(tokenAddress, trustedHandlers, jobRequesterId, this.applyTxDefaults(txOptions))).wait();
|
|
184
184
|
const event = result?.logs?.find(({ topics }) => topics.includes(ethers_1.ethers.id('LaunchedV2(address,address,string)')))?.args;
|
|
185
185
|
if (!event) {
|
|
186
186
|
throw error_1.ErrorLaunchedEventIsNotEmitted;
|
|
@@ -223,14 +223,14 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
223
223
|
* recordingOracleFee: BigInt('10'),
|
|
224
224
|
* reputationOracleFee: BigInt('10'),
|
|
225
225
|
* exchangeOracleFee: BigInt('10'),
|
|
226
|
-
*
|
|
226
|
+
* manifest: 'http://localhost/manifest.json',
|
|
227
227
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
228
228
|
* };
|
|
229
229
|
* await escrowClient.setup(escrowAddress, escrowConfig);
|
|
230
230
|
* ```
|
|
231
231
|
*/
|
|
232
232
|
async setup(escrowAddress, escrowConfig, txOptions = {}) {
|
|
233
|
-
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee,
|
|
233
|
+
const { recordingOracle, reputationOracle, exchangeOracle, recordingOracleFee, reputationOracleFee, exchangeOracleFee, manifest, manifestHash, } = escrowConfig;
|
|
234
234
|
if (!ethers_1.ethers.isAddress(recordingOracle)) {
|
|
235
235
|
throw error_1.ErrorInvalidRecordingOracleAddressProvided;
|
|
236
236
|
}
|
|
@@ -251,11 +251,9 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
251
251
|
if (recordingOracleFee + reputationOracleFee + exchangeOracleFee > 100) {
|
|
252
252
|
throw error_1.ErrorTotalFeeMustBeLessThanHundred;
|
|
253
253
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
if (!(0, utils_1.isValidUrl)(manifestUrl)) {
|
|
258
|
-
throw error_1.ErrorInvalidUrl;
|
|
254
|
+
const isManifestValid = (0, utils_1.isValidUrl)(manifest) || (0, utils_1.isValidJson)(manifest);
|
|
255
|
+
if (!isManifestValid) {
|
|
256
|
+
throw error_1.ErrorInvalidManifest;
|
|
259
257
|
}
|
|
260
258
|
if (!manifestHash) {
|
|
261
259
|
throw error_1.ErrorHashIsEmptyString;
|
|
@@ -265,7 +263,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
265
263
|
}
|
|
266
264
|
try {
|
|
267
265
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
268
|
-
await (await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee,
|
|
266
|
+
await (await escrowContract.setup(reputationOracle, recordingOracle, exchangeOracle, reputationOracleFee, recordingOracleFee, exchangeOracleFee, manifest, manifestHash, this.applyTxDefaults(txOptions))).wait();
|
|
269
267
|
return;
|
|
270
268
|
}
|
|
271
269
|
catch (e) {
|
|
@@ -312,7 +310,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
312
310
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
313
311
|
const tokenAddress = await escrowContract.token();
|
|
314
312
|
const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.runner);
|
|
315
|
-
await (await tokenContract.transfer(escrowAddress, amount, txOptions)).wait();
|
|
313
|
+
await (await tokenContract.transfer(escrowAddress, amount, this.applyTxDefaults(txOptions))).wait();
|
|
316
314
|
return;
|
|
317
315
|
}
|
|
318
316
|
catch (e) {
|
|
@@ -352,7 +350,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
352
350
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
353
351
|
}
|
|
354
352
|
if (!url) {
|
|
355
|
-
throw error_1.
|
|
353
|
+
throw error_1.ErrorInvalidUrl;
|
|
356
354
|
}
|
|
357
355
|
if (!(0, utils_1.isValidUrl)(url)) {
|
|
358
356
|
throw error_1.ErrorInvalidUrl;
|
|
@@ -365,7 +363,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
365
363
|
}
|
|
366
364
|
try {
|
|
367
365
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
368
|
-
await (await escrowContract.storeResults(url, hash, txOptions)).wait();
|
|
366
|
+
await (await escrowContract.storeResults(url, hash, this.applyTxDefaults(txOptions))).wait();
|
|
369
367
|
return;
|
|
370
368
|
}
|
|
371
369
|
catch (e) {
|
|
@@ -407,7 +405,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
407
405
|
}
|
|
408
406
|
try {
|
|
409
407
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
410
|
-
await (await escrowContract.complete(txOptions)).wait();
|
|
408
|
+
await (await escrowContract.complete(this.applyTxDefaults(txOptions))).wait();
|
|
411
409
|
return;
|
|
412
410
|
}
|
|
413
411
|
catch (e) {
|
|
@@ -457,10 +455,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
457
455
|
try {
|
|
458
456
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
459
457
|
if (forceComplete) {
|
|
460
|
-
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, txId, forceComplete, txOptions)).wait();
|
|
458
|
+
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256,bool)'](recipients, amounts, finalResultsUrl, finalResultsHash, txId, forceComplete, this.applyTxDefaults(txOptions))).wait();
|
|
461
459
|
}
|
|
462
460
|
else {
|
|
463
|
-
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256)'](recipients, amounts, finalResultsUrl, finalResultsHash, txId, txOptions)).wait();
|
|
461
|
+
await (await escrowContract['bulkPayOut(address[],uint256[],string,string,uint256)'](recipients, amounts, finalResultsUrl, finalResultsHash, txId, this.applyTxDefaults(txOptions))).wait();
|
|
464
462
|
}
|
|
465
463
|
return;
|
|
466
464
|
}
|
|
@@ -503,7 +501,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
503
501
|
}
|
|
504
502
|
try {
|
|
505
503
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
506
|
-
const transactionReceipt = await (await escrowContract.cancel(txOptions)).wait();
|
|
504
|
+
const transactionReceipt = await (await escrowContract.cancel(this.applyTxDefaults(txOptions))).wait();
|
|
507
505
|
let amountTransferred = undefined;
|
|
508
506
|
const tokenAddress = await escrowContract.token();
|
|
509
507
|
const tokenContract = typechain_types_1.HMToken__factory.connect(tokenAddress, this.runner);
|
|
@@ -579,7 +577,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
579
577
|
}
|
|
580
578
|
try {
|
|
581
579
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
582
|
-
await (await escrowContract.addTrustedHandlers(trustedHandlers, txOptions)).wait();
|
|
580
|
+
await (await escrowContract.addTrustedHandlers(trustedHandlers, this.applyTxDefaults(txOptions))).wait();
|
|
583
581
|
return;
|
|
584
582
|
}
|
|
585
583
|
catch (e) {
|
|
@@ -628,7 +626,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
628
626
|
}
|
|
629
627
|
try {
|
|
630
628
|
const escrowContract = this.getEscrowContract(escrowAddress);
|
|
631
|
-
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress, txOptions)).wait();
|
|
629
|
+
const transactionReceipt = await (await escrowContract.withdraw(tokenAddress, this.applyTxDefaults(txOptions))).wait();
|
|
632
630
|
let amountTransferred = undefined;
|
|
633
631
|
const tokenContract = typechain_types_1.ERC20__factory.connect(tokenAddress, this.runner);
|
|
634
632
|
if (transactionReceipt)
|
|
@@ -700,6 +698,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
700
698
|
* (await signer.sendTransaction(rawTransaction)).wait();
|
|
701
699
|
*/
|
|
702
700
|
async createBulkPayoutTransaction(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash, txId, forceComplete = false, txOptions = {}) {
|
|
701
|
+
txOptions = this.applyTxDefaults(txOptions);
|
|
703
702
|
await this.ensureCorrectBulkPayoutInput(escrowAddress, recipients, amounts, finalResultsUrl, finalResultsHash);
|
|
704
703
|
const signer = this.runner;
|
|
705
704
|
try {
|
|
@@ -756,7 +755,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
756
755
|
}
|
|
757
756
|
});
|
|
758
757
|
if (!finalResultsUrl) {
|
|
759
|
-
throw error_1.
|
|
758
|
+
throw error_1.ErrorInvalidUrl;
|
|
760
759
|
}
|
|
761
760
|
if (!(0, utils_1.isValidUrl)(finalResultsUrl)) {
|
|
762
761
|
throw error_1.ErrorInvalidUrl;
|
|
@@ -853,7 +852,7 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
853
852
|
}
|
|
854
853
|
}
|
|
855
854
|
/**
|
|
856
|
-
* This function returns the manifest
|
|
855
|
+
* This function returns the manifest. Could be a URL or a JSON string.
|
|
857
856
|
*
|
|
858
857
|
* @param {string} escrowAddress Address of the escrow.
|
|
859
858
|
* @returns {Promise<string>} Url of the manifest.
|
|
@@ -869,10 +868,10 @@ class EscrowClient extends base_1.BaseEthersClient {
|
|
|
869
868
|
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
870
869
|
* const escrowClient = await EscrowClient.build(provider);
|
|
871
870
|
*
|
|
872
|
-
* const
|
|
871
|
+
* const manifest = await escrowClient.getManifest('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
873
872
|
* ```
|
|
874
873
|
*/
|
|
875
|
-
async
|
|
874
|
+
async getManifest(escrowAddress) {
|
|
876
875
|
if (!ethers_1.ethers.isAddress(escrowAddress)) {
|
|
877
876
|
throw error_1.ErrorInvalidEscrowAddressProvided;
|
|
878
877
|
}
|
|
@@ -1363,7 +1362,7 @@ class EscrowUtils {
|
|
|
1363
1362
|
* intermediateResultsUrl?: string;
|
|
1364
1363
|
* launcher: string;
|
|
1365
1364
|
* manifestHash?: string;
|
|
1366
|
-
*
|
|
1365
|
+
* manifest?: string;
|
|
1367
1366
|
* recordingOracle?: string;
|
|
1368
1367
|
* reputationOracle?: string;
|
|
1369
1368
|
* exchangeOracle?: string;
|
|
@@ -1469,7 +1468,7 @@ class EscrowUtils {
|
|
|
1469
1468
|
* intermediateResultsUrl?: string;
|
|
1470
1469
|
* launcher: string;
|
|
1471
1470
|
* manifestHash?: string;
|
|
1472
|
-
*
|
|
1471
|
+
* manifest?: string;
|
|
1473
1472
|
* recordingOracle?: string;
|
|
1474
1473
|
* reputationOracle?: string;
|
|
1475
1474
|
* exchangeOracle?: string;
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface IEscrow {
|
|
|
67
67
|
intermediateResultsUrl?: string;
|
|
68
68
|
launcher: string;
|
|
69
69
|
manifestHash?: string;
|
|
70
|
-
|
|
70
|
+
manifest?: string;
|
|
71
71
|
recordingOracle?: string;
|
|
72
72
|
reputationOracle?: string;
|
|
73
73
|
exchangeOracle?: string;
|
|
@@ -95,7 +95,7 @@ export interface IEscrowConfig {
|
|
|
95
95
|
recordingOracleFee: bigint;
|
|
96
96
|
reputationOracleFee: bigint;
|
|
97
97
|
exchangeOracleFee: bigint;
|
|
98
|
-
|
|
98
|
+
manifest: string;
|
|
99
99
|
manifestHash: string;
|
|
100
100
|
}
|
|
101
101
|
export interface IKeyPair {
|
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,OAAO;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAAS;IACxB,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;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,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,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;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;AAED,MAAM,WAAW,kBAAmB,SAAQ,WAAW;IACrD,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,EAAE,CAAC,EAAE,IAAI,CAAC;IACV,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,sBAAsB,EAAE,MAAM,CAAC;IAC/B,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/kvstore.d.ts
CHANGED
|
@@ -176,6 +176,31 @@ export declare class KVStoreClient extends BaseEthersClient {
|
|
|
176
176
|
* ```
|
|
177
177
|
*/
|
|
178
178
|
setFileUrlAndHash(url: string, urlKey?: string, txOptions?: Overrides): Promise<void>;
|
|
179
|
+
/**
|
|
180
|
+
* Gets the value of a key-value pair in the contract.
|
|
181
|
+
*
|
|
182
|
+
* @param {string} address Address from which to get the key value.
|
|
183
|
+
* @param {string} key Key to obtain the value.
|
|
184
|
+
* @returns {string} Value of the key.
|
|
185
|
+
*
|
|
186
|
+
*
|
|
187
|
+
* **Code example**
|
|
188
|
+
*
|
|
189
|
+
* > Need to have available stake.
|
|
190
|
+
*
|
|
191
|
+
* ```ts
|
|
192
|
+
* import { providers } from 'ethers';
|
|
193
|
+
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
194
|
+
*
|
|
195
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
196
|
+
*
|
|
197
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
198
|
+
* const kvstoreClient = await KVStoreClient.build(provider);
|
|
199
|
+
*
|
|
200
|
+
* const value = await kvstoreClient.get('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', 'Role');
|
|
201
|
+
* ```
|
|
202
|
+
*/
|
|
203
|
+
get(address: string, key: string): Promise<string>;
|
|
179
204
|
}
|
|
180
205
|
/**
|
|
181
206
|
* ## Introduction
|
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,E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U,iBAAiB,CAC5B,GAAG,EAAE,MAAM,EACX,MAAM,SAAQ,EACd,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC,IAAI,CAAC;IAuBhB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACU,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAYhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,YAAY;IACvB;;;;;;;;;;;;;;;;;OAiBG;WACiB,cAAc,CAChC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,QAAQ,EAAE,CAAC;IAyBtB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;WACiB,GAAG,CACrB,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC;IAuBlB;;;;;;;;;;;;;;;;;;;OAmBG;WACiB,uBAAuB,CACzC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,SAAQ,GACb,OAAO,CAAC,MAAM,CAAC;IAqClB;;;;;;;;;;;;;;;;;;OAkBG;WACiB,YAAY,CAC9B,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC;CAenB"}
|
package/dist/kvstore.js
CHANGED
|
@@ -154,7 +154,7 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
154
154
|
if (key === '')
|
|
155
155
|
throw error_1.ErrorKVStoreEmptyKey;
|
|
156
156
|
try {
|
|
157
|
-
await (await this.contract.set(key, value, txOptions)).wait();
|
|
157
|
+
await (await this.contract.set(key, value, this.applyTxDefaults(txOptions))).wait();
|
|
158
158
|
}
|
|
159
159
|
catch (e) {
|
|
160
160
|
if (e instanceof Error)
|
|
@@ -196,7 +196,7 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
196
196
|
if (keys.includes(''))
|
|
197
197
|
throw error_1.ErrorKVStoreEmptyKey;
|
|
198
198
|
try {
|
|
199
|
-
await (await this.contract.setBulk(keys, values, txOptions)).wait();
|
|
199
|
+
await (await this.contract.setBulk(keys, values, this.applyTxDefaults(txOptions))).wait();
|
|
200
200
|
}
|
|
201
201
|
catch (e) {
|
|
202
202
|
if (e instanceof Error)
|
|
@@ -237,13 +237,52 @@ class KVStoreClient extends base_1.BaseEthersClient {
|
|
|
237
237
|
const contentHash = ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(content));
|
|
238
238
|
const hashKey = urlKey + '_hash';
|
|
239
239
|
try {
|
|
240
|
-
await (await this.contract.setBulk([urlKey, hashKey], [url, contentHash], txOptions)).wait();
|
|
240
|
+
await (await this.contract.setBulk([urlKey, hashKey], [url, contentHash], this.applyTxDefaults(txOptions))).wait();
|
|
241
241
|
}
|
|
242
242
|
catch (e) {
|
|
243
243
|
if (e instanceof Error)
|
|
244
244
|
throw Error(`Failed to set URL and hash: ${e.message}`);
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Gets the value of a key-value pair in the contract.
|
|
249
|
+
*
|
|
250
|
+
* @param {string} address Address from which to get the key value.
|
|
251
|
+
* @param {string} key Key to obtain the value.
|
|
252
|
+
* @returns {string} Value of the key.
|
|
253
|
+
*
|
|
254
|
+
*
|
|
255
|
+
* **Code example**
|
|
256
|
+
*
|
|
257
|
+
* > Need to have available stake.
|
|
258
|
+
*
|
|
259
|
+
* ```ts
|
|
260
|
+
* import { providers } from 'ethers';
|
|
261
|
+
* import { KVStoreClient } from '@human-protocol/sdk';
|
|
262
|
+
*
|
|
263
|
+
* const rpcUrl = 'YOUR_RPC_URL';
|
|
264
|
+
*
|
|
265
|
+
* const provider = new providers.JsonRpcProvider(rpcUrl);
|
|
266
|
+
* const kvstoreClient = await KVStoreClient.build(provider);
|
|
267
|
+
*
|
|
268
|
+
* const value = await kvstoreClient.get('0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', 'Role');
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
async get(address, key) {
|
|
272
|
+
if (key === '')
|
|
273
|
+
throw error_1.ErrorKVStoreEmptyKey;
|
|
274
|
+
if (!ethers_1.ethers.isAddress(address))
|
|
275
|
+
throw error_1.ErrorInvalidAddress;
|
|
276
|
+
try {
|
|
277
|
+
const result = await this.contract?.get(address, key);
|
|
278
|
+
return result;
|
|
279
|
+
}
|
|
280
|
+
catch (e) {
|
|
281
|
+
if (e instanceof Error)
|
|
282
|
+
throw Error(`Failed to get value: ${e.message}`);
|
|
283
|
+
return e;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
247
286
|
}
|
|
248
287
|
exports.KVStoreClient = KVStoreClient;
|
|
249
288
|
__decorate([
|