UNPKG

kleros-escrow-data-service

Version:

Data service for interacting with Kleros Escrow

54 lines (53 loc) 2.16 kB
import { ethers } from "ethers"; import { Transaction } from "../types/transaction"; import { KlerosEscrowConfig } from "../types/config"; import { BaseService } from "../base/BaseService"; /** * Service for reading ETH transaction data from the Kleros Escrow contract */ export declare class EthTransactionService extends BaseService { /** * Creates a new EthTransactionService instance * @param config The Kleros Escrow configuration * @param provider Optional provider for read operations */ constructor(config: KlerosEscrowConfig, provider?: ethers.providers.Provider); /** * Gets an ETH transaction by its ID * @param transactionId The ID of the transaction to fetch * @returns The ETH transaction data */ getEthTransaction: (transactionId: string) => Promise<Transaction>; /** * Gets all ETH transactions for a specific address * @param address The address to get transactions for * @returns Array of ETH transactions where the address is sender or receiver */ getEthTransactionsByAddress: (address: string) => Promise<Transaction[]>; /** * Gets the total number of ETH transactions in the contract * @returns The count of ETH transactions */ getEthTransactionCount: () => Promise<number>; /** * Checks if an ETH transaction can be executed (timeout has passed) * @param transactionId The ID of the transaction to check * @returns True if the ETH transaction can be executed */ canExecuteEthTransaction: (transactionId: string) => Promise<boolean>; /** * Checks if a party can be timed out for not paying arbitration fees * @param transactionId The ID of the transaction to check * @returns Object indicating which party can be timed out, if any */ canTimeOut: (transactionId: string) => Promise<{ canSenderTimeOut: boolean; canReceiverTimeOut: boolean; }>; /** * Maps numeric status from contract to enum * @param status The numeric status from the contract * @returns The corresponding TransactionStatus enum value */ private mapStatus; }