Skip to content

Commit 83ac3f0

Browse files
Orelsanplssjillen
authored andcommitted
Fix mintWithIdentityDepository
1 parent bc68f09 commit 83ac3f0

File tree

2 files changed

+3
-104
lines changed

2 files changed

+3
-104
lines changed

components/TokenBalance/TokenDeposit.tsx

Lines changed: 2 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import useRealm from '@hooks/useRealm'
1010
import {
1111
getProposal,
1212
GoverningTokenType,
13-
Proposal,
1413
ProposalState,
1514
} from '@solana/spl-governance'
1615
import { getUnrelinquishedVoteRecords } from '@models/api'
@@ -26,14 +25,10 @@ import { chunks } from '@utils/helpers'
2625
import { getProgramVersionForRealm } from '@models/registry/api'
2726
import { notify } from '@utils/notifications'
2827
import { ExclamationIcon } from '@heroicons/react/outline'
29-
import { useEffect, useState } from 'react'
28+
import { useEffect } from 'react'
3029
import useVotePluginsClientStore from 'stores/useVotePluginsClientStore'
3130
import { VSR_PLUGIN_PKS } from '@constants/plugins'
32-
import DelegateTokenBalanceCard from '@components/TokenBalance/DelegateTokenBalanceCard'
33-
import RelinquishVoteCount from '@components/TokenBalance/RelinquishVoteCount'
34-
import SerumGovernanceTokenWrapper from './SerumGovernanceTokenWrapper'
35-
import getNumTokens from '@components/ProposalVotingPower/getNumTokens'
36-
import VotingPowerPct from '@components/ProposalVotingPower/VotingPowerPct'
31+
3732
import { useMaxVoteRecord } from '@hooks/useMaxVoteRecord'
3833
import useWalletOnePointOh from '@hooks/useWalletOnePointOh'
3934
import {
@@ -50,102 +45,6 @@ import asFindable from '@utils/queries/asFindable'
5045
import VanillaVotingPower from '@components/GovernancePower/Vanilla/VanillaVotingPower'
5146
import { fetchTokenAccountByPubkey } from '@hooks/queries/tokenAccount'
5247
import { DepositTokensButton } from '@components/DepositTokensButton'
53-
import { useLegacyVoterWeight } from '@hooks/queries/governancePower'
54-
import {
55-
useRealmCommunityMintInfoQuery,
56-
useRealmCouncilMintInfoQuery,
57-
} from '@hooks/queries/mintInfo'
58-
59-
const TokenBalanceCard = ({
60-
proposal,
61-
inAccountDetails = false,
62-
children,
63-
}: {
64-
proposal?: Option<Proposal>
65-
inAccountDetails?: boolean
66-
children?: React.ReactNode
67-
}) => {
68-
const [hasGovPower, setHasGovPower] = useState<boolean>(false)
69-
const realm = useRealmQuery().data?.result
70-
const realmProgramId = realm?.owner
71-
const mint = useRealmCommunityMintInfoQuery().data?.result
72-
const councilMint = useRealmCouncilMintInfoQuery().data?.result
73-
const wallet = useWalletOnePointOh()
74-
const connected = !!wallet?.connected
75-
const isDepositVisible = (
76-
depositMint: MintInfo | undefined,
77-
realmMint: PublicKey | undefined
78-
) =>
79-
depositMint &&
80-
(!proposal ||
81-
(proposal.isSome() &&
82-
proposal.value.governingTokenMint.toBase58() === realmMint?.toBase58()))
83-
84-
const communityDepositVisible =
85-
// If there is no council then community deposit is the only option to show
86-
!realm?.account.config.councilMint ||
87-
isDepositVisible(mint, realm?.account.communityMint)
88-
89-
const councilDepositVisible = isDepositVisible(
90-
councilMint,
91-
realm?.account.config.councilMint
92-
)
93-
const hasLoaded = mint || councilMint
94-
95-
return (
96-
<>
97-
{hasLoaded ? (
98-
<div
99-
className={`${
100-
inAccountDetails ? `flex w-full gap-8 md:gap-12` : `space-y-4`
101-
}`}
102-
>
103-
{!hasGovPower && !inAccountDetails && connected && (
104-
<div className={'text-xs text-white/50 mt-8'}>
105-
You do not have any governance power in this dao
106-
</div>
107-
)}
108-
{!connected && (
109-
<div className={'text-xs text-white/50 mt-8'}>
110-
Connect your wallet to see governance power
111-
</div>
112-
)}
113-
{communityDepositVisible && (
114-
<TokenDeposit
115-
mint={mint}
116-
tokenRole={GoverningTokenRole.Community}
117-
councilVote={false}
118-
inAccountDetails={inAccountDetails}
119-
setHasGovPower={setHasGovPower}
120-
/>
121-
)}
122-
{councilDepositVisible && (
123-
<TokenDeposit
124-
mint={councilMint}
125-
tokenRole={GoverningTokenRole.Council}
126-
councilVote={true}
127-
inAccountDetails={inAccountDetails}
128-
setHasGovPower={setHasGovPower}
129-
/>
130-
)}
131-
<DelegateTokenBalanceCard />
132-
<RelinquishVoteCount />
133-
</div>
134-
) : (
135-
<>
136-
<div className="h-12 mb-4 rounded-lg animate-pulse bg-bkg-3" />
137-
<div className="h-10 rounded-lg animate-pulse bg-bkg-3" />
138-
</>
139-
)}
140-
{/* TODO: Restrict to Serum DAO */}
141-
{realmProgramId?.toBase58() ===
142-
'G41fmJzd29v7Qmdi8ZyTBBYa98ghh3cwHBTexqCG1PQJ' ? (
143-
<SerumGovernanceTokenWrapper />
144-
) : null}
145-
{children}
146-
</>
147-
)
148-
}
14948

15049
export const TokenDeposit = ({
15150
mint,

pages/dao/[symbol]/proposal/components/instructions/UXDProtocol/MintWithIdentityDepository.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ const MintWithIdentityDepository = ({
128128
const ix = client.createMintWithIdentityDepositoryInstruction(
129129
new Controller('UXD', UXD_DECIMALS, uxdProgramId),
130130
identityDepository,
131-
new PublicKey(form.uxdProgram),
131+
authority,
132132
new PublicKey(form.user),
133133
form.collateralAmount,
134134
{ preflightCommitment: 'processed', commitment: 'processed' },

0 commit comments

Comments
 (0)