Fix: convertPrice

This commit is contained in:
Aleksandr Kraiz
2023-08-03 17:08:55 +04:00
parent dec0e82b07
commit 230c399bdc
2 changed files with 5 additions and 5 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "@orionprotocol/sdk",
"version": "0.19.43",
"version": "0.19.44",
"description": "Orion Protocol SDK",
"main": "./lib/index.cjs",
"module": "./lib/index.js",

View File

@@ -6,11 +6,11 @@ export default function convertPrice(
assetOutAddress: string,
prices: Partial<Record<string, string>> // quoted in quoteAsset. [address]: priceQuotedInQuoteAsset
) {
const assetInPrice = prices[assetInAddress];
if (assetInPrice === undefined) throw Error('assetInPrice is undefined');
const assetInPrice = prices[assetInAddress.toLowerCase()];
if (assetInPrice === undefined) throw Error(`Price conversion: AssetIn (${assetInAddress}) price is undefined`);
const assetOutPrice = prices[assetOutAddress];
if (assetOutPrice === undefined) throw Error('assetOutPrice is undefined');
const assetOutPrice = prices[assetOutAddress.toLowerCase()];
if (assetOutPrice === undefined) throw Error(`Price conversion: AssetOut (${assetOutAddress}) price is undefined`);
const assetInPriceBN = new BigNumber(assetInPrice);
const assetOutPriceBN = new BigNumber(assetOutPrice);