@@ -118,6 +118,7 @@ impl RateLimit {
118118pub enum ConfigParamKey {
119119 TransactionsRequestLimit ( Chain ) ,
120120 TransactionsPendingErrorMaxAge ( Chain ) ,
121+ TransactionsFeeEstimatesCacheDuration ( Chain ) ,
121122 SwapperVaultAddresses ( SwapProvider ) ,
122123 PriceProviderAssetsLimit ( PriceProvider ) ,
123124 PriceProviderAssetsDuration ( PriceProvider ) ,
@@ -137,6 +138,7 @@ impl ConfigParamKey {
137138 pub fn all ( ) -> Vec < Self > {
138139 let transactions = Chain :: all ( ) . into_iter ( ) . map ( Self :: TransactionsRequestLimit ) ;
139140 let pending_transactions = Chain :: all ( ) . into_iter ( ) . map ( Self :: TransactionsPendingErrorMaxAge ) ;
141+ let fee_estimates = Chain :: all ( ) . into_iter ( ) . map ( Self :: TransactionsFeeEstimatesCacheDuration ) ;
140142 let swapper = SwapProvider :: cross_chain_providers ( ) . into_iter ( ) . map ( Self :: SwapperVaultAddresses ) ;
141143 let assets_limit = PriceProvider :: all ( ) . into_iter ( ) . map ( Self :: PriceProviderAssetsLimit ) ;
142144 let assets = PriceProvider :: all ( ) . into_iter ( ) . map ( Self :: PriceProviderAssetsDuration ) ;
@@ -152,6 +154,7 @@ impl ConfigParamKey {
152154 let rate_limits = RateLimitKey :: iter ( ) . flat_map ( |key| RateLimitWindow :: ALL . into_iter ( ) . map ( move |window| Self :: RateLimit ( key, window) ) ) ;
153155 transactions
154156 . chain ( pending_transactions)
157+ . chain ( fee_estimates)
155158 . chain ( swapper)
156159 . chain ( assets_limit)
157160 . chain ( assets)
@@ -172,6 +175,7 @@ impl ConfigParamKey {
172175 match self {
173176 Self :: TransactionsRequestLimit ( chain) => format ! ( "{}.{}" , self . as_ref( ) , chain. as_ref( ) ) ,
174177 Self :: TransactionsPendingErrorMaxAge ( chain) => format ! ( "{}.{}" , self . as_ref( ) , chain. as_ref( ) ) ,
178+ Self :: TransactionsFeeEstimatesCacheDuration ( chain) => format ! ( "{}.{}" , self . as_ref( ) , chain. as_ref( ) ) ,
175179 Self :: SwapperVaultAddresses ( provider) => format ! ( "{}.{}" , self . as_ref( ) , provider. as_ref( ) ) ,
176180 Self :: PriceProviderAssetsLimit ( provider) => format ! ( "{}.{}" , self . as_ref( ) , provider. as_ref( ) ) ,
177181 Self :: PriceProviderAssetsDuration ( provider) => format ! ( "{}.{}" , self . as_ref( ) , provider. as_ref( ) ) ,
@@ -192,6 +196,7 @@ impl ConfigParamKey {
192196 match self {
193197 Self :: TransactionsRequestLimit ( _) => "100" . to_string ( ) ,
194198 Self :: TransactionsPendingErrorMaxAge ( _) => "3d" . to_string ( ) ,
199+ Self :: TransactionsFeeEstimatesCacheDuration ( _) => "1m" . to_string ( ) ,
195200 Self :: SwapperVaultAddresses ( _) => "5m" . to_string ( ) ,
196201 Self :: PriceProviderAssetsLimit ( PriceProvider :: TonApi ) => "1000" . to_string ( ) ,
197202 Self :: PriceProviderAssetsLimit ( _) => "5000" . to_string ( ) ,
@@ -233,6 +238,15 @@ mod tests {
233238 assert_eq ! ( bitcoin. default_value( ) , "3d" ) ;
234239 }
235240
241+ #[ test]
242+ fn test_transactions_fee_estimates_cache_duration ( ) {
243+ let key = ConfigParamKey :: TransactionsFeeEstimatesCacheDuration ( Chain :: Tron ) ;
244+
245+ assert_eq ! ( key. key( ) , "transactionsFeeEstimatesCacheDuration.tron" ) ;
246+ assert_eq ! ( key. default_value( ) , "1m" ) ;
247+ assert_eq ! ( ConfigParamKey :: all( ) . iter( ) . filter( |key| matches!( key, ConfigParamKey :: TransactionsFeeEstimatesCacheDuration ( _) ) ) . count( ) , Chain :: all( ) . len( ) ) ;
248+ }
249+
236250 #[ test]
237251 fn test_scan_type_enable ( ) {
238252 let key = ConfigParamKey :: ScanTypeEnable ( ScanType :: AddressPoisoning ) ;
0 commit comments