Skip to content

Commit

Permalink
Update tokenProvider.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsayo authored Jan 15, 2025
1 parent 973ae93 commit 87af1b8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/plugin-dexscreener/src/providers/tokenProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class TokenPriceProvider implements Provider {
console.log(`Fetching price for token: ${tokenIdentifier}`);

// Make API request
const isAddress = /^0x[a-fA-F0-9]{40}$/.test(tokenIdentifier);
const isAddress = /^0x[a-fA-F0-9]{40}$/.test(tokenIdentifier) || /^[1-9A-HJ-NP-Za-km-z]{43,44}$/.test(address); // validates for ethAddress and solAddress
const endpoint = isAddress
? `https://api.dexscreener.com/latest/dex/tokens/${tokenIdentifier}`
: `https://api.dexscreener.com/latest/dex/search?q=${tokenIdentifier}`;
Expand Down Expand Up @@ -105,4 +105,4 @@ export class TokenPriceProvider implements Provider {

}

export const tokenPriceProvider = new TokenPriceProvider();
export const tokenPriceProvider = new TokenPriceProvider();

0 comments on commit 87af1b8

Please sign in to comment.