remouve unused files and organize directories
This commit is contained in:
parent
284acc87fd
commit
2d5edc0f28
|
@ -13,6 +13,8 @@
|
|||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"prefer-const": 0,
|
||||
"@typescript-eslint/no-non-null-assertion": 0,
|
||||
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||
"@typescript-eslint/ban-ts-comment": 0,
|
||||
"@typescript-eslint/explicit-function-return-type": 0,
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import { MangoClient } from './client';
|
||||
import { MangoClient } from '../src/client';
|
||||
import { Account, Commitment, Connection } from '@solana/web3.js';
|
||||
import configFile from './ids.json';
|
||||
import { Config, getMarketByBaseSymbolAndKind, GroupConfig } from './config';
|
||||
import configFile from '../src/ids.json';
|
||||
import {
|
||||
Config,
|
||||
getMarketByBaseSymbolAndKind,
|
||||
GroupConfig,
|
||||
} from '../src/config';
|
||||
import { Market } from '@project-serum/serum';
|
||||
import { ZERO_BN } from './utils';
|
||||
import { ZERO_BN } from '../src/utils/utils';
|
||||
|
||||
function readKeypair() {
|
||||
return JSON.parse(
|
18
package.json
18
package.json
|
@ -14,23 +14,19 @@
|
|||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build-docs": "yarn typedoc src/index.ts",
|
||||
"cli": "ts-node src/cli.ts",
|
||||
"checkMarginBaskets": "ts-node src/checkMarginBaskets.ts",
|
||||
"liquidator": "ts-node src/liquidator.ts",
|
||||
"launch-group": "ts-node test/initDevnetGroup.ts",
|
||||
"launch-realistic-group": "ts-node test/initRealisticDevnetGroup.ts",
|
||||
"cli": "ts-node src/cli/index.ts",
|
||||
"checkMarginBaskets": "ts-node src/scripts/checkMarginBaskets.ts",
|
||||
"clean": "rm -rf lib",
|
||||
"prepare": "yarn clean && yarn build",
|
||||
"type-check": "tsc --pretty --noEmit",
|
||||
"format": "prettier --check .",
|
||||
"lint": "eslint . --ext ts --ext tsx --ext js --quiet",
|
||||
"shell": "node -e \"$(< shell)\" -i --experimental-repl-await",
|
||||
"keeper": "ts-node src/keeper.ts",
|
||||
"reimburse": "ts-node test/reimburse.ts",
|
||||
"crank": "ts-node src/crank.ts",
|
||||
"scratch": "ts-node src/scratch.ts",
|
||||
"mm": "ts-node src/mm.ts",
|
||||
"dust": "ts-node src/dust.ts",
|
||||
"keeper": "ts-node src/scripts/keeper.ts",
|
||||
"crank": "ts-node src/scripts/crank.ts",
|
||||
"scratch": "ts-node src/scripts/scratch.ts",
|
||||
"mm": "ts-node src/scripts/mm.ts",
|
||||
"dust": "ts-node src/scripts/dust.ts",
|
||||
"example-mango-logs": "ts-node examples/mangoLogs.ts",
|
||||
"test-compute": "ts-node test/compute.test.ts",
|
||||
"test-fillbook": "ts-node test/fillbook.test.ts",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Market, OpenOrders, Orderbook } from '@project-serum/serum';
|
||||
import { AccountInfo, Connection, PublicKey } from '@solana/web3.js';
|
||||
import { I80F48, ONE_I80F48, ZERO_I80F48 } from './fixednum';
|
||||
import { I80F48, ONE_I80F48, ZERO_I80F48 } from './utils/fixednum';
|
||||
import {
|
||||
FREE_ORDER_SLOT,
|
||||
MangoAccountLayout,
|
||||
|
@ -16,7 +16,7 @@ import {
|
|||
nativeToUi,
|
||||
splitOpenOrders,
|
||||
zeroKey,
|
||||
} from './utils';
|
||||
} from './utils/utils';
|
||||
import RootBank from './RootBank';
|
||||
import BN from 'bn.js';
|
||||
import MangoGroup from './MangoGroup';
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Connection, PublicKey } from '@solana/web3.js';
|
|||
import { Big } from 'big.js';
|
||||
import BN from 'bn.js';
|
||||
import { NodeBank, NodeBankLayout } from '.';
|
||||
import { I80F48, ONE_I80F48 } from './fixednum';
|
||||
import { I80F48, ONE_I80F48 } from './utils/fixednum';
|
||||
import {
|
||||
MetaData,
|
||||
RootBankLayout,
|
||||
|
@ -17,7 +17,7 @@ import {
|
|||
} from './layout';
|
||||
import PerpMarket from './PerpMarket';
|
||||
import RootBank from './RootBank';
|
||||
import { getMultipleAccounts, zeroKey } from './utils';
|
||||
import { getMultipleAccounts, zeroKey } from './utils/utils';
|
||||
|
||||
export default class MangoGroup {
|
||||
publicKey: PublicKey;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import BN from 'bn.js';
|
||||
import { PerpMarketCache, PerpMarketInfo, ZERO_BN } from '.';
|
||||
import { I80F48, ZERO_I80F48 } from './fixednum';
|
||||
import { I80F48, ZERO_I80F48 } from './utils/fixednum';
|
||||
import PerpMarket from './PerpMarket';
|
||||
import MangoAccount from './MangoAccount';
|
||||
import Big from 'big.js';
|
||||
|
|
|
@ -14,9 +14,9 @@ import {
|
|||
PerpEventQueueLayout,
|
||||
PerpMarketConfig,
|
||||
} from '.';
|
||||
import { I80F48 } from './fixednum';
|
||||
import { Modify } from './types';
|
||||
import { ZERO_BN } from './utils';
|
||||
import { I80F48 } from './utils/fixednum';
|
||||
import { Modify } from './utils/types';
|
||||
import { ZERO_BN } from './utils/utils';
|
||||
import { EOL } from 'os';
|
||||
import MangoGroup from './MangoGroup';
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { Connection, PublicKey } from '@solana/web3.js';
|
||||
import { I80F48, ZERO_I80F48 } from './fixednum';
|
||||
import { I80F48, ZERO_I80F48 } from './utils/fixednum';
|
||||
import { NodeBank, NodeBankLayout } from './layout';
|
||||
import { getMultipleAccounts, nativeI80F48ToUi, zeroKey } from './utils';
|
||||
import { getMultipleAccounts, nativeI80F48ToUi, zeroKey } from './utils/utils';
|
||||
import BN from 'bn.js';
|
||||
import MangoGroup from './MangoGroup';
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ import BN from 'bn.js';
|
|||
import { PublicKey } from '@solana/web3.js';
|
||||
import { DataType } from './layout';
|
||||
import PerpMarket from './PerpMarket';
|
||||
import { ZERO_BN } from './utils';
|
||||
import { ZERO_BN } from './utils/utils';
|
||||
|
||||
export interface PerpOrder {
|
||||
orderId: BN;
|
||||
|
|
|
@ -6,18 +6,6 @@ import yargs from 'yargs/yargs';
|
|||
import { hideBin } from 'yargs/helpers';
|
||||
import { Options, PositionalOptions } from 'yargs';
|
||||
import { Account, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||
|
||||
import {
|
||||
addPerpMarket,
|
||||
addPythOracle,
|
||||
addSpotMarket,
|
||||
addStubOracle,
|
||||
addSwitchboardOracle,
|
||||
initGroup,
|
||||
listMarket,
|
||||
sanityCheck,
|
||||
setStubOracle,
|
||||
} from './commands';
|
||||
import {
|
||||
Cluster,
|
||||
Config,
|
||||
|
@ -28,14 +16,35 @@ import {
|
|||
GroupConfig,
|
||||
PerpMarketConfig,
|
||||
SpotMarketConfig,
|
||||
} from './config';
|
||||
import { MangoClient } from './client';
|
||||
import { throwUndefined, uiToNative } from './utils';
|
||||
import { QUOTE_INDEX } from './layout';
|
||||
} from '../config';
|
||||
import { MangoClient } from '../client';
|
||||
import { throwUndefined, uiToNative } from '../utils/utils';
|
||||
import { QUOTE_INDEX } from '../layout';
|
||||
import { Coder } from '@project-serum/anchor';
|
||||
import idl from './mango_logs.json';
|
||||
import { getMarketIndexBySymbol } from '.';
|
||||
import idl from '../mango_logs.json';
|
||||
import { getMarketIndexBySymbol } from '../config';
|
||||
import { Market } from '@project-serum/serum';
|
||||
import initGroup from './initGroup';
|
||||
import addPerpMarket from './addPerpMarket';
|
||||
import addSpotMarket from './addSpotMarket';
|
||||
import addStubOracle from './addStubOracle';
|
||||
import addPythOracle from './addPythOracle';
|
||||
import addSwitchboardOracle from './addSwitchboardOracle';
|
||||
import setStubOracle from './setStubOracle';
|
||||
import listMarket from './listMarket';
|
||||
import sanityCheck from './sanityCheck';
|
||||
|
||||
export {
|
||||
addPerpMarket,
|
||||
addSpotMarket,
|
||||
addStubOracle,
|
||||
addPythOracle,
|
||||
addSwitchboardOracle,
|
||||
initGroup,
|
||||
setStubOracle,
|
||||
listMarket,
|
||||
sanityCheck,
|
||||
};
|
||||
|
||||
const clusterDesc: [string, Options] = [
|
||||
'cluster',
|
||||
|
@ -50,7 +59,7 @@ const configDesc: [string, Options] = [
|
|||
'config',
|
||||
{
|
||||
describe: 'the config file to store all public keys',
|
||||
default: __dirname + '/ids.json',
|
||||
default: './src/ids.json',
|
||||
type: 'string',
|
||||
},
|
||||
];
|
|
@ -12,8 +12,7 @@ import {
|
|||
Transaction,
|
||||
} from '@solana/web3.js';
|
||||
import { MangoClient } from '../client';
|
||||
import { GroupConfig } from '../config';
|
||||
import { ZERO_BN } from '../utils';
|
||||
import { ZERO_BN } from '../utils/utils';
|
||||
|
||||
export default async function listMarket(
|
||||
connection: Connection,
|
||||
|
@ -39,6 +38,7 @@ export default async function listMarket(
|
|||
|
||||
async function getVaultOwnerAndNonce() {
|
||||
const nonce = ZERO_BN.clone();
|
||||
// eslint-disable-next-line
|
||||
while (true) {
|
||||
try {
|
||||
const vaultOwner = await PublicKey.createProgramAddress(
|
|
@ -4,8 +4,8 @@ import MangoAccount from '../MangoAccount';
|
|||
import PerpMarket from '../PerpMarket';
|
||||
import { getPerpMarketByIndex, getTokenByMint, GroupConfig } from '../config';
|
||||
import { MangoCache, QUOTE_INDEX } from '../layout';
|
||||
import { I80F48, ZERO_I80F48 } from '../fixednum';
|
||||
import { promiseUndef, ZERO_BN, zeroKey } from '../utils';
|
||||
import { I80F48, ZERO_I80F48 } from '../utils/fixednum';
|
||||
import { promiseUndef, ZERO_BN, zeroKey } from '../utils/utils';
|
||||
import RootBank from '../RootBank';
|
||||
|
||||
async function setUp(client: MangoClient, mangoGroupKey: PublicKey) {
|
|
@ -27,7 +27,7 @@ import {
|
|||
uiToNative,
|
||||
ZERO_BN,
|
||||
zeroKey,
|
||||
} from './utils';
|
||||
} from './utils/utils';
|
||||
import {
|
||||
AssetType,
|
||||
BookSideLayout,
|
||||
|
@ -109,10 +109,10 @@ import {
|
|||
Market,
|
||||
OpenOrders,
|
||||
} from '@project-serum/serum';
|
||||
import { I80F48, ONE_I80F48, ZERO_I80F48 } from './fixednum';
|
||||
import { I80F48, ONE_I80F48, ZERO_I80F48 } from './utils/fixednum';
|
||||
import { Order } from '@project-serum/serum/lib/market';
|
||||
|
||||
import { PerpOrderType, WalletAdapter } from './types';
|
||||
import { PerpOrderType, WalletAdapter } from './utils/types';
|
||||
import { BookSide, PerpOrder } from './book';
|
||||
import {
|
||||
closeAccount,
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
import initGroup from './initGroup';
|
||||
import addPerpMarket from './addPerpMarket';
|
||||
import addSpotMarket from './addSpotMarket';
|
||||
import addStubOracle from './addStubOracle';
|
||||
import addPythOracle from './addPythOracle';
|
||||
import addSwitchboardOracle from './addSwitchboardOracle';
|
||||
import setStubOracle from './setStubOracle';
|
||||
import listMarket from './listMarket';
|
||||
import sanityCheck from './sanityCheck';
|
||||
|
||||
export {
|
||||
addPerpMarket,
|
||||
addSpotMarket,
|
||||
addStubOracle,
|
||||
addPythOracle,
|
||||
addSwitchboardOracle,
|
||||
initGroup,
|
||||
setStubOracle,
|
||||
listMarket,
|
||||
sanityCheck,
|
||||
};
|
|
@ -1,6 +1,6 @@
|
|||
import { PublicKey } from '@solana/web3.js';
|
||||
import IDS from './ids.json';
|
||||
import { zeroKey } from './utils';
|
||||
import { zeroKey } from './utils/utils';
|
||||
|
||||
export type Cluster = 'devnet' | 'mainnet' | 'localnet' | 'testnet';
|
||||
|
||||
|
|
70
src/dust.ts
70
src/dust.ts
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
This will probably move to its own repo at some point but easier to keep it here for now
|
||||
*/
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import { MangoClient } from './client';
|
||||
import {
|
||||
Account,
|
||||
Commitment,
|
||||
Connection,
|
||||
PublicKey,
|
||||
Transaction,
|
||||
} from '@solana/web3.js';
|
||||
import { getMultipleAccounts, sleep } from './utils';
|
||||
import configFile from './ids.json';
|
||||
import { Cluster, Config } from './config';
|
||||
import BN from 'bn.js';
|
||||
import {
|
||||
decodeEventQueue,
|
||||
DexInstructions,
|
||||
Market,
|
||||
} from '@project-serum/serum';
|
||||
import { Token, TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
||||
import { QUOTE_INDEX } from '.';
|
||||
|
||||
const config = new Config(configFile);
|
||||
|
||||
const cluster = (process.env.CLUSTER || 'devnet') as Cluster;
|
||||
const groupName = process.env.GROUP || 'devnet.2';
|
||||
const groupIds = config.getGroup(cluster, groupName);
|
||||
|
||||
if (!groupIds) {
|
||||
throw new Error(`Group ${groupName} not found`);
|
||||
}
|
||||
const mangoProgramId = groupIds.mangoProgramId;
|
||||
const mangoGroupKey = groupIds.publicKey;
|
||||
const payer = new Account(
|
||||
JSON.parse(
|
||||
process.env.KEYPAIR ||
|
||||
fs.readFileSync(os.homedir() + '/.config/solana/devnet.json', 'utf-8'),
|
||||
),
|
||||
);
|
||||
|
||||
const connection = new Connection(
|
||||
process.env.ENDPOINT_URL || config.cluster_urls[cluster],
|
||||
'processed' as Commitment,
|
||||
);
|
||||
const client = new MangoClient(connection, mangoProgramId);
|
||||
|
||||
async function run() {
|
||||
if (!groupIds) {
|
||||
throw new Error(`Group ${groupName} not found`);
|
||||
}
|
||||
|
||||
const mangoGroup = await client.getMangoGroup(mangoGroupKey);
|
||||
const rootBanks = await mangoGroup.loadRootBanks(connection);
|
||||
const cache = await mangoGroup.loadCache(connection);
|
||||
const quoteRootBank = rootBanks[QUOTE_INDEX];
|
||||
if (!quoteRootBank) {
|
||||
throw new Error('Quote Rootbank Not Found');
|
||||
}
|
||||
const mangoAccount = await client.getMangoAccount(new PublicKey('8m3Lh1Exh5WaG76aFRWFGgMU5yWXLxifbgVfCnFjv15p'), mangoGroup.dexProgramId);
|
||||
// console.log('Creating group dust account');
|
||||
// await client.createDustAccount(mangoGroup, payer);
|
||||
console.log('Resolving account dust');
|
||||
await client.resolveDust(mangoGroup, mangoAccount, quoteRootBank, cache, payer);
|
||||
}
|
||||
|
||||
run();
|
||||
|
|
@ -24,9 +24,9 @@ export {
|
|||
export * from './book';
|
||||
export * from './client';
|
||||
export * from './config';
|
||||
export * from './fixednum';
|
||||
export * from './utils/fixednum';
|
||||
export * from './instruction';
|
||||
export * from './layout';
|
||||
export * from './token';
|
||||
export * from './types';
|
||||
export * from './utils';
|
||||
export * from './utils/token';
|
||||
export * from './utils/types';
|
||||
export * from './utils/utils';
|
||||
|
|
|
@ -8,7 +8,7 @@ import { AssetType, encodeMangoInstruction, INFO_LEN } from './layout';
|
|||
import BN from 'bn.js';
|
||||
import { TOKEN_PROGRAM_ID } from '@solana/spl-token';
|
||||
import { Order } from '@project-serum/serum/lib/market';
|
||||
import { I80F48, ZERO_I80F48 } from './fixednum';
|
||||
import { I80F48, ZERO_I80F48 } from './utils/fixednum';
|
||||
import { PerpOrder, PerpOrderType, ZERO_BN } from '.';
|
||||
|
||||
export function makeInitMangoGroupInstruction(
|
||||
|
|
|
@ -15,11 +15,11 @@ import {
|
|||
Union,
|
||||
} from 'buffer-layout';
|
||||
import { PublicKey } from '@solana/web3.js';
|
||||
import { I80F48, ONE_I80F48 } from './fixednum';
|
||||
import { I80F48, ONE_I80F48 } from './utils/fixednum';
|
||||
import BN from 'bn.js';
|
||||
import { zeroKey } from './utils';
|
||||
import { zeroKey } from './utils/utils';
|
||||
import PerpAccount from './PerpAccount';
|
||||
import { PerpOrderType } from './types';
|
||||
import { PerpOrderType } from './utils/types';
|
||||
|
||||
export const MAX_TOKENS = 16;
|
||||
export const MAX_PAIRS = MAX_TOKENS - 1;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { Account, Commitment, Connection } from '@solana/web3.js';
|
||||
import { MangoClient } from './client';
|
||||
import { Cluster, Config } from './config';
|
||||
import { MangoClient } from '../client';
|
||||
import { Cluster, Config } from '../config';
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
|
||||
|
@ -21,12 +21,12 @@ const mangoProgramId = groupIds.mangoProgramId;
|
|||
const mangoGroupKey = groupIds.publicKey;
|
||||
const client = new MangoClient(connection, mangoProgramId);
|
||||
|
||||
const payer = new Account(
|
||||
JSON.parse(
|
||||
process.env.KEYPAIR ||
|
||||
fs.readFileSync(os.homedir() + '/.config/solana/devnet.json', 'utf-8'),
|
||||
),
|
||||
);
|
||||
// const payer = new Account(
|
||||
// JSON.parse(
|
||||
// process.env.KEYPAIR ||
|
||||
// fs.readFileSync(os.homedir() + '/.config/solana/devnet.json', 'utf-8'),
|
||||
// ),
|
||||
// );
|
||||
|
||||
async function check() {
|
||||
const group = await client.getMangoGroup(mangoGroupKey);
|
|
@ -3,7 +3,7 @@
|
|||
*/
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import { MangoClient } from './client';
|
||||
import { MangoClient } from '../client';
|
||||
import {
|
||||
Account,
|
||||
Commitment,
|
||||
|
@ -11,9 +11,9 @@ import {
|
|||
PublicKey,
|
||||
Transaction,
|
||||
} from '@solana/web3.js';
|
||||
import { getMultipleAccounts, sleep } from './utils';
|
||||
import configFile from './ids.json';
|
||||
import { Cluster, Config } from './config';
|
||||
import { getMultipleAccounts, sleep } from '../utils/utils';
|
||||
import configFile from '../ids.json';
|
||||
import { Cluster, Config } from '../config';
|
||||
import BN from 'bn.js';
|
||||
import {
|
||||
decodeEventQueue,
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
This will probably move to its own repo at some point but easier to keep it here for now
|
||||
*/
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import { MangoClient } from '../client';
|
||||
import { Account, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||
import configFile from '../ids.json';
|
||||
import { Cluster, Config } from '../config';
|
||||
import { QUOTE_INDEX } from '..';
|
||||
|
||||
const config = new Config(configFile);
|
||||
|
||||
const cluster = (process.env.CLUSTER || 'devnet') as Cluster;
|
||||
const groupName = process.env.GROUP || 'devnet.2';
|
||||
const groupIds = config.getGroup(cluster, groupName);
|
||||
|
||||
if (!groupIds) {
|
||||
throw new Error(`Group ${groupName} not found`);
|
||||
}
|
||||
const mangoProgramId = groupIds.mangoProgramId;
|
||||
const mangoGroupKey = groupIds.publicKey;
|
||||
const payer = new Account(
|
||||
JSON.parse(
|
||||
process.env.KEYPAIR ||
|
||||
fs.readFileSync(os.homedir() + '/.config/solana/devnet.json', 'utf-8'),
|
||||
),
|
||||
);
|
||||
|
||||
const connection = new Connection(
|
||||
process.env.ENDPOINT_URL || config.cluster_urls[cluster],
|
||||
'processed' as Commitment,
|
||||
);
|
||||
const client = new MangoClient(connection, mangoProgramId);
|
||||
|
||||
async function run() {
|
||||
if (!groupIds) {
|
||||
throw new Error(`Group ${groupName} not found`);
|
||||
}
|
||||
|
||||
const mangoGroup = await client.getMangoGroup(mangoGroupKey);
|
||||
const rootBanks = await mangoGroup.loadRootBanks(connection);
|
||||
const cache = await mangoGroup.loadCache(connection);
|
||||
const quoteRootBank = rootBanks[QUOTE_INDEX];
|
||||
if (!quoteRootBank) {
|
||||
throw new Error('Quote Rootbank Not Found');
|
||||
}
|
||||
const mangoAccount = await client.getMangoAccount(
|
||||
new PublicKey('8m3Lh1Exh5WaG76aFRWFGgMU5yWXLxifbgVfCnFjv15p'),
|
||||
mangoGroup.dexProgramId,
|
||||
);
|
||||
// console.log('Creating group dust account');
|
||||
// await client.createDustAccount(mangoGroup, payer);
|
||||
console.log('Resolving account dust');
|
||||
await client.resolveDust(
|
||||
mangoGroup,
|
||||
mangoAccount,
|
||||
quoteRootBank,
|
||||
cache,
|
||||
payer,
|
||||
);
|
||||
}
|
||||
|
||||
run();
|
|
@ -1,17 +1,14 @@
|
|||
import { MangoClient } from './client';
|
||||
import {
|
||||
Commitment,
|
||||
Connection
|
||||
} from '@solana/web3.js';
|
||||
import { sleep } from './utils';
|
||||
import configFile from './ids.json';
|
||||
import { MangoClient } from '../client';
|
||||
import { Commitment, Connection } from '@solana/web3.js';
|
||||
import { sleep } from '../utils/utils';
|
||||
import configFile from '../ids.json';
|
||||
import {
|
||||
Cluster,
|
||||
Config,
|
||||
getPerpMarketByBaseSymbol,
|
||||
PerpMarketConfig
|
||||
} from './config';
|
||||
import { ONE_BN, ZERO_BN } from '.';
|
||||
PerpMarketConfig,
|
||||
} from '../config';
|
||||
import { ONE_BN, ZERO_BN } from '..';
|
||||
|
||||
export class Fetcher {
|
||||
/**
|
|
@ -3,7 +3,7 @@ This will probably move to its own repo at some point but easier to keep it here
|
|||
*/
|
||||
import * as os from 'os';
|
||||
import * as fs from 'fs';
|
||||
import { MangoClient } from './client';
|
||||
import { MangoClient } from '../client';
|
||||
import {
|
||||
Account,
|
||||
Commitment,
|
||||
|
@ -11,20 +11,20 @@ import {
|
|||
PublicKey,
|
||||
Transaction,
|
||||
} from '@solana/web3.js';
|
||||
import { getMultipleAccounts, zeroKey } from './utils';
|
||||
import configFile from './ids.json';
|
||||
import { Cluster, Config } from './config';
|
||||
import { getMultipleAccounts, zeroKey } from '../utils/utils';
|
||||
import configFile from '../ids.json';
|
||||
import { Cluster, Config } from '../config';
|
||||
import {
|
||||
makeCachePerpMarketsInstruction,
|
||||
makeCachePricesInstruction,
|
||||
makeCacheRootBankInstruction,
|
||||
makeUpdateFundingInstruction,
|
||||
makeUpdateRootBankInstruction,
|
||||
} from './instruction';
|
||||
} from '../instruction';
|
||||
import BN from 'bn.js';
|
||||
import { PerpEventQueueLayout } from './layout';
|
||||
import { MangoGroup, PerpMarket, promiseUndef } from '.';
|
||||
import PerpEventQueue from './PerpEventQueue';
|
||||
import { PerpEventQueueLayout } from '../layout';
|
||||
import { MangoGroup, PerpMarket, promiseUndef } from '..';
|
||||
import PerpEventQueue from '../PerpEventQueue';
|
||||
|
||||
let lastRootBankCacheUpdate = 0;
|
||||
const groupName = process.env.GROUP || 'mainnet.1';
|
|
@ -2,7 +2,7 @@ import BN from 'bn.js';
|
|||
import { PublicKey } from '@solana/web3.js';
|
||||
|
||||
import { BinaryReader, Schema, BorshError, BinaryWriter } from 'borsh';
|
||||
import { I80F48 } from './fixednum';
|
||||
import { I80F48 } from '../utils/fixednum';
|
||||
|
||||
(BinaryReader.prototype as any).readPubkey = function () {
|
||||
const reader = this as unknown as BinaryReader;
|
|
@ -1,18 +1,8 @@
|
|||
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||
import { group } from 'console';
|
||||
import {
|
||||
getTokenBySymbol,
|
||||
I80F48,
|
||||
PerpMarket,
|
||||
PerpMarketConfig,
|
||||
SpotMarketConfig,
|
||||
} from '.';
|
||||
import { MangoClient } from './client';
|
||||
import { Cluster, Config } from './config';
|
||||
import { Market } from '@project-serum/serum';
|
||||
import * as Process from 'process';
|
||||
import RootBank from './RootBank';
|
||||
import BN from 'bn.js';
|
||||
import { Commitment, Connection } from '@solana/web3.js';
|
||||
import { getTokenBySymbol, PerpMarketConfig, SpotMarketConfig } from '..';
|
||||
import { MangoClient } from '../client';
|
||||
import { Cluster, Config } from '../config';
|
||||
import RootBank from '../RootBank';
|
||||
|
||||
// e.g. CLUSTER=devnet GROUP=devnet.2 yarn ts-node src/markets.ts
|
||||
// e.g. SYMBOL=MNGO CLUSTER=devnet GROUP=devnet.3 yarn ts-node src/markets.ts
|
|
@ -1,4 +1,4 @@
|
|||
import { createDevnetConnection } from '../test/utils';
|
||||
import { createDevnetConnection } from '../../test/utils';
|
||||
import { Account, PublicKey } from '@solana/web3.js';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
|
@ -3,8 +3,8 @@ import {
|
|||
Config,
|
||||
getPerpMarketByBaseSymbol,
|
||||
PerpMarketConfig,
|
||||
} from './config';
|
||||
import configFile from './ids.json';
|
||||
} from '../config';
|
||||
import configFile from '../ids.json';
|
||||
import {
|
||||
Account,
|
||||
Commitment,
|
||||
|
@ -14,7 +14,7 @@ import {
|
|||
} from '@solana/web3.js';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import { MangoClient } from './client';
|
||||
import { MangoClient } from '../client';
|
||||
import {
|
||||
BookSide,
|
||||
makeCancelAllPerpOrdersInstruction,
|
||||
|
@ -22,11 +22,11 @@ import {
|
|||
MangoCache,
|
||||
ONE_BN,
|
||||
sleep,
|
||||
} from './index';
|
||||
} from '../index';
|
||||
import { BN } from 'bn.js';
|
||||
import MangoAccount from './MangoAccount';
|
||||
import MangoGroup from './MangoGroup';
|
||||
import PerpMarket from './PerpMarket';
|
||||
import MangoAccount from '../MangoAccount';
|
||||
import MangoGroup from '../MangoGroup';
|
||||
import PerpMarket from '../PerpMarket';
|
||||
|
||||
const interval = parseInt(process.env.INTERVAL || '10000');
|
||||
const control = { isRunning: true, interval: interval };
|
|
@ -1,9 +1,9 @@
|
|||
import configFile from './ids.json';
|
||||
import { Cluster, Config, GroupConfig } from './config';
|
||||
import { findPerpMarketParams } from './utils';
|
||||
import { MangoClient } from './client';
|
||||
import configFile from '../ids.json';
|
||||
import { Config, GroupConfig } from '../config';
|
||||
import { findPerpMarketParams } from '../utils/utils';
|
||||
import { MangoClient } from '../client';
|
||||
import { Commitment, Connection } from '@solana/web3.js';
|
||||
import { QUOTE_INDEX } from './layout';
|
||||
import { QUOTE_INDEX } from '../layout';
|
||||
|
||||
async function main() {
|
||||
const config = new Config(configFile);
|
|
@ -1,7 +1,6 @@
|
|||
import { Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||
import { group } from 'console';
|
||||
import { MangoClient } from './client';
|
||||
import { Cluster, Config } from './config';
|
||||
import { MangoClient } from '../client';
|
||||
import { Cluster, Config } from '../config';
|
||||
|
||||
const config = Config.ids();
|
||||
const cluster = (process.env.CLUSTER || 'mainnet') as Cluster;
|
|
@ -1,8 +1,8 @@
|
|||
import { Cluster, Config, GroupConfig } from './config';
|
||||
import { Cluster, Config, GroupConfig } from '../config';
|
||||
import { Account, Commitment, Connection, PublicKey } from '@solana/web3.js';
|
||||
import fs from 'fs';
|
||||
import os from 'os';
|
||||
import { IDS, MangoClient, QUOTE_INDEX, RootBank } from './index';
|
||||
import { IDS, MangoClient, QUOTE_INDEX, RootBank } from '../index';
|
||||
|
||||
async function main() {
|
||||
const payer = new Account(
|
||||
|
@ -53,7 +53,7 @@ async function main() {
|
|||
quoteRootBank,
|
||||
payer,
|
||||
);
|
||||
// console.log(txids);
|
||||
console.log(txids);
|
||||
}
|
||||
|
||||
main();
|
|
@ -1,4 +1,4 @@
|
|||
import { MangoInstructionLayout } from '.';
|
||||
import { MangoInstructionLayout } from '..';
|
||||
|
||||
const ins = process.env.INS!;
|
||||
const data = Buffer.from(ins, 'hex');
|
|
@ -1,6 +1,5 @@
|
|||
import BN from 'bn.js';
|
||||
import Big from 'big.js';
|
||||
import { ZERO_BN } from './utils';
|
||||
|
||||
// TODO - this whole class is inefficient; consider optimizing
|
||||
export class I80F48 {
|
|
@ -1,6 +1,6 @@
|
|||
import { Connection, PublicKey } from '@solana/web3.js';
|
||||
import { TokenInstructions } from '@project-serum/serum';
|
||||
import { TokenAccountLayout } from './layout';
|
||||
import { TokenAccountLayout } from '../layout';
|
||||
|
||||
export class TokenAccount {
|
||||
publicKey!: PublicKey;
|
|
@ -15,8 +15,8 @@ import {
|
|||
} from '@solana/web3.js';
|
||||
import { OpenOrders, TokenInstructions } from '@project-serum/serum';
|
||||
import { I80F48, ONE_I80F48 } from './fixednum';
|
||||
import MangoGroup from './MangoGroup';
|
||||
import { HealthType } from './MangoAccount';
|
||||
import MangoGroup from '../MangoGroup';
|
||||
import { HealthType } from '../MangoAccount';
|
||||
|
||||
/** @internal */
|
||||
export const ZERO_BN = new BN(0);
|
|
@ -7,7 +7,6 @@ import {
|
|||
import { TOKEN_PROGRAM_ID, Token, u64 } from '@solana/spl-token';
|
||||
import {
|
||||
Account,
|
||||
Keypair,
|
||||
Commitment,
|
||||
Connection,
|
||||
PublicKey,
|
||||
|
@ -17,7 +16,7 @@ import {
|
|||
TransactionSignature,
|
||||
} from '@solana/web3.js';
|
||||
import { StubOracleLayout } from '../src/layout';
|
||||
import { createAccountInstruction, sleep, ZERO_BN } from '../src/utils';
|
||||
import { createAccountInstruction, sleep, ZERO_BN } from '../src/utils/utils';
|
||||
import { msrmMints, MangoClient, I80F48 } from '../src';
|
||||
import MangoGroup from '../src/MangoGroup';
|
||||
import MangoAccount from '../src/MangoAccount';
|
||||
|
@ -301,6 +300,7 @@ export async function listMarket(
|
|||
|
||||
async function getVaultOwnerAndNonce() {
|
||||
const nonce = ZERO_BN;
|
||||
// eslint-disable-next-line
|
||||
while (true) {
|
||||
try {
|
||||
const vaultOwner = await PublicKey.createProgramAddress(
|
||||
|
|
|
@ -14,6 +14,6 @@
|
|||
"sourceMap": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"include": ["./src/**/*", "examples/example.ts"],
|
||||
"exclude": ["./src/**/*.test.js", "node_modules", "**/node_modules"]
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue