diff --git a/package.json b/package.json index c205967cd..0312865d5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@openbook-dex/openbook-v2", - "version": "0.2.3", + "version": "0.2.4", "description": "Typescript Client for openbook-v2 program.", "repository": "https://github.com/openbook-dex/openbook-v2/", "author": { diff --git a/ts/client/src/accounts/market.ts b/ts/client/src/accounts/market.ts index f3c16527e..7717648fe 100644 --- a/ts/client/src/accounts/market.ts +++ b/ts/client/src/accounts/market.ts @@ -88,12 +88,14 @@ export class Market { ); } public priceUiToLots(uiAmount: number): BN { - return toNative(uiAmount * Number(this.account.baseLotSize.toString()), this.account.quoteDecimals) - .div( - new BN(Math.pow(10, this.account.baseDecimals)).imul( - this.account.quoteLotSize, - ), - ); + return toNative( + uiAmount * Number(this.account.baseLotSize.toString()), + this.account.quoteDecimals, + ).div( + new BN(Math.pow(10, this.account.baseDecimals)).imul( + this.account.quoteLotSize, + ), + ); } public makerFeeFloor(quoteNative: BN): BN { diff --git a/ts/client/src/test/market.ts b/ts/client/src/test/market.ts index bd040ffc9..03d835922 100644 --- a/ts/client/src/test/market.ts +++ b/ts/client/src/test/market.ts @@ -67,13 +67,13 @@ async function testMarketLots(): Promise { ); const market = await Market.load(client, marketPk); - if ("1" !== market.priceUiToLots(1e-10).toString()) { + if ('1' !== market.priceUiToLots(1e-10).toString()) { throw new Error('price lot calculation rounds wrongly'); } - if ("0" !== market.priceUiToLots(9e-11).toString()) { + if ('0' !== market.priceUiToLots(9e-11).toString()) { throw new Error('price lot calculation rounds wrongly'); } - if ("1" !== market.priceUiToLots(19e-11).toString()) { + if ('1' !== market.priceUiToLots(19e-11).toString()) { throw new Error('price lot calculation rounds wrongly'); } } @@ -82,4 +82,4 @@ async function testMarketLots(): Promise { // void testFindAllMarkets(); // void testDecodeMarket(); // void testWatchMarket(); -void testMarketLots(); \ No newline at end of file +void testMarketLots();