From 230c399bdc559c5106ffa22bebf3df1afc4af244 Mon Sep 17 00:00:00 2001 From: Aleksandr Kraiz Date: Thu, 3 Aug 2023 17:08:55 +0400 Subject: [PATCH] Fix: convertPrice --- package.json | 2 +- src/utils/convertPrice.ts | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 8b72901..908b26e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/utils/convertPrice.ts b/src/utils/convertPrice.ts index 95415bb..3055b9b 100644 --- a/src/utils/convertPrice.ts +++ b/src/utils/convertPrice.ts @@ -6,11 +6,11 @@ export default function convertPrice( assetOutAddress: string, prices: Partial> // 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);