From 85e674385ea67a14f8e96d774b9d233678cf484f Mon Sep 17 00:00:00 2001 From: Riordan Panayides Date: Sat, 22 May 2021 13:54:53 +0100 Subject: [PATCH] Add function to get token decimals by index --- src/client.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/client.ts b/src/client.ts index df0bb60..1c58fcb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -169,6 +169,9 @@ export class MangoGroup { getTokenSymbol(tokenIndex: number): string { return TOKEN_MINTS.find((m) => m.address.toString() === this.tokens[tokenIndex].toString())?.name || ''; } + getTokenDecimals(tokenIndex: number): number { + return tokenToDecimals[this.getTokenSymbol(tokenIndex)] + } } export class MarginAccount {