GovernanceTypes module contains all type definitions used for interacting with Internet Computer governance canisters, including the NNS governance canister. These types are generated Motoko bindings that correspond to the Candid interface of governance canisters.
Overview
This module provides comprehensive type definitions for:- Proposals and proposal filtering
- Neurons and neuron management
- Voting and ballot information
- Governance canister metadata
- Nervous system functions
- Network economics parameters
Core Types
ProposalInfo
Contains detailed information about a governance proposal.The unique identifier for this proposal.
The current status of the proposal:
1: Open (accepting votes)2: Rejected3: Accepted4: Executed5: Failed
The proposal topic/category (e.g., Governance, NetworkEconomics, NodeAdmin).
Map of neuron IDs to their votes on this proposal.
Unix timestamp when the proposal was created.
The current vote tally for this proposal.
The actual proposal content including title, summary, and action.
The neuron ID that submitted this proposal.
Proposal
The actual content and action of a governance proposal.URL with additional information about the proposal.
The proposal title.
A markdown-formatted summary of the proposal.
Action
The action to be executed when a proposal is adopted.Motion: A motion proposal (non-executable, advisory)ManageNeuron: Manage a specific neuronExecuteNnsFunction: Execute an NNS functionManageNetworkEconomics: Update network economics parameters
Tally
Vote tallying information for a proposal.Total voting power that voted against the proposal.
Total voting power that voted in favor of the proposal.
Total voting power eligible to vote on this proposal.
Unix timestamp when this tally was calculated.
ListProposalInfo
Filter criteria for listing proposals.Maximum number of proposals to return.
Return proposals created before this proposal ID (for pagination).
Array of proposal status codes to include. Empty array means include all statuses.
Array of reward status codes to include. Empty array means include all reward statuses.
Array of topic IDs to exclude from results.
If true, omits large fields from the response for better performance.
If true, includes all ManageNeuron proposals (which are normally filtered).
ListProposalInfoResponse
Response containing a list of proposals.Array of ProposalInfo objects matching the filter criteria.
Neuron Types
NeuronId
Unique identifier for a neuron.The numeric identifier for the neuron.
Neuron
Complete neuron information.The unique identifier for this neuron.
The principal that controls this neuron.
The amount of ICP staked in this neuron (in e8s, where 1 ICP = 100,000,000 e8s).
The maturity of this neuron in e8s equivalent.
The dissolve state of the neuron (dissolving or locked with a delay).
Map of topics to the neurons this neuron follows for automatic voting.
NeuronInfo
Summary information about a neuron (lighter weight than full Neuron type).The amount of ICP staked in this neuron (in e8s).
The voting power of this neuron, including bonuses.
The state of the neuron:
1: Not dissolving (locked)2: Dissolving3: Dissolved
The dissolve delay in seconds.
The age of the neuron in seconds.
Voting Types
Ballot
A vote cast by a neuron on a proposal.The vote value:
0: Unspecified (not voted)1: Yes2: No
The voting power used for this vote.
BallotInfo
Information about a neuron’s vote on a specific proposal.The vote cast (0 = unspecified, 1 = yes, 2 = no).
The ID of the proposal this ballot is for.
Nervous System Functions
NervousSystemFunction
Defines a callable function in a governance canister.The unique identifier for this function.
The name of the function (e.g., “CreateSubnet”, “AddNodeToSubnet”).
Optional description of what this function does.
ListNervousSystemFunctionsResponse
Response containing the list of available nervous system functions.Array of available nervous system functions.
Array of function IDs that are reserved and cannot be used for custom functions.
Error Types
GovernanceError
Error information returned by governance operations.Human-readable error message.
Error type code indicating the category of error.
Governance Canister Interface
GovernanceCanister
The actor interface for interacting with governance canisters.Network Economics Types
NetworkEconomics
Parameters that govern the economic model of the network.Minimum amount of ICP (in e8s) required to create a neuron.
Cost (in e8s) for a rejected proposal.
Transaction fee for ledger operations (in e8s).
Additional Types
DissolveState
Represents the dissolve state of a neuron.DissolveDelaySeconds: Neuron is not dissolving, has this delay remainingWhenDissolvedTimestampSeconds: Neuron is dissolving, will be dissolved at this timestamp
Followees
List of neurons that are followed for a specific topic.KnownNeuronData
Metadata for publicly known neurons.The public name of the neuron.
Optional description of the neuron’s purpose or owner.
Working with E8s
Many values in the governance types use “e8s” (satoshis) as the unit:- 1 ICP = 100,000,000 e8s
- 1 e8s = 0.00000001 ICP
NNS Function IDs
TheGovernanceUtils module provides a list of NNS function IDs and their names. For example:
0: Unspecified1: CreateSubnet2: AddNodeToSubnet3: NnsCanisterInstall4: NnsCanisterUpgrade- And many more…
Related Documentation
- GovernanceService - Methods for interacting with governance canisters
- OpenChat Bot SDK Overview - Getting started with the SDK