1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

optional value for all fee, prevent breaking when no value

This commit is contained in:
Soon Huat 2022-03-21 15:35:06 +08:00
parent 4ad5f12398
commit 9da987ea9d

View File

@ -295,13 +295,13 @@ export async function getOrderPriceAndFees(
// calculate full price, we assume that all the values are in ocean, otherwise this will be incorrect
orderPriceAndFee.price = new Decimal(+orderPriceAndFee.price || 0)
.add(new Decimal(+orderPriceAndFee.consumeMarketOrderFee || 0))
.add(new Decimal(+orderPriceAndFee.publisherMarketOrderFee || 0))
.add(new Decimal(+orderPriceAndFee?.consumeMarketOrderFee || 0))
.add(new Decimal(+orderPriceAndFee?.publisherMarketOrderFee || 0))
.add(new Decimal(+orderPriceAndFee?.providerFee?.providerFeeAmount || 0))
.add(new Decimal(+orderPriceAndFee.publisherMarketPoolSwapFee || 0))
.add(new Decimal(+orderPriceAndFee.publisherMarketFixedSwapFee || 0))
.add(new Decimal(+orderPriceAndFee.consumeMarketPoolSwapFee || 0))
.add(new Decimal(+orderPriceAndFee.consumeMarketFixedSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.publisherMarketPoolSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.publisherMarketFixedSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.consumeMarketPoolSwapFee || 0))
.add(new Decimal(+orderPriceAndFee?.consumeMarketFixedSwapFee || 0))
.toString()
return orderPriceAndFee
}