diff --git a/package.json b/package.json index 4c56eedf..65704ea8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@curvefi/api", - "version": "2.65.7", + "version": "2.65.8", "description": "JavaScript library for curve.fi", "main": "lib/index.js", "author": "Macket", diff --git a/src/external-api.ts b/src/external-api.ts index fae8155f..3b208edc 100644 --- a/src/external-api.ts +++ b/src/external-api.ts @@ -292,6 +292,7 @@ export const _getLiteNetworksData = memoize( }, API_CONSTANTS: { nativeTokenName: config.native_currency_coingecko_id, + wrappedNativeTokenAddress: config.wrapped_native_token, }, }; } catch (error) { diff --git a/src/interfaces.ts b/src/interfaces.ts index 397bb51d..dc9e6f4f 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -75,6 +75,7 @@ export interface INetworkConstants { ZERO_ADDRESS: string, API_CONSTANTS?: { nativeTokenName: string + wrappedNativeTokenAddress: string } } diff --git a/src/utils.ts b/src/utils.ts index 9f13fd2b..4a19b2a4 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -500,6 +500,10 @@ export const _getUsdRate = async (assetId: string): Promise => { assetId = 'curve-dao-token'; } + if(curve.isLiteChain && assetId.toLowerCase() === curve.constants.API_CONSTANTS?.wrappedNativeTokenAddress.toLowerCase()) { + assetId = nativeTokenName + } + if ((_usdRatesCache[assetId]?.time || 0) + 600000 < Date.now()) { const url = [nativeTokenName, 'ethereum', 'bitcoin', 'link', 'curve-dao-token', 'stasis-eurs'].includes(assetId.toLowerCase()) ? `https://api.coingecko.com/api/v3/simple/price?ids=${assetId}&vs_currencies=usd` :