From b5691e23812755a7133502d041364ffb94fd92ec Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Sun, 11 Dec 2022 17:22:43 +0100 Subject: [PATCH] ts: Fix toUiPrice() (#332) For example, the SOL native price of 0.0136 should become the ui price of 13.6 because SOL decimals are 9. --- ts/client/src/accounts/group.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ts/client/src/accounts/group.ts b/ts/client/src/accounts/group.ts index 66030f42e..fc8cc47cb 100644 --- a/ts/client/src/accounts/group.ts +++ b/ts/client/src/accounts/group.ts @@ -569,8 +569,8 @@ export class Group { } } - public toUiPrice(price: I80F48, baseDecimals: number): number { - return toUiDecimals(price, baseDecimals - this.getInsuranceMintDecimals()); + public toUiPrice(price: I80F48 | number, baseDecimals: number): number { + return toUiDecimals(price, this.getInsuranceMintDecimals() - baseDecimals); } public toNativePrice(uiPrice: number, baseDecimals: number): I80F48 {