Skip to content

Commit

Permalink
Merge pull request #436 from curvefi/fix/fixed-nativeToken-lite
Browse files Browse the repository at this point in the history
fix: fix nativeToken price for corn
  • Loading branch information
fedorovdg authored Dec 31, 2024
2 parents aa7985a + 7538a3e commit e480c06
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.65.23",
"version": "2.65.24",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
2 changes: 1 addition & 1 deletion src/external-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ export const _getLiteNetworksData = memoize(
wrappedAddress: wrapped_native_token,
},
API_CONSTANTS: {
nativeTokenName: config.native_currency_coingecko_id || config.platform_coingecko_id,
nativeTokenName: config.native_currency_coingecko_id,
wrappedNativeTokenAddress: config.wrapped_native_token,
},
};
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,11 @@ export const _getUsdRate = async (assetId: string): Promise<number> => {
}

if (nativeTokenName === undefined) {
throw Error('nativeTokenName not found')
if(curve.isLiteChain && curve.constants.API_CONSTANTS?.wrappedNativeTokenAddress.toLowerCase() && curve.constants.API_CONSTANTS?.wrappedNativeTokenAddress.toLowerCase() in pricesFromApi) {
return pricesFromApi[curve.constants.API_CONSTANTS?.wrappedNativeTokenAddress.toLowerCase()];
} else {
throw Error('nativeTokenName not found')
}
}

assetId = {
Expand Down

0 comments on commit e480c06

Please sign in to comment.