@@ -50,6 +50,8 @@ export interface BungeeApiOptions {
5050 affiliate ?: string
5151}
5252
53+ type BungeeApiType = 'bungee' | 'events' | 'across' | 'bungee-manual'
54+
5355interface IntermediateTokensParams {
5456 fromChainId : SupportedChainId
5557 toChainId : TargetChainId
@@ -362,8 +364,14 @@ export class BungeeApi {
362364 return bridges ?? this . options . includeBridges ?? SUPPORTED_BRIDGES
363365 }
364366
367+ private shouldAddAffiliate ( apiType : BungeeApiType , baseUrl : string ) : boolean {
368+ const isBungeeApi = apiType === 'bungee' || apiType === 'bungee-manual'
369+
370+ return ! baseUrl . includes ( BUNGEE_BASE_URL ) && isBungeeApi
371+ }
372+
365373 private async makeApiCall < T > (
366- apiType : 'bungee' | 'events' | 'across' | 'bungee-manual' ,
374+ apiType : BungeeApiType ,
367375 path : string ,
368376 params : Record < string , string > | URLSearchParams ,
369377 isValidResponse ?: ( response : unknown ) => response is T ,
@@ -379,7 +387,7 @@ export class BungeeApi {
379387 const url = `${ baseUrl } ${ path } ?${ new URLSearchParams ( params ) . toString ( ) } `
380388 const headers : Record < string , string > = { }
381389
382- if ( this . options . affiliate && ! baseUrl . includes ( BUNGEE_BASE_URL ) ) {
390+ if ( this . shouldAddAffiliate ( apiType , baseUrl ) && this . options . affiliate ) {
383391 headers [ 'affiliate' ] = this . options . affiliate
384392 }
385393
0 commit comments