show notification when loading closed or invalid accounts
This commit is contained in:
parent
b1a3655889
commit
17d0027931
|
@ -10,6 +10,7 @@ import { useWallet } from '@solana/wallet-adapter-react'
|
||||||
import useLocalStorageState from 'hooks/useLocalStorageState'
|
import useLocalStorageState from 'hooks/useLocalStorageState'
|
||||||
import { DEFAULT_PRIORITY_FEE_LEVEL } from './settings/RpcSettings'
|
import { DEFAULT_PRIORITY_FEE_LEVEL } from './settings/RpcSettings'
|
||||||
import { useHiddenMangoAccounts } from 'hooks/useHiddenMangoAccounts'
|
import { useHiddenMangoAccounts } from 'hooks/useHiddenMangoAccounts'
|
||||||
|
import { notify } from 'utils/notifications'
|
||||||
|
|
||||||
const set = mangoStore.getState().set
|
const set = mangoStore.getState().set
|
||||||
const actions = mangoStore.getState().actions
|
const actions = mangoStore.getState().actions
|
||||||
|
@ -174,6 +175,7 @@ const ReadOnlyMangoAccount = () => {
|
||||||
const pk = new PublicKey(ma)
|
const pk = new PublicKey(ma)
|
||||||
const readOnlyMangoAccount = await client.getMangoAccount(pk)
|
const readOnlyMangoAccount = await client.getMangoAccount(pk)
|
||||||
await readOnlyMangoAccount.reloadSerum3OpenOrders(client)
|
await readOnlyMangoAccount.reloadSerum3OpenOrders(client)
|
||||||
|
console.log(readOnlyMangoAccount)
|
||||||
set((state) => {
|
set((state) => {
|
||||||
state.mangoAccount.current = readOnlyMangoAccount
|
state.mangoAccount.current = readOnlyMangoAccount
|
||||||
state.mangoAccount.initialLoad = false
|
state.mangoAccount.initialLoad = false
|
||||||
|
@ -181,6 +183,11 @@ const ReadOnlyMangoAccount = () => {
|
||||||
await actions.fetchOpenOrders()
|
await actions.fetchOpenOrders()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('error', error)
|
console.error('error', error)
|
||||||
|
notify({
|
||||||
|
title: 'No account found',
|
||||||
|
description: 'Account closed or invalid address',
|
||||||
|
type: 'error',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue