From 240f5a05b5ca45a896b7cb4dd29cb104470e2b5f Mon Sep 17 00:00:00 2001 From: dd Date: Sun, 14 Mar 2021 13:22:42 -0400 Subject: [PATCH] separated out tokenDecimals --- package.json | 2 +- src/client.ts | 16 ++++++++++------ src/index.ts | 7 +------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index eab28c1..1c25873 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@blockworks-foundation/mango-client", - "version": "0.1.4", + "version": "0.1.5", "description": "Library for interacting with Mango Markets' solana smart contracts.", "repository": "blockworks-foundation/mango-client-ts", "author": { diff --git a/src/client.ts b/src/client.ts index e1f3b1c..2c8762e 100644 --- a/src/client.ts +++ b/src/client.ts @@ -43,6 +43,14 @@ import { makeCancelOrderInstruction, makeSettleFundsInstruction } from './instru import { Aggregator } from './schema'; import { TOKEN_PROGRAM_ID } from '@solana/spl-token'; +export const tokenToDecimals = { + "BTC": 4, + "ETH": 3, + "USDT": 2, + "USDC": 2 +} + + export class MangoGroup { publicKey: PublicKey; @@ -208,12 +216,8 @@ export class MarginAccount { `${"Asset".padEnd(5)} ${"Deposits".padEnd(10)} ${"Borrows".padEnd(10)}`, ] - const tokenToDecimals = { - "BTC": 4, - "ETH": 3, - "USDC": 2 - } - const tokenNames = ["BTC", "ETH", "USDC"] // TODO pull this from somewhere + + const tokenNames = ["BTC", "ETH", "USDT"] // TODO pull this from somewhere for (let i = 0; i < mangoGroup.tokens.length; i++) { const decimals = tokenToDecimals[tokenNames[i]] diff --git a/src/index.ts b/src/index.ts index 3f5574b..a96a1c5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,7 @@ import { MangoClient, MangoGroup } from './client'; import IDS from './ids.json'; -import { Account, Connection, PublicKey } from '@solana/web3.js'; -import { Aggregator } from './schema'; -import { homedir } from 'os'; -import fs from 'fs'; -import { sleep } from './utils'; -export { MangoClient, MangoGroup, MarginAccount } from './client'; +export { MangoClient, MangoGroup, MarginAccount, tokenToDecimals } from './client'; export { MangoIndexLayout, MarginAccountLayout, MangoGroupLayout } from './layout'; export * from './layout'; export * from './utils'