Skip to content

Commit

Permalink
quantityToUiBase
Browse files Browse the repository at this point in the history
  • Loading branch information
binyebarwe committed Dec 17, 2023
1 parent 7d9c347 commit 7ba5c1c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openbook-dex/openbook-v2",
"version": "0.0.24",
"version": "0.0.25",
"description": "Typescript Client for openbook-v2 program.",
"repository": "https://github.com/openbook-dex/openbook-v2/",
"author": {
Expand Down
8 changes: 8 additions & 0 deletions ts/client/src/market.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,3 +174,11 @@ export function baseLotsToUi(market: MarketAccount, quantity: BN): number {
export function quoteLotsToUi(market: MarketAccount, quantity: BN): number {
return parseFloat(quantity.toString()) * quoteLotsToUiConverter(market);
}

export function quantityToUiBase(
market: MarketAccount,
quantity: BN,
decimals: number,
): number {
return toUiDecimals(quantity.mul(market.baseLotSize).toNumber(), decimals);
}

0 comments on commit 7ba5c1c

Please sign in to comment.