workaround: mango account reload
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
parent
30714fb0dc
commit
c2fb9a8fbe
|
@ -700,6 +700,10 @@ export class MangoClient {
|
|||
.map((serum3Account) => serum3Account.openOrders),
|
||||
);
|
||||
|
||||
// TODO: remove
|
||||
console.log(
|
||||
`number of healthRemainingAccounts: ${healthRemainingAccounts.length}`,
|
||||
);
|
||||
return healthRemainingAccounts;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { PublicKey } from '@solana/web3.js';
|
||||
|
||||
export const DEVNET_GROUP = '4Fv4jWsd9kYZjCMvkpcXnS63x9cHHHTqCDHTTTB5MbQt';
|
||||
export const DEVNET_GROUP = 'DESBjo923XfXcAfKTmAdJ5UPguaAMoND4sYb18KY95Vx';
|
||||
|
||||
export const DEVNET_MINTS = new Map([
|
||||
['USDC', '8FRFC6MoGGkMFQwngccyu69VnYbzykGeez7ignHVAFSN'],
|
||||
|
|
|
@ -38,7 +38,7 @@ async function main() {
|
|||
}
|
||||
|
||||
// create + fetch account
|
||||
const mangoAccount = await client.getOrCreateMangoAccount(
|
||||
let mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
|
@ -47,16 +47,40 @@ async function main() {
|
|||
console.log(`MangoAccount ${mangoAccount.publicKey}`);
|
||||
|
||||
// deposit and withdraw
|
||||
console.log(`Depositing...5000000`);
|
||||
console.log(`Depositing...50_000000 USDC`);
|
||||
await client.deposit(group, mangoAccount, 'USDC', 50_000000);
|
||||
|
||||
// manual reload for now
|
||||
mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
'my_mango_account',
|
||||
);
|
||||
console.log(`Depositing...5000000 BTC`);
|
||||
await client.deposit(group, mangoAccount, 'BTC', 5000000);
|
||||
|
||||
console.log(`Withdrawing...1000000`);
|
||||
// manual reload for now
|
||||
mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
'my_mango_account',
|
||||
);
|
||||
await client.withdraw(group, mangoAccount, 'USDC', 1_000000, false);
|
||||
|
||||
// serum3
|
||||
console.log(
|
||||
`Placing serum3 bid which would not be settled since its relatively low then midprice`,
|
||||
);
|
||||
// manual reload for now
|
||||
mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
'my_mango_account',
|
||||
);
|
||||
await client.serum3PlaceOrder(
|
||||
group,
|
||||
mangoAccount,
|
||||
|
@ -70,7 +94,15 @@ async function main() {
|
|||
Date.now(),
|
||||
10,
|
||||
);
|
||||
|
||||
console.log(`Placing serum3 bid way above midprice`);
|
||||
// manual reload for now
|
||||
mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
'my_mango_account',
|
||||
);
|
||||
await client.serum3PlaceOrder(
|
||||
group,
|
||||
mangoAccount,
|
||||
|
@ -84,7 +116,22 @@ async function main() {
|
|||
Date.now(),
|
||||
10,
|
||||
);
|
||||
|
||||
console.log(`Placing serum3 ask way below midprice`);
|
||||
// manual reload for now
|
||||
mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
'my_mango_account',
|
||||
);
|
||||
// manual reload for now
|
||||
mangoAccount = await client.getOrCreateMangoAccount(
|
||||
group,
|
||||
user.publicKey,
|
||||
0,
|
||||
'my_mango_account',
|
||||
);
|
||||
await client.serum3PlaceOrder(
|
||||
group,
|
||||
mangoAccount,
|
||||
|
|
Loading…
Reference in New Issue