@@ -59,6 +59,7 @@ import type {
5959 ValidatedParams ,
6060 ValidationResult ,
6161 LiFiConfig ,
62+ LiFiFeeConfig ,
6263} from './types' ;
6364import { getAllTokenIdsForChain } from 'utils/tokenHelpers' ;
6465import { sleep } from 'utils' ;
@@ -180,7 +181,7 @@ export class LiFiRoute<N extends Network>
180181 ? canonicalAddress ( request . recipient )
181182 : generateThrowawayAddress ( toChain . chain ) ;
182183
183- const integrator = this . getIntegrator ( request ) ;
184+ const { integrator, feePercent } = this . getFeeConfig ( request ) ;
184185
185186 const quoteRequest : QuoteRequest = {
186187 fromChain : fromChainId ,
@@ -196,7 +197,7 @@ export class LiFiRoute<N extends Network>
196197 maxPriceImpact : params . normalizedParams . maxPriceImpact ,
197198 integrator,
198199 referrer : params . options . referrer ,
199- fee : params . options . fee ,
200+ fee : feePercent ,
200201 } ;
201202
202203 // Lifi SDK has a AllowDenyPrefer type but then it's converted into a different format for quote requests...
@@ -216,12 +217,12 @@ export class LiFiRoute<N extends Network>
216217 return getQuote ( quoteRequest ) ;
217218 }
218219
219- getIntegrator ( request : routes . RouteTransferRequest < N > ) : string {
220- if ( ! this . config ?. getIntegrator ) {
221- return DEFAULT_INTEGRATOR ;
220+ getFeeConfig ( request : routes . RouteTransferRequest < N > ) : LiFiFeeConfig {
221+ if ( ! this . config ?. getFeeConfig ) {
222+ return { integrator : DEFAULT_INTEGRATOR , feePercent : 0 } ;
222223 }
223224
224- return this . config . getIntegrator ( request ) ;
225+ return this . config . getFeeConfig ( request ) ;
225226 }
226227
227228 async quote (
@@ -386,7 +387,7 @@ export function createLiFiRouteWithConfig<N extends Network>(
386387 // to avoid extra network calls to fetch chains which we don't need.
387388 lifiSdkConfig . set ( {
388389 // The integrator is required here so just set it to the default.
389- // The actual integrator used will be set per-quote in fetchQuote()
390+ // The actual integrator used will be set per-quote in fetchQuote().
390391 integrator : DEFAULT_INTEGRATOR ,
391392 apiUrl : config . apiUrl ?? DEFAULT_API_URL ,
392393 } ) ;
0 commit comments