fix recent trades and add update delays after srm deposit and withdraw

This commit is contained in:
Tyler Shipe 2021-04-25 18:57:16 -04:00
parent f95988c88b
commit 16003fd8cf
5 changed files with 11 additions and 8 deletions

View File

@ -12,7 +12,7 @@ import { ElementTitle } from './styles'
import Input from './Input'
import { notify } from '../utils/notifications'
import { SRM_DECIMALS } from '@project-serum/serum/lib/token-instructions'
import { floorToDecimal } from '../utils'
import { floorToDecimal, sleep } from '../utils'
const DepositSrmModal = ({ isOpen, onClose }) => {
const [inputAmount, setInputAmount] = useState('')
@ -65,9 +65,10 @@ const DepositSrmModal = ({ isOpen, onClose }) => {
.then(async (_mangoSrmAcct: PublicKey) => {
setSubmitting(false)
onClose()
await actions.fetchWalletBalances()
await actions.fetchMangoSrmAccounts()
await actions.fetchMangoGroup()
await sleep(500)
actions.fetchWalletBalances()
actions.fetchMangoSrmAccounts()
actions.fetchMangoGroup()
})
.catch((err) => {
setSubmitting(false)

View File

@ -29,7 +29,7 @@ export default function PublicTrades() {
}, [fetchTradesForChart])
useInterval(async () => {
fetchTradesForChart
fetchTradesForChart()
}, 5000)
return (

View File

@ -11,6 +11,7 @@ import Input from './Input'
import { notify } from '../utils/notifications'
import { SRM_DECIMALS } from '@project-serum/serum/lib/token-instructions'
import { PublicKey } from '@solana/web3.js'
import { sleep } from '../utils'
const WithdrawModal = ({ isOpen, onClose }) => {
const [inputAmount, setInputAmount] = useState('')
@ -58,7 +59,8 @@ const WithdrawModal = ({ isOpen, onClose }) => {
.then(async (_transSig: string) => {
setSubmitting(false)
onClose()
await actions.fetchWalletBalances()
await sleep(500)
actions.fetchWalletBalances()
actions.fetchMangoSrmAccounts()
actions.fetchMangoGroup()
})

View File

@ -8,7 +8,7 @@ import useMarketList from './useMarketList'
import { notify } from '../utils/notifications'
import useInterval from './useInterval'
const _SLOW_REFRESH_INTERVAL = 5 * 1000
const _SLOW_REFRESH_INTERVAL = 6 * 1000
const marketAddressSelector = (s) => s.selectedMarket.address
const mangoGroupMarketsSelector = (s) => s.selectedMangoGroup.markets

View File

@ -18,7 +18,7 @@ import { notify } from '../utils/notifications'
export const ENDPOINTS: EndpointInfo[] = [
{
name: 'mainnet-beta',
url: 'https://solana-api.projectserum.com/',
url: 'https://api.mainnet-beta.solana.com/',
websocket: 'https://api.mainnet-beta.solana.com/',
custom: false,
},