import type { FetchGasFeeEstimateOptions, GasFeeState } from '@metamask/gas-fee-controller'; import type { Hex } from '@metamask/utils'; import EventEmitter from 'events'; import type { TransactionControllerMessenger } from '../TransactionController.js'; import type { GasFeeEstimates, GasFeeFlow, Layer1GasFeeFlow, TransactionMeta, TransactionBatchMeta } from '../types.js'; import { GasFeeEstimateLevel } from '../types.js'; /** * Automatically polls and updates suggested gas fees on unapproved transactions. */ export declare class GasFeePoller { #private; hub: EventEmitter; /** * Constructs a new instance of the GasFeePoller. * * @param options - The options for this instance. * @param options.gasFeeFlows - The gas fee flows to use to obtain suitable gas fees. * @param options.getGasFeeControllerEstimates - Callback to obtain the default fee estimates. * @param options.getTransactions - Callback to obtain the transaction data. * @param options.getTransactionBatches - Callback to obtain the transaction batch data. * @param options.layer1GasFeeFlows - The layer 1 gas fee flows to use to obtain suitable layer 1 gas fees. * @param options.messenger - The TransactionControllerMessenger instance. * @param options.onStateChange - Callback to register a listener for controller state changes. */ constructor({ gasFeeFlows, getGasFeeControllerEstimates, getTransactions, getTransactionBatches, layer1GasFeeFlows, messenger, onStateChange, }: { gasFeeFlows: GasFeeFlow[]; getGasFeeControllerEstimates: (options: FetchGasFeeEstimateOptions) => Promise; getTransactions: () => TransactionMeta[]; getTransactionBatches: () => TransactionBatchMeta[]; layer1GasFeeFlows: Layer1GasFeeFlow[]; messenger: TransactionControllerMessenger; onStateChange: (listener: () => void) => void; }); } /** * Updates gas properties for transaction. * * @param args - Argument bag. * @param args.txMeta - The transaction meta. * @param args.gasFeeEstimates - The gas fee estimates. * @param args.gasFeeEstimatesLoaded - Whether the gas fee estimates are loaded. * @param args.isTxParamsGasFeeUpdatesEnabled - Whether to update the gas fee properties in `txParams`. * @param args.layer1GasFee - The layer 1 gas fee. */ export declare function updateTransactionGasProperties({ gasFeeEstimates, gasFeeEstimatesLoaded, isTxParamsGasFeeUpdatesEnabled, layer1GasFee, txMeta, }: { gasFeeEstimates?: GasFeeEstimates; gasFeeEstimatesLoaded?: boolean; isTxParamsGasFeeUpdatesEnabled: (transactionMeta: TransactionMeta) => boolean; layer1GasFee?: Hex; txMeta: TransactionMeta; }): void; /** * Updates `txParams` gas values accordingly with given `userFeeLevel` from `txMeta.gasFeeEstimates`. * * @param args - Argument bag. * @param args.txMeta - The transaction meta. * @param args.userFeeLevel - The user fee level. */ export declare function updateTransactionGasEstimates({ txMeta, userFeeLevel, }: { txMeta: TransactionMeta; userFeeLevel: GasFeeEstimateLevel; }): void; //# sourceMappingURL=GasFeePoller.d.ts.map