diff --git a/cli/src/declarations/governance.d.ts b/cli/src/declarations/governance.d.ts index 1dfb5ea..9b7437d 100644 --- a/cli/src/declarations/governance.d.ts +++ b/cli/src/declarations/governance.d.ts @@ -8,6 +8,9 @@ export interface AccountIdentifier { export type Action = | {RegisterKnownNeuron: KnownNeuron} | {ManageNeuron: ManageNeuron} + | {UpdateCanisterSettings: UpdateCanisterSettings} + | {InstallCode: InstallCode} + | {StopOrStartCanister: StopOrStartCanister} | {CreateServiceNervousSystem: CreateServiceNervousSystem} | {ExecuteNnsFunction: ExecuteNnsFunction} | {RewardNodeProvider: RewardNodeProvider} @@ -16,7 +19,7 @@ export type Action = | {SetDefaultFollowees: SetDefaultFollowees} | {RewardNodeProviders: RewardNodeProviders} | {ManageNetworkEconomics: NetworkEconomics} - | {ApproveGenesisKyc: ApproveGenesisKyc} + | {ApproveGenesisKyc: Principals} | {AddOrRemoveNodeProvider: AddOrRemoveNodeProvider} | {Motion: Motion}; export interface AddHotKey { @@ -37,7 +40,7 @@ export interface Ballot { } export interface BallotInfo { vote: number; - proposal_id: [] | [NeuronId]; + proposal_id: [] | [ProposalId]; } export type By = | {NeuronIdOrSubaccount: {}} @@ -46,6 +49,14 @@ export type By = export interface Canister { id: [] | [Principal]; } +export interface CanisterSettings { + freezing_threshold: [] | [bigint]; + controllers: [] | [Controllers]; + log_visibility: [] | [number]; + wasm_memory_limit: [] | [bigint]; + memory_allocation: [] | [bigint]; + compute_allocation: [] | [bigint]; +} export interface CanisterStatusResultV2 { status: [] | [number]; freezing_threshold: [] | [bigint]; @@ -59,15 +70,6 @@ export interface CanisterSummary { status: [] | [CanisterStatusResultV2]; canister_id: [] | [Principal]; } -export interface CfNeuron { - has_created_neuron_recipes: [] | [boolean]; - nns_neuron_id: bigint; - amount_icp_e8s: bigint; -} -export interface CfParticipant { - hotkey_principal: string; - cf_neurons: Array; -} export type Change = {ToRemove: NodeProvider} | {ToAdd: NodeProvider}; export interface ChangeAutoStakeMaturity { requested_setting_for_auto_stake_maturity: boolean; @@ -135,6 +137,9 @@ export interface Committed_1 { export interface Configure { operation: [] | [Operation]; } +export interface Controllers { + controllers: Array; +} export interface Countries { iso_codes: Array; } @@ -150,6 +155,10 @@ export interface CreateServiceNervousSystem { swap_parameters: [] | [SwapParameters]; initial_token_distribution: [] | [InitialTokenDistribution]; } +export interface DateRangeFilter { + start_timestamp_seconds: [] | [bigint]; + end_timestamp_seconds: [] | [bigint]; +} export interface Decimal { human_readable: [] | [string]; } @@ -197,7 +206,7 @@ export interface FollowersMap { followers_map: Array<[bigint, Followers]>; } export interface GetNeuronsFundAuditInfoRequest { - nns_proposal_id: [] | [NeuronId]; + nns_proposal_id: [] | [ProposalId]; } export interface GetNeuronsFundAuditInfoResponse { result: [] | [Result_6]; @@ -208,7 +217,7 @@ export interface GlobalTimeOfDay { export interface Governance { default_followees: Array<[number, Followees]>; making_sns_proposal: [] | [MakingSnsProposal]; - most_recent_monthly_node_provider_rewards: [] | [MostRecentMonthlyNodeProviderRewards]; + most_recent_monthly_node_provider_rewards: [] | [MonthlyNodeProviderRewards]; maturity_modulation_last_updated_at_timestamp_seconds: [] | [bigint]; wait_for_quiet_threshold_seconds: bigint; metrics: [] | [GovernanceCachedMetrics]; @@ -248,21 +257,25 @@ export interface GovernanceCachedMetrics { not_dissolving_neurons_count: bigint; total_locked_e8s: bigint; neurons_fund_total_active_neurons: bigint; + total_voting_power_non_self_authenticating_controller: [] | [bigint]; total_staked_maturity_e8s_equivalent: bigint; not_dissolving_neurons_e8s_buckets_ect: Array<[bigint, number]>; total_staked_e8s_ect: bigint; not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: bigint; dissolved_neurons_e8s: bigint; + total_staked_e8s_non_self_authenticating_controller: [] | [bigint]; dissolving_neurons_e8s_buckets_seed: Array<[bigint, number]>; neurons_with_less_than_6_months_dissolve_delay_e8s: bigint; not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: Array<[bigint, number]>; dissolving_neurons_count_buckets: Array<[bigint, bigint]>; dissolving_neurons_e8s_buckets_ect: Array<[bigint, number]>; + non_self_authenticating_controller_neuron_subset_metrics: [] | [NeuronSubsetMetrics]; dissolving_neurons_count: bigint; dissolving_neurons_e8s_buckets: Array<[bigint, number]>; total_staked_maturity_e8s_equivalent_seed: bigint; community_fund_total_staked_e8s: bigint; not_dissolving_neurons_e8s_buckets_seed: Array<[bigint, number]>; + public_neuron_subset_metrics: [] | [NeuronSubsetMetrics]; timestamp_seconds: bigint; seed_neuron_count: bigint; } @@ -296,6 +309,20 @@ export interface InitialTokenDistribution { developer_distribution: [] | [DeveloperDistribution]; swap_distribution: [] | [SwapDistribution]; } +export interface InstallCode { + skip_stopping_before_installing: [] | [boolean]; + wasm_module_hash: [] | [Uint8Array | number[]]; + canister_id: [] | [Principal]; + arg_hash: [] | [Uint8Array | number[]]; + install_mode: [] | [number]; +} +export interface InstallCodeRequest { + arg: [] | [Uint8Array | number[]]; + wasm_module: [] | [Uint8Array | number[]]; + skip_stopping_before_installing: [] | [boolean]; + canister_id: [] | [Principal]; + install_mode: [] | [number]; +} export interface KnownNeuron { id: [] | [NeuronId]; known_neuron_data: [] | [KnownNeuronData]; @@ -314,20 +341,28 @@ export interface ListKnownNeuronsResponse { known_neurons: Array; } export interface ListNeurons { + include_public_neurons_in_full_neurons: [] | [boolean]; neuron_ids: BigUint64Array | bigint[]; + include_empty_neurons_readable_by_caller: [] | [boolean]; include_neurons_readable_by_caller: boolean; } export interface ListNeuronsResponse { neuron_infos: Array<[bigint, NeuronInfo]>; full_neurons: Array; } +export interface ListNodeProviderRewardsRequest { + date_filter: [] | [DateRangeFilter]; +} +export interface ListNodeProviderRewardsResponse { + rewards: Array; +} export interface ListNodeProvidersResponse { node_providers: Array; } export interface ListProposalInfo { include_reward_status: Int32Array | number[]; omit_large_fields: [] | [boolean]; - before_proposal: [] | [NeuronId]; + before_proposal: [] | [ProposalId]; limit: number; exclude_topic: Int32Array | number[]; include_all_manage_neuron_proposals: [] | [boolean]; @@ -336,9 +371,15 @@ export interface ListProposalInfo { export interface ListProposalInfoResponse { proposal_info: Array; } +export interface MakeProposalRequest { + url: string; + title: [] | [string]; + action: [] | [ProposalActionRequest]; + summary: string; +} export interface MakeProposalResponse { message: [] | [string]; - proposal_id: [] | [NeuronId]; + proposal_id: [] | [ProposalId]; } export interface MakingSnsProposal { proposal: [] | [Proposal]; @@ -350,6 +391,24 @@ export interface ManageNeuron { command: [] | [Command]; neuron_id_or_subaccount: [] | [NeuronIdOrSubaccount]; } +export type ManageNeuronCommandRequest = + | {Spawn: Spawn} + | {Split: Split} + | {Follow: Follow} + | {ClaimOrRefresh: ClaimOrRefresh} + | {Configure: Configure} + | {RegisterVote: RegisterVote} + | {Merge: Merge} + | {DisburseToNeuron: DisburseToNeuron} + | {MakeProposal: MakeProposalRequest} + | {StakeMaturity: StakeMaturity} + | {MergeMaturity: MergeMaturity} + | {Disburse: Disburse}; +export interface ManageNeuronRequest { + id: [] | [NeuronId]; + command: [] | [ManageNeuronCommandRequest]; + neuron_id_or_subaccount: [] | [NeuronIdOrSubaccount]; +} export interface ManageNeuronResponse { command: [] | [Command_1]; } @@ -378,9 +437,14 @@ export interface Migrations { neuron_indexes_migration: [] | [Migration]; copy_inactive_neurons_to_stable_memory_migration: [] | [Migration]; } -export interface MostRecentMonthlyNodeProviderRewards { +export interface MonthlyNodeProviderRewards { + minimum_xdr_permyriad_per_icp: [] | [bigint]; + registry_version: [] | [bigint]; + node_providers: Array; timestamp: bigint; rewards: Array; + xdr_conversion_rate: [] | [XdrConversionRate]; + maximum_node_provider_rewards_e8s: [] | [bigint]; } export interface Motion { motion_text: string; @@ -415,6 +479,7 @@ export interface Neuron { dissolve_state: [] | [DissolveState]; followees: Array<[number, Followees]>; neuron_fees_e8s: bigint; + visibility: [] | [number]; transfer: [] | [NeuronStakeTransfer]; known_neuron_data: [] | [KnownNeuronData]; spawn_at_timestamp_seconds: [] | [bigint]; @@ -451,6 +516,7 @@ export interface NeuronInfo { stake_e8s: bigint; joined_community_fund_timestamp_seconds: [] | [bigint]; retrieved_at_timestamp_seconds: bigint; + visibility: [] | [number]; known_neuron_data: [] | [KnownNeuronData]; voting_power: bigint; age_seconds: bigint; @@ -464,6 +530,18 @@ export interface NeuronStakeTransfer { transfer_timestamp: bigint; block_height: bigint; } +export interface NeuronSubsetMetrics { + total_maturity_e8s_equivalent: [] | [bigint]; + maturity_e8s_equivalent_buckets: Array<[bigint, bigint]>; + voting_power_buckets: Array<[bigint, bigint]>; + total_staked_e8s: [] | [bigint]; + count: [] | [bigint]; + total_staked_maturity_e8s_equivalent: [] | [bigint]; + staked_maturity_e8s_equivalent_buckets: Array<[bigint, bigint]>; + staked_e8s_buckets: Array<[bigint, bigint]>; + total_voting_power: [] | [bigint]; + count_buckets: Array<[bigint, bigint]>; +} export interface NeuronsFundAuditInfo { final_neurons_fund_participation: [] | [NeuronsFundParticipation]; initial_neurons_fund_participation: [] | [NeuronsFundParticipation]; @@ -488,13 +566,15 @@ export interface NeuronsFundMatchedFundingCurveCoefficients { full_participation_milestone_xdr: [] | [Decimal]; } export interface NeuronsFundNeuron { - hotkey_principal: [] | [string]; + controller: [] | [Principal]; + hotkeys: [] | [Principals]; is_capped: [] | [boolean]; nns_neuron_id: [] | [bigint]; amount_icp_e8s: [] | [bigint]; } export interface NeuronsFundNeuronPortion { - hotkey_principal: [] | [Principal]; + controller: [] | [Principal]; + hotkeys: Array; is_capped: [] | [boolean]; maturity_equivalent_icp_e8s: [] | [bigint]; nns_neuron_id: [] | [NeuronId]; @@ -535,6 +615,7 @@ export type Operation = | {StopDissolving: {}} | {StartDissolving: {}} | {IncreaseDissolveDelay: IncreaseDissolveDelay} + | {SetVisibility: SetVisibility} | {JoinCommunityFund: {}} | {LeaveCommunityFund: {}} | {SetDissolveTimestamp: SetDissolveTimestamp}; @@ -554,6 +635,9 @@ export interface Params { export interface Percentage { basis_points: [] | [bigint]; } +export interface Principals { + principals: Array; +} export type Progress = {LastNeuronId: NeuronId}; export interface Proposal { url: string; @@ -561,10 +645,23 @@ export interface Proposal { action: [] | [Action]; summary: string; } +export type ProposalActionRequest = + | {RegisterKnownNeuron: KnownNeuron} + | {ManageNeuron: ManageNeuronRequest} + | {UpdateCanisterSettings: UpdateCanisterSettings} + | {InstallCode: InstallCodeRequest} + | {StopOrStartCanister: StopOrStartCanister} + | {CreateServiceNervousSystem: CreateServiceNervousSystem} + | {ExecuteNnsFunction: ExecuteNnsFunction} + | {RewardNodeProvider: RewardNodeProvider} + | {RewardNodeProviders: RewardNodeProviders} + | {ManageNetworkEconomics: NetworkEconomics} + | {ApproveGenesisKyc: Principals} + | {AddOrRemoveNodeProvider: AddOrRemoveNodeProvider} + | {Motion: Motion}; export interface ProposalData { - id: [] | [NeuronId]; + id: [] | [ProposalId]; failure_reason: [] | [GovernanceError]; - cf_participants: Array; ballots: Array<[bigint, Ballot]>; proposal_timestamp_seconds: bigint; reward_event_round: bigint; @@ -581,8 +678,11 @@ export interface ProposalData { executed_timestamp_seconds: bigint; original_total_community_fund_maturity_e8s_equivalent: [] | [bigint]; } +export interface ProposalId { + id: bigint; +} export interface ProposalInfo { - id: [] | [NeuronId]; + id: [] | [ProposalId]; status: number; topic: number; failure_reason: [] | [GovernanceError]; @@ -602,7 +702,7 @@ export interface ProposalInfo { } export interface RegisterVote { vote: number; - proposal: [] | [NeuronId]; + proposal: [] | [ProposalId]; } export interface RemoveHotKey { hot_key_to_remove: [] | [Principal]; @@ -622,7 +722,7 @@ export type Result_1 = {Error: GovernanceError} | {NeuronId: NeuronId}; export type Result_10 = {Ok: Ok_1} | {Err: GovernanceError}; export type Result_2 = {Ok: Neuron} | {Err: GovernanceError}; export type Result_3 = {Ok: GovernanceCachedMetrics} | {Err: GovernanceError}; -export type Result_4 = {Ok: RewardNodeProviders} | {Err: GovernanceError}; +export type Result_4 = {Ok: MonthlyNodeProviderRewards} | {Err: GovernanceError}; export type Result_5 = {Ok: NeuronInfo} | {Err: GovernanceError}; export type Result_6 = {Ok: Ok} | {Err: GovernanceError}; export type Result_7 = {Ok: NodeProvider} | {Err: GovernanceError}; @@ -635,7 +735,7 @@ export interface RewardEvent { total_available_e8s_equivalent: bigint; latest_round_available_e8s_equivalent: [] | [bigint]; distributed_e8s_equivalent: bigint; - settled_proposals: Array; + settled_proposals: Array; } export type RewardMode = {RewardToNeuron: RewardToNeuron} | {RewardToAccount: RewardToAccount}; export interface RewardNodeProvider { @@ -666,6 +766,9 @@ export interface SetSnsTokenSwapOpenTimeWindow { request: [] | [SetOpenTimeWindowRequest]; swap_canister_id: [] | [Principal]; } +export interface SetVisibility { + visibility: [] | [number]; +} export interface SettleCommunityFundParticipation { result: [] | [Result_8]; open_sns_token_swap_proposal_id: [] | [bigint]; @@ -695,6 +798,10 @@ export interface StakeMaturityResponse { maturity_e8s: bigint; staked_maturity_e8s: bigint; } +export interface StopOrStartCanister { + action: [] | [number]; + canister_id: [] | [Principal]; +} export interface SwapBackgroundInformation { ledger_index_canister_summary: [] | [CanisterSummary]; fallback_controller_principal_ids: Array; @@ -743,6 +850,10 @@ export interface TimeWindow { export interface Tokens { e8s: [] | [bigint]; } +export interface UpdateCanisterSettings { + canister_id: [] | [Principal]; + settings: [] | [CanisterSettings]; +} export interface UpdateNodeProvider { reward_account: [] | [AccountIdentifier]; } @@ -770,10 +881,7 @@ export interface _SERVICE { get_latest_reward_event: ActorMethod<[], RewardEvent>; get_metrics: ActorMethod<[], Result_3>; get_monthly_node_provider_rewards: ActorMethod<[], Result_4>; - get_most_recent_monthly_node_provider_rewards: ActorMethod< - [], - [] | [MostRecentMonthlyNodeProviderRewards] - >; + get_most_recent_monthly_node_provider_rewards: ActorMethod<[], [] | [MonthlyNodeProviderRewards]>; get_network_economics_parameters: ActorMethod<[], NetworkEconomics>; get_neuron_ids: ActorMethod<[], BigUint64Array | bigint[]>; get_neuron_info: ActorMethod<[bigint], Result_5>; @@ -788,15 +896,19 @@ export interface _SERVICE { get_restore_aging_summary: ActorMethod<[], RestoreAgingSummary>; list_known_neurons: ActorMethod<[], ListKnownNeuronsResponse>; list_neurons: ActorMethod<[ListNeurons], ListNeuronsResponse>; + list_node_provider_rewards: ActorMethod< + [ListNodeProviderRewardsRequest], + ListNodeProviderRewardsResponse + >; list_node_providers: ActorMethod<[], ListNodeProvidersResponse>; list_proposals: ActorMethod<[ListProposalInfo], ListProposalInfoResponse>; - manage_neuron: ActorMethod<[ManageNeuron], ManageNeuronResponse>; + manage_neuron: ActorMethod<[ManageNeuronRequest], ManageNeuronResponse>; settle_community_fund_participation: ActorMethod<[SettleCommunityFundParticipation], Result>; settle_neurons_fund_participation: ActorMethod< [SettleNeuronsFundParticipationRequest], SettleNeuronsFundParticipationResponse >; - simulate_manage_neuron: ActorMethod<[ManageNeuron], ManageNeuronResponse>; + simulate_manage_neuron: ActorMethod<[ManageNeuronRequest], ManageNeuronResponse>; transfer_gtc_neuron: ActorMethod<[NeuronId, NeuronId], Result>; update_node_provider: ActorMethod<[UpdateNodeProvider], Result>; } diff --git a/cli/src/declarations/governance.did b/cli/src/declarations/governance.did index 40eaf16..85388e4 100644 --- a/cli/src/declarations/governance.did +++ b/cli/src/declarations/governance.did @@ -1,7 +1,13 @@ -type AccountIdentifier = record { hash : blob }; +type AccountIdentifier = record { + hash : blob; +}; + type Action = variant { RegisterKnownNeuron : KnownNeuron; ManageNeuron : ManageNeuron; + UpdateCanisterSettings : UpdateCanisterSettings; + InstallCode : InstallCode; + StopOrStartCanister : StopOrStartCanister; CreateServiceNervousSystem : CreateServiceNervousSystem; ExecuteNnsFunction : ExecuteNnsFunction; RewardNodeProvider : RewardNodeProvider; @@ -10,22 +16,56 @@ type Action = variant { SetDefaultFollowees : SetDefaultFollowees; RewardNodeProviders : RewardNodeProviders; ManageNetworkEconomics : NetworkEconomics; - ApproveGenesisKyc : ApproveGenesisKyc; + ApproveGenesisKyc : Principals; AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; Motion : Motion; }; -type AddHotKey = record { new_hot_key : opt principal }; -type AddOrRemoveNodeProvider = record { change : opt Change }; -type Amount = record { e8s : nat64 }; -type ApproveGenesisKyc = record { principals : vec principal }; -type Ballot = record { vote : int32; voting_power : nat64 }; -type BallotInfo = record { vote : int32; proposal_id : opt NeuronId }; + +type AddHotKey = record { + new_hot_key : opt principal; +}; + +type AddOrRemoveNodeProvider = record { + change : opt Change; +}; + +type Amount = record { + e8s : nat64; +}; + +type ApproveGenesisKyc = record { + principals : vec principal; +}; + +type Ballot = record { + vote : int32; + voting_power : nat64; +}; + +type BallotInfo = record { + vote : int32; + proposal_id : opt ProposalId; +}; + type By = variant { NeuronIdOrSubaccount : record {}; MemoAndController : ClaimOrRefreshNeuronFromAccount; Memo : nat64; }; -type Canister = record { id : opt principal }; + +type Canister = record { + id : opt principal; +}; + +type CanisterSettings = record { + freezing_threshold : opt nat64; + controllers : opt Controllers; + log_visibility : opt int32; + wasm_memory_limit : opt nat64; + memory_allocation : opt nat64; + compute_allocation : opt nat64; +}; + type CanisterStatusResultV2 = record { status : opt int32; freezing_threshold : opt nat64; @@ -35,30 +75,38 @@ type CanisterStatusResultV2 = record { idle_cycles_burned_per_day : opt nat64; module_hash : blob; }; + type CanisterSummary = record { status : opt CanisterStatusResultV2; canister_id : opt principal; }; -type CfNeuron = record { - has_created_neuron_recipes : opt bool; - nns_neuron_id : nat64; - amount_icp_e8s : nat64; + +type Change = variant { + ToRemove : NodeProvider; + ToAdd : NodeProvider; }; -type CfParticipant = record { - hotkey_principal : text; - cf_neurons : vec CfNeuron; -}; -type Change = variant { ToRemove : NodeProvider; ToAdd : NodeProvider }; + type ChangeAutoStakeMaturity = record { requested_setting_for_auto_stake_maturity : bool; }; -type ClaimOrRefresh = record { by : opt By }; + +type ClaimOrRefresh = record { + by : opt By; +}; + type ClaimOrRefreshNeuronFromAccount = record { controller : opt principal; memo : nat64; }; -type ClaimOrRefreshNeuronFromAccountResponse = record { result : opt Result_1 }; -type ClaimOrRefreshResponse = record { refreshed_neuron_id : opt NeuronId }; + +type ClaimOrRefreshNeuronFromAccountResponse = record { + result : opt Result_1; +}; + +type ClaimOrRefreshResponse = record { + refreshed_neuron_id : opt NeuronId; +}; + type Command = variant { Spawn : Spawn; Split : Split; @@ -73,6 +121,7 @@ type Command = variant { MergeMaturity : MergeMaturity; Disburse : Disburse; }; + type Command_1 = variant { Error : GovernanceError; Spawn : SpawnResponse; @@ -88,6 +137,7 @@ type Command_1 = variant { MergeMaturity : MergeMaturityResponse; Disburse : DisburseResponse; }; + type Command_2 = variant { Spawn : NeuronId; Split : Split; @@ -99,18 +149,31 @@ type Command_2 = variant { MergeMaturity : MergeMaturity; Disburse : Disburse; }; + type Committed = record { total_direct_contribution_icp_e8s : opt nat64; total_neurons_fund_contribution_icp_e8s : opt nat64; sns_governance_canister_id : opt principal; }; + type Committed_1 = record { total_direct_participation_icp_e8s : opt nat64; total_neurons_fund_participation_icp_e8s : opt nat64; sns_governance_canister_id : opt principal; }; -type Configure = record { operation : opt Operation }; -type Countries = record { iso_codes : vec text }; + +type Configure = record { + operation : opt Operation; +}; + +type Controllers = record { + controllers : vec principal; +}; + +type Countries = record { + iso_codes : vec text; +}; + type CreateServiceNervousSystem = record { url : opt text; governance_parameters : opt GovernanceParameters; @@ -123,18 +186,33 @@ type CreateServiceNervousSystem = record { swap_parameters : opt SwapParameters; initial_token_distribution : opt InitialTokenDistribution; }; -type Decimal = record { human_readable : opt text }; + +type DateRangeFilter = record { + start_timestamp_seconds : opt nat64; + end_timestamp_seconds : opt nat64; +}; + +type Decimal = record { + human_readable : opt text; +}; + type DerivedProposalInformation = record { swap_background_information : opt SwapBackgroundInformation; }; + type DeveloperDistribution = record { developer_neurons : vec NeuronDistribution; }; + type Disburse = record { to_account : opt AccountIdentifier; amount : opt Amount; }; -type DisburseResponse = record { transfer_block_height : nat64 }; + +type DisburseResponse = record { + transfer_block_height : nat64; +}; + type DisburseToNeuron = record { dissolve_delay_seconds : nat64; kyc_verified : bool; @@ -142,23 +220,54 @@ type DisburseToNeuron = record { new_controller : opt principal; nonce : nat64; }; + type DissolveState = variant { DissolveDelaySeconds : nat64; WhenDissolvedTimestampSeconds : nat64; }; -type Duration = record { seconds : opt nat64 }; -type ExecuteNnsFunction = record { nns_function : int32; payload : blob }; -type Follow = record { topic : int32; followees : vec NeuronId }; -type Followees = record { followees : vec NeuronId }; -type Followers = record { followers : vec NeuronId }; -type FollowersMap = record { followers_map : vec record { nat64; Followers } }; -type GetNeuronsFundAuditInfoRequest = record { nns_proposal_id : opt NeuronId }; -type GetNeuronsFundAuditInfoResponse = record { result : opt Result_6 }; -type GlobalTimeOfDay = record { seconds_after_utc_midnight : opt nat64 }; + +type Duration = record { + seconds : opt nat64; +}; + +type ExecuteNnsFunction = record { + nns_function : int32; + payload : blob; +}; + +type Follow = record { + topic : int32; + followees : vec NeuronId; +}; + +type Followees = record { + followees : vec NeuronId; +}; + +type Followers = record { + followers : vec NeuronId; +}; + +type FollowersMap = record { + followers_map : vec record { nat64; Followers }; +}; + +type GetNeuronsFundAuditInfoRequest = record { + nns_proposal_id : opt ProposalId; +}; + +type GetNeuronsFundAuditInfoResponse = record { + result : opt Result_6; +}; + +type GlobalTimeOfDay = record { + seconds_after_utc_midnight : opt nat64; +}; + type Governance = record { default_followees : vec record { int32; Followees }; making_sns_proposal : opt MakingSnsProposal; - most_recent_monthly_node_provider_rewards : opt MostRecentMonthlyNodeProviderRewards; + most_recent_monthly_node_provider_rewards : opt MonthlyNodeProviderRewards; maturity_modulation_last_updated_at_timestamp_seconds : opt nat64; wait_for_quiet_threshold_seconds : nat64; metrics : opt GovernanceCachedMetrics; @@ -179,6 +288,7 @@ type Governance = record { neurons : vec record { nat64; Neuron }; genesis_timestamp_seconds : nat64; }; + type GovernanceCachedMetrics = record { total_maturity_e8s_equivalent : nat64; not_dissolving_neurons_e8s_buckets : vec record { nat64; float64 }; @@ -201,11 +311,13 @@ type GovernanceCachedMetrics = record { not_dissolving_neurons_count : nat64; total_locked_e8s : nat64; neurons_fund_total_active_neurons : nat64; + total_voting_power_non_self_authenticating_controller : opt nat64; total_staked_maturity_e8s_equivalent : nat64; not_dissolving_neurons_e8s_buckets_ect : vec record { nat64; float64 }; total_staked_e8s_ect : nat64; not_dissolving_neurons_staked_maturity_e8s_equivalent_sum : nat64; dissolved_neurons_e8s : nat64; + total_staked_e8s_non_self_authenticating_controller : opt nat64; dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; neurons_with_less_than_6_months_dissolve_delay_e8s : nat64; not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets : vec record { @@ -214,15 +326,22 @@ type GovernanceCachedMetrics = record { }; dissolving_neurons_count_buckets : vec record { nat64; nat64 }; dissolving_neurons_e8s_buckets_ect : vec record { nat64; float64 }; + non_self_authenticating_controller_neuron_subset_metrics : opt NeuronSubsetMetrics; dissolving_neurons_count : nat64; dissolving_neurons_e8s_buckets : vec record { nat64; float64 }; total_staked_maturity_e8s_equivalent_seed : nat64; community_fund_total_staked_e8s : nat64; not_dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; + public_neuron_subset_metrics : opt NeuronSubsetMetrics; timestamp_seconds : nat64; seed_neuron_count : nat64; }; -type GovernanceError = record { error_message : text; error_type : int32 }; + +type GovernanceError = record { + error_message : text; + error_type : int32; +}; + type GovernanceParameters = record { neuron_maximum_dissolve_delay_bonus : opt Percentage; neuron_maximum_age_for_age_bonus : opt Duration; @@ -235,90 +354,194 @@ type GovernanceParameters = record { proposal_rejection_fee : opt Tokens; voting_reward_parameters : opt VotingRewardParameters; }; + type IdealMatchedParticipationFunction = record { serialized_representation : opt text; }; -type Image = record { base64_encoding : opt text }; + +type Image = record { + base64_encoding : opt text; +}; + type IncreaseDissolveDelay = record { additional_dissolve_delay_seconds : nat32; }; + type InitialTokenDistribution = record { treasury_distribution : opt SwapDistribution; developer_distribution : opt DeveloperDistribution; swap_distribution : opt SwapDistribution; }; + +type InstallCode = record { + skip_stopping_before_installing : opt bool; + wasm_module_hash : opt blob; + canister_id : opt principal; + arg_hash : opt blob; + install_mode : opt int32; +}; + +type InstallCodeRequest = record { + arg : opt blob; + wasm_module : opt blob; + skip_stopping_before_installing : opt bool; + canister_id : opt principal; + install_mode : opt int32; +}; + type KnownNeuron = record { id : opt NeuronId; known_neuron_data : opt KnownNeuronData; }; -type KnownNeuronData = record { name : text; description : opt text }; + +type KnownNeuronData = record { + name : text; + description : opt text; +}; + type LedgerParameters = record { transaction_fee : opt Tokens; token_symbol : opt text; token_logo : opt Image; token_name : opt text; }; -type ListKnownNeuronsResponse = record { known_neurons : vec KnownNeuron }; + +type ListKnownNeuronsResponse = record { + known_neurons : vec KnownNeuron; +}; + type ListNeurons = record { + include_public_neurons_in_full_neurons : opt bool; neuron_ids : vec nat64; + include_empty_neurons_readable_by_caller : opt bool; include_neurons_readable_by_caller : bool; }; + type ListNeuronsResponse = record { neuron_infos : vec record { nat64; NeuronInfo }; full_neurons : vec Neuron; }; -type ListNodeProvidersResponse = record { node_providers : vec NodeProvider }; + +type ListNodeProviderRewardsRequest = record { + date_filter : opt DateRangeFilter; +}; + +type ListNodeProviderRewardsResponse = record { + rewards : vec MonthlyNodeProviderRewards; +}; + +type ListNodeProvidersResponse = record { + node_providers : vec NodeProvider; +}; + type ListProposalInfo = record { include_reward_status : vec int32; omit_large_fields : opt bool; - before_proposal : opt NeuronId; + before_proposal : opt ProposalId; limit : nat32; exclude_topic : vec int32; include_all_manage_neuron_proposals : opt bool; include_status : vec int32; }; -type ListProposalInfoResponse = record { proposal_info : vec ProposalInfo }; + +type ListProposalInfoResponse = record { + proposal_info : vec ProposalInfo; +}; + +type MakeProposalRequest = record { + url : text; + title : opt text; + action : opt ProposalActionRequest; + summary : text; +}; + type MakeProposalResponse = record { message : opt text; - proposal_id : opt NeuronId; + proposal_id : opt ProposalId; }; + type MakingSnsProposal = record { proposal : opt Proposal; caller : opt principal; proposer_id : opt NeuronId; }; + type ManageNeuron = record { id : opt NeuronId; command : opt Command; neuron_id_or_subaccount : opt NeuronIdOrSubaccount; }; -type ManageNeuronResponse = record { command : opt Command_1 }; -type Merge = record { source_neuron_id : opt NeuronId }; -type MergeMaturity = record { percentage_to_merge : nat32 }; + +type ManageNeuronCommandRequest = variant { + Spawn : Spawn; + Split : Split; + Follow : Follow; + ClaimOrRefresh : ClaimOrRefresh; + Configure : Configure; + RegisterVote : RegisterVote; + Merge : Merge; + DisburseToNeuron : DisburseToNeuron; + MakeProposal : MakeProposalRequest; + StakeMaturity : StakeMaturity; + MergeMaturity : MergeMaturity; + Disburse : Disburse; +}; + +type ManageNeuronRequest = record { + id : opt NeuronId; + command : opt ManageNeuronCommandRequest; + neuron_id_or_subaccount : opt NeuronIdOrSubaccount; +}; + +type ManageNeuronResponse = record { + command : opt Command_1; +}; + +type Merge = record { + source_neuron_id : opt NeuronId; +}; + +type MergeMaturity = record { + percentage_to_merge : nat32; +}; + type MergeMaturityResponse = record { merged_maturity_e8s : nat64; new_stake_e8s : nat64; }; + type MergeResponse = record { target_neuron : opt Neuron; source_neuron : opt Neuron; target_neuron_info : opt NeuronInfo; source_neuron_info : opt NeuronInfo; }; + type Migration = record { status : opt int32; failure_reason : opt text; progress : opt Progress; }; + type Migrations = record { neuron_indexes_migration : opt Migration; copy_inactive_neurons_to_stable_memory_migration : opt Migration; }; -type MostRecentMonthlyNodeProviderRewards = record { + +type MonthlyNodeProviderRewards = record { + minimum_xdr_permyriad_per_icp : opt nat64; + registry_version : opt nat64; + node_providers : vec NodeProvider; timestamp : nat64; rewards : vec RewardNodeProvider; + xdr_conversion_rate : opt XdrConversionRate; + maximum_node_provider_rewards_e8s : opt nat64; }; -type Motion = record { motion_text : text }; + +type Motion = record { + motion_text : text; +}; + type NetworkEconomics = record { neuron_minimum_stake_e8s : nat64; max_proposals_to_keep_per_topic : nat32; @@ -330,6 +553,7 @@ type NetworkEconomics = record { maximum_node_provider_rewards_e8s : nat64; neurons_fund_economics : opt NeuronsFundEconomics; }; + type Neuron = record { id : opt NeuronId; staked_maturity_e8s_equivalent : opt nat64; @@ -349,18 +573,22 @@ type Neuron = record { dissolve_state : opt DissolveState; followees : vec record { int32; Followees }; neuron_fees_e8s : nat64; + visibility : opt int32; transfer : opt NeuronStakeTransfer; known_neuron_data : opt KnownNeuronData; spawn_at_timestamp_seconds : opt nat64; }; + type NeuronBasketConstructionParameters = record { dissolve_delay_interval : opt Duration; count : opt nat64; }; + type NeuronBasketConstructionParameters_1 = record { dissolve_delay_interval_seconds : nat64; count : nat64; }; + type NeuronDistribution = record { controller : opt principal; dissolve_delay : opt Duration; @@ -368,12 +596,25 @@ type NeuronDistribution = record { vesting_period : opt Duration; stake : opt Tokens; }; -type NeuronId = record { id : nat64 }; -type NeuronIdOrSubaccount = variant { Subaccount : blob; NeuronId : NeuronId }; + +type NeuronId = record { + id : nat64; +}; + +type ProposalId = record { + id : nat64; +}; + +type NeuronIdOrSubaccount = variant { + Subaccount : blob; + NeuronId : NeuronId; +}; + type NeuronInFlightCommand = record { command : opt Command_2; timestamp : nat64; }; + type NeuronInfo = record { dissolve_delay_seconds : nat64; recent_ballots : vec BallotInfo; @@ -383,10 +624,12 @@ type NeuronInfo = record { stake_e8s : nat64; joined_community_fund_timestamp_seconds : opt nat64; retrieved_at_timestamp_seconds : nat64; + visibility : opt int32; known_neuron_data : opt KnownNeuronData; voting_power : nat64; age_seconds : nat64; }; + type NeuronStakeTransfer = record { to_subaccount : blob; neuron_stake_e8s : nat64; @@ -396,40 +639,62 @@ type NeuronStakeTransfer = record { transfer_timestamp : nat64; block_height : nat64; }; + +type NeuronSubsetMetrics = record { + total_maturity_e8s_equivalent : opt nat64; + maturity_e8s_equivalent_buckets : vec record { nat64; nat64 }; + voting_power_buckets : vec record { nat64; nat64 }; + total_staked_e8s : opt nat64; + count : opt nat64; + total_staked_maturity_e8s_equivalent : opt nat64; + staked_maturity_e8s_equivalent_buckets : vec record { nat64; nat64 }; + staked_e8s_buckets : vec record { nat64; nat64 }; + total_voting_power : opt nat64; + count_buckets : vec record { nat64; nat64 }; +}; + type NeuronsFundAuditInfo = record { final_neurons_fund_participation : opt NeuronsFundParticipation; initial_neurons_fund_participation : opt NeuronsFundParticipation; neurons_fund_refunds : opt NeuronsFundSnapshot; }; + type NeuronsFundData = record { final_neurons_fund_participation : opt NeuronsFundParticipation; initial_neurons_fund_participation : opt NeuronsFundParticipation; neurons_fund_refunds : opt NeuronsFundSnapshot; }; + type NeuronsFundEconomics = record { maximum_icp_xdr_rate : opt Percentage; neurons_fund_matched_funding_curve_coefficients : opt NeuronsFundMatchedFundingCurveCoefficients; max_theoretical_neurons_fund_participation_amount_xdr : opt Decimal; minimum_icp_xdr_rate : opt Percentage; }; + type NeuronsFundMatchedFundingCurveCoefficients = record { contribution_threshold_xdr : opt Decimal; one_third_participation_milestone_xdr : opt Decimal; full_participation_milestone_xdr : opt Decimal; }; + type NeuronsFundNeuron = record { - hotkey_principal : opt text; + controller : opt principal; + hotkeys : opt Principals; is_capped : opt bool; nns_neuron_id : opt nat64; amount_icp_e8s : opt nat64; }; + type NeuronsFundNeuronPortion = record { - hotkey_principal : opt principal; + controller : opt principal; + hotkeys : vec principal; is_capped : opt bool; maturity_equivalent_icp_e8s : opt nat64; nns_neuron_id : opt NeuronId; amount_icp_e8s : opt nat64; }; + type NeuronsFundParticipation = record { total_maturity_equivalent_icp_e8s : opt nat64; intended_neurons_fund_participation_icp_e8s : opt nat64; @@ -440,20 +705,30 @@ type NeuronsFundParticipation = record { ideal_matched_participation_function : opt IdealMatchedParticipationFunction; allocated_neurons_fund_participation_icp_e8s : opt nat64; }; + type NeuronsFundSnapshot = record { neurons_fund_neuron_portions : vec NeuronsFundNeuronPortion; }; + type NodeProvider = record { id : opt principal; reward_account : opt AccountIdentifier; }; -type Ok = record { neurons_fund_audit_info : opt NeuronsFundAuditInfo }; -type Ok_1 = record { neurons_fund_neuron_portions : vec NeuronsFundNeuron }; + +type Ok = record { + neurons_fund_audit_info : opt NeuronsFundAuditInfo; +}; + +type Ok_1 = record { + neurons_fund_neuron_portions : vec NeuronsFundNeuron; +}; + type OpenSnsTokenSwap = record { community_fund_investment_e8s : opt nat64; target_swap_canister_id : opt principal; params : opt Params; }; + type Operation = variant { RemoveHotKey : RemoveHotKey; AddHotKey : AddHotKey; @@ -461,10 +736,12 @@ type Operation = variant { StopDissolving : record {}; StartDissolving : record {}; IncreaseDissolveDelay : IncreaseDissolveDelay; + SetVisibility : SetVisibility; JoinCommunityFund : record {}; LeaveCommunityFund : record {}; SetDissolveTimestamp : SetDissolveTimestamp; }; + type Params = record { min_participant_icp_e8s : nat64; neuron_basket_construction_parameters : opt NeuronBasketConstructionParameters_1; @@ -478,18 +755,45 @@ type Params = record { min_icp_e8s : nat64; max_direct_participation_icp_e8s : opt nat64; }; -type Percentage = record { basis_points : opt nat64 }; -type Progress = variant { LastNeuronId : NeuronId }; + +type Percentage = record { + basis_points : opt nat64; +}; + +type Principals = record { + principals : vec principal; +}; + +type Progress = variant { + LastNeuronId : NeuronId; +}; + type Proposal = record { url : text; title : opt text; action : opt Action; summary : text; }; + +type ProposalActionRequest = variant { + RegisterKnownNeuron : KnownNeuron; + ManageNeuron : ManageNeuronRequest; + UpdateCanisterSettings : UpdateCanisterSettings; + InstallCode : InstallCodeRequest; + StopOrStartCanister : StopOrStartCanister; + CreateServiceNervousSystem : CreateServiceNervousSystem; + ExecuteNnsFunction : ExecuteNnsFunction; + RewardNodeProvider : RewardNodeProvider; + RewardNodeProviders : RewardNodeProviders; + ManageNetworkEconomics : NetworkEconomics; + ApproveGenesisKyc : Principals; + AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; + Motion : Motion; +}; + type ProposalData = record { - id : opt NeuronId; + id : opt ProposalId; failure_reason : opt GovernanceError; - cf_participants : vec CfParticipant; ballots : vec record { nat64; Ballot }; proposal_timestamp_seconds : nat64; reward_event_round : nat64; @@ -506,8 +810,9 @@ type ProposalData = record { executed_timestamp_seconds : nat64; original_total_community_fund_maturity_e8s_equivalent : opt nat64; }; + type ProposalInfo = record { - id : opt NeuronId; + id : opt ProposalId; status : int32; topic : int32; failure_reason : opt GovernanceError; @@ -525,29 +830,81 @@ type ProposalInfo = record { proposer : opt NeuronId; executed_timestamp_seconds : nat64; }; -type RegisterVote = record { vote : int32; proposal : opt NeuronId }; -type RemoveHotKey = record { hot_key_to_remove : opt principal }; + +type RegisterVote = record { + vote : int32; + proposal : opt ProposalId; +}; + +type RemoveHotKey = record { + hot_key_to_remove : opt principal; +}; + type RestoreAgingNeuronGroup = record { count : opt nat64; previous_total_stake_e8s : opt nat64; current_total_stake_e8s : opt nat64; group_type : int32; }; + type RestoreAgingSummary = record { groups : vec RestoreAgingNeuronGroup; timestamp_seconds : opt nat64; }; -type Result = variant { Ok; Err : GovernanceError }; -type Result_1 = variant { Error : GovernanceError; NeuronId : NeuronId }; -type Result_10 = variant { Ok : Ok_1; Err : GovernanceError }; -type Result_2 = variant { Ok : Neuron; Err : GovernanceError }; -type Result_3 = variant { Ok : GovernanceCachedMetrics; Err : GovernanceError }; -type Result_4 = variant { Ok : RewardNodeProviders; Err : GovernanceError }; -type Result_5 = variant { Ok : NeuronInfo; Err : GovernanceError }; -type Result_6 = variant { Ok : Ok; Err : GovernanceError }; -type Result_7 = variant { Ok : NodeProvider; Err : GovernanceError }; -type Result_8 = variant { Committed : Committed; Aborted : record {} }; -type Result_9 = variant { Committed : Committed_1; Aborted : record {} }; + +type Result = variant { + Ok; + Err : GovernanceError; +}; + +type Result_1 = variant { + Error : GovernanceError; + NeuronId : NeuronId; +}; + +type Result_10 = variant { + Ok : Ok_1; + Err : GovernanceError; +}; + +type Result_2 = variant { + Ok : Neuron; + Err : GovernanceError; +}; + +type Result_3 = variant { + Ok : GovernanceCachedMetrics; + Err : GovernanceError; +}; + +type Result_4 = variant { + Ok : MonthlyNodeProviderRewards; + Err : GovernanceError; +}; + +type Result_5 = variant { + Ok : NeuronInfo; + Err : GovernanceError; +}; + +type Result_6 = variant { + Ok : Ok; + Err : GovernanceError; +}; + +type Result_7 = variant { + Ok : NodeProvider; + Err : GovernanceError; +}; + +type Result_8 = variant { + Committed : Committed; + Aborted : record {} }; + +type Result_9 = variant { + Committed : Committed_1; + Aborted : record {} }; + type RewardEvent = record { rounds_since_last_distribution : opt nat64; day_after_genesis : nat64; @@ -555,53 +912,96 @@ type RewardEvent = record { total_available_e8s_equivalent : nat64; latest_round_available_e8s_equivalent : opt nat64; distributed_e8s_equivalent : nat64; - settled_proposals : vec NeuronId; + settled_proposals : vec ProposalId; }; + type RewardMode = variant { RewardToNeuron : RewardToNeuron; RewardToAccount : RewardToAccount; }; + type RewardNodeProvider = record { node_provider : opt NodeProvider; reward_mode : opt RewardMode; amount_e8s : nat64; }; + type RewardNodeProviders = record { use_registry_derived_rewards : opt bool; rewards : vec RewardNodeProvider; }; -type RewardToAccount = record { to_account : opt AccountIdentifier }; -type RewardToNeuron = record { dissolve_delay_seconds : nat64 }; + +type RewardToAccount = record { + to_account : opt AccountIdentifier; +}; + +type RewardToNeuron = record { + dissolve_delay_seconds : nat64; +}; + type SetDefaultFollowees = record { default_followees : vec record { int32; Followees }; }; -type SetDissolveTimestamp = record { dissolve_timestamp_seconds : nat64 }; -type SetOpenTimeWindowRequest = record { open_time_window : opt TimeWindow }; + +type SetDissolveTimestamp = record { + dissolve_timestamp_seconds : nat64; +}; + +type SetOpenTimeWindowRequest = record { + open_time_window : opt TimeWindow; +}; + type SetSnsTokenSwapOpenTimeWindow = record { request : opt SetOpenTimeWindowRequest; swap_canister_id : opt principal; }; + +type SetVisibility = record { + visibility : opt int32; +}; + type SettleCommunityFundParticipation = record { result : opt Result_8; open_sns_token_swap_proposal_id : opt nat64; }; + type SettleNeuronsFundParticipationRequest = record { result : opt Result_9; nns_proposal_id : opt nat64; }; -type SettleNeuronsFundParticipationResponse = record { result : opt Result_10 }; + +type SettleNeuronsFundParticipationResponse = record { + result : opt Result_10; +}; + type Spawn = record { percentage_to_spawn : opt nat32; new_controller : opt principal; nonce : opt nat64; }; -type SpawnResponse = record { created_neuron_id : opt NeuronId }; -type Split = record { amount_e8s : nat64 }; -type StakeMaturity = record { percentage_to_stake : opt nat32 }; + +type SpawnResponse = record { + created_neuron_id : opt NeuronId; +}; + +type Split = record { + amount_e8s : nat64; +}; + +type StakeMaturity = record { + percentage_to_stake : opt nat32; +}; + type StakeMaturityResponse = record { maturity_e8s : nat64; staked_maturity_e8s : nat64; }; + +type StopOrStartCanister = record { + action : opt int32; + canister_id : opt principal; +}; + type SwapBackgroundInformation = record { ledger_index_canister_summary : opt CanisterSummary; fallback_controller_principal_ids : vec principal; @@ -612,7 +1012,11 @@ type SwapBackgroundInformation = record { root_canister_summary : opt CanisterSummary; dapp_canister_summaries : vec CanisterSummary; }; -type SwapDistribution = record { total : opt Tokens }; + +type SwapDistribution = record { + total : opt Tokens; +}; + type SwapParameters = record { minimum_participants : opt nat64; neurons_fund_participation : opt bool; @@ -629,34 +1033,54 @@ type SwapParameters = record { neurons_fund_investment_icp : opt Tokens; restricted_countries : opt Countries; }; + type SwapParticipationLimits = record { min_participant_icp_e8s : opt nat64; max_participant_icp_e8s : opt nat64; min_direct_participation_icp_e8s : opt nat64; max_direct_participation_icp_e8s : opt nat64; }; + type Tally = record { no : nat64; yes : nat64; total : nat64; timestamp_seconds : nat64; }; + type TimeWindow = record { start_timestamp_seconds : nat64; end_timestamp_seconds : nat64; }; -type Tokens = record { e8s : opt nat64 }; -type UpdateNodeProvider = record { reward_account : opt AccountIdentifier }; + +type Tokens = record { + e8s : opt nat64; +}; + +type UpdateCanisterSettings = record { + canister_id : opt principal; + settings : opt CanisterSettings; +}; + +type UpdateNodeProvider = record { + reward_account : opt AccountIdentifier; +}; + type VotingRewardParameters = record { reward_rate_transition_duration : opt Duration; initial_reward_rate : opt Percentage; final_reward_rate : opt Percentage; }; -type WaitForQuietState = record { current_deadline_timestamp_seconds : nat64 }; + +type WaitForQuietState = record { + current_deadline_timestamp_seconds : nat64; +}; + type XdrConversionRate = record { xdr_permyriad_per_icp : opt nat64; timestamp_seconds : opt nat64; }; + service : (Governance) -> { claim_gtc_neurons : (principal, vec NeuronId) -> (Result); claim_or_refresh_neuron_from_account : (ClaimOrRefreshNeuronFromAccount) -> ( @@ -671,7 +1095,7 @@ service : (Governance) -> { get_metrics : () -> (Result_3) query; get_monthly_node_provider_rewards : () -> (Result_4); get_most_recent_monthly_node_provider_rewards : () -> ( - opt MostRecentMonthlyNodeProviderRewards, + opt MonthlyNodeProviderRewards, ) query; get_network_economics_parameters : () -> (NetworkEconomics) query; get_neuron_ids : () -> (vec nat64) query; @@ -688,16 +1112,19 @@ service : (Governance) -> { get_restore_aging_summary : () -> (RestoreAgingSummary) query; list_known_neurons : () -> (ListKnownNeuronsResponse) query; list_neurons : (ListNeurons) -> (ListNeuronsResponse) query; + list_node_provider_rewards : (ListNodeProviderRewardsRequest) -> ( + ListNodeProviderRewardsResponse, + ) query; list_node_providers : () -> (ListNodeProvidersResponse) query; list_proposals : (ListProposalInfo) -> (ListProposalInfoResponse) query; - manage_neuron : (ManageNeuron) -> (ManageNeuronResponse); + manage_neuron : (ManageNeuronRequest) -> (ManageNeuronResponse); settle_community_fund_participation : (SettleCommunityFundParticipation) -> ( Result, ); settle_neurons_fund_participation : ( SettleNeuronsFundParticipationRequest, ) -> (SettleNeuronsFundParticipationResponse); - simulate_manage_neuron : (ManageNeuron) -> (ManageNeuronResponse); + simulate_manage_neuron : (ManageNeuronRequest) -> (ManageNeuronResponse); transfer_gtc_neuron : (NeuronId, NeuronId) -> (Result); update_node_provider : (UpdateNodeProvider) -> (Result); -} \ No newline at end of file +} diff --git a/cli/src/declarations/governance.idl.js b/cli/src/declarations/governance.idl.js index ff79aab..eb67da2 100644 --- a/cli/src/declarations/governance.idl.js +++ b/cli/src/declarations/governance.idl.js @@ -1,4 +1,5 @@ export const idlFactory = ({IDL}) => { + const ManageNeuronRequest = IDL.Rec(); const Proposal = IDL.Rec(); const NeuronId = IDL.Record({id: IDL.Nat64}); const Followees = IDL.Record({followees: IDL.Vec(NeuronId)}); @@ -40,6 +41,7 @@ export const idlFactory = ({IDL}) => { const IncreaseDissolveDelay = IDL.Record({ additional_dissolve_delay_seconds: IDL.Nat32 }); + const SetVisibility = IDL.Record({visibility: IDL.Opt(IDL.Int32)}); const SetDissolveTimestamp = IDL.Record({ dissolve_timestamp_seconds: IDL.Nat64 }); @@ -50,14 +52,16 @@ export const idlFactory = ({IDL}) => { StopDissolving: IDL.Record({}), StartDissolving: IDL.Record({}), IncreaseDissolveDelay: IncreaseDissolveDelay, + SetVisibility: SetVisibility, JoinCommunityFund: IDL.Record({}), LeaveCommunityFund: IDL.Record({}), SetDissolveTimestamp: SetDissolveTimestamp }); const Configure = IDL.Record({operation: IDL.Opt(Operation)}); + const ProposalId = IDL.Record({id: IDL.Nat64}); const RegisterVote = IDL.Record({ vote: IDL.Int32, - proposal: IDL.Opt(NeuronId) + proposal: IDL.Opt(ProposalId) }); const Merge = IDL.Record({source_neuron_id: IDL.Opt(NeuronId)}); const DisburseToNeuron = IDL.Record({ @@ -100,6 +104,30 @@ export const idlFactory = ({IDL}) => { command: IDL.Opt(Command), neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) }); + const Controllers = IDL.Record({controllers: IDL.Vec(IDL.Principal)}); + const CanisterSettings = IDL.Record({ + freezing_threshold: IDL.Opt(IDL.Nat64), + controllers: IDL.Opt(Controllers), + log_visibility: IDL.Opt(IDL.Int32), + wasm_memory_limit: IDL.Opt(IDL.Nat64), + memory_allocation: IDL.Opt(IDL.Nat64), + compute_allocation: IDL.Opt(IDL.Nat64) + }); + const UpdateCanisterSettings = IDL.Record({ + canister_id: IDL.Opt(IDL.Principal), + settings: IDL.Opt(CanisterSettings) + }); + const InstallCode = IDL.Record({ + skip_stopping_before_installing: IDL.Opt(IDL.Bool), + wasm_module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), + canister_id: IDL.Opt(IDL.Principal), + arg_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), + install_mode: IDL.Opt(IDL.Int32) + }); + const StopOrStartCanister = IDL.Record({ + action: IDL.Opt(IDL.Int32), + canister_id: IDL.Opt(IDL.Principal) + }); const Percentage = IDL.Record({basis_points: IDL.Opt(IDL.Nat64)}); const Duration = IDL.Record({seconds: IDL.Opt(IDL.Nat64)}); const Tokens = IDL.Record({e8s: IDL.Opt(IDL.Nat64)}); @@ -266,9 +294,7 @@ export const idlFactory = ({IDL}) => { maximum_node_provider_rewards_e8s: IDL.Nat64, neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) }); - const ApproveGenesisKyc = IDL.Record({ - principals: IDL.Vec(IDL.Principal) - }); + const Principals = IDL.Record({principals: IDL.Vec(IDL.Principal)}); const Change = IDL.Variant({ ToRemove: NodeProvider, ToAdd: NodeProvider @@ -278,6 +304,9 @@ export const idlFactory = ({IDL}) => { const Action = IDL.Variant({ RegisterKnownNeuron: KnownNeuron, ManageNeuron: ManageNeuron, + UpdateCanisterSettings: UpdateCanisterSettings, + InstallCode: InstallCode, + StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, RewardNodeProvider: RewardNodeProvider, @@ -286,7 +315,7 @@ export const idlFactory = ({IDL}) => { SetDefaultFollowees: SetDefaultFollowees, RewardNodeProviders: RewardNodeProviders, ManageNetworkEconomics: NetworkEconomics, - ApproveGenesisKyc: ApproveGenesisKyc, + ApproveGenesisKyc: Principals, AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, Motion: Motion }); @@ -303,9 +332,30 @@ export const idlFactory = ({IDL}) => { caller: IDL.Opt(IDL.Principal), proposer_id: IDL.Opt(NeuronId) }); - const MostRecentMonthlyNodeProviderRewards = IDL.Record({ + const XdrConversionRate = IDL.Record({ + xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const MonthlyNodeProviderRewards = IDL.Record({ + minimum_xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + registry_version: IDL.Opt(IDL.Nat64), + node_providers: IDL.Vec(NodeProvider), timestamp: IDL.Nat64, - rewards: IDL.Vec(RewardNodeProvider) + rewards: IDL.Vec(RewardNodeProvider), + xdr_conversion_rate: IDL.Opt(XdrConversionRate), + maximum_node_provider_rewards_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronSubsetMetrics = IDL.Record({ + total_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + maturity_e8s_equivalent_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + total_staked_e8s: IDL.Opt(IDL.Nat64), + count: IDL.Opt(IDL.Nat64), + total_staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + staked_maturity_e8s_equivalent_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + staked_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + total_voting_power: IDL.Opt(IDL.Nat64), + count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)) }); const GovernanceCachedMetrics = IDL.Record({ total_maturity_e8s_equivalent: IDL.Nat64, @@ -328,11 +378,13 @@ export const idlFactory = ({IDL}) => { not_dissolving_neurons_count: IDL.Nat64, total_locked_e8s: IDL.Nat64, neurons_fund_total_active_neurons: IDL.Nat64, + total_voting_power_non_self_authenticating_controller: IDL.Opt(IDL.Nat64), total_staked_maturity_e8s_equivalent: IDL.Nat64, not_dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), total_staked_e8s_ect: IDL.Nat64, not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, dissolved_neurons_e8s: IDL.Nat64, + total_staked_e8s_non_self_authenticating_controller: IDL.Opt(IDL.Nat64), dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), neurons_with_less_than_6_months_dissolve_delay_e8s: IDL.Nat64, not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( @@ -340,11 +392,13 @@ export const idlFactory = ({IDL}) => { ), dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + non_self_authenticating_controller_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), dissolving_neurons_count: IDL.Nat64, dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), total_staked_maturity_e8s_equivalent_seed: IDL.Nat64, community_fund_total_staked_e8s: IDL.Nat64, not_dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + public_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), timestamp_seconds: IDL.Nat64, seed_neuron_count: IDL.Nat64 }); @@ -365,7 +419,7 @@ export const idlFactory = ({IDL}) => { total_available_e8s_equivalent: IDL.Nat64, latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), distributed_e8s_equivalent: IDL.Nat64, - settled_proposals: IDL.Vec(NeuronId) + settled_proposals: IDL.Vec(ProposalId) }); const NeuronStakeTransfer = IDL.Record({ to_subaccount: IDL.Vec(IDL.Nat8), @@ -394,15 +448,6 @@ export const idlFactory = ({IDL}) => { error_message: IDL.Text, error_type: IDL.Int32 }); - const CfNeuron = IDL.Record({ - has_created_neuron_recipes: IDL.Opt(IDL.Bool), - nns_neuron_id: IDL.Nat64, - amount_icp_e8s: IDL.Nat64 - }); - const CfParticipant = IDL.Record({ - hotkey_principal: IDL.Text, - cf_neurons: IDL.Vec(CfNeuron) - }); const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); const SwapParticipationLimits = IDL.Record({ min_participant_icp_e8s: IDL.Opt(IDL.Nat64), @@ -411,7 +456,8 @@ export const idlFactory = ({IDL}) => { max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) }); const NeuronsFundNeuronPortion = IDL.Record({ - hotkey_principal: IDL.Opt(IDL.Principal), + controller: IDL.Opt(IDL.Principal), + hotkeys: IDL.Vec(IDL.Principal), is_capped: IDL.Opt(IDL.Bool), maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), nns_neuron_id: IDL.Opt(NeuronId), @@ -474,9 +520,8 @@ export const idlFactory = ({IDL}) => { current_deadline_timestamp_seconds: IDL.Nat64 }); const ProposalData = IDL.Record({ - id: IDL.Opt(NeuronId), + id: IDL.Opt(ProposalId), failure_reason: IDL.Opt(GovernanceError), - cf_participants: IDL.Vec(CfParticipant), ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), proposal_timestamp_seconds: IDL.Nat64, reward_event_round: IDL.Nat64, @@ -493,10 +538,6 @@ export const idlFactory = ({IDL}) => { executed_timestamp_seconds: IDL.Nat64, original_total_community_fund_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64) }); - const XdrConversionRate = IDL.Record({ - xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), - timestamp_seconds: IDL.Opt(IDL.Nat64) - }); const Command_2 = IDL.Variant({ Spawn: NeuronId, Split: Split, @@ -514,7 +555,7 @@ export const idlFactory = ({IDL}) => { }); const BallotInfo = IDL.Record({ vote: IDL.Int32, - proposal_id: IDL.Opt(NeuronId) + proposal_id: IDL.Opt(ProposalId) }); const DissolveState = IDL.Variant({ DissolveDelaySeconds: IDL.Nat64, @@ -539,6 +580,7 @@ export const idlFactory = ({IDL}) => { dissolve_state: IDL.Opt(DissolveState), followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), neuron_fees_e8s: IDL.Nat64, + visibility: IDL.Opt(IDL.Int32), transfer: IDL.Opt(NeuronStakeTransfer), known_neuron_data: IDL.Opt(KnownNeuronData), spawn_at_timestamp_seconds: IDL.Opt(IDL.Nat64) @@ -546,7 +588,7 @@ export const idlFactory = ({IDL}) => { const Governance = IDL.Record({ default_followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), making_sns_proposal: IDL.Opt(MakingSnsProposal), - most_recent_monthly_node_provider_rewards: IDL.Opt(MostRecentMonthlyNodeProviderRewards), + most_recent_monthly_node_provider_rewards: IDL.Opt(MonthlyNodeProviderRewards), maturity_modulation_last_updated_at_timestamp_seconds: IDL.Opt(IDL.Nat64), wait_for_quiet_threshold_seconds: IDL.Nat64, metrics: IDL.Opt(GovernanceCachedMetrics), @@ -581,7 +623,7 @@ export const idlFactory = ({IDL}) => { Err: GovernanceError }); const Result_4 = IDL.Variant({ - Ok: RewardNodeProviders, + Ok: MonthlyNodeProviderRewards, Err: GovernanceError }); const NeuronInfo = IDL.Record({ @@ -593,13 +635,14 @@ export const idlFactory = ({IDL}) => { stake_e8s: IDL.Nat64, joined_community_fund_timestamp_seconds: IDL.Opt(IDL.Nat64), retrieved_at_timestamp_seconds: IDL.Nat64, + visibility: IDL.Opt(IDL.Int32), known_neuron_data: IDL.Opt(KnownNeuronData), voting_power: IDL.Nat64, age_seconds: IDL.Nat64 }); const Result_5 = IDL.Variant({Ok: NeuronInfo, Err: GovernanceError}); const GetNeuronsFundAuditInfoRequest = IDL.Record({ - nns_proposal_id: IDL.Opt(NeuronId) + nns_proposal_id: IDL.Opt(ProposalId) }); const NeuronsFundAuditInfo = IDL.Record({ final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), @@ -618,7 +661,7 @@ export const idlFactory = ({IDL}) => { Err: GovernanceError }); const ProposalInfo = IDL.Record({ - id: IDL.Opt(NeuronId), + id: IDL.Opt(ProposalId), status: IDL.Int32, topic: IDL.Int32, failure_reason: IDL.Opt(GovernanceError), @@ -640,20 +683,32 @@ export const idlFactory = ({IDL}) => { known_neurons: IDL.Vec(KnownNeuron) }); const ListNeurons = IDL.Record({ + include_public_neurons_in_full_neurons: IDL.Opt(IDL.Bool), neuron_ids: IDL.Vec(IDL.Nat64), + include_empty_neurons_readable_by_caller: IDL.Opt(IDL.Bool), include_neurons_readable_by_caller: IDL.Bool }); const ListNeuronsResponse = IDL.Record({ neuron_infos: IDL.Vec(IDL.Tuple(IDL.Nat64, NeuronInfo)), full_neurons: IDL.Vec(Neuron) }); + const DateRangeFilter = IDL.Record({ + start_timestamp_seconds: IDL.Opt(IDL.Nat64), + end_timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const ListNodeProviderRewardsRequest = IDL.Record({ + date_filter: IDL.Opt(DateRangeFilter) + }); + const ListNodeProviderRewardsResponse = IDL.Record({ + rewards: IDL.Vec(MonthlyNodeProviderRewards) + }); const ListNodeProvidersResponse = IDL.Record({ node_providers: IDL.Vec(NodeProvider) }); const ListProposalInfo = IDL.Record({ include_reward_status: IDL.Vec(IDL.Int32), omit_large_fields: IDL.Opt(IDL.Bool), - before_proposal: IDL.Opt(NeuronId), + before_proposal: IDL.Opt(ProposalId), limit: IDL.Nat32, exclude_topic: IDL.Vec(IDL.Int32), include_all_manage_neuron_proposals: IDL.Opt(IDL.Bool), @@ -662,6 +717,55 @@ export const idlFactory = ({IDL}) => { const ListProposalInfoResponse = IDL.Record({ proposal_info: IDL.Vec(ProposalInfo) }); + const InstallCodeRequest = IDL.Record({ + arg: IDL.Opt(IDL.Vec(IDL.Nat8)), + wasm_module: IDL.Opt(IDL.Vec(IDL.Nat8)), + skip_stopping_before_installing: IDL.Opt(IDL.Bool), + canister_id: IDL.Opt(IDL.Principal), + install_mode: IDL.Opt(IDL.Int32) + }); + const ProposalActionRequest = IDL.Variant({ + RegisterKnownNeuron: KnownNeuron, + ManageNeuron: ManageNeuronRequest, + UpdateCanisterSettings: UpdateCanisterSettings, + InstallCode: InstallCodeRequest, + StopOrStartCanister: StopOrStartCanister, + CreateServiceNervousSystem: CreateServiceNervousSystem, + ExecuteNnsFunction: ExecuteNnsFunction, + RewardNodeProvider: RewardNodeProvider, + RewardNodeProviders: RewardNodeProviders, + ManageNetworkEconomics: NetworkEconomics, + ApproveGenesisKyc: Principals, + AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, + Motion: Motion + }); + const MakeProposalRequest = IDL.Record({ + url: IDL.Text, + title: IDL.Opt(IDL.Text), + action: IDL.Opt(ProposalActionRequest), + summary: IDL.Text + }); + const ManageNeuronCommandRequest = IDL.Variant({ + Spawn: Spawn, + Split: Split, + Follow: Follow, + ClaimOrRefresh: ClaimOrRefresh, + Configure: Configure, + RegisterVote: RegisterVote, + Merge: Merge, + DisburseToNeuron: DisburseToNeuron, + MakeProposal: MakeProposalRequest, + StakeMaturity: StakeMaturity, + MergeMaturity: MergeMaturity, + Disburse: Disburse + }); + ManageNeuronRequest.fill( + IDL.Record({ + id: IDL.Opt(NeuronId), + command: IDL.Opt(ManageNeuronCommandRequest), + neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) + }) + ); const SpawnResponse = IDL.Record({created_neuron_id: IDL.Opt(NeuronId)}); const ClaimOrRefreshResponse = IDL.Record({ refreshed_neuron_id: IDL.Opt(NeuronId) @@ -674,7 +778,7 @@ export const idlFactory = ({IDL}) => { }); const MakeProposalResponse = IDL.Record({ message: IDL.Opt(IDL.Text), - proposal_id: IDL.Opt(NeuronId) + proposal_id: IDL.Opt(ProposalId) }); const StakeMaturityResponse = IDL.Record({ maturity_e8s: IDL.Nat64, @@ -728,7 +832,8 @@ export const idlFactory = ({IDL}) => { nns_proposal_id: IDL.Opt(IDL.Nat64) }); const NeuronsFundNeuron = IDL.Record({ - hotkey_principal: IDL.Opt(IDL.Text), + controller: IDL.Opt(IDL.Principal), + hotkeys: IDL.Opt(Principals), is_capped: IDL.Opt(IDL.Bool), nns_neuron_id: IDL.Opt(IDL.Nat64), amount_icp_e8s: IDL.Opt(IDL.Nat64) @@ -758,7 +863,7 @@ export const idlFactory = ({IDL}) => { get_monthly_node_provider_rewards: IDL.Func([], [Result_4], []), get_most_recent_monthly_node_provider_rewards: IDL.Func( [], - [IDL.Opt(MostRecentMonthlyNodeProviderRewards)], + [IDL.Opt(MonthlyNodeProviderRewards)], ['query'] ), get_network_economics_parameters: IDL.Func([], [NetworkEconomics], ['query']), @@ -776,16 +881,21 @@ export const idlFactory = ({IDL}) => { get_restore_aging_summary: IDL.Func([], [RestoreAgingSummary], ['query']), list_known_neurons: IDL.Func([], [ListKnownNeuronsResponse], ['query']), list_neurons: IDL.Func([ListNeurons], [ListNeuronsResponse], ['query']), + list_node_provider_rewards: IDL.Func( + [ListNodeProviderRewardsRequest], + [ListNodeProviderRewardsResponse], + ['query'] + ), list_node_providers: IDL.Func([], [ListNodeProvidersResponse], ['query']), list_proposals: IDL.Func([ListProposalInfo], [ListProposalInfoResponse], ['query']), - manage_neuron: IDL.Func([ManageNeuron], [ManageNeuronResponse], []), + manage_neuron: IDL.Func([ManageNeuronRequest], [ManageNeuronResponse], []), settle_community_fund_participation: IDL.Func([SettleCommunityFundParticipation], [Result], []), settle_neurons_fund_participation: IDL.Func( [SettleNeuronsFundParticipationRequest], [SettleNeuronsFundParticipationResponse], [] ), - simulate_manage_neuron: IDL.Func([ManageNeuron], [ManageNeuronResponse], []), + simulate_manage_neuron: IDL.Func([ManageNeuronRequest], [ManageNeuronResponse], []), transfer_gtc_neuron: IDL.Func([NeuronId, NeuronId], [Result], []), update_node_provider: IDL.Func([UpdateNodeProvider], [Result], []) }); @@ -832,6 +942,7 @@ export const init = ({IDL}) => { const IncreaseDissolveDelay = IDL.Record({ additional_dissolve_delay_seconds: IDL.Nat32 }); + const SetVisibility = IDL.Record({visibility: IDL.Opt(IDL.Int32)}); const SetDissolveTimestamp = IDL.Record({ dissolve_timestamp_seconds: IDL.Nat64 }); @@ -842,14 +953,16 @@ export const init = ({IDL}) => { StopDissolving: IDL.Record({}), StartDissolving: IDL.Record({}), IncreaseDissolveDelay: IncreaseDissolveDelay, + SetVisibility: SetVisibility, JoinCommunityFund: IDL.Record({}), LeaveCommunityFund: IDL.Record({}), SetDissolveTimestamp: SetDissolveTimestamp }); const Configure = IDL.Record({operation: IDL.Opt(Operation)}); + const ProposalId = IDL.Record({id: IDL.Nat64}); const RegisterVote = IDL.Record({ vote: IDL.Int32, - proposal: IDL.Opt(NeuronId) + proposal: IDL.Opt(ProposalId) }); const Merge = IDL.Record({source_neuron_id: IDL.Opt(NeuronId)}); const DisburseToNeuron = IDL.Record({ @@ -892,6 +1005,30 @@ export const init = ({IDL}) => { command: IDL.Opt(Command), neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) }); + const Controllers = IDL.Record({controllers: IDL.Vec(IDL.Principal)}); + const CanisterSettings = IDL.Record({ + freezing_threshold: IDL.Opt(IDL.Nat64), + controllers: IDL.Opt(Controllers), + log_visibility: IDL.Opt(IDL.Int32), + wasm_memory_limit: IDL.Opt(IDL.Nat64), + memory_allocation: IDL.Opt(IDL.Nat64), + compute_allocation: IDL.Opt(IDL.Nat64) + }); + const UpdateCanisterSettings = IDL.Record({ + canister_id: IDL.Opt(IDL.Principal), + settings: IDL.Opt(CanisterSettings) + }); + const InstallCode = IDL.Record({ + skip_stopping_before_installing: IDL.Opt(IDL.Bool), + wasm_module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), + canister_id: IDL.Opt(IDL.Principal), + arg_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), + install_mode: IDL.Opt(IDL.Int32) + }); + const StopOrStartCanister = IDL.Record({ + action: IDL.Opt(IDL.Int32), + canister_id: IDL.Opt(IDL.Principal) + }); const Percentage = IDL.Record({basis_points: IDL.Opt(IDL.Nat64)}); const Duration = IDL.Record({seconds: IDL.Opt(IDL.Nat64)}); const Tokens = IDL.Record({e8s: IDL.Opt(IDL.Nat64)}); @@ -1058,9 +1195,7 @@ export const init = ({IDL}) => { maximum_node_provider_rewards_e8s: IDL.Nat64, neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) }); - const ApproveGenesisKyc = IDL.Record({ - principals: IDL.Vec(IDL.Principal) - }); + const Principals = IDL.Record({principals: IDL.Vec(IDL.Principal)}); const Change = IDL.Variant({ ToRemove: NodeProvider, ToAdd: NodeProvider @@ -1070,6 +1205,9 @@ export const init = ({IDL}) => { const Action = IDL.Variant({ RegisterKnownNeuron: KnownNeuron, ManageNeuron: ManageNeuron, + UpdateCanisterSettings: UpdateCanisterSettings, + InstallCode: InstallCode, + StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, RewardNodeProvider: RewardNodeProvider, @@ -1078,7 +1216,7 @@ export const init = ({IDL}) => { SetDefaultFollowees: SetDefaultFollowees, RewardNodeProviders: RewardNodeProviders, ManageNetworkEconomics: NetworkEconomics, - ApproveGenesisKyc: ApproveGenesisKyc, + ApproveGenesisKyc: Principals, AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, Motion: Motion }); @@ -1095,9 +1233,30 @@ export const init = ({IDL}) => { caller: IDL.Opt(IDL.Principal), proposer_id: IDL.Opt(NeuronId) }); - const MostRecentMonthlyNodeProviderRewards = IDL.Record({ + const XdrConversionRate = IDL.Record({ + xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const MonthlyNodeProviderRewards = IDL.Record({ + minimum_xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + registry_version: IDL.Opt(IDL.Nat64), + node_providers: IDL.Vec(NodeProvider), timestamp: IDL.Nat64, - rewards: IDL.Vec(RewardNodeProvider) + rewards: IDL.Vec(RewardNodeProvider), + xdr_conversion_rate: IDL.Opt(XdrConversionRate), + maximum_node_provider_rewards_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronSubsetMetrics = IDL.Record({ + total_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + maturity_e8s_equivalent_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + total_staked_e8s: IDL.Opt(IDL.Nat64), + count: IDL.Opt(IDL.Nat64), + total_staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + staked_maturity_e8s_equivalent_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + staked_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + total_voting_power: IDL.Opt(IDL.Nat64), + count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)) }); const GovernanceCachedMetrics = IDL.Record({ total_maturity_e8s_equivalent: IDL.Nat64, @@ -1120,11 +1279,13 @@ export const init = ({IDL}) => { not_dissolving_neurons_count: IDL.Nat64, total_locked_e8s: IDL.Nat64, neurons_fund_total_active_neurons: IDL.Nat64, + total_voting_power_non_self_authenticating_controller: IDL.Opt(IDL.Nat64), total_staked_maturity_e8s_equivalent: IDL.Nat64, not_dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), total_staked_e8s_ect: IDL.Nat64, not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, dissolved_neurons_e8s: IDL.Nat64, + total_staked_e8s_non_self_authenticating_controller: IDL.Opt(IDL.Nat64), dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), neurons_with_less_than_6_months_dissolve_delay_e8s: IDL.Nat64, not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( @@ -1132,11 +1293,13 @@ export const init = ({IDL}) => { ), dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), dissolving_neurons_e8s_buckets_ect: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + non_self_authenticating_controller_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), dissolving_neurons_count: IDL.Nat64, dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), total_staked_maturity_e8s_equivalent_seed: IDL.Nat64, community_fund_total_staked_e8s: IDL.Nat64, not_dissolving_neurons_e8s_buckets_seed: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + public_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), timestamp_seconds: IDL.Nat64, seed_neuron_count: IDL.Nat64 }); @@ -1157,7 +1320,7 @@ export const init = ({IDL}) => { total_available_e8s_equivalent: IDL.Nat64, latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), distributed_e8s_equivalent: IDL.Nat64, - settled_proposals: IDL.Vec(NeuronId) + settled_proposals: IDL.Vec(ProposalId) }); const NeuronStakeTransfer = IDL.Record({ to_subaccount: IDL.Vec(IDL.Nat8), @@ -1186,15 +1349,6 @@ export const init = ({IDL}) => { error_message: IDL.Text, error_type: IDL.Int32 }); - const CfNeuron = IDL.Record({ - has_created_neuron_recipes: IDL.Opt(IDL.Bool), - nns_neuron_id: IDL.Nat64, - amount_icp_e8s: IDL.Nat64 - }); - const CfParticipant = IDL.Record({ - hotkey_principal: IDL.Text, - cf_neurons: IDL.Vec(CfNeuron) - }); const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); const SwapParticipationLimits = IDL.Record({ min_participant_icp_e8s: IDL.Opt(IDL.Nat64), @@ -1203,7 +1357,8 @@ export const init = ({IDL}) => { max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) }); const NeuronsFundNeuronPortion = IDL.Record({ - hotkey_principal: IDL.Opt(IDL.Principal), + controller: IDL.Opt(IDL.Principal), + hotkeys: IDL.Vec(IDL.Principal), is_capped: IDL.Opt(IDL.Bool), maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), nns_neuron_id: IDL.Opt(NeuronId), @@ -1266,9 +1421,8 @@ export const init = ({IDL}) => { current_deadline_timestamp_seconds: IDL.Nat64 }); const ProposalData = IDL.Record({ - id: IDL.Opt(NeuronId), + id: IDL.Opt(ProposalId), failure_reason: IDL.Opt(GovernanceError), - cf_participants: IDL.Vec(CfParticipant), ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), proposal_timestamp_seconds: IDL.Nat64, reward_event_round: IDL.Nat64, @@ -1285,10 +1439,6 @@ export const init = ({IDL}) => { executed_timestamp_seconds: IDL.Nat64, original_total_community_fund_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64) }); - const XdrConversionRate = IDL.Record({ - xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), - timestamp_seconds: IDL.Opt(IDL.Nat64) - }); const Command_2 = IDL.Variant({ Spawn: NeuronId, Split: Split, @@ -1306,7 +1456,7 @@ export const init = ({IDL}) => { }); const BallotInfo = IDL.Record({ vote: IDL.Int32, - proposal_id: IDL.Opt(NeuronId) + proposal_id: IDL.Opt(ProposalId) }); const DissolveState = IDL.Variant({ DissolveDelaySeconds: IDL.Nat64, @@ -1331,6 +1481,7 @@ export const init = ({IDL}) => { dissolve_state: IDL.Opt(DissolveState), followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), neuron_fees_e8s: IDL.Nat64, + visibility: IDL.Opt(IDL.Int32), transfer: IDL.Opt(NeuronStakeTransfer), known_neuron_data: IDL.Opt(KnownNeuronData), spawn_at_timestamp_seconds: IDL.Opt(IDL.Nat64) @@ -1338,7 +1489,7 @@ export const init = ({IDL}) => { const Governance = IDL.Record({ default_followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), making_sns_proposal: IDL.Opt(MakingSnsProposal), - most_recent_monthly_node_provider_rewards: IDL.Opt(MostRecentMonthlyNodeProviderRewards), + most_recent_monthly_node_provider_rewards: IDL.Opt(MonthlyNodeProviderRewards), maturity_modulation_last_updated_at_timestamp_seconds: IDL.Opt(IDL.Nat64), wait_for_quiet_threshold_seconds: IDL.Nat64, metrics: IDL.Opt(GovernanceCachedMetrics), diff --git a/cli/src/declarations/internet_identity.d.ts b/cli/src/declarations/internet_identity.d.ts index 4e90b53..a2321b7 100644 --- a/cli/src/declarations/internet_identity.d.ts +++ b/cli/src/declarations/internet_identity.d.ts @@ -71,6 +71,18 @@ export interface BufferedArchiveEntry { anchor_number: UserNumber; timestamp: Timestamp; } +export interface CaptchaConfig { + max_unsolved_captchas: bigint; + captcha_trigger: + | { + Dynamic: { + reference_rate_sampling_interval_s: bigint; + threshold_pct: number; + current_rate_sampling_interval_s: bigint; + }; + } + | {Static: {CaptchaDisabled: null} | {CaptchaEnabled: null}}; +} export type CaptchaResult = ChallengeResult; export interface Challenge { png_base64: string; @@ -81,6 +93,13 @@ export interface ChallengeResult { key: ChallengeKey; chars: string; } +export interface CheckCaptchaArg { + solution: string; +} +export type CheckCaptchaError = + | {NoRegistrationFlow: null} + | {UnexpectedCall: {next_step: RegistrationFlowNextStep}} + | {WrongSolution: {new_captcha_png_base64: string}}; export type CredentialId = Uint8Array | number[]; export interface Delegation { pubkey: PublicKey; @@ -152,6 +171,25 @@ export interface IdAliasCredentials { rp_id_alias_credential: SignedIdAlias; issuer_id_alias_credential: SignedIdAlias; } +export interface IdRegFinishArg { + authn_method: AuthnMethodData; +} +export type IdRegFinishError = + | {NoRegistrationFlow: null} + | {UnexpectedCall: {next_step: RegistrationFlowNextStep}} + | {InvalidAuthnMethod: string} + | {IdentityLimitReached: null} + | {StorageError: string}; +export interface IdRegFinishResult { + identity_number: bigint; +} +export interface IdRegNextStepResult { + next_step: RegistrationFlowNextStep; +} +export type IdRegStartError = + | {InvalidCaller: null} + | {AlreadyInProgress: null} + | {RateLimitExceeded: null}; export interface IdentityAnchorInfo { devices: Array; device_registration: [] | [DeviceRegistrationInfo]; @@ -178,15 +216,11 @@ export type IdentityMetadataReplaceError = }; }; export type IdentityNumber = bigint; -export type IdentityRegisterError = - | {BadCaptcha: null} - | {CanisterFull: null} - | {InvalidMetadata: string}; export interface InternetIdentityInit { assigned_user_number_range: [] | [[bigint, bigint]]; - max_inflight_captchas: [] | [bigint]; archive_config: [] | [ArchiveConfig]; canister_creation_cycles_cost: [] | [bigint]; + captcha_config: [] | [CaptchaConfig]; register_rate_limit: [] | [RateLimitConfig]; } export interface InternetIdentityStats { @@ -233,6 +267,11 @@ export type RegisterResponse = | {bad_challenge: null} | {canister_full: null} | {registered: {user_number: UserNumber}}; +export type RegistrationFlowNextStep = + | { + CheckCaptcha: {captcha_png_base64: string}; + } + | {Finish: null}; export type SessionKey = PublicKey; export interface SignedDelegation { signature: Uint8Array | number[]; @@ -303,7 +342,11 @@ export interface _SERVICE { [IdentityNumber, PublicKey, AuthnMethodSecuritySettings], {Ok: null} | {Err: AuthnMethodSecuritySettingsReplaceError} >; - captcha_create: ActorMethod<[], {Ok: Challenge} | {Err: null}>; + check_captcha: ActorMethod< + [CheckCaptchaArg], + {Ok: IdRegNextStepResult} | {Err: CheckCaptchaError} + >; + config: ActorMethod<[], InternetIdentityInit>; create_challenge: ActorMethod<[], Challenge>; deploy_archive: ActorMethod<[Uint8Array | number[]], DeployArchiveResult>; enter_device_registration_mode: ActorMethod<[UserNumber], Timestamp>; @@ -325,10 +368,11 @@ export interface _SERVICE { [IdentityNumber, MetadataMapV2], {Ok: null} | {Err: IdentityMetadataReplaceError} >; - identity_register: ActorMethod< - [AuthnMethodData, CaptchaResult, [] | [Principal]], - {Ok: IdentityNumber} | {Err: IdentityRegisterError} + identity_registration_finish: ActorMethod< + [IdRegFinishArg], + {Ok: IdRegFinishResult} | {Err: IdRegFinishError} >; + identity_registration_start: ActorMethod<[], {Ok: IdRegNextStepResult} | {Err: IdRegStartError}>; init_salt: ActorMethod<[], undefined>; lookup: ActorMethod<[UserNumber], Array>; prepare_delegation: ActorMethod< diff --git a/cli/src/declarations/internet_identity.did b/cli/src/declarations/internet_identity.did index 0164427..500ef4d 100644 --- a/cli/src/declarations/internet_identity.did +++ b/cli/src/declarations/internet_identity.did @@ -209,6 +209,33 @@ type RateLimitConfig = record { max_tokens: nat64; }; +// Captcha configuration +// Default: +// - max_unsolved_captchas: 500 +// - captcha_trigger: Static, CaptchaEnabled +type CaptchaConfig = record { + // Maximum number of unsolved captchas. + max_unsolved_captchas : nat64; + // Configuration for when captcha protection should kick in. + captcha_trigger: variant { + // Based on the rate of registrations compared to some reference time frame and allowing some leeway. + Dynamic: record { + // Percentage of increased registration rate observed in the current rate sampling interval (compared to + // reference rate) at which II will enable captcha for new registrations. + threshold_pct: nat16; + // Length of the interval in seconds used to sample the current rate of registrations. + current_rate_sampling_interval_s: nat64; + // Length of the interval in seconds used to sample the reference rate of registrations. + reference_rate_sampling_interval_s: nat64; + }; + // Statically enable / disable captcha + Static: variant { + CaptchaEnabled; + CaptchaDisabled; + } + }; +}; + // Init arguments of II which can be supplied on install and upgrade. // Setting a value to null keeps the previous value. type InternetIdentityInit = record { @@ -228,9 +255,8 @@ type InternetIdentityInit = record { canister_creation_cycles_cost : opt nat64; // Rate limit for the `register` call. register_rate_limit : opt RateLimitConfig; - // Maximum number of inflight captchas. - // Default: 500 - max_inflight_captchas: opt nat64; + // Configuration of the captcha in the registration flow. + captcha_config: opt CaptchaConfig; }; type ChallengeKey = text; @@ -403,23 +429,12 @@ type IdentityInfo = record { }; type IdentityInfoError = variant { - /// The principal is not authorized to call this method with the given arguments. + // The principal is not authorized to call this method with the given arguments. Unauthorized: principal; - /// Internal canister error. See the error message for details. + // Internal canister error. See the error message for details. InternalCanisterError: text; }; - - -type IdentityRegisterError = variant { - // No more registrations are possible in this instance of the II service canister. - CanisterFull; - // The captcha check was not successful. - BadCaptcha; - // The metadata of the provided authentication method contains invalid entries. - InvalidMetadata: text; -}; - type AuthnMethodAddError = variant { InvalidMetadata: text; }; @@ -432,51 +447,51 @@ type AuthnMethodReplaceError = variant { type AuthnMethodMetadataReplaceError = variant { InvalidMetadata: text; - /// No authentication method found with the given public key. + // No authentication method found with the given public key. AuthnMethodNotFound; }; type AuthnMethodSecuritySettingsReplaceError = variant { - /// No authentication method found with the given public key. + // No authentication method found with the given public key. AuthnMethodNotFound; }; type IdentityMetadataReplaceError = variant { - /// The principal is not authorized to call this method with the given arguments. + // The principal is not authorized to call this method with the given arguments. Unauthorized: principal; - /// The identity including the new metadata exceeds the maximum allowed size. + // The identity including the new metadata exceeds the maximum allowed size. StorageSpaceExceeded: record {space_available: nat64; space_required: nat64}; - /// Internal canister error. See the error message for details. + // Internal canister error. See the error message for details. InternalCanisterError: text; }; type PrepareIdAliasRequest = record { - /// Origin of the issuer in the attribute sharing flow. + // Origin of the issuer in the attribute sharing flow. issuer : FrontendHostname; - /// Origin of the relying party in the attribute sharing flow. + // Origin of the relying party in the attribute sharing flow. relying_party : FrontendHostname; - /// Identity for which the IdAlias should be generated. + // Identity for which the IdAlias should be generated. identity_number : IdentityNumber; }; type PrepareIdAliasError = variant { - /// The principal is not authorized to call this method with the given arguments. + // The principal is not authorized to call this method with the given arguments. Unauthorized: principal; - /// Internal canister error. See the error message for details. + // Internal canister error. See the error message for details. InternalCanisterError: text; }; -/// The prepared id alias contains two (still unsigned) credentials in JWT format, -/// certifying the id alias for the issuer resp. the relying party. +// The prepared id alias contains two (still unsigned) credentials in JWT format, +// certifying the id alias for the issuer resp. the relying party. type PreparedIdAlias = record { rp_id_alias_jwt : text; issuer_id_alias_jwt : text; canister_sig_pk_der : PublicKey; }; -/// The request to retrieve the actual signed id alias credentials. -/// The field values should be equal to the values of corresponding -/// fields from the preceding `PrepareIdAliasRequest` and `PrepareIdAliasResponse`. +// The request to retrieve the actual signed id alias credentials. +// The field values should be equal to the values of corresponding +// fields from the preceding `PrepareIdAliasRequest` and `PrepareIdAliasResponse`. type GetIdAliasRequest = record { rp_id_alias_jwt : text; issuer : FrontendHostname; @@ -486,15 +501,15 @@ type GetIdAliasRequest = record { }; type GetIdAliasError = variant { - /// The principal is not authorized to call this method with the given arguments. + // The principal is not authorized to call this method with the given arguments. Unauthorized: principal; - /// The credential(s) are not available: may be expired or not prepared yet (call prepare_id_alias to prepare). + // The credential(s) are not available: may be expired or not prepared yet (call prepare_id_alias to prepare). NoSuchCredentials : text; - /// Internal canister error. See the error message for details. + // Internal canister error. See the error message for details. InternalCanisterError: text; }; -/// The signed id alias credentials for each involved party. +// The signed id alias credentials for each involved party. type IdAliasCredentials = record { rp_id_alias_credential : SignedIdAlias; issuer_id_alias_credential : SignedIdAlias; @@ -506,8 +521,76 @@ type SignedIdAlias = record { id_dapp : principal; }; +type IdRegNextStepResult = record { + // The next step in the registration flow + next_step: RegistrationFlowNextStep; +}; + +type IdRegStartError = variant { + // The method was called anonymously, which is not supported. + InvalidCaller; + // Too many registrations. Please try again later. + RateLimitExceeded; + // A registration flow is already in progress. + AlreadyInProgress; +}; + +// The next step in the registration flow: +// - CheckCaptcha: supply the solution to the captcha using `check_captcha` +// - Finish: finish the registration using `identity_registration_finish` +type RegistrationFlowNextStep = variant { + // Supply the captcha solution using check_captcha + CheckCaptcha: record { + captcha_png_base64: text; + }; + // Finish the registration using identity_registration_finish + Finish; +}; + +type CheckCaptchaArg = record { + solution : text; +}; + +type CheckCaptchaError = variant { + // The supplied solution was wrong. Try again with the new captcha. + WrongSolution: record { + new_captcha_png_base64: text; + }; + // This call is unexpected, see next_step. + UnexpectedCall: record { + next_step: RegistrationFlowNextStep; + }; + // No registration flow ongoing for the caller. + NoRegistrationFlow; +}; + +type IdRegFinishArg = record { + authn_method: AuthnMethodData; +}; + +type IdRegFinishResult = record { + identity_number: nat64; +}; + +type IdRegFinishError = variant { + // The configured maximum number of identities has been reached. + IdentityLimitReached; + // This call is unexpected, see next_step. + UnexpectedCall: record { + next_step: RegistrationFlowNextStep; + }; + // No registration flow ongoing for the caller. + NoRegistrationFlow; + // The supplied authn_method is not valid. + InvalidAuthnMethod: text; + // Error while persisting the new identity. + StorageError: text; +}; + service : (opt InternetIdentityInit) -> { - init_salt: () -> (); + // Legacy identity management API + // ============================== + create_challenge : () -> (Challenge); register : (DeviceData, ChallengeResult, opt principal) -> (RegisterResponse); add : (UserNumber, DeviceData) -> (); @@ -522,37 +605,25 @@ service : (opt InternetIdentityInit) -> { get_anchor_credentials : (UserNumber) -> (AnchorCredentials) query; get_anchor_info : (UserNumber) -> (IdentityAnchorInfo); get_principal : (UserNumber, FrontendHostname) -> (principal) query; - stats : () -> (InternetIdentityStats) query; enter_device_registration_mode : (UserNumber) -> (Timestamp); exit_device_registration_mode : (UserNumber) -> (); add_tentative_device : (UserNumber, DeviceData) -> (AddTentativeDeviceResponse); verify_tentative_device : (UserNumber, verification_code: text) -> (VerifyTentativeDeviceResponse); - prepare_delegation : (UserNumber, FrontendHostname, SessionKey, maxTimeToLive : opt nat64) -> (UserKey, Timestamp); - get_delegation: (UserNumber, FrontendHostname, SessionKey, Timestamp) -> (GetDelegationResponse) query; - - http_request: (request: HttpRequest) -> (HttpResponse) query; - http_request_update: (request: HttpRequest) -> (HttpResponse); - - deploy_archive: (wasm: blob) -> (DeployArchiveResult); - // Returns a batch of entries _sorted by sequence number_ to be archived. - // This is an update call because the archive information _must_ be certified. - // Only callable by this IIs archive canister. - fetch_entries: () -> (vec BufferedArchiveEntry); - acknowledge_entries: (sequence_number: nat64) -> (); + // V2 Identity Management API + // ========================== + // WARNING: The following methods are experimental and may ch 0ange in the future. - // V2 API - // WARNING: The following methods are experimental and may change in the future. + // Starts the identity registration flow to create a new identity. + identity_registration_start: () -> (variant {Ok: IdRegNextStepResult; Err: IdRegStartError;}); - // Creates a new captcha. The solution needs to be submitted using the - // `identity_register` call. - captcha_create: () -> (variant {Ok: Challenge; Err;}); + // Check the captcha challenge + // If successful, the registration can be finished with `identity_registration_finish`. + check_captcha: (CheckCaptchaArg) -> (variant {Ok: IdRegNextStepResult; Err: CheckCaptchaError;}); - // Registers a new identity with the given authn_method. - // A valid captcha solution to a previously generated captcha (using create_captcha) must be provided. - // The sender needs to match the supplied authn_method. - identity_register: (AuthnMethodData, CaptchaResult, opt principal) -> (variant {Ok: IdentityNumber; Err: IdentityRegisterError;}); + // Starts the identity registration flow to create a new identity. + identity_registration_finish: (IdRegFinishArg) -> (variant {Ok: IdRegFinishResult; Err: IdRegFinishError;}); // Returns information about the authentication methods of the identity with the given number. // Only returns the minimal information required for authentication without exposing any metadata such as aliases. @@ -611,8 +682,32 @@ service : (opt InternetIdentityInit) -> { // Requires authentication. authn_method_confirm: (IdentityNumber, confirmation_code: text) -> (variant {Ok; Err: AuthnMethodConfirmationError;}); + // Authentication protocol + // ======================= + prepare_delegation : (UserNumber, FrontendHostname, SessionKey, maxTimeToLive : opt nat64) -> (UserKey, Timestamp); + get_delegation: (UserNumber, FrontendHostname, SessionKey, Timestamp) -> (GetDelegationResponse) query; + // Attribute Sharing MVP API + // ========================= // The methods below are used to generate ID-alias credentials during attribute sharing flow. prepare_id_alias : (PrepareIdAliasRequest) -> (variant {Ok: PreparedIdAlias; Err: PrepareIdAliasError;}); get_id_alias : (GetIdAliasRequest) -> (variant {Ok: IdAliasCredentials; Err: GetIdAliasError;}) query; + + // HTTP Gateway protocol + // ===================== + http_request: (request: HttpRequest) -> (HttpResponse) query; + http_request_update: (request: HttpRequest) -> (HttpResponse); + + // Internal Methods + // ================ + init_salt: () -> (); + stats : () -> (InternetIdentityStats) query; + config : () -> (InternetIdentityInit) query; + + deploy_archive: (wasm: blob) -> (DeployArchiveResult); + // Returns a batch of entries _sorted by sequence number_ to be archived. + // This is an update call because the archive information _must_ be certified. + // Only callable by this IIs archive canister. + fetch_entries: () -> (vec BufferedArchiveEntry); + acknowledge_entries: (sequence_number: nat64) -> (); } diff --git a/cli/src/declarations/internet_identity.idl.js b/cli/src/declarations/internet_identity.idl.js index 23cbc04..404f733 100644 --- a/cli/src/declarations/internet_identity.idl.js +++ b/cli/src/declarations/internet_identity.idl.js @@ -7,15 +7,29 @@ export const idlFactory = ({IDL}) => { module_hash: IDL.Vec(IDL.Nat8), entries_fetch_limit: IDL.Nat16 }); + const CaptchaConfig = IDL.Record({ + max_unsolved_captchas: IDL.Nat64, + captcha_trigger: IDL.Variant({ + Dynamic: IDL.Record({ + reference_rate_sampling_interval_s: IDL.Nat64, + threshold_pct: IDL.Nat16, + current_rate_sampling_interval_s: IDL.Nat64 + }), + Static: IDL.Variant({ + CaptchaDisabled: IDL.Null, + CaptchaEnabled: IDL.Null + }) + }) + }); const RateLimitConfig = IDL.Record({ max_tokens: IDL.Nat64, time_per_token_ns: IDL.Nat64 }); const InternetIdentityInit = IDL.Record({ assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - max_inflight_captchas: IDL.Opt(IDL.Nat64), archive_config: IDL.Opt(ArchiveConfig), canister_creation_cycles_cost: IDL.Opt(IDL.Nat64), + captcha_config: IDL.Opt(CaptchaConfig), register_rate_limit: IDL.Opt(RateLimitConfig) }); const UserNumber = IDL.Nat64; @@ -134,6 +148,19 @@ export const idlFactory = ({IDL}) => { const AuthnMethodSecuritySettingsReplaceError = IDL.Variant({ AuthnMethodNotFound: IDL.Null }); + const CheckCaptchaArg = IDL.Record({solution: IDL.Text}); + const RegistrationFlowNextStep = IDL.Variant({ + CheckCaptcha: IDL.Record({captcha_png_base64: IDL.Text}), + Finish: IDL.Null + }); + const IdRegNextStepResult = IDL.Record({ + next_step: RegistrationFlowNextStep + }); + const CheckCaptchaError = IDL.Variant({ + NoRegistrationFlow: IDL.Null, + UnexpectedCall: IDL.Record({next_step: RegistrationFlowNextStep}), + WrongSolution: IDL.Record({new_captcha_png_base64: IDL.Text}) + }); const ChallengeKey = IDL.Text; const Challenge = IDL.Record({ png_base64: IDL.Text, @@ -265,15 +292,19 @@ export const idlFactory = ({IDL}) => { space_available: IDL.Nat64 }) }); - const ChallengeResult = IDL.Record({ - key: ChallengeKey, - chars: IDL.Text + const IdRegFinishArg = IDL.Record({authn_method: AuthnMethodData}); + const IdRegFinishResult = IDL.Record({identity_number: IDL.Nat64}); + const IdRegFinishError = IDL.Variant({ + NoRegistrationFlow: IDL.Null, + UnexpectedCall: IDL.Record({next_step: RegistrationFlowNextStep}), + InvalidAuthnMethod: IDL.Text, + IdentityLimitReached: IDL.Null, + StorageError: IDL.Text }); - const CaptchaResult = ChallengeResult; - const IdentityRegisterError = IDL.Variant({ - BadCaptcha: IDL.Null, - CanisterFull: IDL.Null, - InvalidMetadata: IDL.Text + const IdRegStartError = IDL.Variant({ + InvalidCaller: IDL.Null, + AlreadyInProgress: IDL.Null, + RateLimitExceeded: IDL.Null }); const UserKey = PublicKey; const PrepareIdAliasRequest = IDL.Record({ @@ -290,6 +321,10 @@ export const idlFactory = ({IDL}) => { InternalCanisterError: IDL.Text, Unauthorized: IDL.Principal }); + const ChallengeResult = IDL.Record({ + key: ChallengeKey, + chars: IDL.Text + }); const RegisterResponse = IDL.Variant({ bad_challenge: IDL.Null, canister_full: IDL.Null, @@ -387,7 +422,17 @@ export const idlFactory = ({IDL}) => { ], [] ), - captcha_create: IDL.Func([], [IDL.Variant({Ok: Challenge, Err: IDL.Null})], []), + check_captcha: IDL.Func( + [CheckCaptchaArg], + [ + IDL.Variant({ + Ok: IdRegNextStepResult, + Err: CheckCaptchaError + }) + ], + [] + ), + config: IDL.Func([], [InternetIdentityInit], ['query']), create_challenge: IDL.Func([], [Challenge], []), deploy_archive: IDL.Func([IDL.Vec(IDL.Nat8)], [DeployArchiveResult], []), enter_device_registration_mode: IDL.Func([UserNumber], [Timestamp], []), @@ -428,9 +473,14 @@ export const idlFactory = ({IDL}) => { ], [] ), - identity_register: IDL.Func( - [AuthnMethodData, CaptchaResult, IDL.Opt(IDL.Principal)], - [IDL.Variant({Ok: IdentityNumber, Err: IdentityRegisterError})], + identity_registration_finish: IDL.Func( + [IdRegFinishArg], + [IDL.Variant({Ok: IdRegFinishResult, Err: IdRegFinishError})], + [] + ), + identity_registration_start: IDL.Func( + [], + [IDL.Variant({Ok: IdRegNextStepResult, Err: IdRegStartError})], [] ), init_salt: IDL.Func([], [], []), @@ -464,15 +514,29 @@ export const init = ({IDL}) => { module_hash: IDL.Vec(IDL.Nat8), entries_fetch_limit: IDL.Nat16 }); + const CaptchaConfig = IDL.Record({ + max_unsolved_captchas: IDL.Nat64, + captcha_trigger: IDL.Variant({ + Dynamic: IDL.Record({ + reference_rate_sampling_interval_s: IDL.Nat64, + threshold_pct: IDL.Nat16, + current_rate_sampling_interval_s: IDL.Nat64 + }), + Static: IDL.Variant({ + CaptchaDisabled: IDL.Null, + CaptchaEnabled: IDL.Null + }) + }) + }); const RateLimitConfig = IDL.Record({ max_tokens: IDL.Nat64, time_per_token_ns: IDL.Nat64 }); const InternetIdentityInit = IDL.Record({ assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - max_inflight_captchas: IDL.Opt(IDL.Nat64), archive_config: IDL.Opt(ArchiveConfig), canister_creation_cycles_cost: IDL.Opt(IDL.Nat64), + captcha_config: IDL.Opt(CaptchaConfig), register_rate_limit: IDL.Opt(RateLimitConfig) }); return [IDL.Opt(InternetIdentityInit)]; diff --git a/cli/src/modules/internet-identity.ts b/cli/src/modules/internet-identity.ts index 119227d..aa8d125 100644 --- a/cli/src/modules/internet-identity.ts +++ b/cli/src/modules/internet-identity.ts @@ -1,5 +1,9 @@ +import {IDL} from '@dfinity/candid'; +import {toNullable} from '@dfinity/utils'; +import type {InternetIdentityInit} from '../declarations/internet_identity'; +import {init} from '../declarations/internet_identity.idl'; import {Module} from '../services/modules.services'; -import type {ModuleDescription} from '../types/module'; +import type {ModuleDescription, ModuleInstallParams} from '../types/module'; const INTERNET_IDENTITY: ModuleDescription = { key: 'internet_identity', @@ -7,4 +11,32 @@ const INTERNET_IDENTITY: ModuleDescription = { canisterId: 'rdmx6-jaaaa-aaaaa-aaadq-cai' }; -export const internetIdentity = new Module(INTERNET_IDENTITY); +class InternetIdentityModule extends Module { + override async install(params: ModuleInstallParams): Promise { + const initArgs: InternetIdentityInit = { + archive_config: toNullable(), + canister_creation_cycles_cost: toNullable(), + assigned_user_number_range: toNullable(), + register_rate_limit: toNullable(), + captcha_config: toNullable({ + max_unsolved_captchas: 50n, + captcha_trigger: { + Static: { + CaptchaDisabled: null + } + } + }) + }; + + // Type definitions generated by Candid are not clean enough. + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const arg = IDL.encode(init({IDL}), [[initArgs]]); + + await super.install({ + arg, + ...params + }); + } +} + +export const internetIdentity = new InternetIdentityModule(INTERNET_IDENTITY); diff --git a/modules.json b/modules.json index 0457bb5..b92c29d 100644 --- a/modules.json +++ b/modules.json @@ -1,11 +1,11 @@ { "internet_identity": { - "commit": "fd5486afabb4e0eead403f771d63d8752f95ab17", + "commit": "14cbf0f3c15eaa476d2b42e8754188328448b5f5", "repo": "https://github.com/dfinity/internet-identity", - "url": "https://github.com/dfinity/internet-identity/releases/download/release-2024-08-30/internet_identity_dev.wasm.gz", + "url": "https://github.com/dfinity/internet-identity/releases/download/release-2024-10-18/internet_identity_dev.wasm.gz", "candid": [ { - "url": "https://github.com/dfinity/internet-identity/releases/download/release-2024-08-30/internet_identity.did" + "url": "https://github.com/dfinity/internet-identity/releases/download/release-2024-10-18/internet_identity.did" } ] }, @@ -95,7 +95,7 @@ ] }, "governance": { - "commit": "e790c6636115482db53ca3daa2f1900202ab04cf", + "commit": "4bed17bfc82cddc5691743db6228992cdc2740f4", "repo": "https://github.com/dfinity/ic", "url": "https://download.dfinity.systems/ic/{commit}/canisters/governance-canister.wasm.gz", "candid": [