@human-protocol/sdk / Modules / escrow / EscrowUtils
Class: EscrowUtils
escrow.EscrowUtils
Introduction
Utility class for escrow-related operations.
Installation
npm
npm install @human-protocol/sdk
yarn
yarn install @human-protocol/sdk
Code example
Signer
Using private key(backend)
import { ChainId, EscrowUtils } from '@human-protocol/sdk';
const escrowAddresses = new EscrowUtils.getEscrows({
networks: [ChainId.POLYGON_MUMBAI]
});
Table of contents
Constructors
Methods
Constructors
constructor
• new EscrowUtils()
Methods
getEscrow
▸ Static
getEscrow(chainId
, escrowAddress
): Promise
<EscrowData
>
This function returns the escrow data for a given address.
This uses Subgraph
Input parameters
enum ChainId {
ALL = -1,
MAINNET = 1,
RINKEBY = 4,
GOERLI = 5,
BSC_MAINNET = 56,
BSC_TESTNET = 97,
POLYGON = 137,
POLYGON_MUMBAI = 80001,
MOONBEAM = 1284,
MOONBASE_ALPHA = 1287,
AVALANCHE = 43114,
AVALANCHE_TESTNET = 43113,
CELO = 42220,
CELO_ALFAJORES = 44787,
SKALE = 1273227453,
LOCALHOST = 1338,
}
type EscrowData = {
id: string;
address: string;
amountPaid: string;
balance: string;
count: string;
jobRequesterId: string;
factoryAddress: string;
finalResultsUrl?: string;
intermediateResultsUrl?: string;
launcher: string;
manifestHash?: string;
manifestUrl?: string;
recordingOracle?: string;
recordingOracleFee?: string;
reputationOracle?: string;
reputationOracleFee?: string;
exchangeOracle?: string;
exchangeOracleFee?: string;
status: EscrowStatus;
token: string;
totalFundedAmount: string;
createdAt: string;
};
Parameters
Name | Type | Description |
---|
| | Network in which the escrow has been deployed |
| | |
Returns
Promise
<EscrowData
>
Escrow data
Code example
import { ChainId, EscrowUtils } from '@human-protocol/sdk';
const escrowData = new EscrowUtils.getEscrow(ChainId.POLYGON_MUMBAI, "0x1234567890123456789012345678901234567890");
Defined in
escrow.ts:1641
getEscrows
▸ Static
getEscrows(filter
): Promise
<EscrowData
[]>
This function returns an array of escrows based on the specified filter parameters.
Input parameters
interface IEscrowsFilter {
networks: ChainId[];
launcher?: string;
reputationOracle?: string;
recordingOracle?: string;
exchangeOracle?: string;
jobRequesterId?: string;
status?: EscrowStatus;
from?: Date;
to?: Date;
}
enum ChainId {
ALL = -1,
MAINNET = 1,
RINKEBY = 4,
GOERLI = 5,
BSC_MAINNET = 56,
BSC_TESTNET = 97,
POLYGON = 137,
POLYGON_MUMBAI = 80001,
MOONBEAM = 1284,
MOONBASE_ALPHA = 1287,
AVALANCHE = 43114,
AVALANCHE_TESTNET = 43113,
CELO = 42220,
CELO_ALFAJORES = 44787,
SKALE = 1273227453,
LOCALHOST = 1338,
}
enum EscrowStatus {
Launched,
Pending,
Partial,
Paid,
Complete,
Cancelled,
}
type EscrowData = {
id: string;
address: string;
amountPaid: string;
balance: string;
count: string;
jobRequesterId: string;
factoryAddress: string;
finalResultsUrl?: string;
intermediateResultsUrl?: string;
launcher: string;
manifestHash?: string;
manifestUrl?: string;
recordingOracle?: string;
recordingOracleFee?: string;
reputationOracle?: string;
reputationOracleFee?: string;
exchangeOracle?: string;
exchangeOracleFee?: string;
status: EscrowStatus;
token: string;
totalFundedAmount: string;
createdAt: string;
};
Parameters
Returns
Promise
<EscrowData
[]>
List of escrows that match the filter.
Code example
import { ChainId, EscrowUtils, EscrowStatus } from '@human-protocol/sdk';
const filters: IEscrowsFilter = {
status: EscrowStatus.Pending,
from: new Date(2023, 4, 8),
to: new Date(2023, 5, 8),
networks: [ChainId.POLYGON_MUMBAI]
};
const escrowDatas = await EscrowUtils.getEscrows(filters);
Defined in
escrow.ts:1504
Last updated