Skip to content

Commit

Permalink
Merge branch 'Mythic-Project:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLazySol authored Dec 10, 2024
2 parents dba46b1 + b773aae commit 84be852
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 13 deletions.
4 changes: 3 additions & 1 deletion components/instructions/ExecuteAllInstructionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ const useSignersNeeded = (

//we need to remove the governance and its treasury from the signers
const signers = propInstructions
.map((x) => x.account.instructions.flatMap((inst) => inst.accounts))
.map(
(x) => x.account.instructions?.flatMap((inst) => inst.accounts) || []
)
.filter((x) => x)
.flatMap((x) => x)
.filter((x) => x.isSigner)
Expand Down
24 changes: 14 additions & 10 deletions pages/dao/[symbol]/proposal/[pk]/ProposalWarnings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ const SetRealmConfigWarning = () => (
</h3>
<div className="mt-2">
<p className="text-sm text-yellow-700">
This proposal writes to your realm configuration, which could affect how
votes are counted. Both the instruction data AND accounts list contain parameters.
Before you vote, make sure you review the proposal&apos;s instructions and the concerned
accounts, and understand the implications of passing this proposal.
This proposal writes to your realm configuration, which could affect
how votes are counted. Both the instruction data AND accounts list
contain parameters. Before you vote, make sure you review the
proposal&apos;s instructions and the concerned accounts, and
understand the implications of passing this proposal.
</p>
</div>
</div>
Expand Down Expand Up @@ -79,10 +80,11 @@ const SetGovernanceConfig = () => (
</h3>
<div className="mt-2">
<p className="text-sm text-yellow-700">
This proposal writes to your governance configuration, which could affect how
votes are counted. Both the instruction data AND accounts list contain parameters.
Before you vote, make sure you review the proposal&apos;s instructions and the concerned
accounts, and understand the implications of passing this proposal.
This proposal writes to your governance configuration, which could
affect how votes are counted. Both the instruction data AND accounts
list contain parameters. Before you vote, make sure you review the
proposal&apos;s instructions and the concerned accounts, and
understand the implications of passing this proposal.
</p>
</div>
</div>
Expand Down Expand Up @@ -190,8 +192,10 @@ const useProposalSafetyCheck = (proposal: Proposal) => {
?.result

const isUsingForwardProgram = transactions
?.flatMap((tx) =>
tx.account.instructions.flatMap((ins) => ins.programId.toBase58())
?.flatMap(
(tx) =>
tx.account.instructions?.flatMap((ins) => ins.programId.toBase58()) ||
[]
)
.filter((x) => x === MANGO_INSTRUCTION_FORWARDER).length

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { IxGateParams } from '@blockworks-foundation/mango-v4/dist/types/src/cli
import useWalletOnePointOh from '@hooks/useWalletOnePointOh'
import useProgramSelector from '@components/Mango/useProgramSelector'
import ProgramSelector from '@components/Mango/ProgramSelector'
import ForwarderProgram, {
useForwarderProgramHelpers,
} from '@components/ForwarderProgram/ForwarderProgram'

type IxGateSetForm = IxGateParams & {
governedAccount: AssetAccount | null
Expand All @@ -31,6 +34,7 @@ const IxGateSet = ({
governance: ProgramAccount<Governance> | null
}) => {
const wallet = useWalletOnePointOh()
const forwarderProgramHelpers = useForwarderProgramHelpers()
const programSelectorHook = useProgramSelector()
const { mangoClient, mangoGroup } = UseMangoV4(
programSelectorHook.program?.val,
Expand Down Expand Up @@ -153,7 +157,9 @@ const IxGateSet = ({
})
.instruction()

serializedInstruction = serializeInstructionToBase64(ix)
serializedInstruction = serializeInstructionToBase64(
forwarderProgramHelpers.withForwarderWrapper(ix)
)
}
const obj: UiInstruction = {
serializedInstruction: serializedInstruction,
Expand All @@ -170,7 +176,11 @@ const IxGateSet = ({
index
)
// eslint-disable-next-line react-hooks/exhaustive-deps -- TODO please fix, it can cause difficult bugs. You might wanna check out https://bobbyhadz.com/blog/react-hooks-exhaustive-deps for info. -@asktree
}, [form])
}, [
form,
forwarderProgramHelpers.form,
forwarderProgramHelpers.withForwarderWrapper,
])
const schema = yup.object().shape({
governedAccount: yup
.object()
Expand Down Expand Up @@ -684,6 +694,7 @@ const IxGateSet = ({
formErrors={formErrors}
></InstructionForm>
)}
<ForwarderProgram {...forwarderProgramHelpers}></ForwarderProgram>
</>
)
}
Expand Down

0 comments on commit 84be852

Please sign in to comment.