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.
This commit is contained in:
Christian Kamm 2022-12-11 17:22:43 +01:00 committed by GitHub
parent e0f50bf0d4
commit b5691e2381
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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 {