import { BigNumber, Wallet } from 'ethers'; import type { EnvelopingTxRequest } from '../common/relayTransaction.types'; import { type EnvelopingRequest, type RelayTxOptions } from '../common'; declare const estimateRelayMaxPossibleGas: (envelopingRequest: EnvelopingTxRequest, relayWorkerAddress: string, options?: RelayTxOptions) => Promise; /** * We try to estimate the maximum possible gas that the transaction will consume * without requiring the signature of the user. The idea is to apply 2 different strategies * according to the type of request: * - deploy: the server signs the request and estimates the gas of the deployment with a static call * - relay: we split the requests into different stages * - preEnvelopedTxEstimation: the gas required without the payment and the internal call * - paymentEstimation: the gas required for the payment * - internalEstimation: the gas required for the internal call * - POST_DEPLOY_NO_EXECUTION: when there is no execution in deployment, an additional 4_000 are needed * - POST_DEPLOY_EXECUTION: when there is execution in deployment, an additional 1_500 are needed * - STORAGE_REFUND: After the nonces were already touched by a smart wallet deployment or smart wallet execution, we need to subtract 15_000 * - Manually subtract: * - Without signature, we cannot analyze if some of the gas costs should be included or not, to avoid underestimating the relay transaction * the costs are included in all of them. These costs can be subtract by using the following constants: * - POST_RELAY_DEPLOY_GAS_COST: The transfer back cost is always included since we cannot know if the smart wallet is going * to have some balance after the execution * - ACCOUNT_ALREADY_CREATED: The owner address of the smart wallet was previously created. A utility function was included to check * if the owner address of smart wallet was already created * @param relayRequest * @param signer * @param options * @returns */ declare const estimateRelayMaxPossibleGasNoSignature: (relayRequest: EnvelopingRequest, signer: Wallet, options?: RelayTxOptions) => Promise; export { estimateRelayMaxPossibleGas, estimateRelayMaxPossibleGasNoSignature };