import { Logger, RequestContext } from '@chimera-monorepo/utils'; import { WriteTransaction, ITransactionReceipt, ISigner } from './shared'; import { ChainReader } from './chainreader'; import { TransactionDispatch } from './dispatch'; /** * @classdesc Handles submitting, confirming, and bumping gas of arbitrary transactions onchain. Also performs onchain reads with embedded retries */ export declare class ChainService extends ChainReader { private static instance?; /** * A singleton-like interface for handling all logic related to conducting on-chain transactions. * * @remarks * Using the Signer instance passed into this constructor outside of the context of this * class is not recommended, and may cause issues with nonce being tracked improperly * due to the caching mechanisms used here. * * @param logger The Logger used for logging. * @param signer The Signer or Wallet instance, or private key, for signing transactions. * @param config At least a partial configuration used by ChainService for chains, * providers, etc. * @param ghostInstance Used in the event that we are conducting an integration test (which will have * multiple txservice instances) and want to prevent this instantiation from being saved as the singleton. */ constructor(logger: Logger, config: unknown, signer: string | ISigner, _ghostInstance?: boolean); /** * Send specified transaction on specified chain and wait for the configured number of confirmations. * Will emit events throughout its lifecycle. * * @param tx - Tx to send * @param tx.domain - Domain identifier of chain to send transaction on * @param tx.to - Address to send tx to * @param tx.value - Value to send tx with * @param tx.data - Calldata to execute * @param tx.from - (optional) Account to send tx from * * @returns TransactionReceipt once the tx is mined if the transaction was successful. * * @throws TransactionError with one of the reasons specified in ValidSendErrors. If another error occurs, * something went wrong within ChainService process. * @throws ChainServiceFailure, which indicates something went wrong with the service logic. */ sendTx(tx: WriteTransaction, context: RequestContext): Promise; /** * Helper to wrap getting signer address for specified domain. * @returns The signer address for that chain. * @throws TransactionError.reasons.ProviderNotFound if provider is not configured for * that ID. */ getAddress(chainId?: number): Promise; /** * Helper to wrap getting provider for specified domain. * @param domain The domain of the chain for which we want a provider. * @returns The ChainRpcProvider for that chain. * @throws TransactionError.reasons.ProviderNotFound if provider is not configured for * that ID. */ getProvider(domain: number): Promise; /** * Populate the provider mapping using chain configurations. * @param context - The request context object used for logging. * @param signer - The signer that will be used for onchain operations. */ protected setupProviders(context: RequestContext, signer: string): Promise; } //# sourceMappingURL=chainservice.d.ts.map