How do I use SnsListProposalsParams and {certified: false}

Locally I’d like to list my proposals, which I can do:

async function listProposals(beforeProposal?: ProposalId) {
    const agent: any = await ActorFactory.getGovernanceAgent();
    if (process.env.DFX_NETWORK !== "ic") {
      await agent.fetchRootKey();
    }

    const principal: Principal = Principal.fromText(process.env.CANISTER_ID_SNS_GOVERNANCE ?? "");
    const { listProposals: governanceListProposals } = SnsGovernanceCanister.create({
      agent,
      canisterId: principal
    });

    const params: SnsListProposalsParams = {
      includeStatus: [selectedProposalStatus],
      limit: itemsPerPage,
      beforeProposal: beforeProposal,
      excludeType: getExcludedFunctionIds()
    };

    proposals = await governanceListProposals(params);
    console.log(proposals);
    filterProposals();
  }

provided I change this line:
proposals = await governanceListProposals(params);
to
proposals = await governanceListProposals({certified: false});

How do I do the certified false and have the params?

You do not use TypeScript?

certified is part of the params for the function listProposals.

To be fair the JSdocs of the function can be improved, agree.

1 Like

Sorry mate, yeah I was using typescript but my problem was I just wasn’t including all the statuses to actually show the proposals.


  let selectedProposalStatus = [0,1,2,3,4,5];

so i get them and am able to add certified false to the extended params



    const principal: Principal = Principal.fromText(process.env.CANISTER_ID_SNS_GOVERNANCE ?? "");
    const { listProposals: governanceListProposals } = SnsGovernanceCanister.create({
      agent,
      canisterId: principal
    });

    const params: SnsListProposalsParams = {
      includeStatus: selectedProposalStatus,
      limit: itemsPerPage,
      beforeProposal: beforeProposal,
      excludeType: getExcludedFunctionIds(),
      certified: false
    };

    proposals = await governanceListProposals(params);

1 Like