@@ -56,6 +56,7 @@ import { useConnection } from '@solana/wallet-adapter-react'
5656import { tokenAccountQueryKeys } from '@hooks/queries/tokenAccount'
5757import queryClient from '@hooks/queries/queryClient'
5858import { useVsrClient } from '../../../VoterWeightPlugins/useVsrClient'
59+ import { CUSTOM_BIO_VSR_PLUGIN_PK } from '@constants/plugins'
5960
6061const YES = 'Yes'
6162const NO = 'No'
@@ -71,7 +72,7 @@ const LockTokensModal = ({
7172} ) => {
7273 const { getOwnedDeposits } = useDepositStore ( )
7374 const realm = useRealmQuery ( ) . data ?. result
74- const mint = useRealmCommunityMintInfoQuery ( ) . data ?. result
75+ const defaultMint = useRealmCommunityMintInfoQuery ( ) . data ?. result
7576 const { realmTokenAccount, realmInfo } = useRealm ( )
7677 const { data : tokenOwnerRecordPk } = useAddressQuery_CommunityTokenOwner ( )
7778
@@ -177,9 +178,19 @@ const LockTokensModal = ({
177178 realm ,
178179 )
179180
181+ const isCustomBioPlugin = client ?. program . programId . toBase58 ( ) === CUSTOM_BIO_VSR_PLUGIN_PK && deposits [ 0 ] !== undefined
182+
183+ const depositMint = isCustomBioPlugin ?
184+ deposits [ 0 ] . mint . publicKey
185+ : realm ?. account . communityMint
186+
187+ const mint = isCustomBioPlugin ?
188+ deposits [ 0 ] . mint . account
189+ : defaultMint
190+
180191 const depositRecord = deposits . find (
181192 ( x ) =>
182- x . mint . publicKey . toBase58 ( ) === realm ?. account . communityMint . toBase58 ( ) &&
193+ x . mint . publicKey . toBase58 ( ) === depositMint ! . toBase58 ( ) &&
183194 x . lockup . kind . none ,
184195 )
185196 const [ lockupPeriodDays , setLockupPeriodDays ] = useState < number > ( 0 )
@@ -222,6 +233,7 @@ const LockTokensModal = ({
222233 )
223234 : getMintDecimalAmount ( mint , depositRecord ?. amountDepositedNative )
224235 : 0
236+
225237 const maxAmount = depositToUnlock ? maxAmountToUnlock : maxAmountToLock
226238 const maxAmountToLockFmt =
227239 depositRecord && mint && realmTokenAccount
@@ -303,7 +315,7 @@ const LockTokensModal = ({
303315 }
304316 await voteRegistryLockDeposit ( {
305317 rpcContext,
306- mintPk : realm ! . account . communityMint ! ,
318+ mintPk : depositMint ! ,
307319 communityMintPk : realm ! . account . communityMint ! ,
308320 realmPk : realm ! . pubkey ! ,
309321 programId : realm ! . owner ,
@@ -328,6 +340,13 @@ const LockTokensModal = ({
328340 queryClient . invalidateQueries (
329341 tokenAccountQueryKeys . byOwner ( connection . rpcEndpoint , wallet ! . publicKey ! ) ,
330342 )
343+ queryClient . invalidateQueries (
344+ [ 'get-custom-vsr-token-account' , {
345+ realm : realm ?. pubkey . toBase58 ( ) ,
346+ mint : realm ?. account . communityMint . toBase58 ( ) ,
347+ pubkey : wallet ?. publicKey ?. toBase58 ( )
348+ } ]
349+ )
331350 onClose ( )
332351 }
333352
0 commit comments