fixed issue with delayed token wallet updating

This commit is contained in:
dd 2021-04-09 19:47:57 -04:00
parent ce3e07a8d7
commit 4f9b9a4615
2 changed files with 8 additions and 10 deletions

View File

@ -51,13 +51,11 @@ async function balanceWallets(
}
}
if (updateWallets) {
await sleep(1000)
const liqorWalletAccounts = await getMultipleAccounts(connection, liqorWallets)
liqorValuesUi = liqorWalletAccounts.map(
(a, i) => nativeToUi(parseTokenAccountData(a.accountInfo.data).amount, mangoGroup.mintDecimals[i])
)
}
await sleep(1000)
const liqorWalletAccounts = await getMultipleAccounts(connection, liqorWallets)
liqorValuesUi = liqorWalletAccounts.map(
(a, i) => nativeToUi(parseTokenAccountData(a.accountInfo.data).amount, mangoGroup.mintDecimals[i])
)
// TODO cancel outstanding orders as well
const diffs: number[] = []
@ -338,7 +336,7 @@ async function runPartialLiquidator() {
await client.sendTransaction(connection, transaction, payer, [])
console.log('Successful partial liquidation')
notify(``)
notify(`Successful partial liquidation ${ma.publicKey.toBase58()}`)
liquidated = true
break
} catch (e) {

View File

@ -346,8 +346,8 @@ async function testAll() {
const market = await Market.load(connection, mangoGroup.spotMarkets[1], { skipPreflight: true, commitment: 'singleGossip'}, mangoGroup.dexProgramId)
for (let i = 0; i < 45; i++) {
const price = 1010 + 10 * i
await client.placeAndSettle(connection, programId, mangoGroup, marginAccount, market, payer, "sell", price, 0.001)
const price = 990 - 10 * i
await client.placeAndSettle(connection, programId, mangoGroup, marginAccount, market, payer, "buy", price, 0.001)
await sleep(500)
}