This commit is contained in:
Adrian Brzeziński 2024-03-23 18:34:50 +01:00
parent 2af795c05a
commit d4a05d3ddd
4 changed files with 8 additions and 15 deletions

View File

@ -136,9 +136,7 @@ function DespositForm({ token: selectedToken }: StakeFormProps) {
setInputAmount('')
await sleep(500)
if (!mangoAccount) {
await actions.fetchMangoAccounts(
(client.program.provider as AnchorProvider).wallet.publicKey,
)
await actions.fetchMangoAccounts(publicKey)
}
await actions.reloadMangoAccount(slot)
await actions.fetchWalletTokens(publicKey)

View File

@ -33,7 +33,6 @@ import useMangoGroup from 'hooks/useMangoGroup'
import FormatNumericValue from './shared/FormatNumericValue'
import { getNextAccountNumber, stakeAndCreate } from 'utils/transactions'
// import { MangoAccount } from '@blockworks-foundation/mango-v4'
import { AnchorProvider } from '@project-serum/anchor'
import useBankRates from 'hooks/useBankRates'
import { Disclosure } from '@headlessui/react'
import SheenLoader from './shared/SheenLoader'
@ -202,11 +201,13 @@ function StakeForm({ token: selectedToken }: StakeFormProps) {
if (!ipAllowed || !stakeBank || !publicKey) {
return
}
const client = mangoStore.getState().client
const jlpGroup = mangoStore.getState().group.jlpGroup
const lstGroup = mangoStore.getState().group.lstGroup
const isJlpGroup = stakeBank.name === 'JLP' || stakeBank.name === 'USDC'
const group = isJlpGroup ? jlpGroup : lstGroup
const client = isJlpGroup
? mangoStore.getState().client.jlp
: mangoStore.getState().client.lst
const actions = mangoStore.getState().actions
const mangoAccount = mangoStore.getState().mangoAccount.current
const mangoAccounts = mangoStore.getState().mangoAccounts
@ -243,9 +244,7 @@ function StakeForm({ token: selectedToken }: StakeFormProps) {
setInputAmount('')
await sleep(500)
if (!mangoAccount) {
await actions.fetchMangoAccounts(
(client.program.provider as AnchorProvider).wallet.publicKey,
)
await actions.fetchMangoAccounts(publicKey)
}
await actions.reloadMangoAccount(slot)
await actions.fetchWalletTokens(publicKey)

View File

@ -196,9 +196,7 @@ function UnstakeForm({ token: selectedToken }: UnstakeFormProps) {
txid: tx,
})
await sleep(100)
await actions.fetchMangoAccounts(
(client.program.provider as AnchorProvider).wallet.publicKey,
)
await actions.fetchMangoAccounts(publicKey)
await actions.reloadMangoAccount()
await actions.fetchWalletTokens(publicKey)
mangoAccount = mangoStore.getState().mangoAccount.current
@ -223,9 +221,7 @@ function UnstakeForm({ token: selectedToken }: UnstakeFormProps) {
setSubmitting(false)
setInputAmount('')
await sleep(100)
await actions.fetchMangoAccounts(
(client.program.provider as AnchorProvider).wallet.publicKey,
)
await actions.fetchMangoAccounts(publicKey)
await actions.reloadMangoAccount()
await actions.fetchWalletTokens(publicKey)
} catch (e) {

View File

@ -825,7 +825,7 @@ const mangoStore = create<MangoStore>()(
if (!group || !client) return
const altResponse = await connection.getAddressLookupTable(
new PublicKey('AgCBUZ6UMWqPyLftTxeAqpQxtrfiCyL2HgRfmmM6QTfCj'),
new PublicKey('AgCBUZ6UMWqPLftTxeAqpQxtrfiCyL2HgRfmmM6QTfCj'),
)
const altKeys = altResponse.value?.state.addresses