import type { TransactionRequest } from '@ethersproject/abstract-provider'; import { BigNumber } from 'ethers'; export type TransactionPayload = { to: string; data: string; value: BigNumber; }; export type Transaction = { nonce: number; createdAt: number; maxPriority: BigNumber; maxFeePerGas: BigNumber; gasLimit: BigNumber; }; /** * Keep track of queuing, pending, mined and confirmed transactions, * and allows for pruning unnecessary data. * After signing, a tx is `queuing`. * After being broadcasted, a tx is `pending`. * After being included in a block, a tx is `mined`. * After passing the finality threshold, a tx is `confirmed`. * This class is mainly used by nonce-tracker which relies * on transcation-manager to keep an update to date view * on transactions. */ declare class TranscationManager { /** * transaction payloads */ readonly payloads: Map; /** * transaction requests, before signing */ readonly queuing: Map; /** * pending transactions */ readonly pending: Map; /** * mined transactions */ readonly mined: Map; /** * confirmed transactions */ readonly confirmed: Map; /** * Return all the queuing transactions * @returns Array of transaction hashes */ getAllQueuingTxs(): TransactionRequest[]; /** * Return pending and mined transactions * @returns Array of transaction hashes */ getAllUnconfirmedTxs(): Transaction[]; /** * Return pending and mined transactions * @returns Array of transaction hashes */ getAllUnconfirmedHash(): string[]; /** * If a transaction payload exists in mined or pending with a higher/equal gas price * @param payload object * @param maxPriority Max Priority Fee. Tips paying to the miners, which correlates to the likelyhood of getting transactions included. * @returns [true if it exists, transaction hash] */ existInMinedOrPendingWithHigherFee(payload: TransactionPayload, maxPriority: BigNumber): [boolean, string]; /** * Adds queuing transaction * @param hash transaction hash * @param transaction object * @returns true if transaction got added to queue, otherwise false */ addToQueuing(hash: string, transaction: Omit, transactionPayload: TransactionPayload): boolean; /** * Moves transaction from queuing to pending * @param hash transaction hash */ moveFromQueuingToPending(hash: string): void; /** * Moves transcation from queuing or pending or mined to confirmed * @param hash transaction hash */ moveToConfirmed(hash: string): void; /** * Moves transcation from pending to mined * @param hash transaction hash */ moveFromPendingToMined(hash: string): void; /** * Moves transcation from mined to confirmed. Delete payload * @param hash transaction hash */ moveFromMinedToConfirmed(hash: string): void; /** * Removed transcation from queuing, pending, mined and confirmed * @param hash transaction hash */ remove(hash: string): void; /** * Removes confirmed blocks except last 5 nonces. * This is a way for us to clean up some memory which we know * we don't need anymore. */ prune(): void; /** * @returns current timestamp */ private _getTime; } export default TranscationManager; //# sourceMappingURL=transaction-manager.d.ts.map