8000 Fix sns demo proposals creation by mstrasinskis · Pull Request #6722 · dfinity/nns-dapp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix sns demo proposals creation #6722

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 14 additions & 18 deletions frontend/src/lib/api/dev.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,25 +219,21 @@ export const makeSnsDummyProposals = async ({
});
const { snsProposals } = await import("./sns-dummy.api");

const allCalls = await Promise.allSettled(
snsProposals.map((proposal) =>
canister
.manageNeuron({
subaccount: neuronId.id,
command: [{ MakeProposal: proposal }],
})
.catch((error) => {
console.error(
"Error while creating dummy proposal: ",
proposal.title
);
console.error(error);
throw error;
})
)
);
const errors: unknown[] = [];
for (const proposal of snsProposals) {
try {
await canister.manageNeuron({
subaccount: neuronId.id,
command: [{ MakeProposal: proposal }],
});
} catch (error) {
console.error("Error while creating dummy proposal: ", proposal.title);
console.error(error);
errors.push(error);
}
}

if (allCalls.some((call) => call.status === "rejected")) {
if (errors.length > 0) {
throw new Error();
}

Expand Down
7 changes: 5 additions & 2 deletions frontend/src/lib/api/sns-dummy.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const nsFunctionProposal1 = {
],
validator_method_name: ["test"],
target_method_name: ["test"],
topic: [{ Governance: null }],
},
},
],
Expand Down Expand Up @@ -89,6 +90,7 @@ const nsFunctionProposal2 = {
],
validator_method_name: ["test"],
target_method_name: ["test"],
topic: [{ Governance: null }],
},
},
],
Expand All @@ -98,9 +100,10 @@ const nsFunctionProposal2 = {
};

// We need to pass a proposal to add a function to the nervous system first
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const executeNSFunctionProposal = {
url: "internet-computer.org",
title: "Execute Generic Nervoys system Function",
title: "Execute Generic Nervous system Function",
summary:
"# Summary\nThis is a dummy proposal to execute a *nervous system function*.",
action: [
Expand Down Expand Up @@ -212,7 +215,7 @@ export const snsProposals = [
nsFunctionProposal1,
nsFunctionProposal2,
// The following proposals require specific state to be set up first.
executeNSFunctionProposal,
// executeNSFunctionProposal,
// removeNSFunctionProposal,
// upgradeProposal,
// upgradeControlledCanisterProposal,
Expand Down
0