@tunghm/relay-kit
Version:
SDK for Safe Smart Accounts with support for ERC-4337 and Relay
61 lines • 2.56 kB
TypeScript
import { EstimateGasData } from '@safe-global/types-kit';
import { EstimateFeeFunctionProps, IFeeEstimator } from '../../../../packs/safe-4337/types';
import { GelatoGasMultipliers } from './types';
/**
* GelatoFeeEstimator implements IFeeEstimator for Gelato bundler.
*
* Key differences from Pimlico/Biconomy:
* - Uses standard eth_maxPriorityFeePerGas instead of custom RPC methods
* - 1Balance sponsorship via URL param (no paymaster RPC calls needed)
* - External paymaster support for ERC-20 payments
*
* Gas Pricing Approach:
* - Gelato doesn't provide custom gas price tiers (slow/standard/fast)
* - Uses standard Ethereum RPC: eth_maxPriorityFeePerGas
* - Calculates maxFeePerGas from baseFee + priorityFee
* - Applies configurable multipliers for safety margin (default 1.5x)
*
* Sponsorship Models:
* 1. 1Balance (Gelato native): sponsorApiKey in URL, gas fields = 0
* 2. External paymaster: standard pm_getPaymasterStubData/pm_getPaymasterData
*
* @example
* ```typescript
* // Auto-detected from URL
* const estimator = new GelatoFeeEstimator()
*
* // With custom multipliers
* const estimator = new GelatoFeeEstimator({
* maxFeePerGasMultiplier: 2.0,
* maxPriorityFeePerGasMultiplier: 1.5
* })
* ```
*/
export declare class GelatoFeeEstimator implements IFeeEstimator {
#private;
constructor(gasMultipliers?: GelatoGasMultipliers);
/**
* Setup the userOperation before calling eth_estimateUserOperationGas
*
* This method:
* 1. Checks if using 1Balance sponsorship (gas fields = 0)
* 2. If not sponsored, calculates gas from standard RPC
* 3. If external paymaster provided, fetches stub data
*
* @param props - Estimation parameters
* @returns Gas estimation data including fees and paymaster stub data
*/
preEstimateUserOperationGas({ bundlerUrl, userOperation, entryPoint, paymasterOptions, protocolKit }: EstimateFeeFunctionProps): Promise<EstimateGasData>;
/**
* Adjust the userOperation values after calling eth_estimateUserOperationGas
*
* This method:
* 1. If using 1Balance: no post-estimation needed (return empty)
* 2. If external paymaster: calls pm_getPaymasterData for final data
*
* @param props - Estimation parameters
* @returns Paymaster data to merge into userOperation
*/
postEstimateUserOperationGas({ bundlerUrl, userOperation, entryPoint, paymasterOptions, protocolKit }: EstimateFeeFunctionProps): Promise<EstimateGasData>;
}
//# sourceMappingURL=GelatoFeeEstimator.d.ts.map