mirror of
https://github.com/orionprotocol/sdk.git
synced 2026-04-01 02:27:56 +03:00
Fix: convertPrice
This commit is contained in:
@@ -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