List Proposals with dfx

I’m trying to figure out how to list all active NNS proposals. According to there are ~334 ones, but I get the following on the cli:

bash-3.2$ CANISTER=rrkah-fqaaa-aaaaa-aaaaq-cai
bash-3.2$ dfx canister --network= --no-wallet call $CANISTER list_proposals
The Replica returned an error: code 5, message: "Canister rrkah-fqaaa-aaaaa-aaaaq-cai trapped explicitly: Panicked at 'Deserialization Failed: "No more values to deserialize"', /builds/dfinity-lab/dfinity/rs/rust_canisters/dfn_core/src/"

I can list pending proposals with get_pending_proposals but I only see one there I think.

1 Like

As described by did interface file, the querhy function list_proposals have a arguments, whose type is ListProposalInfo:

  list_proposals : (ListProposalInfo) -> (ListProposalInfoResponse) query;
1 Like

Thanks, flyq. I’m trying to list all proposals. Does ListProposalInfo establish a filter for list_proposals?

Welcome, @electronified. Here is the source code and comment.

Yes, there are some kinds of proposals, such as a proposal with resticted voting.

A proposal with resticted voting is included only if the caller is allowed to vote on the proposal.

Returns the proposals info of proposals with proposal ID less than before_proposal (exclusive), returning at most limit proposal infos.

1 Like