@human-protocol/sdk 1.1.19 → 2.1.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 +4 -5
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +3 -3
- package/dist/constants.js +3 -3
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +4 -2
- package/dist/error.d.ts +0 -6
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +2 -14
- package/dist/escrow.d.ts +23 -24
- package/dist/escrow.d.ts.map +1 -1
- package/dist/escrow.js +86 -90
- package/dist/graphql/queries/{staking.d.ts → operator.d.ts} +2 -1
- package/dist/graphql/queries/operator.d.ts.map +1 -0
- package/dist/graphql/queries/{staking.js → operator.js} +24 -1
- package/dist/graphql/types.d.ts +5 -6
- package/dist/graphql/types.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/interfaces.d.ts +28 -18
- package/dist/interfaces.d.ts.map +1 -1
- package/dist/kvstore.d.ts +41 -20
- package/dist/kvstore.d.ts.map +1 -1
- package/dist/kvstore.js +61 -45
- package/dist/operator.d.ts +68 -0
- package/dist/operator.d.ts.map +1 -0
- package/dist/operator.js +153 -0
- package/dist/staking.d.ts +24 -91
- package/dist/staking.d.ts.map +1 -1
- package/dist/staking.js +47 -166
- package/dist/statistics.d.ts.map +1 -1
- package/dist/statistics.js +7 -6
- package/dist/types.d.ts +1 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +0 -7
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +8 -28
- package/package.json +4 -4
- package/src/base.ts +5 -6
- package/src/constants.ts +3 -3
- package/src/decorators.ts +3 -2
- package/src/error.ts +0 -12
- package/src/escrow.ts +101 -114
- package/src/graphql/queries/{staking.ts → operator.ts} +24 -0
- package/src/graphql/types.ts +5 -7
- package/src/index.ts +2 -0
- package/src/interfaces.ts +30 -18
- package/src/kvstore.ts +73 -52
- package/src/operator.ts +192 -0
- package/src/staking.ts +49 -182
- package/src/statistics.ts +8 -9
- package/src/types.ts +1 -3
- package/src/utils.ts +7 -29
- package/dist/graphql/queries/staking.d.ts.map +0 -1
package/dist/base.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Signer } from 'ethers';
|
|
1
|
+
import { ContractRunner } from 'ethers';
|
|
3
2
|
import { NetworkData } from './types';
|
|
4
3
|
/**
|
|
5
4
|
* ## Introduction
|
|
@@ -8,14 +7,14 @@ import { NetworkData } from './types';
|
|
|
8
7
|
*
|
|
9
8
|
*/
|
|
10
9
|
export declare abstract class BaseEthersClient {
|
|
11
|
-
protected
|
|
10
|
+
protected runner: ContractRunner;
|
|
12
11
|
networkData: NetworkData;
|
|
13
12
|
/**
|
|
14
13
|
* **BaseClient constructor**
|
|
15
14
|
*
|
|
16
|
-
* @param {
|
|
15
|
+
* @param {ContractRunner} runner The Signer or Provider object to interact with the Ethereum network
|
|
17
16
|
* @param {NetworkData} networkData The network information required to connect to the contracts
|
|
18
17
|
*/
|
|
19
|
-
constructor(
|
|
18
|
+
constructor(runner: ContractRunner, networkData: NetworkData);
|
|
20
19
|
}
|
|
21
20
|
//# 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,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEtC;;;;;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;CAI7D"}
|
package/dist/base.js
CHANGED
|
@@ -11,12 +11,12 @@ class BaseEthersClient {
|
|
|
11
11
|
/**
|
|
12
12
|
* **BaseClient constructor**
|
|
13
13
|
*
|
|
14
|
-
* @param {
|
|
14
|
+
* @param {ContractRunner} runner The Signer or Provider object to interact with the Ethereum network
|
|
15
15
|
* @param {NetworkData} networkData The network information required to connect to the contracts
|
|
16
16
|
*/
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(runner, networkData) {
|
|
18
18
|
this.networkData = networkData;
|
|
19
|
-
this.
|
|
19
|
+
this.runner = runner;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
exports.BaseEthersClient = BaseEthersClient;
|
package/dist/constants.js
CHANGED
|
@@ -235,7 +235,7 @@ exports.NETWORKS = {
|
|
|
235
235
|
stakingAddress: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0',
|
|
236
236
|
rewardPoolAddress: '0xa513E6E4b8f2a923D98304ec87F64353C4D5C853',
|
|
237
237
|
kvstoreAddress: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707',
|
|
238
|
-
subgraphUrl: '',
|
|
238
|
+
subgraphUrl: 'http://localhost:8000/subgraphs/name/humanprotocol/localhost',
|
|
239
239
|
oldSubgraphUrl: '',
|
|
240
240
|
oldFactoryAddress: '',
|
|
241
241
|
},
|
|
@@ -243,8 +243,8 @@ exports.NETWORKS = {
|
|
|
243
243
|
exports.KVStoreKeys = {
|
|
244
244
|
role: 'role',
|
|
245
245
|
fee: 'fee',
|
|
246
|
-
publicKey: '
|
|
247
|
-
webhookUrl: '
|
|
246
|
+
publicKey: 'public_key',
|
|
247
|
+
webhookUrl: 'webhook_url',
|
|
248
248
|
url: 'url',
|
|
249
249
|
};
|
|
250
250
|
exports.Role = {
|
package/dist/decorators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAC5B,MAAM,EAAE,GAAG,EACX,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,kBAAkB,sBAe/B"}
|
package/dist/decorators.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.requiresSigner = void 0;
|
|
4
4
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
const ethers_1 = require("ethers");
|
|
6
5
|
const error_1 = require("./error");
|
|
7
6
|
function requiresSigner(target, propertyKey, descriptor) {
|
|
8
7
|
const originalMethod = descriptor.value;
|
|
9
8
|
descriptor.value = async function (...args) {
|
|
10
|
-
|
|
9
|
+
try {
|
|
10
|
+
!this.runner.getAddress();
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
11
13
|
throw error_1.ErrorSigner;
|
|
12
14
|
}
|
|
13
15
|
return originalMethod.apply(this, args);
|
package/dist/error.d.ts
CHANGED
|
@@ -177,12 +177,6 @@ export declare class EthereumError extends Error {
|
|
|
177
177
|
export declare class InvalidArgumentError extends EthereumError {
|
|
178
178
|
constructor(message: string);
|
|
179
179
|
}
|
|
180
|
-
export declare class OutOfGasError extends EthereumError {
|
|
181
|
-
constructor(message: string);
|
|
182
|
-
}
|
|
183
|
-
export declare class UnpredictableGasLimit extends EthereumError {
|
|
184
|
-
constructor(message: string);
|
|
185
|
-
}
|
|
186
180
|
export declare class ReplacementUnderpriced extends EthereumError {
|
|
187
181
|
constructor(message: string);
|
|
188
182
|
}
|
package/dist/error.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../src/error.ts"],"names":[],"mappings":"AAAA;;GA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OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,YAAa,SAAQ,aAAa;gBACjC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,sBAAuB,SAAQ,aAAa;gBAC3C,MAAM,EAAE,MAAM;CAG3B;AAED,qBAAa,2BAA4B,SAAQ,KAAK;gBACxC,OAAO,EAAE,MAAM;CAG5B;AACD;;GAEG;AACH,eAAO,MAAM,gBAAgB,OAA4B,CAAC"}
|
package/dist/error.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError =
|
|
3
|
+
exports.TransactionReplaced = exports.NonceExpired = exports.NumericFault = exports.ReplacementUnderpriced = exports.InvalidArgumentError = exports.EthereumError = exports.ErrorHashIsEmptyString = exports.ErrorLaunchedEventIsNotEmitted = exports.ErrorRecipientAndAmountsMustBeSameLength = exports.ErrorAmountsCannotBeEmptyArray = exports.ErrorEscrowDoesNotHaveEnoughBalance = exports.ErrorAmountMustBeGreaterThanZero = exports.ErrorRecipientCannotBeEmptyArray = exports.ErrorTotalFeeMustBeLessThanHundred = exports.ErrorFeeMustBeBetweenZeroAndHundred = exports.ErrorNoURLprovided = exports.ErrorListOfHandlersCannotBeEmpty = exports.ErrorUrlIsEmptyString = exports.ErrorInvalidUrl = exports.ErrorStorageClientDoesNotExist = exports.ErrorManifestFileDoesNotExist = exports.ErrorTransferEventNotFoundInTransactionLogs = exports.ErrorEscrowAddressIsNotProvidedByFactory = exports.ErrorSigner = exports.ErrorUnsupportedChainID = exports.ErrorProviderDoesNotExist = exports.ErrorHMTokenAmountNotApproved = exports.ErrorFailedToCheckAllowance = exports.ErrorFailedToApproveStakingAmountSignerDoesNotExist = exports.ErrorStakingGetStakers = exports.ErrorInvalidEscrowAddressProvided = 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
|
+
exports.ErrorInvalidHash = exports.InvalidEthereumAddressError = exports.ContractExecutionError = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @constant {Error} - The Staking contract is missing.
|
|
7
7
|
*/
|
|
@@ -187,18 +187,6 @@ class InvalidArgumentError extends EthereumError {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
190
|
-
class OutOfGasError extends EthereumError {
|
|
191
|
-
constructor(message) {
|
|
192
|
-
super(`Out of gas: ${message}`);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
exports.OutOfGasError = OutOfGasError;
|
|
196
|
-
class UnpredictableGasLimit extends EthereumError {
|
|
197
|
-
constructor(message) {
|
|
198
|
-
super(`Unpredictable gas limit: ${message}`);
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
exports.UnpredictableGasLimit = UnpredictableGasLimit;
|
|
202
190
|
class ReplacementUnderpriced extends EthereumError {
|
|
203
191
|
constructor(message) {
|
|
204
192
|
super(`Replacement underpriced: ${message}`);
|
package/dist/escrow.d.ts
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BigNumber, Overrides, Signer } from 'ethers';
|
|
1
|
+
import { ContractRunner, Overrides } from 'ethers';
|
|
3
2
|
import { BaseEthersClient } from './base';
|
|
4
3
|
import { ChainId } from './enums';
|
|
4
|
+
import { EscrowData } from './graphql';
|
|
5
5
|
import { IEscrowConfig, IEscrowsFilter } from './interfaces';
|
|
6
6
|
import { EscrowCancel, EscrowStatus, NetworkData } from './types';
|
|
7
|
-
import { EscrowData } from './graphql';
|
|
8
7
|
/**
|
|
9
8
|
* ## Introduction
|
|
10
9
|
*
|
|
11
10
|
* This client enables to perform actions on Escrow contracts and obtain information from both the contracts and subgraph.
|
|
12
11
|
*
|
|
13
|
-
* Internally, the SDK will use one network or another according to the network ID of the `
|
|
12
|
+
* Internally, the SDK will use one network or another according to the network ID of the `runner`.
|
|
14
13
|
* To use this client, it is recommended to initialize it using the static `build` method.
|
|
15
14
|
*
|
|
16
15
|
* ```ts
|
|
17
|
-
* static async build(
|
|
16
|
+
* static async build(runner: ContractRunner);
|
|
18
17
|
* ```
|
|
19
18
|
*
|
|
20
19
|
* A `Signer` or a `Provider` should be passed depending on the use case of this module:
|
|
@@ -79,20 +78,20 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
79
78
|
/**
|
|
80
79
|
* **EscrowClient constructor**
|
|
81
80
|
*
|
|
82
|
-
* @param {
|
|
81
|
+
* @param {ContractRunner} runner The Runner object to interact with the Ethereum network
|
|
83
82
|
* @param {NetworkData} network The network information required to connect to the Escrow contract
|
|
84
83
|
*/
|
|
85
|
-
constructor(
|
|
84
|
+
constructor(runner: ContractRunner, networkData: NetworkData);
|
|
86
85
|
/**
|
|
87
|
-
* Creates an instance of EscrowClient from a
|
|
86
|
+
* Creates an instance of EscrowClient from a Runner.
|
|
88
87
|
*
|
|
89
|
-
* @param {
|
|
88
|
+
* @param {ContractRunner} runner The Runner object to interact with the Ethereum network
|
|
90
89
|
*
|
|
91
90
|
* @returns {Promise<EscrowClient>} An instance of EscrowClient
|
|
92
91
|
* @throws {ErrorProviderDoesNotExist} Thrown if the provider does not exist for the provided Signer
|
|
93
92
|
* @throws {ErrorUnsupportedChainID} Thrown if the network's chainId is not supported
|
|
94
93
|
*/
|
|
95
|
-
static build(
|
|
94
|
+
static build(runner: ContractRunner): Promise<EscrowClient>;
|
|
96
95
|
/**
|
|
97
96
|
* Connects to the escrow contract
|
|
98
97
|
*
|
|
@@ -160,9 +159,9 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
160
159
|
* recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
161
160
|
* reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
162
161
|
* exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
163
|
-
* recordingOracleFee:
|
|
164
|
-
* reputationOracleFee:
|
|
165
|
-
* exchangeOracleFee:
|
|
162
|
+
* recordingOracleFee: bigint.from('10'),
|
|
163
|
+
* reputationOracleFee: bigint.from('10'),
|
|
164
|
+
* exchangeOracleFee: bigint.from('10'),
|
|
166
165
|
* manifestUrl: 'htttp://localhost/manifest.json',
|
|
167
166
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
168
167
|
* };
|
|
@@ -201,9 +200,9 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
201
200
|
* recordingOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
202
201
|
* reputationOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
203
202
|
* exchangeOracle: '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266',
|
|
204
|
-
* recordingOracleFee:
|
|
205
|
-
* reputationOracleFee:
|
|
206
|
-
* exchangeOracleFee:
|
|
203
|
+
* recordingOracleFee: bigint.from('10'),
|
|
204
|
+
* reputationOracleFee: bigint.from('10'),
|
|
205
|
+
* exchangeOracleFee: bigint.from('10'),
|
|
207
206
|
* manifestUrl: 'htttp://localhost/manifest.json',
|
|
208
207
|
* manifestHash: 'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079',
|
|
209
208
|
* };
|
|
@@ -216,7 +215,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
216
215
|
* This function adds funds of the chosen token to the escrow.
|
|
217
216
|
*
|
|
218
217
|
* @param {string} escrowAddress Address of the escrow to fund.
|
|
219
|
-
* @param {
|
|
218
|
+
* @param {bigint} amount Amount to be added as funds.
|
|
220
219
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
221
220
|
* @returns Returns void if successful. Throws error if any.
|
|
222
221
|
*
|
|
@@ -234,11 +233,11 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
234
233
|
* const signer = new Wallet(privateKey, provider);
|
|
235
234
|
* const escrowClient = await EscrowClient.build(signer);
|
|
236
235
|
*
|
|
237
|
-
* const amount = ethers.
|
|
236
|
+
* const amount = ethers.parseUnits(5, 'ether'); //convert from ETH to WEI
|
|
238
237
|
* await escrowClient.fund('0x62dD51230A30401C455c8398d06F85e4EaB6309f', amount);
|
|
239
238
|
* ```
|
|
240
239
|
*/
|
|
241
|
-
fund(escrowAddress: string, amount:
|
|
240
|
+
fund(escrowAddress: string, amount: bigint, txOptions?: Overrides): Promise<void>;
|
|
242
241
|
/**
|
|
243
242
|
* This function stores the results url and hash.
|
|
244
243
|
*
|
|
@@ -300,7 +299,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
300
299
|
*
|
|
301
300
|
* @param {string} escrowAddress Escrow address to payout.
|
|
302
301
|
* @param {string[]} recipients Array of recipient addresses.
|
|
303
|
-
* @param {
|
|
302
|
+
* @param {bigint[]} amounts Array of amounts the recipients will receive.
|
|
304
303
|
* @param {string} finalResultsUrl Final results file url.
|
|
305
304
|
* @param {string} finalResultsHash Final results file hash.
|
|
306
305
|
* @param {Overrides} [txOptions] - Additional transaction parameters (optional, defaults to an empty object).
|
|
@@ -323,14 +322,14 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
323
322
|
* const escrowClient = await EscrowClient.build(signer);
|
|
324
323
|
*
|
|
325
324
|
* const recipients = ['0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266', '0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266'];
|
|
326
|
-
* const amounts = [ethers.
|
|
325
|
+
* const amounts = [ethers.parseUnits(5, 'ether'), ethers.parseUnits(10, 'ether')];
|
|
327
326
|
* const resultsUrl = 'http://localhost/results.json';
|
|
328
327
|
* const resultsHash'b5dad76bf6772c0f07fd5e048f6e75a5f86ee079';
|
|
329
328
|
*
|
|
330
329
|
* await escrowClient.bulkPayOut('0x62dD51230A30401C455c8398d06F85e4EaB6309f', recipients, amounts, resultsUrl, resultsHash);
|
|
331
330
|
* ```
|
|
332
331
|
*/
|
|
333
|
-
bulkPayOut(escrowAddress: string, recipients: string[], amounts:
|
|
332
|
+
bulkPayOut(escrowAddress: string, recipients: string[], amounts: bigint[], finalResultsUrl: string, finalResultsHash: string, txOptions?: Overrides): Promise<void>;
|
|
334
333
|
/**
|
|
335
334
|
* This function cancels the specified escrow and sends the balance to the canceler.
|
|
336
335
|
*
|
|
@@ -418,7 +417,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
418
417
|
* This function returns the balance for a specified escrow address.
|
|
419
418
|
*
|
|
420
419
|
* @param {string} escrowAddress Address of the escrow.
|
|
421
|
-
* @returns {
|
|
420
|
+
* @returns {bigint} Balance of the escrow in the token used to fund it.
|
|
422
421
|
*
|
|
423
422
|
* **Code example**
|
|
424
423
|
*
|
|
@@ -434,7 +433,7 @@ export declare class EscrowClient extends BaseEthersClient {
|
|
|
434
433
|
* const balance = await escrowClient.getBalance('0x62dD51230A30401C455c8398d06F85e4EaB6309f');
|
|
435
434
|
* ```
|
|
436
435
|
*/
|
|
437
|
-
getBalance(escrowAddress: string): Promise<
|
|
436
|
+
getBalance(escrowAddress: string): Promise<bigint>;
|
|
438
437
|
/**
|
|
439
438
|
* This function returns the manifest file hash.
|
|
440
439
|
*
|
package/dist/escrow.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"escrow.d.ts","sourceRoot":"","sources":["../src/escrow.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,cAAc,EAAY,SAAS,EAAU,MAAM,QAAQ,CAAC;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAG1C,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAyBlC,OAAO,EACL,UAAU,EAGX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAGlE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoEG;AACH,qBAAa,YAAa,SAAQ,gBAAgB;IAChD,OAAO,CAAC,qBAAqB,CAAgB;IAE7C;;;;;OAKG;gBACS,MAAM,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW;IAS5D;;;;;;;;OAQG;WACiB,KAAK,CAAC,MAAM,EAAE,cAAc;IAiBhD;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAQzB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8BG;IAEU,YAAY,CACvB,YAAY,EAAE,MAAM,EACpB,eAAe,EAAE,MAAM,EAAE,EACzB,cAAc,EAAE,MAAM,EACtB,SAAS,GAAE,SAAc,GACxB,OAAO,CAAC,MAAM,CAAC;IAqClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAqCG;IAEG,K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