Skip to content

Commit

Permalink
Civic Gateway Lib: Post merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelleher committed Jul 15, 2022
1 parent 71d5eea commit 89becfc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hooks/useGovernanceAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export default function useGovernanceAssets() {
},
{
id: Instructions.ConfigureGatewayPlugin,
name: 'Civic: Configure Gateway plugin',
name: 'Civic: Configure existing Gateway plugin',
isVisible: canUseAuthorityInstruction,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
SYSTEM_PROGRAM_ID,
} from '@solana/spl-governance'
import { validateInstruction } from '@utils/instructionTools'
import { UiInstruction } from '@utils/uiTypes/proposalCreationTypes'
import { NameValue, UiInstruction } from '@utils/uiTypes/proposalCreationTypes'

import useWalletStore from 'stores/useWalletStore'
import useRealm from '@hooks/useRealm'
Expand All @@ -26,8 +26,8 @@ import { getRegistrarPDA } from '@utils/plugin/accounts'

interface CreateGatewayRegistrarForm {
governedAccount: AssetAccount | undefined
gatekeeperNetwork: PublicKey // populated by dropdown
otherGatekeeperNetwork: PublicKey | undefined // manual entry
gatekeeperNetwork: NameValue // populated by dropdown
otherGatekeeperNetwork: NameValue | undefined // manual entry
predecessor: PublicKey | undefined // if part of a chain of plugins
}

Expand All @@ -48,7 +48,11 @@ const CreateGatewayPluginRegistrar = ({
const { handleSetInstructions } = useContext(NewProposalContext)

const chosenGatekeeperNetwork = useMemo(() => {
return form?.otherGatekeeperNetwork || form?.gatekeeperNetwork
const chosenEntry = form?.otherGatekeeperNetwork || form?.gatekeeperNetwork
if (chosenEntry) {
console.log('chosenString', chosenEntry)
return new PublicKey(chosenEntry.value)
}
}, [form])

async function getInstruction(): Promise<UiInstruction> {
Expand Down Expand Up @@ -133,23 +137,23 @@ const CreateGatewayPluginRegistrar = ({
),
options: [
{
key: 'Bot Resistance',
name: 'Bot Resistance',
value: 'ignREusXmGrscGNUesoU9mxfds9AiYTezUKex2PsZV6',
},
{
key: 'Uniqueness',
name: 'Uniqueness',
value: 'uniqobk8oGh4XBLMqM68K8M2zNu3CdYX7q5go7whQiv',
},
{
key: 'ID Verification',
name: 'ID Verification',
value: 'bni1ewus6aMxTxBi5SAfzEmmXLf8KcVFRmTfproJuKw',
},
{
key: 'ID Verification for DeFi',
name: 'ID Verification for DeFi',
value: 'gatbGF9DvLAw3kWyn1EmH5Nh1Sqp8sTukF7yaQpSc71',
},
{
key: 'Other',
name: 'Other',
value: '',
},
],
Expand All @@ -160,7 +164,7 @@ const CreateGatewayPluginRegistrar = ({
inputType: 'text',
name: 'otherGatekeeperNetwork',
type: InstructionInputType.INPUT,
hide: () => form?.gatekeeperNetwork?.toString() !== '', // Other selected
hide: () => form?.gatekeeperNetwork?.value.toString() !== '', // Other selected
},
{
label: 'Predecessor plugin (optional)',
Expand Down
2 changes: 1 addition & 1 deletion utils/uiTypes/proposalCreationTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export interface MangoMakeAddOracleForm {
oracleAccount: string | undefined
}

type NameValue = {
export type NameValue = {
name: string
value: string
}
Expand Down

0 comments on commit 89becfc

Please sign in to comment.