@tunghm/relay-kit
Version:
SDK for Safe Smart Accounts with support for ERC-4337 and Relay
52 lines • 2.07 kB
TypeScript
import { IFeeEstimator } from '../types';
/**
* Supported bundler types for auto-detection
*/
export type BundlerType = 'PIMLICO' | 'BICONOMY' | 'GELATO' | 'GENERIC';
/**
* Detect bundler provider from URL pattern
*
* @param bundlerUrl - The bundler RPC URL
* @returns Detected bundler type
*
* @example
* ```typescript
* detectBundlerFromUrl('https://api.pimlico.io/v2/...') // 'PIMLICO'
* detectBundlerFromUrl('https://bundler.biconomy.io/api/v3/...') // 'BICONOMY'
* detectBundlerFromUrl('https://api.gelato.digital/bundlers/1/rpc') // 'GELATO'
* detectBundlerFromUrl('http://localhost:4337') // 'PIMLICO' (Alto self-hosted)
* detectBundlerFromUrl('https://bundler.inheritwallet.io') // 'PIMLICO' (Alto self-hosted)
* detectBundlerFromUrl('https://custom-bundler.com/rpc') // 'PIMLICO' (default)
* ```
*/
export declare function detectBundlerFromUrl(bundlerUrl: string): BundlerType;
/**
* Create appropriate fee estimator based on bundler URL auto-detection
*
* This function automatically detects the bundler type from the URL and
* returns the corresponding fee estimator instance.
*
* @param bundlerUrl - The bundler RPC URL
* @returns Fee estimator instance for detected bundler
*
* @example
* ```typescript
* // Auto-detect Pimlico
* const estimator = createFeeEstimatorFromUrl('https://api.pimlico.io/v2/...')
* // Returns: PimlicoFeeEstimator instance
*
* // Auto-detect Biconomy
* const estimator = createFeeEstimatorFromUrl('https://bundler.biconomy.io/api/v3/...')
* // Returns: BiconomyFeeEstimator instance
*
* // Auto-detect Gelato
* const estimator = createFeeEstimatorFromUrl('https://api.gelato.digital/bundlers/1/rpc')
* // Returns: GelatoFeeEstimator instance
*
* // Default to Pimlico for self-hosted Alto or unknown bundlers
* const estimator = createFeeEstimatorFromUrl('http://localhost:4337')
* // Returns: PimlicoFeeEstimator instance (Alto-compatible)
* ```
*/
export declare function createFeeEstimatorFromUrl(bundlerUrl: string): IFeeEstimator;
//# sourceMappingURL=bundlerDetection.d.ts.map