more frequent mango acct updates
This commit is contained in:
parent
f44acbab27
commit
17d73fc3cf
|
@ -6,7 +6,7 @@ import {
|
|||
PerpMarket,
|
||||
} from '@blockworks-foundation/mango-client'
|
||||
import { notify } from '../utils/notifications'
|
||||
import { calculateMarketPrice, getDecimalCount } from '../utils'
|
||||
import { calculateMarketPrice, getDecimalCount, sleep } from '../utils'
|
||||
import FloatingElement from './FloatingElement'
|
||||
import { floorToDecimal } from '../utils/index'
|
||||
import useMangoStore, { mangoClient } from '../stores/useMangoStore'
|
||||
|
@ -226,6 +226,9 @@ export default function TradeForm() {
|
|||
baseSize,
|
||||
orderType
|
||||
)
|
||||
sleep(2000).then(() => {
|
||||
actions.fetchMangoAccounts()
|
||||
})
|
||||
} else {
|
||||
txid = await mangoClient.placePerpOrder(
|
||||
mangoGroup,
|
||||
|
@ -238,12 +241,14 @@ export default function TradeForm() {
|
|||
baseSize,
|
||||
orderType
|
||||
)
|
||||
sleep(3000).then(() => {
|
||||
actions.fetchMangoAccounts()
|
||||
})
|
||||
}
|
||||
|
||||
notify({ title: 'Successfully placed trade', txid })
|
||||
setPrice('')
|
||||
onSetBaseSize('')
|
||||
actions.fetchMangoAccounts()
|
||||
} catch (e) {
|
||||
notify({
|
||||
title: 'Error placing order',
|
||||
|
|
|
@ -137,11 +137,16 @@ export default function useWallet() {
|
|||
|
||||
useInterval(() => {
|
||||
if (connected && mangoAccount) {
|
||||
actions.fetchMangoAccounts()
|
||||
actions.fetchWalletTokens()
|
||||
}
|
||||
}, 60 * SECONDS)
|
||||
|
||||
useInterval(() => {
|
||||
if (connected && mangoAccount) {
|
||||
actions.fetchMangoAccounts()
|
||||
actions.fetchTradeHistory()
|
||||
}
|
||||
}, 180 * SECONDS)
|
||||
}, 30 * SECONDS)
|
||||
|
||||
return { connected, wallet }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue