UNPKG

@holographxyz/cli

Version:
310 lines (309 loc) 11.8 kB
/// <reference types="node" /> import WebSocket from 'ws'; import { Command } from '@oclif/core'; import { Wallet } from '@ethersproject/wallet'; import { Contract, PopulatedTransaction } from '@ethersproject/contracts'; import { BigNumber } from '@ethersproject/bignumber'; import { Interface, EventFragment } from '@ethersproject/abi'; import { WebSocketProvider, JsonRpcProvider } from '@ethersproject/providers'; import { Block, BlockWithTransactions, TransactionReceipt, TransactionResponse } from '@ethersproject/abstract-provider'; import { Environment } from '@holographxyz/environment'; import { ConfigFile } from './config'; import { GasPricing } from './gas'; export declare const warpFlag: { warp: import("@oclif/core/lib/interfaces").OptionFlag<number>; }; export declare const networksFlag: { networks: import("@oclif/core/lib/interfaces").OptionFlag<string[] | undefined>; }; export declare const networkFlag: { network: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined>; }; export declare enum OperatorMode { listen = "listen", manual = "manual", auto = "auto" } export declare enum ProviderStatus { NOT_CONFIGURED = "NOT_CONFIGURED", CONNECTED = "CONNECTED", DISCONNECTED = "DISCONNECTED" } export declare type KeepAliveParams = { debug: (...args: any[]) => void; websocket: WebSocket; onDisconnect: (code: number, reason: any) => void; expectedPongBack?: number; checkInterval?: number; }; export declare type BlockJob = { network: string; block: number; }; export declare enum FilterType { to = 0, from = 1, functionSig = 2 } export declare enum TransactionType { unknown = "unknown", erc20 = "erc20", erc721 = "erc721", deploy = "deploy" } export declare type TransactionFilter = { type: FilterType; match: string | { [key: string]: string; }; networkDependant: boolean; }; interface AbstractError extends Error { [key: string]: any; } export declare const keepAlive: ({ debug, websocket, onDisconnect, expectedPongBack, checkInterval, }: KeepAliveParams) => void; export declare type ExecuteTransactionParams = { network: string; tags?: (string | number)[]; contract: Contract; methodName: string; args: any[]; gasPrice?: BigNumber; gasLimit?: BigNumber | null; value?: BigNumber; attempts?: number; canFail?: boolean; interval?: number; waitForReceipt?: boolean; }; export declare type SendTransactionParams = { network: string; tags?: (string | number)[]; rawTx: PopulatedTransaction; attempts?: number; canFail?: boolean; interval?: number; }; export declare type PopulateTransactionParams = { network: string; contract: Contract; methodName: string; args: any[]; gasPrice: BigNumber; gasLimit: BigNumber; value: BigNumber; nonce: number; tags?: (string | number)[]; attempts?: number; canFail?: boolean; interval?: number; }; export declare type GasLimitParams = { network: string; tags?: (string | number)[]; contract: Contract; methodName: string; args: any[]; gasPrice?: BigNumber; value?: BigNumber; attempts?: number; canFail?: boolean; interval?: number; }; export declare type BlockParams = { network: string; blockNumber: number; tags?: (string | number)[]; attempts?: number; canFail?: boolean; interval?: number; }; export declare type WalletParams = { network: string; walletAddress: string; tags?: (string | number)[]; attempts?: number; canFail?: boolean; interval?: number; }; export declare type TransactionParams = { network: string; transactionHash: string; tags?: (string | number)[]; attempts?: number; canFail?: boolean; interval?: number; }; declare type ImplementsCommand = Command; declare type NetworkMonitorOptions = { parent: ImplementsCommand; configFile: ConfigFile; networks?: string[]; debug: (...args: string[]) => void; processTransactions?: (job: BlockJob, transactions: TransactionResponse[]) => Promise<void>; filters?: TransactionFilter[]; userWallet?: Wallet; lastBlockFilename?: string; warp?: number; verbose?: boolean; }; export declare class NetworkMonitor { verbose: boolean; environment: Environment; parent: ImplementsCommand; configFile: ConfigFile; userWallet?: Wallet; LAST_BLOCKS_FILE_NAME: string; filters: TransactionFilter[]; processTransactions: ((job: BlockJob, transactions: TransactionResponse[]) => Promise<void>) | undefined; log: (message: string, ...args: any[]) => void; warn: (message: string, ...args: any[]) => void; debug: (...args: any[]) => void; networks: string[]; runningProcesses: number; bridgeAddress: string; factoryAddress: string; interfacesAddress: string; operatorAddress: string; registryAddress: string; messagingModuleAddress: string; wallets: { [key: string]: Wallet; }; walletNonces: { [key: string]: number; }; providers: { [key: string]: JsonRpcProvider | WebSocketProvider; }; ws: { [key: string]: WebSocket; }; activated: { [key: string]: boolean; }; abiCoder: import("@ethersproject/abi").AbiCoder; networkColors: any; latestBlockHeight: { [key: string]: number; }; currentBlockHeight: { [key: string]: number; }; blockJobs: { [key: string]: BlockJob[]; }; exited: boolean; lastProcessBlockDone: { [key: string]: number; }; lastBlockJobDone: { [key: string]: number; }; blockJobMonitorProcess: { [key: string]: NodeJS.Timer; }; gasPrices: { [key: string]: GasPricing; }; holograph: Contract; holographer: Contract; bridgeContract: Contract; factoryContract: Contract; interfacesContract: Contract; operatorContract: Contract; registryContract: Contract; messagingModuleContract: Contract; HOLOGRAPH_ADDRESSES: { localhost: string; experimental: string; develop: string; testnet: string; mainnet: string; }; localhostWallets: { [key: string]: Wallet; }; static localhostPrivateKey: string; lzEndpointAddress: { [key: string]: string; }; lzEndpointContract: { [key: string]: Contract; }; LAYERZERO_RECEIVERS: { [key: string]: string; }; needToSubscribe: boolean; warp: number; targetEvents: Record<string, string>; getProviderStatus(): { [key: string]: ProviderStatus; }; checkConnectionStatus(): void; constructor(options: NetworkMonitorOptions); run(continuous: boolean, blockJobs?: { [key: string]: BlockJob[]; }, ethersInitializedCallback?: () => Promise<void>): Promise<void>; loadLastBlocks(configDir: string): Promise<{ [key: string]: number; }>; saveLastBlocks(configDir: string, lastBlocks: { [key: string]: number; }): void; disconnectBuilder(network: string, rpcEndpoint: string, subscribe: boolean): (code: number, reason: any) => void; failoverWebSocketProvider(network: string, rpcEndpoint: string, subscribe: boolean): void; initializeEthers(): Promise<void>; exitCallback?: () => void; exitHandler: (exitCode: number) => Promise<void>; exitRouter: (options: { [key: string]: string | number | boolean; }, exitCode: number | string) => void; monitorBuilder: (network: string) => () => void; restartProvider: (network: string) => Promise<void>; blockJobMonitor: (network: string) => Promise<void>; jobHandlerBuilder: (network: string) => () => void; blockJobHandler: (network: string, job?: BlockJob) => void; filterTransaction(job: BlockJob, transaction: TransactionResponse, interestingTransactions: TransactionResponse[]): void; extractGasData(network: string, block: Block | BlockWithTransactions, tx: TransactionResponse): void; processBlock(job: BlockJob): Promise<void>; networkSubscribe(network: string): void; structuredLog(network: string, msg: string, tagId?: string | number | (number | string)[]): void; structuredLogError(network: string, error: string | Error | AbstractError, tagId?: string | number | (number | string)[]): void; static iface: Interface; static packetEventFragment: EventFragment; static lzPacketEventFragment: EventFragment; static lzEventFragment: EventFragment; static erc20TransferEventFragment: EventFragment; static erc721TransferEventFragment: EventFragment; static availableJobEventFragment: EventFragment; static bridgeableContractDeployedEventFragment: EventFragment; static availableOperatorJobEventFragment: EventFragment; static crossChainMessageSentEventFragment: EventFragment; static finishedOperatorJobEventFragment: EventFragment; static failedOperatorJobEventFragment: EventFragment; decodePacketEvent(receipt: TransactionReceipt, target?: string): string | undefined; decodeLzPacketEvent(receipt: TransactionReceipt, target?: string): string | undefined; decodeLzEvent(receipt: TransactionReceipt, target?: string): any[] | undefined; decodeErc20TransferEvent(receipt: TransactionReceipt, target?: string): string[] | undefined; decodeErc721TransferEvent(receipt: TransactionReceipt, target?: string): string[] | undefined; decodeAvailableJobEvent(receipt: TransactionReceipt, target?: string): string | undefined; decodeAvailableOperatorJobEvent(receipt: TransactionReceipt, target?: string): string[] | undefined; decodeBridgeableContractDeployedEvent(receipt: TransactionReceipt, target?: string): string[] | undefined; decodeCrossChainMessageSentEvent(receipt: TransactionReceipt, target?: string): string | undefined; decodeFinishedOperatorJobEvent(receipt: TransactionReceipt, target?: string): string[] | undefined; decodeFailedOperatorJobEvent(receipt: TransactionReceipt, target?: string): string | undefined; lowerCaseAllStrings(input: any[], add?: string): any[]; randomTag(): string; getBlock({ blockNumber, network, tags, attempts, canFail, interval, }: BlockParams): Promise<Block | null>; getBlockWithTransactions({ blockNumber, network, tags, attempts, canFail, interval, }: BlockParams): Promise<BlockWithTransactions | null>; getTransaction({ transactionHash, network, tags, attempts, canFail, interval, }: TransactionParams): Promise<TransactionResponse | null>; getTransactionReceipt({ transactionHash, network, tags, attempts, canFail, interval, }: TransactionParams): Promise<TransactionReceipt | null>; getBalance({ walletAddress, network, tags, attempts, canFail, interval, }: WalletParams): Promise<BigNumber>; getNonce({ walletAddress, network, tags, attempts, canFail, interval, }: WalletParams): Promise<number>; getGasLimit({ contract, methodName, args, network, tags, gasPrice, value, attempts, canFail, interval, }: GasLimitParams): Promise<BigNumber | null>; sendTransaction({ rawTx, network, tags, attempts, canFail, interval, }: SendTransactionParams): Promise<TransactionResponse | null>; populateTransaction({ network, contract, methodName, args, gasPrice, gasLimit, value, nonce, tags, attempts, canFail, interval, }: PopulateTransactionParams): Promise<PopulatedTransaction | null>; executeTransaction({ network, tags, contract, methodName, args, gasPrice, gasLimit, value, attempts, canFail, interval, waitForReceipt, }: ExecuteTransactionParams): Promise<TransactionReceipt | null>; } export {};