What exactly does Unknown mean in enum types in ic-js?

neuron.listProposals is used to query for proposals, but when I enter the request parameter to use Unknown, no proposals are returned.
This is the first time I’ve used an official dev kit and I’m not too familiar with the corresponding types, but what exactly does Unknown mean? Shouldn’t it mean select all?
image

      const listType: ListProposalsRequest = {
            limit: 100,
            beforeProposal: undefined,
            includeRewardStatus:[ProposalRewardStatus.Unknown],
            excludeTopic:[Topic.Unspecified],
            includeStatus: [ProposalStatus.Unknown],
        };

When I changed
ProposalRewardStatus.Unknown =>ProposalRewardStatus.AcceptVotes
ProposalStatus.Unknown => ProposalStatus.Open,
I finally got 2 proposals and it was consistent with what I found on the official NNS website.
I just don’t quite understand what Unknown actually stands for

I don’t exactly remember what’s Unknown but, I can share that we exclude such flags in NNS dapp.

Unknown are available in the lib to reflect the enum of the governance canister code - for example https://github.com/dfinity/ic/blob/bd646cf9385531f0b390b3d3d1f902d90b0c4a15/rs/nns/governance/src/gen/ic_nns_governance.pb.v1.rs#L3542 - but, practically we do not use it those in the frontend.

OH, I see, maybe the ic-js library hasn’t been updated in this regard, the type is like this in ic-js.

export declare enum ProposalRewardStatus {
    Unknown = 0,
    AcceptVotes = 1,
    ReadyToSettle = 2,
    Settled = 3,
    Ineligible = 4
}

Uknown has been changed to Unspecified in the rust library.
I wonder if there are still developers who maintain the ic-js library?

Most probably we indeed did not rename “Unknown” to “Unspecified” in the js lib, correct. As I said we do not use this value anyway in NNS dapp.

We, the gix team at DFINITY, are maintaining the ic-js libraries and are using those in NNS dapp.
e.g. last commit was provided by me and merged last week.

Thanks for the reply, so is this an error?
Speaking from my actual experience of using Unknown without returning any results, it’s likely that there is some error with this type.

No, I don’t think so. It’s a name of a JS enum, what’s really matter is it’s value - i.e. 0.

export enum ProposalRewardStatus {
  Unknown = 0,
  ...

That said, don’t get me wrong. I’m not against renaming Unknown to Unspecified :wink:

Ok, I see what you mean, but why is it that no object is returned when I set the value to ProposalRewardStatus.Unknown, when it should be set to 0 it should return all of them!

I don’t think that’s how it works. By requesting Unspecified / Unknown you request those proposals that are set as Unspecified / Unknown . So it returns none because there aren’t such types.

Try with [] to get all.

:wink:It does work. That was an oversight on my part.

1 Like

Glad to hear it work out, thanks for the feedback.

1 Like