separated out tokenDecimals

This commit is contained in:
dd 2021-03-14 13:22:42 -04:00
parent 8fbc082286
commit 240f5a05b5
3 changed files with 12 additions and 13 deletions

View File

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

View File

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

View File

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