Where can we get all proposals? i tried nns governance canister’s list_proposal method but it returns proposals from few topics only. from topic 3 & 9 only. where are proposals on rest of the topics?
Correct, the governance canister only provide the proposals through paginated lists.
That’s the utils function wrapper we use in NNS dapp: https://github.com/dfinity/ic-js/tree/main/packages/nns#gear-listproposals
bit confuse here. so where are proposals from other topics? like topic number 1,2 etc.?
list_proposals does not return proposals from these topics.
These are the parameters: https://github.com/dfinity/ic-js/blob/95e1eee44995a8a9981473a9061326b8f2d9a64c/packages/nns/src/canisters/governance/request.converters.ts#L866
return {
include_reward_status: Int32Array.from(includeRewardStatus),
before_proposal: beforeProposal ? [fromProposalId(beforeProposal)] : [],
limit: limit,
exclude_topic: Int32Array.from(excludeTopic),
include_status: Int32Array.from(includeStatus),
};
Don’t really know the historic “why and how”, just what we are using .
sorry to bother you again. i am just looking for a confirmation if governance canister does have proposals from rest of the topics or not.
In Governance Dashboard we can view proposals from all topics so i was assuming there was a way to get them through governance canister as well. (Governance - IC Dashboard)
this is the code i’m using right now. not excluding any topic so i was expecting it’ll return all the proposals. not able to understand where am i going wrong here.
const resp = await nnsGovernanceCanister.list_proposals({
include_reward_status: [],
before_proposal: [{ id: 1000 }],
limit: 1000,
exclude_topic: [],
include_all_manage_neuron_proposals: [true],
include_status: [],
});
resp.proposal_info.map((p) => console.log(p.id[0].id));
and this is output of it:
728n
715n
713n
543n
517n
364n
340n
so it returns only 7 proposals out of 1000.
can you take a look & suggest something? thanks for all the help
The governance canister - as any other canisters currently - offers no REST api.
The dashboard is not on chain. They offer a web2 API but, I have never used it my self to list proposals, therefore cannot tell you what is possible or not with it.
Are you sure that before_proposal: [{ id: 1000 }]
accepts a number and not a bigint?
Beside that not sure, 1000n looks like a pretty low number, have you try with a most recent ID like 123434n?
Have you also try to set include_reward_status
and include_status
instead of empty?
sorry if i wan’t clear with my question. i wasn’t talking about REST APIs. i was saying rest of the topics
in above statement.
The dashboard is not on chain. They offer a web2 API but, I have never used it my self to list proposals, therefore cannot tell you what is possible or not with it.
i understand, my point was proposals are happening on chain. dashboard is not on chain but it must be getting its data from somewhere. IC is a blockchain project from my understanding, so all data related to chain must be on chain right? proposals are part of governance process so they must be on chain somewhere. maybe i’m wrong, its just my understanding of system so far.
Are you sure that before_proposal: [{ id: 1000 }] accepts a number and not a bigint?
yes, i think it does accept Number as it is not throwing any error & i’m able to fetch proposals with it.
Beside that not sure, 1000n looks like a pretty low number, have you try with a most recent ID like 123434n?
yes i have tried big numbers & getting same results. proposals from other topics are missing.
Have you also try to set
include_reward_status
andinclude_status
instead of empty?
need help with this one. both of these argument accepts Int32
, can you guide me where are list of all the possible status & reward status numbers?
unfortunaly don’t know well enough the dashboard to answer, it would be only speculation.
See for example:
We use enums and convert those to these arrays. Hope that help.