Merge branch 'dev' into ts-client
This commit is contained in:
commit
45b9dbf383
|
@ -6,10 +6,10 @@ import {
|
||||||
PublicKey,
|
PublicKey,
|
||||||
} from '@solana/web3.js';
|
} from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { PerpMarketIndex } from '../src/accounts/perp';
|
import { PerpMarketIndex } from '../../src/accounts/perp';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
import { buildVersionedTx } from '../src/utils';
|
import { buildVersionedTx } from '../../src/utils';
|
||||||
|
|
||||||
//
|
//
|
||||||
// An example for admins based on high level api i.e. the client
|
// An example for admins based on high level api i.e. the client
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// An example for users based on high level api i.e. the client
|
// An example for users based on high level api i.e. the client
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair } from '@solana/web3.js';
|
import { Connection, Keypair } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Serum3Side } from '../src/accounts/serum3';
|
import { Serum3Side } from '../../src/accounts/serum3';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// script which shows how to close a mango account cleanly i.e. close all active positions, withdraw all tokens, etc.
|
// script which shows how to close a mango account cleanly i.e. close all active positions, withdraw all tokens, etc.
|
||||||
|
|
|
@ -2,12 +2,12 @@ import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Group } from '../src/accounts/group';
|
import { Group } from '../../src/accounts/group';
|
||||||
import { HealthType } from '../src/accounts/mangoAccount';
|
import { HealthType } from '../../src/accounts/mangoAccount';
|
||||||
import { PerpOrderSide, PerpOrderType } from '../src/accounts/perp';
|
import { PerpOrderSide, PerpOrderType } from '../../src/accounts/perp';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
import { toUiDecimalsForQuote } from '../src/utils';
|
import { toUiDecimalsForQuote } from '../../src/utils';
|
||||||
|
|
||||||
//
|
//
|
||||||
// An example for users based on high level api i.e. the client
|
// An example for users based on high level api i.e. the client
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair } from '@solana/web3.js';
|
import { Connection, Keypair } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// example script to close accounts - banks, markets, group etc. which require admin to be the signer
|
// example script to close accounts - banks, markets, group etc. which require admin to be the signer
|
||||||
|
|
|
@ -3,7 +3,7 @@ import {
|
||||||
ASSOCIATED_TOKEN_PROGRAM_ID,
|
ASSOCIATED_TOKEN_PROGRAM_ID,
|
||||||
NATIVE_MINT,
|
NATIVE_MINT,
|
||||||
TOKEN_PROGRAM_ID,
|
TOKEN_PROGRAM_ID,
|
||||||
} from '../src/utils/spl';
|
} from '../../src/utils/spl';
|
||||||
import {
|
import {
|
||||||
AddressLookupTableProgram,
|
AddressLookupTableProgram,
|
||||||
ComputeBudgetProgram,
|
ComputeBudgetProgram,
|
||||||
|
@ -15,21 +15,21 @@ import {
|
||||||
SystemProgram,
|
SystemProgram,
|
||||||
} from '@solana/web3.js';
|
} from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { TokenIndex } from '../src/accounts/bank';
|
import { TokenIndex } from '../../src/accounts/bank';
|
||||||
import { Group } from '../src/accounts/group';
|
import { Group } from '../../src/accounts/group';
|
||||||
import {
|
import {
|
||||||
Serum3OrderType,
|
Serum3OrderType,
|
||||||
Serum3SelfTradeBehavior,
|
Serum3SelfTradeBehavior,
|
||||||
Serum3Side,
|
Serum3Side,
|
||||||
} from '../src/accounts/serum3';
|
} from '../../src/accounts/serum3';
|
||||||
import { Builder } from '../src/builder';
|
import { Builder } from '../../src/builder';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import {
|
import {
|
||||||
NullPerpEditParams,
|
NullPerpEditParams,
|
||||||
NullTokenEditParams,
|
NullTokenEditParams,
|
||||||
} from '../src/clientIxParamBuilder';
|
} from '../../src/clientIxParamBuilder';
|
||||||
import { MANGO_V4_ID, OPENBOOK_PROGRAM_ID } from '../src/constants';
|
import { MANGO_V4_ID, OPENBOOK_PROGRAM_ID } from '../../src/constants';
|
||||||
import { buildVersionedTx, toNative } from '../src/utils';
|
import { buildVersionedTx, toNative } from '../../src/utils';
|
||||||
|
|
||||||
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
|
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair } from '@solana/web3.js';
|
import { Connection, Keypair } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Serum3Side } from '../src/accounts/serum3';
|
import { Serum3Side } from '../../src/accounts/serum3';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// (untested?) script which closes a mango account cleanly, first closes all positions, withdraws all tokens and then closes it
|
// (untested?) script which closes a mango account cleanly, first closes all positions, withdraws all tokens and then closes it
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Group } from '../src/accounts/group';
|
import { Group } from '../../src/accounts/group';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
|
const GROUP_NUM = Number(process.env.GROUP_NUM || 0);
|
||||||
const MANGO_ACCOUNT_PK = process.env.MANGO_ACCOUNT_PK;
|
const MANGO_ACCOUNT_PK = process.env.MANGO_ACCOUNT_PK;
|
||||||
|
|
|
@ -4,8 +4,8 @@ import {
|
||||||
isPythOracle,
|
isPythOracle,
|
||||||
isSwitchboardOracle,
|
isSwitchboardOracle,
|
||||||
parseSwitchboardOracle,
|
parseSwitchboardOracle,
|
||||||
} from '../src/accounts/oracle';
|
} from '../../src/accounts/oracle';
|
||||||
import { toNativeI80F48 } from '../src/utils';
|
import { toNativeI80F48 } from '../../src/utils';
|
||||||
const { MB_CLUSTER_URL } = process.env;
|
const { MB_CLUSTER_URL } = process.env;
|
||||||
|
|
||||||
async function decodePrice(conn, ai): Promise<void> {
|
async function decodePrice(conn, ai): Promise<void> {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Cluster, Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Cluster, Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { HealthType } from '../src/accounts/mangoAccount';
|
import { HealthType } from '../../src/accounts/mangoAccount';
|
||||||
import { PerpMarketIndex } from '../src/accounts/perp';
|
import { PerpMarketIndex } from '../../src/accounts/perp';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
import { I80F48 } from '../src/numbers/I80F48';
|
import { I80F48 } from '../../src/numbers/I80F48';
|
||||||
import { toUiDecimalsForQuote } from '../src/utils';
|
import { toUiDecimalsForQuote } from '../../src/utils';
|
||||||
|
|
||||||
const CLUSTER_URL =
|
const CLUSTER_URL =
|
||||||
process.env.CLUSTER_URL_OVERRIDE || process.env.MB_CLUSTER_URL;
|
process.env.CLUSTER_URL_OVERRIDE || process.env.MB_CLUSTER_URL;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair } from '@solana/web3.js';
|
import { Connection, Keypair } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { HealthType } from '../src/accounts/mangoAccount';
|
import { HealthType } from '../../src/accounts/mangoAccount';
|
||||||
import { MangoClient, MANGO_V4_ID, toUiDecimalsForQuote } from '../src/index';
|
import { MangoClient, MANGO_V4_ID, toUiDecimalsForQuote } from '../../src/index';
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const options = AnchorProvider.defaultOptions();
|
const options = AnchorProvider.defaultOptions();
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, BN, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
import { Connection, Keypair, PublicKey } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { Bank } from '../src/accounts/bank';
|
import { Bank } from '../../src/accounts/bank';
|
||||||
import { MangoAccount } from '../src/accounts/mangoAccount';
|
import { MangoAccount } from '../../src/accounts/mangoAccount';
|
||||||
import { PerpMarket, PerpOrderSide, PerpOrderType } from '../src/accounts/perp';
|
import { PerpMarket, PerpOrderSide, PerpOrderType } from '../../src/accounts/perp';
|
||||||
import {
|
import {
|
||||||
Serum3OrderType,
|
Serum3OrderType,
|
||||||
Serum3SelfTradeBehavior,
|
Serum3SelfTradeBehavior,
|
||||||
Serum3Side,
|
Serum3Side,
|
||||||
} from '../src/accounts/serum3';
|
} from '../../src/accounts/serum3';
|
||||||
import { Builder } from '../src/builder';
|
import { Builder } from '../../src/builder';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import {
|
import {
|
||||||
NullPerpEditParams,
|
NullPerpEditParams,
|
||||||
NullTokenEditParams,
|
NullTokenEditParams,
|
||||||
} from '../src/clientIxParamBuilder';
|
} from '../../src/clientIxParamBuilder';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// This script creates liquidation candidates
|
// This script creates liquidation candidates
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
import { AnchorProvider, Wallet } from '@coral-xyz/anchor';
|
||||||
import { Connection, Keypair } from '@solana/web3.js';
|
import { Connection, Keypair } from '@solana/web3.js';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { MangoClient } from '../src/client';
|
import { MangoClient } from '../../src/client';
|
||||||
import { MANGO_V4_ID } from '../src/constants';
|
import { MANGO_V4_ID } from '../../src/constants';
|
||||||
|
|
||||||
//
|
//
|
||||||
// This script tries to withdraw all positive balances for all accounts
|
// This script tries to withdraw all positive balances for all accounts
|
||||||
|
|
Loading…
Reference in New Issue