mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-03-17 00:31:34 +03:00
Fix: convertPrice
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user