separated out tokenDecimals
This commit is contained in:
parent
8fbc082286
commit
240f5a05b5
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@blockworks-foundation/mango-client",
|
"name": "@blockworks-foundation/mango-client",
|
||||||
"version": "0.1.4",
|
"version": "0.1.5",
|
||||||
"description": "Library for interacting with Mango Markets' solana smart contracts.",
|
"description": "Library for interacting with Mango Markets' solana smart contracts.",
|
||||||
"repository": "blockworks-foundation/mango-client-ts",
|
"repository": "blockworks-foundation/mango-client-ts",
|
||||||
"author": {
|
"author": {
|
||||||
|
|
|
@ -43,6 +43,14 @@ import { makeCancelOrderInstruction, makeSettleFundsInstruction } from './instru
|
||||||
import { Aggregator } from './schema';
|
import { Aggregator } from './schema';
|
||||||
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
||||||
|
|
||||||
|
export const tokenToDecimals = {
|
||||||
|
"BTC": 4,
|
||||||
|
"ETH": 3,
|
||||||
|
"USDT": 2,
|
||||||
|
"USDC": 2
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
export class MangoGroup {
|
export class MangoGroup {
|
||||||
publicKey: PublicKey;
|
publicKey: PublicKey;
|
||||||
|
@ -208,12 +216,8 @@ export class MarginAccount {
|
||||||
`${"Asset".padEnd(5)} ${"Deposits".padEnd(10)} ${"Borrows".padEnd(10)}`,
|
`${"Asset".padEnd(5)} ${"Deposits".padEnd(10)} ${"Borrows".padEnd(10)}`,
|
||||||
]
|
]
|
||||||
|
|
||||||
const tokenToDecimals = {
|
|
||||||
"BTC": 4,
|
const tokenNames = ["BTC", "ETH", "USDT"] // TODO pull this from somewhere
|
||||||
"ETH": 3,
|
|
||||||
"USDC": 2
|
|
||||||
}
|
|
||||||
const tokenNames = ["BTC", "ETH", "USDC"] // TODO pull this from somewhere
|
|
||||||
|
|
||||||
for (let i = 0; i < mangoGroup.tokens.length; i++) {
|
for (let i = 0; i < mangoGroup.tokens.length; i++) {
|
||||||
const decimals = tokenToDecimals[tokenNames[i]]
|
const decimals = tokenToDecimals[tokenNames[i]]
|
||||||
|
|
|
@ -1,12 +1,7 @@
|
||||||
import { MangoClient, MangoGroup } from './client';
|
import { MangoClient, MangoGroup } from './client';
|
||||||
import IDS from './ids.json';
|
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 { MangoIndexLayout, MarginAccountLayout, MangoGroupLayout } from './layout';
|
||||||
export * from './layout';
|
export * from './layout';
|
||||||
export * from './utils'
|
export * from './utils'
|
||||||
|
|
Loading…
Reference in New Issue