UNPKG

@holographxyz/cli

Version:
125 lines (124 loc) 4.15 kB
import { Command } from '@oclif/core'; import { TransactionResponse } from '@ethersproject/abstract-provider'; import { Environment } from '@holographxyz/environment'; import { BlockJob, NetworkMonitor, TransactionType } from '../../utils/network-monitor'; import ApiService from '../../services/api-service'; declare enum LogType { ContractDeployment = "ContractDeployment", AvailableJob = "AvailableJob" } declare type TransactionLog = { messageTx: string; messageNetwork: string; messageBlock: number; messageAddress: string; logType: LogType; }; interface Scope { network: string; startBlock: number; endBlock: number; } interface ContractDeployment extends TransactionLog { address: string; networks: string[]; } interface AvailableJob extends TransactionLog { jobType: TransactionType; jobHash: string; bridgeTx: string; bridgeNetwork: string; bridgeBlock: number; bridgeAddress: string; operatorTx: string; operatorNetwork: string; operatorBlock: number; operatorAddress: string; completed: boolean; } interface RawData { data?: string; tokenId?: string; collection?: string; holographId?: number; operatorJobPayload?: string; from?: string; to?: string; } export default class Analyze extends Command { static hidden: boolean; static description: string; static examples: string[]; static flags: { scope: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>; scopeFile: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>; output: import("@oclif/core/lib/interfaces").OptionFlag<string>; updateApiOn: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>; }; environment: Environment; outputFile: string; collectionMap: { [key: string]: boolean; }; operatorJobIndexMap: { [key: string]: number; }; operatorJobCounterMap: { [key: string]: number; }; transactionLogs: (ContractDeployment | AvailableJob)[]; networkMonitor: NetworkMonitor; blockJobs: { [key: string]: BlockJob[]; }; apiService: ApiService | undefined; /** * Command Entry Point */ run(): Promise<void>; /** * Keeps track of the operator jobs */ manageOperatorJobMaps(index: number, operatorJobHash: string, beam: AvailableJob): void; /** * Validates that the input scope is valid and using a supported network */ validateScope(scope: Scope, networks: string[], scopeJobs: Scope[]): void; /** * Checks all the input scopes and validates them */ scopeItOut(scopeFlags?: string[], scopeFile?: string): Promise<{ networks: string[]; scopeJobs: Scope[]; }>; exitCallback(): void; /** * Build the filters to search for events via the network monitor */ filterBuilder(): Promise<void>; /** * Update cross chain transaction on DB */ updateBeamStatusDB(beam: AvailableJob, rawData?: RawData): Promise<void>; /** * Process the transactions in each block job */ processTransactions(job: BlockJob, transactions: TransactionResponse[]): Promise<void>; /** * Finds bridge out events and keeps track of them */ handleBridgeOutEvent(transaction: TransactionResponse, network: string, tags: (string | number)[]): Promise<void>; /** * Handle the AvailableOperatorJob event from the Holograph Operator, when one is picked up while processing transactions */ handleAvailableOperatorJobEvent(transaction: TransactionResponse, network: string, tags: (string | number)[]): Promise<void>; /** * Finds bridge in events and keeps track of them */ handleBridgeInEvent(transaction: TransactionResponse, network: string, tags: (string | number)[]): Promise<void>; /** * Checks if the operator job is valid and has not already been executed */ validateOperatorJob(transactionHash: string, network: string, payload: string, tags: (string | number)[]): Promise<boolean>; } export {};