Skip to content

Commit

Permalink
Add missing accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
ChewingGlass committed Oct 12, 2023
1 parent a0a057b commit e11a324
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
17 changes: 12 additions & 5 deletions scripts/bulk-create-proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ interface Proposal {
uri: string;
maxChoicesPerVoter: number;
choices: Choice[];
proposalConfig: string;
proposalConfig?: string;
tags: string[]
}

Expand Down Expand Up @@ -80,9 +80,10 @@ export async function run(args: any = process.argv) {
const proposals: Proposal[] = JSON.parse(fileData);

const instructions: TransactionInstruction[] = [];
const organizationK = organizationKey(argv.orgName)[0];
const organization = await orgProgram.account.organizationV0.fetch(
organizationKey(argv.orgName)[0]
)
organizationK
);

let i = 0;
for (const proposalData of proposals) {
Expand All @@ -93,7 +94,7 @@ export async function run(args: any = process.argv) {
} = await orgProgram.methods
.initializeProposalV0(proposalData)
.accounts({
organization: organizationKey(argv.orgName)[0],
organization: organizationK,
owner: authority,
})
.prepare();
Expand All @@ -102,7 +103,13 @@ export async function run(args: any = process.argv) {
.updateStateV0({
newState: { voting: {} },
})
.accounts({ proposal })
.accounts({
proposal,
owner: authority,
proposalConfig: proposalData.proposalConfig
? new PublicKey(proposalData.proposalConfig)
: organization.defaultProposalConfig,
})
.prepare();

instructions.push(instruction, setState);
Expand Down
2 changes: 1 addition & 1 deletion scripts/create-proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export async function run(args: any = process.argv) {
.updateStateV0({
newState: { voting: {} },
})
.accounts({ proposal })
.accounts({ proposal, owner: authority })
.prepare();

await sendInstructionsOrSquads({
Expand Down

0 comments on commit e11a324

Please sign in to comment.