kleros-escrow-data-service
Version:
Data service for interacting with Kleros Escrow
143 lines (142 loc) • 4.71 kB
TypeScript
import { ethers } from "ethers";
import { EthTransactionService, DisputeService, ArbitratorService, IPFSService, EthEventService } from "../services";
import { KlerosEscrowConfig } from "../types";
import { TransactionActions, DisputeActions, EvidenceActions } from "../actions";
/**
* Client for interacting with Kleros Escrow ETH services
* Provides read and write operations for escrow transactions
*/
export declare class KlerosEscrowEthClient {
private config;
/**
* Services for reading ETH transaction data
*/
readonly services: {
ethTransaction: EthTransactionService;
dispute: DisputeService;
arbitrator: ArbitratorService;
ethEvent: EthEventService;
ipfs: IPFSService;
};
/**
* Actions for writing data (only available if a signer is provided)
*/
readonly actions?: {
transaction: TransactionActions;
dispute: DisputeActions;
evidence: EvidenceActions;
};
/**
* Creates a new KlerosEscrowEthClient
* @param config The Kleros Escrow configuration
* @param signer Optional signer for write operations
*/
constructor(config: KlerosEscrowConfig, signer?: ethers.Signer);
/**
* Gets the configuration used by this client
* @returns The Kleros Escrow configuration
*/
getConfig(): KlerosEscrowConfig;
/**
* Checks if this client has write capabilities
* @returns True if the client can perform write operations
*/
canWrite(): boolean;
/**
* Convenience method to get an ETH transaction by ID
* @param transactionId The ID of the transaction to fetch
* @returns The ETH transaction data
*/
getEthTransaction(transactionId: string): Promise<import("../types").Transaction>;
/**
* Convenience method to get a dispute by transaction ID
* @param transactionId The ID of the transaction
* @returns The dispute data if it exists
*/
getDispute(transactionId: string): Promise<import("../types").Dispute | null>;
/**
* Convenience method to get the arbitrator information
* @returns The arbitrator information
*/
getArbitrator(): Promise<import("../types").Arbitrator>;
/**
* Convenience method to fetch data from IPFS
* @param path The IPFS path or CID
* @returns The data from IPFS
*/
fetchFromIPFS(path: string): Promise<any>;
/**
* Get all ETH transaction details from subgraph
* @param transactionId The transaction ID
* @returns Combined ETH transaction details with events
*/
getEthTransactionDetails(transactionId: string): Promise<{
rulings: {
_arbitrator: string;
_disputeID: string;
blockNumber: string;
blockTimestamp: string;
_ruling: string;
transactionHash: string;
}[];
metaEvidences: {
id: string;
blockTimestamp: string;
transactionHash: string;
_evidence: string;
blockNumber: string;
_metaEvidenceID: string;
}[];
payments: {
id: string;
_transactionID: string;
_amount: string;
_party: string;
blockNumber: string;
blockTimestamp: string;
transactionHash: string;
}[];
evidences: {
_arbitrator: string;
_party: string;
_evidence: string;
_evidenceGroupID: string;
blockNumber: string;
transactionHash: string;
}[];
disputes: {
_arbitrator: string;
_disputeID: string;
blockNumber: string;
blockTimestamp: string;
_metaEvidenceID: string;
_evidenceGroupID: string;
transactionHash: string;
}[];
hasToPayFees: {
_transactionID: string;
blockNumber: string;
blockTimestamp: string;
_party: string;
transactionHash: string;
}[];
}>;
/**
* Get all ETH meta evidence from subgraph
* @returns Array of all ETH meta evidence
*/
getAllEthMetaEvidence(): Promise<{
id: string;
blockTimestamp: string;
transactionHash: string;
_evidence: string;
blockNumber: string;
_metaEvidenceID: string;
}[]>;
/**
* Get ETH transactions by address
* @param address The address to get transactions for
* @returns Array of ETH transactions for the address
*/
getEthTransactionsByAddress(address: string): Promise<import("../types").Transaction[]>;
}