From a00feb1d94a9e3b0ad9ecf555a340a5b7d9b30e7 Mon Sep 17 00:00:00 2001 From: dd Date: Sun, 14 Feb 2021 10:53:19 -0500 Subject: [PATCH] added utility functions to MangoGroup --- src/client.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/client.ts b/src/client.ts index 04b324c..bc2bf49 100644 --- a/src/client.ts +++ b/src/client.ts @@ -88,6 +88,13 @@ export class MangoGroup { getDepositRate(tokenIndex: number): number { return 0.0 // TODO } + + getUiTotalDeposit(tokenIndex: number): number { + return nativeToUi(this.totalDeposits[tokenIndex] * this.indexes[tokenIndex].deposit, this.mintDecimals[tokenIndex]) + } + getUiTotalBorrow(tokenIndex: number): number { + return nativeToUi(this.totalBorrows[tokenIndex] * this.indexes[tokenIndex].borrow, this.mintDecimals[tokenIndex]) + } } export class MarginAccount {