diff --git a/cli/src/declarations/cmc.d.ts b/cli/src/declarations/cmc.d.ts index ee98e6c..66f4a27 100644 --- a/cli/src/declarations/cmc.d.ts +++ b/cli/src/declarations/cmc.d.ts @@ -15,9 +15,11 @@ export type BlockIndex = bigint; export interface CanisterSettings { freezing_threshold: [] | [bigint]; wasm_memory_threshold: [] | [bigint]; + environment_variables: [] | [Array]; controllers: [] | [Array]; reserved_cycles_limit: [] | [bigint]; log_visibility: [] | [log_visibility]; + log_memory_limit: [] | [bigint]; wasm_memory_limit: [] | [bigint]; memory_allocation: [] | [bigint]; compute_allocation: [] | [bigint]; @@ -272,7 +274,14 @@ export type SubnetSelection = export interface SubnetTypesToSubnetsResponse { data: Array<[string, Array]>; } -export type log_visibility = {controllers: null} | {public: null}; +export interface environment_variable { + value: string; + name: string; +} +export type log_visibility = + | {controllers: null} + | {public: null} + | {allowed_viewers: Array}; export interface _SERVICE { /** * Creates a canister using the cycles attached to the function call. diff --git a/cli/src/declarations/cmc.did b/cli/src/declarations/cmc.did index 9da9a33..455d15b 100644 --- a/cli/src/declarations/cmc.did +++ b/cli/src/declarations/cmc.did @@ -3,6 +3,11 @@ type BlockIndex = nat64; type log_visibility = variant { controllers; public; + allowed_viewers : vec principal; +}; +type environment_variable = record { + name: text; + value: text; }; type CanisterSettings = record { controllers : opt vec principal; @@ -13,6 +18,8 @@ type CanisterSettings = record { log_visibility : opt log_visibility; wasm_memory_limit : opt nat; wasm_memory_threshold : opt nat; + environment_variables : opt vec environment_variable; + log_memory_limit : opt nat; }; type Subaccount = opt blob; type Memo = opt blob; diff --git a/cli/src/declarations/cmc.idl.js b/cli/src/declarations/cmc.idl.js index 1f6bc87..ae0a1ab 100644 --- a/cli/src/declarations/cmc.idl.js +++ b/cli/src/declarations/cmc.idl.js @@ -25,16 +25,23 @@ export const idlFactory = ({IDL}) => { Filter: SubnetFilter, Subnet: IDL.Record({subnet: IDL.Principal}) }); + const environment_variable = IDL.Record({ + value: IDL.Text, + name: IDL.Text + }); const log_visibility = IDL.Variant({ controllers: IDL.Null, - public: IDL.Null + public: IDL.Null, + allowed_viewers: IDL.Vec(IDL.Principal) }); const CanisterSettings = IDL.Record({ freezing_threshold: IDL.Opt(IDL.Nat), wasm_memory_threshold: IDL.Opt(IDL.Nat), + environment_variables: IDL.Opt(IDL.Vec(environment_variable)), controllers: IDL.Opt(IDL.Vec(IDL.Principal)), reserved_cycles_limit: IDL.Opt(IDL.Nat), log_visibility: IDL.Opt(log_visibility), + log_memory_limit: IDL.Opt(IDL.Nat), wasm_memory_limit: IDL.Opt(IDL.Nat), memory_allocation: IDL.Opt(IDL.Nat), compute_allocation: IDL.Opt(IDL.Nat) diff --git a/cli/src/declarations/governance.d.ts b/cli/src/declarations/governance.d.ts index 365db06..9d550bf 100644 --- a/cli/src/declarations/governance.d.ts +++ b/cli/src/declarations/governance.d.ts @@ -19,9 +19,11 @@ export interface AccountIdentifier { } export type Action = | {RegisterKnownNeuron: KnownNeuron} - | {ManageNeuron: ManageNeuron} + | {FulfillSubnetRentalRequest: FulfillSubnetRentalRequest} + | {ManageNeuron: ManageNeuronProposal} | {UpdateCanisterSettings: UpdateCanisterSettings} | {InstallCode: InstallCode} + | {DeregisterKnownNeuron: DeregisterKnownNeuron} | {StopOrStartCanister: StopOrStartCanister} | {CreateServiceNervousSystem: CreateServiceNervousSystem} | {ExecuteNnsFunction: ExecuteNnsFunction} @@ -100,24 +102,6 @@ export interface ClaimOrRefreshNeuronFromAccountResponse { export interface ClaimOrRefreshResponse { refreshed_neuron_id: [] | [NeuronId]; } -/** - * KEEP THIS IN SYNC WITH ManageNeuronCommandRequest! - */ -export type Command = - | {Spawn: Spawn} - | {Split: Split} - | {Follow: Follow} - | {DisburseMaturity: DisburseMaturity} - | {RefreshVotingPower: RefreshVotingPower} - | {ClaimOrRefresh: ClaimOrRefresh} - | {Configure: Configure} - | {RegisterVote: RegisterVote} - | {Merge: Merge} - | {DisburseToNeuron: DisburseToNeuron} - | {MakeProposal: Proposal} - | {StakeMaturity: StakeMaturity} - | {MergeMaturity: MergeMaturity} - | {Disburse: Disburse}; export type Command_1 = | {Error: GovernanceError} | {Spawn: SpawnResponse} @@ -130,6 +114,7 @@ export type Command_1 = | {RegisterVote: {}} | {Merge: MergeResponse} | {DisburseToNeuron: SpawnResponse} + | {SetFollowing: SetFollowingResponse} | {MakeProposal: MakeProposalResponse} | {StakeMaturity: StakeMaturityResponse} | {MergeMaturity: MergeMaturityResponse} @@ -179,9 +164,17 @@ export interface DateRangeFilter { start_timestamp_seconds: [] | [bigint]; end_timestamp_seconds: [] | [bigint]; } +export interface DateUtc { + day: number; + month: number; + year: number; +} export interface Decimal { human_readable: [] | [string]; } +export interface DeregisterKnownNeuron { + id: [] | [NeuronId]; +} export interface DerivedProposalInformation { swap_background_information: [] | [SwapBackgroundInformation]; } @@ -193,6 +186,7 @@ export interface Disburse { amount: [] | [Amount]; } export interface DisburseMaturity { + to_account_identifier: [] | [AccountIdentifier]; to_account: [] | [Account]; percentage_to_disburse: number; } @@ -226,24 +220,66 @@ export interface Follow { export interface Followees { followees: Array; } -export interface Followers { - followers: Array; +export interface FolloweesForTopic { + topic: [] | [number]; + followees: [] | [Array]; +} +/** + * Creates a rented subnet from a rental request (in the Subnet Rental + * canister). + */ +export interface FulfillSubnetRentalRequest { + /** + * Identifies which rental request to fulfill. + * + * (Identifying the rental request by user works, because a user can have at + * most one rental request in the Subnet Rental canister). + */ + user: [] | [Principal]; + /** + * What software the nodes will run. + * + * This must be approved by a prior proposal to bless an IC OS version. + * + * This is a FULL git commit ID in the ic repo. (Therefore, it must be a 40 + * character hexidecimal string, not an abbreviated git commit ID.) + * + * One way to find a suitable value is with the following command: + * + * ic-admin \ + * get-subnet 0 \ + * --nns-urls https://nns.ic0.app \ + * | grep replica_version_id + * + * Where to obtain a recent version of ic-admin: + * + * https://github.com/dfinity/ic/releases/latest + */ + replica_version_id: [] | [string]; + /** + * Which nodes will be members of the subnet. + */ + node_ids: [] | [Array]; } -export interface FollowersMap { - followers_map: Array<[bigint, Followers]>; +export interface GetNeuronIndexRequest { + page_size: [] | [number]; + exclusive_start_neuron_id: [] | [NeuronId]; } +export type GetNeuronIndexResult = {Ok: NeuronIndexData} | {Err: GovernanceError}; export interface GetNeuronsFundAuditInfoRequest { nns_proposal_id: [] | [ProposalId]; } export interface GetNeuronsFundAuditInfoResponse { result: [] | [Result_6]; } +export interface GetPendingProposalsRequest { + return_self_describing_action: [] | [boolean]; +} export interface GlobalTimeOfDay { seconds_after_utc_midnight: [] | [bigint]; } export interface Governance { default_followees: Array<[number, Followees]>; - making_sns_proposal: [] | [MakingSnsProposal]; most_recent_monthly_node_provider_rewards: [] | [MonthlyNodeProviderRewards]; maturity_modulation_last_updated_at_timestamp_seconds: [] | [bigint]; wait_for_quiet_threshold_seconds: bigint; @@ -257,7 +293,6 @@ export interface Governance { latest_reward_event: [] | [RewardEvent]; to_claim_transfers: Array; short_voting_period_seconds: bigint; - topic_followee_index: Array<[number, FollowersMap]>; proposals: Array<[bigint, ProposalData]>; xdr_conversion_rate: [] | [XdrConversionRate]; in_flight_commands: Array<[bigint, NeuronInFlightCommand]>; @@ -287,6 +322,7 @@ export interface GovernanceCachedMetrics { total_voting_power_non_self_authenticating_controller: [] | [bigint]; total_staked_maturity_e8s_equivalent: bigint; not_dissolving_neurons_e8s_buckets_ect: Array<[bigint, number]>; + spawning_neurons_count: bigint; declining_voting_power_neuron_subset_metrics: [] | [NeuronSubsetMetrics]; total_staked_e8s_ect: bigint; not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: bigint; @@ -357,7 +393,14 @@ export interface KnownNeuron { } export interface KnownNeuronData { name: string; + /** + * The first `opt` makes it so that the field can be renamed/deprecated in the future, and + * the second `opt` makes it so that an older client not recognizing a new variant can still + * get the rest of the `vec`. + */ + committed_topics: [] | [Array<[] | [TopicToFollow]>]; description: [] | [string]; + links: [] | [Array]; } export interface LedgerParameters { transaction_fee: [] | [Tokens]; @@ -368,6 +411,40 @@ export interface LedgerParameters { export interface ListKnownNeuronsResponse { known_neurons: Array; } +export interface ListNeuronVotesRequest { + /** + * Only fetch the voting history for proposal whose id `< before_proposal`. This can be used as a + * pagination token - pass the minimum proposal id as `before_proposal` for the next page. + */ + before_proposal: [] | [ProposalId]; + /** + * The maximum number of votes to fetch. The maximum number allowed is 500, and 500 will be used + * if is set as either null or > 500. + */ + limit: [] | [bigint]; + /** + * The neuron id for which the voting history will be returned. Currently, the voting history is + * only recorded for known neurons. + */ + neuron_id: [] | [NeuronId]; +} +export type ListNeuronVotesResponse = + | { + Ok: { + votes: [] | [Array]; + /** + * All the proposals before this id is "finalized", which means if a proposal before this id + * does not exist in the votes, it will never appear in the voting history, either because the + * neuron is not eligible to vote on the proposal, or the neuron is not a known neuron at the + * time of the proposal creation. Therefore, if a client syncs the entire voting history of a + * certain neuron and store `all_finalized_before_proposal`, it doesn't need to start from + * scratch the next time - it can stop as soon as they have seen any votes + * `< all_finalized_before_proposal`. + */ + all_finalized_before_proposal: [] | [ProposalId]; + }; + } + | {Err: GovernanceError}; /** * Parameters of the list_neurons method. */ @@ -419,7 +496,8 @@ export interface ListNodeProviderRewardsResponse { export interface ListNodeProvidersResponse { node_providers: Array; } -export interface ListProposalInfo { +export interface ListProposalInfoRequest { + return_self_describing_action: [] | [boolean]; include_reward_status: Int32Array; omit_large_fields: [] | [boolean]; before_proposal: [] | [ProposalId]; @@ -441,24 +519,38 @@ export interface MakeProposalResponse { message: [] | [string]; proposal_id: [] | [ProposalId]; } -export interface MakingSnsProposal { - proposal: [] | [Proposal]; - caller: [] | [Principal]; - proposer_id: [] | [NeuronId]; -} /** - * Not to be confused with ManageNeuronRequest. (Yes, this is very structurally - * similar to that, but not actually exactly equivalent.) + * KEEP THIS IN SYNC WITH COMMAND! + */ +export type ManageNeuronCommandRequest = + | {Spawn: Spawn} + | {Split: Split} + | {Follow: Follow} + | {DisburseMaturity: DisburseMaturity} + | {RefreshVotingPower: RefreshVotingPower} + | {ClaimOrRefresh: ClaimOrRefresh} + | {Configure: Configure} + | {RegisterVote: RegisterVote} + | {Merge: Merge} + | {DisburseToNeuron: DisburseToNeuron} + | {SetFollowing: SetFollowing} + | {MakeProposal: MakeProposalRequest} + | {StakeMaturity: StakeMaturity} + | {MergeMaturity: MergeMaturity} + | {Disburse: Disburse}; +/** + * Not to be confused with ManageNeuronRequest. This is only used to represent a manage neuron proposal. + * (Yes, this is very structurally similar to that, but not actually exactly equivalent) */ -export interface ManageNeuron { +export interface ManageNeuronProposal { id: [] | [NeuronId]; - command: [] | [Command]; + command: [] | [ManageNeuronProposalCommand]; neuron_id_or_subaccount: [] | [NeuronIdOrSubaccount]; } /** - * KEEP THIS IN SYNC WITH COMMAND! + * KEEP THIS IN SYNC WITH ManageNeuronCommandRequest! */ -export type ManageNeuronCommandRequest = +export type ManageNeuronProposalCommand = | {Spawn: Spawn} | {Split: Split} | {Follow: Follow} @@ -469,7 +561,8 @@ export type ManageNeuronCommandRequest = | {RegisterVote: RegisterVote} | {Merge: Merge} | {DisburseToNeuron: DisburseToNeuron} - | {MakeProposal: MakeProposalRequest} + | {SetFollowing: SetFollowing} + | {MakeProposal: Proposal} | {StakeMaturity: StakeMaturity} | {MergeMaturity: MergeMaturity} | {Disburse: Disburse}; @@ -500,6 +593,13 @@ export interface ManageNeuronResponse { */ command: [] | [Command_1]; } +export interface MaturityDisbursement { + account_identifier_to_disburse_to: [] | [AccountIdentifier]; + timestamp_of_disbursement_seconds: [] | [bigint]; + amount_e8s: [] | [bigint]; + account_to_disburse_to: [] | [Account]; + finalize_disbursement_timestamp_seconds: [] | [bigint]; +} export interface Merge { source_neuron_id: [] | [NeuronId]; } @@ -517,9 +617,12 @@ export interface MergeResponse { source_neuron_info: [] | [NeuronInfo]; } export interface MonthlyNodeProviderRewards { + algorithm_version: [] | [number]; minimum_xdr_permyriad_per_icp: [] | [bigint]; + end_date: [] | [DateUtc]; registry_version: [] | [bigint]; node_providers: Array; + start_date: [] | [DateUtc]; timestamp: bigint; rewards: Array; xdr_conversion_rate: [] | [XdrConversionRate]; @@ -619,6 +722,11 @@ export interface Neuron { hot_keys: Array; account: Uint8Array; joined_community_fund_timestamp_seconds: [] | [bigint]; + /** + * The maturity disbursements in progress, i.e. the disbursements that are initiated but not + * finalized. The finalization happens 7 days after the disbursement is initiated. + */ + maturity_disbursements_in_progress: [] | [Array]; dissolve_state: [] | [DissolveState]; followees: Array<[number, Followees]>; neuron_fees_e8s: bigint; @@ -650,6 +758,9 @@ export interface NeuronInFlightCommand { command: [] | [Command_2]; timestamp: bigint; } +export interface NeuronIndexData { + neurons: Array; +} /** * A limit view of Neuron that allows some aspects of all neurons to be read by * anyone (i.e. without having to be the neuron's controller nor one of its @@ -659,6 +770,7 @@ export interface NeuronInFlightCommand { * one of the same (or at least similar) name in Neuron. */ export interface NeuronInfo { + id: [] | [NeuronId]; dissolve_delay_seconds: bigint; recent_ballots: Array; voting_power_refreshed_timestamp_seconds: [] | [bigint]; @@ -719,6 +831,13 @@ export interface NeuronSubsetMetrics { potential_voting_power_buckets: Array<[bigint, bigint]>; count_buckets: Array<[bigint, bigint]>; } +export interface NeuronVote { + /** + * The vote of the neuron on the specific proposal id. + */ + vote: [] | [Vote]; + proposal_id: [] | [ProposalId]; +} export interface NeuronsFundAuditInfo { final_neurons_fund_participation: [] | [NeuronsFundParticipation]; initial_neurons_fund_participation: [] | [NeuronsFundParticipation]; @@ -820,12 +939,15 @@ export interface Proposal { title: [] | [string]; action: [] | [Action]; summary: string; + self_describing_action: [] | [SelfDescribingProposalAction]; } export type ProposalActionRequest = | {RegisterKnownNeuron: KnownNeuron} + | {FulfillSubnetRentalRequest: FulfillSubnetRentalRequest} | {ManageNeuron: ManageNeuronRequest} | {UpdateCanisterSettings: UpdateCanisterSettings} | {InstallCode: InstallCodeRequest} + | {DeregisterKnownNeuron: DeregisterKnownNeuron} | {StopOrStartCanister: StopOrStartCanister} | {CreateServiceNervousSystem: CreateServiceNervousSystem} | {ExecuteNnsFunction: ExecuteNnsFunction} @@ -837,6 +959,7 @@ export type ProposalActionRequest = | {Motion: Motion}; export interface ProposalData { id: [] | [ProposalId]; + topic: [] | [number]; failure_reason: [] | [GovernanceError]; ballots: Array<[bigint, Ballot]>; proposal_timestamp_seconds: bigint; @@ -938,12 +1061,28 @@ export interface RewardToAccount { export interface RewardToNeuron { dissolve_delay_seconds: bigint; } +export interface SelfDescribingProposalAction { + type_description: [] | [string]; + type_name: [] | [string]; + value: [] | [SelfDescribingValue]; +} +export type SelfDescribingValue = + | {Int: bigint} + | {Map: Array<[string, SelfDescribingValue]>} + | {Nat: bigint} + | {Blob: Uint8Array} + | {Text: string} + | {Array: Array}; export interface SetDefaultFollowees { default_followees: Array<[number, Followees]>; } export interface SetDissolveTimestamp { dissolve_timestamp_seconds: bigint; } +export interface SetFollowing { + topic_following: [] | [Array]; +} +export type SetFollowingResponse = {}; export interface SetOpenTimeWindowRequest { open_time_window: [] | [TimeWindow]; } @@ -974,6 +1113,7 @@ export interface SpawnResponse { created_neuron_id: [] | [NeuronId]; } export interface Split { + memo: [] | [bigint]; amount_e8s: bigint; } export interface StakeMaturity { @@ -1035,6 +1175,31 @@ export interface TimeWindow { export interface Tokens { e8s: [] | [bigint]; } +/** + * A topic that can be followed. It is almost the same as the topic on the + * proposal, except that the `CatchAll` is a special value and following on this + * `topic` will let the neuron follow the votes on all topics except for + * Governance and SnsAndCommunityFund. + */ +export type TopicToFollow = + | {Kyc: null} + | {ServiceNervousSystemManagement: null} + | {ApiBoundaryNodeManagement: null} + | {ApplicationCanisterManagement: null} + | {SubnetRental: null} + | {NeuronManagement: null} + | {NodeProviderRewards: null} + | {SubnetManagement: null} + | {ExchangeRate: null} + | {CatchAll: null} + | {NodeAdmin: null} + | {IcOsVersionElection: null} + | {ProtocolCanisterManagement: null} + | {NetworkEconomics: null} + | {IcOsVersionDeployment: null} + | {ParticipantManagement: null} + | {Governance: null} + | {SnsAndCommunityFund: null}; export interface UpdateCanisterSettings { canister_id: [] | [Principal]; settings: [] | [CanisterSettings]; @@ -1042,6 +1207,15 @@ export interface UpdateCanisterSettings { export interface UpdateNodeProvider { reward_account: [] | [AccountIdentifier]; } +export type Vote = + | {No: null} + | {Yes: null} + | { + /** + * Abstentions are recorded as Unspecified. + */ + Unspecified: null; + }; /** * Parameters that affect the voting power of neurons. */ @@ -1106,6 +1280,7 @@ export interface _SERVICE { get_most_recent_monthly_node_provider_rewards: ActorMethod<[], [] | [MonthlyNodeProviderRewards]>; get_network_economics_parameters: ActorMethod<[], NetworkEconomics>; get_neuron_ids: ActorMethod<[], BigUint64Array>; + get_neuron_index: ActorMethod<[GetNeuronIndexRequest], GetNeuronIndexResult>; get_neuron_info: ActorMethod<[bigint], Result_5>; get_neuron_info_by_id_or_subaccount: ActorMethod<[NeuronIdOrSubaccount], Result_5>; get_neurons_fund_audit_info: ActorMethod< @@ -1113,17 +1288,18 @@ export interface _SERVICE { GetNeuronsFundAuditInfoResponse >; get_node_provider_by_caller: ActorMethod<[null], Result_7>; - get_pending_proposals: ActorMethod<[], Array>; + get_pending_proposals: ActorMethod<[[] | [GetPendingProposalsRequest]], Array>; get_proposal_info: ActorMethod<[bigint], [] | [ProposalInfo]>; get_restore_aging_summary: ActorMethod<[], RestoreAgingSummary>; list_known_neurons: ActorMethod<[], ListKnownNeuronsResponse>; + list_neuron_votes: ActorMethod<[ListNeuronVotesRequest], ListNeuronVotesResponse>; list_neurons: ActorMethod<[ListNeurons], ListNeuronsResponse>; list_node_provider_rewards: ActorMethod< [ListNodeProviderRewardsRequest], ListNodeProviderRewardsResponse >; list_node_providers: ActorMethod<[], ListNodeProvidersResponse>; - list_proposals: ActorMethod<[ListProposalInfo], ListProposalInfoResponse>; + list_proposals: ActorMethod<[ListProposalInfoRequest], ListProposalInfoResponse>; manage_neuron: ActorMethod<[ManageNeuronRequest], ManageNeuronResponse>; settle_community_fund_participation: ActorMethod<[SettleCommunityFundParticipation], Result>; settle_neurons_fund_participation: ActorMethod< diff --git a/cli/src/declarations/governance.did b/cli/src/declarations/governance.did index 7a4332f..fecb89a 100644 --- a/cli/src/declarations/governance.did +++ b/cli/src/declarations/governance.did @@ -4,7 +4,8 @@ type AccountIdentifier = record { type Action = variant { RegisterKnownNeuron : KnownNeuron; - ManageNeuron : ManageNeuron; + DeregisterKnownNeuron : DeregisterKnownNeuron; + ManageNeuron : ManageNeuronProposal; UpdateCanisterSettings : UpdateCanisterSettings; InstallCode : InstallCode; StopOrStartCanister : StopOrStartCanister; @@ -19,6 +20,7 @@ type Action = variant { ApproveGenesisKyc : Principals; AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; Motion : Motion; + FulfillSubnetRentalRequest : FulfillSubnetRentalRequest; }; type AddHotKey = record { @@ -126,6 +128,7 @@ type RefreshVotingPowerResponse = record { type DisburseMaturity = record { percentage_to_disburse : nat32; to_account : opt Account; + to_account_identifier: opt AccountIdentifier; }; type Account = record { @@ -137,8 +140,20 @@ type DisburseMaturityResponse = record { amount_disbursed_e8s : opt nat64; }; +type SetFollowing = record { + topic_following : opt vec FolloweesForTopic; +}; + +type FolloweesForTopic = record { + followees : opt vec NeuronId; + topic : opt int32; +}; + +type SetFollowingResponse = record { +}; + // KEEP THIS IN SYNC WITH ManageNeuronCommandRequest! -type Command = variant { +type ManageNeuronProposalCommand = variant { Spawn : Spawn; Split : Split; Follow : Follow; @@ -153,6 +168,7 @@ type Command = variant { Disburse : Disburse; RefreshVotingPower : RefreshVotingPower; DisburseMaturity : DisburseMaturity; + SetFollowing : SetFollowing; // KEEP THIS IN SYNC WITH ManageNeuronCommandRequest! }; @@ -173,6 +189,7 @@ type Command_1 = variant { Disburse : DisburseResponse; RefreshVotingPower : RefreshVotingPowerResponse; DisburseMaturity : DisburseMaturityResponse; + SetFollowing : SetFollowingResponse; }; type Command_2 = variant { @@ -281,14 +298,6 @@ 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; }; @@ -303,7 +312,6 @@ type GlobalTimeOfDay = record { type Governance = record { default_followees : vec record { int32; Followees }; - making_sns_proposal : opt MakingSnsProposal; most_recent_monthly_node_provider_rewards : opt MonthlyNodeProviderRewards; maturity_modulation_last_updated_at_timestamp_seconds : opt nat64; wait_for_quiet_threshold_seconds : nat64; @@ -317,7 +325,6 @@ type Governance = record { latest_reward_event : opt RewardEvent; to_claim_transfers : vec NeuronStakeTransfer; short_voting_period_seconds : nat64; - topic_followee_index : vec record { int32; FollowersMap }; proposals : vec record { nat64; ProposalData }; xdr_conversion_rate : opt XdrConversionRate; in_flight_commands : vec record { nat64; NeuronInFlightCommand }; @@ -369,6 +376,7 @@ type GovernanceCachedMetrics = record { not_dissolving_neurons_e8s_buckets_seed : vec record { nat64; float64 }; timestamp_seconds : nat64; seed_neuron_count : nat64; + spawning_neurons_count : nat64; non_self_authenticating_controller_neuron_subset_metrics : opt NeuronSubsetMetrics; public_neuron_subset_metrics : opt NeuronSubsetMetrics; @@ -433,9 +441,18 @@ type KnownNeuron = record { known_neuron_data : opt KnownNeuronData; }; +type DeregisterKnownNeuron = record { + id : opt NeuronId; +}; + type KnownNeuronData = record { name : text; description : opt text; + links : opt vec text; + // The first `opt` makes it so that the field can be renamed/deprecated in the future, and + // the second `opt` makes it so that an older client not recognizing a new variant can still + // get the rest of the `vec`. + committed_topics : opt vec opt TopicToFollow; }; type LedgerParameters = record { @@ -500,7 +517,7 @@ type ListNodeProvidersResponse = record { node_providers : vec NodeProvider; }; -type ListProposalInfo = record { +type ListProposalInfoRequest = record { include_reward_status : vec int32; omit_large_fields : opt bool; before_proposal : opt ProposalId; @@ -508,6 +525,7 @@ type ListProposalInfo = record { exclude_topic : vec int32; include_all_manage_neuron_proposals : opt bool; include_status : vec int32; + return_self_describing_action : opt bool; }; type ListProposalInfoResponse = record { @@ -526,17 +544,11 @@ type MakeProposalResponse = record { proposal_id : opt ProposalId; }; -type MakingSnsProposal = record { - proposal : opt Proposal; - caller : opt principal; - proposer_id : opt NeuronId; -}; - -// Not to be confused with ManageNeuronRequest. (Yes, this is very structurally -// similar to that, but not actually exactly equivalent.) -type ManageNeuron = record { +// Not to be confused with ManageNeuronRequest. This is only used to represent a manage neuron proposal. +// (Yes, this is very structurally similar to that, but not actually exactly equivalent) +type ManageNeuronProposal = record { id : opt NeuronId; - command : opt Command; + command : opt ManageNeuronProposalCommand; neuron_id_or_subaccount : opt NeuronIdOrSubaccount; }; @@ -556,6 +568,7 @@ type ManageNeuronCommandRequest = variant { Disburse : Disburse; RefreshVotingPower : RefreshVotingPower; DisburseMaturity : DisburseMaturity; + SetFollowing : SetFollowing; // KEEP THIS IN SYNC WITH COMMAND! }; @@ -599,11 +612,20 @@ type MergeResponse = record { source_neuron_info : opt NeuronInfo; }; +type DateUtc = record { + year : nat32; + month : nat32; + day : nat32; +}; + type MonthlyNodeProviderRewards = record { minimum_xdr_permyriad_per_icp : opt nat64; registry_version : opt nat64; + algorithm_version : opt nat32; node_providers : vec NodeProvider; timestamp : nat64; + start_date : opt DateUtc; + end_date : opt DateUtc; rewards : vec RewardNodeProvider; xdr_conversion_rate : opt XdrConversionRate; maximum_node_provider_rewards_e8s : opt nat64; @@ -741,6 +763,10 @@ type Neuron = record { // // Per NNS policy, this is opt. Nevertheless, it will never be null. potential_voting_power : opt nat64; + + // The maturity disbursements in progress, i.e. the disbursements that are initiated but not + // finalized. The finalization happens 7 days after the disbursement is initiated. + maturity_disbursements_in_progress : opt vec MaturityDisbursement; }; type NeuronBasketConstructionParameters = record { @@ -779,6 +805,20 @@ type NeuronInFlightCommand = record { timestamp : nat64; }; +type GetNeuronIndexRequest = record { + exclusive_start_neuron_id: opt NeuronId; + page_size: opt nat32; +}; + +type NeuronIndexData = record { + neurons: vec NeuronInfo; +}; + +type GetNeuronIndexResult = variant { + Ok : NeuronIndexData; + Err : GovernanceError; +}; + // A limit view of Neuron that allows some aspects of all neurons to be read by // anyone (i.e. without having to be the neuron's controller nor one of its // hotkeys). @@ -786,6 +826,7 @@ type NeuronInFlightCommand = record { // As such, the meaning of each field in this type is generally the same as the // one of the same (or at least similar) name in Neuron. type NeuronInfo = record { + id: opt NeuronId; dissolve_delay_seconds : nat64; recent_ballots : vec BallotInfo; neuron_type : opt int32; @@ -967,10 +1008,12 @@ type Proposal = record { title : opt text; action : opt Action; summary : text; + self_describing_action : opt SelfDescribingProposalAction; }; type ProposalActionRequest = variant { RegisterKnownNeuron : KnownNeuron; + DeregisterKnownNeuron : DeregisterKnownNeuron; ManageNeuron : ManageNeuronRequest; UpdateCanisterSettings : UpdateCanisterSettings; InstallCode : InstallCodeRequest; @@ -983,6 +1026,39 @@ type ProposalActionRequest = variant { ApproveGenesisKyc : Principals; AddOrRemoveNodeProvider : AddOrRemoveNodeProvider; Motion : Motion; + FulfillSubnetRentalRequest : FulfillSubnetRentalRequest; +}; + +// Creates a rented subnet from a rental request (in the Subnet Rental +// canister). +type FulfillSubnetRentalRequest = record { + // Identifies which rental request to fulfill. + // + // (Identifying the rental request by user works, because a user can have at + // most one rental request in the Subnet Rental canister). + user : opt principal; + + // Which nodes will be members of the subnet. + node_ids : opt vec principal; + + // What software the nodes will run. + // + // This must be approved by a prior proposal to bless an IC OS version. + // + // This is a FULL git commit ID in the ic repo. (Therefore, it must be a 40 + // character hexidecimal string, not an abbreviated git commit ID.) + // + // One way to find a suitable value is with the following command: + // + // ic-admin \ + // get-subnet 0 \ + // --nns-urls https://nns.ic0.app \ + // | grep replica_version_id + // + // Where to obtain a recent version of ic-admin: + // + // https://github.com/dfinity/ic/releases/latest + replica_version_id : opt text; }; type ProposalData = record { @@ -1004,6 +1080,7 @@ type ProposalData = record { executed_timestamp_seconds : nat64; original_total_community_fund_maturity_e8s_equivalent : opt nat64; total_potential_voting_power : opt nat64; + topic: opt int32; }; type ProposalInfo = record { @@ -1182,6 +1259,7 @@ type SpawnResponse = record { type Split = record { amount_e8s : nat64; + memo : opt nat64; }; type StakeMaturity = record { @@ -1277,6 +1355,98 @@ type XdrConversionRate = record { timestamp_seconds : opt nat64; }; +type MaturityDisbursement = record { + amount_e8s : opt nat64; + timestamp_of_disbursement_seconds : opt nat64; + finalize_disbursement_timestamp_seconds : opt nat64; + account_to_disburse_to : opt Account; + account_identifier_to_disburse_to : opt AccountIdentifier; +}; + +// A topic that can be followed. It is almost the same as the topic on the +// proposal, except that the `CatchAll` is a special value and following on this +// `topic` will let the neuron follow the votes on all topics except for +// Governance and SnsAndCommunityFund. +type TopicToFollow = variant { + CatchAll; + NeuronManagement; + ExchangeRate; + NetworkEconomics; + Governance; + NodeAdmin; + ParticipantManagement; + SubnetManagement; + Kyc; + NodeProviderRewards; + IcOsVersionDeployment; + IcOsVersionElection; + SnsAndCommunityFund; + ApiBoundaryNodeManagement; + SubnetRental; + ApplicationCanisterManagement; + ProtocolCanisterManagement; + ServiceNervousSystemManagement; +}; + +type ListNeuronVotesRequest = record { + // The neuron id for which the voting history will be returned. Currently, the voting history is + // only recorded for known neurons. + neuron_id : opt NeuronId; + // Only fetch the voting history for proposal whose id `< before_proposal`. This can be used as a + // pagination token - pass the minimum proposal id as `before_proposal` for the next page. + before_proposal : opt ProposalId; + // The maximum number of votes to fetch. The maximum number allowed is 500, and 500 will be used + // if is set as either null or > 500. + limit : opt nat64; +}; + +type ListNeuronVotesResponse = variant { + Ok : record { + votes : opt vec NeuronVote; + // All the proposals before this id is "finalized", which means if a proposal before this id + // does not exist in the votes, it will never appear in the voting history, either because the + // neuron is not eligible to vote on the proposal, or the neuron is not a known neuron at the + // time of the proposal creation. Therefore, if a client syncs the entire voting history of a + // certain neuron and store `all_finalized_before_proposal`, it doesn't need to start from + // scratch the next time - it can stop as soon as they have seen any votes + // `< all_finalized_before_proposal`. + all_finalized_before_proposal : opt ProposalId; + }; + Err : GovernanceError; +}; + +type NeuronVote = record { + proposal_id : opt ProposalId; + // The vote of the neuron on the specific proposal id. + vote : opt Vote; +}; + +type Vote = variant { + // Abstentions are recorded as Unspecified. + Unspecified; + Yes; + No; +}; + +type SelfDescribingProposalAction = record { + type_name : opt text; + type_description : opt text; + value : opt SelfDescribingValue; +}; + +type SelfDescribingValue = variant { + Blob : blob; + Text : text; + Nat : nat; + Int : int; + Array : vec SelfDescribingValue; + Map : vec record { text; SelfDescribingValue }; +}; + +type GetPendingProposalsRequest = record { + return_self_describing_action : opt bool; +} + service : (Governance) -> { claim_gtc_neurons : (principal, vec NeuronId) -> (Result); claim_or_refresh_neuron_from_account : (ClaimOrRefreshNeuronFromAccount) -> ( @@ -1295,6 +1465,7 @@ service : (Governance) -> { ) query; get_network_economics_parameters : () -> (NetworkEconomics) query; get_neuron_ids : () -> (vec nat64) query; + get_neuron_index: (GetNeuronIndexRequest) -> (GetNeuronIndexResult) query; get_neuron_info : (nat64) -> (Result_5) query; get_neuron_info_by_id_or_subaccount : (NeuronIdOrSubaccount) -> ( Result_5, @@ -1303,7 +1474,7 @@ service : (Governance) -> { GetNeuronsFundAuditInfoResponse, ) query; get_node_provider_by_caller : (null) -> (Result_7) query; - get_pending_proposals : () -> (vec ProposalInfo) query; + get_pending_proposals : (opt GetPendingProposalsRequest) -> (vec ProposalInfo) query; get_proposal_info : (nat64) -> (opt ProposalInfo) query; get_restore_aging_summary : () -> (RestoreAgingSummary) query; list_known_neurons : () -> (ListKnownNeuronsResponse) query; @@ -1312,7 +1483,8 @@ service : (Governance) -> { ListNodeProviderRewardsResponse, ) query; list_node_providers : () -> (ListNodeProvidersResponse) query; - list_proposals : (ListProposalInfo) -> (ListProposalInfoResponse) query; + list_proposals : (ListProposalInfoRequest) -> (ListProposalInfoResponse) query; + list_neuron_votes : (ListNeuronVotesRequest) -> (ListNeuronVotesResponse) query; manage_neuron : (ManageNeuronRequest) -> (ManageNeuronResponse); settle_community_fund_participation : (SettleCommunityFundParticipation) -> ( Result, diff --git a/cli/src/declarations/governance.idl.js b/cli/src/declarations/governance.idl.js index 2dba1f4..7007e3c 100644 --- a/cli/src/declarations/governance.idl.js +++ b/cli/src/declarations/governance.idl.js @@ -9,22 +9,289 @@ export const idlFactory = ({IDL}) => { const ManageNeuronRequest = IDL.Rec(); const Proposal = IDL.Rec(); + const SelfDescribingValue = IDL.Rec(); const NeuronId = IDL.Record({id: IDL.Nat64}); const Followees = IDL.Record({followees: IDL.Vec(NeuronId)}); + const DateUtc = IDL.Record({ + day: IDL.Nat32, + month: IDL.Nat32, + year: IDL.Nat32 + }); + const AccountIdentifier = IDL.Record({hash: IDL.Vec(IDL.Nat8)}); + const NodeProvider = IDL.Record({ + id: IDL.Opt(IDL.Principal), + reward_account: IDL.Opt(AccountIdentifier) + }); + const RewardToNeuron = IDL.Record({dissolve_delay_seconds: IDL.Nat64}); + const RewardToAccount = IDL.Record({ + to_account: IDL.Opt(AccountIdentifier) + }); + const RewardMode = IDL.Variant({ + RewardToNeuron: RewardToNeuron, + RewardToAccount: RewardToAccount + }); + const RewardNodeProvider = IDL.Record({ + node_provider: IDL.Opt(NodeProvider), + reward_mode: IDL.Opt(RewardMode), + amount_e8s: IDL.Nat64 + }); + const XdrConversionRate = IDL.Record({ + xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const MonthlyNodeProviderRewards = IDL.Record({ + algorithm_version: IDL.Opt(IDL.Nat32), + minimum_xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + end_date: IDL.Opt(DateUtc), + registry_version: IDL.Opt(IDL.Nat64), + node_providers: IDL.Vec(NodeProvider), + start_date: IDL.Opt(DateUtc), + timestamp: IDL.Nat64, + 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), + deciding_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + total_staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + total_potential_voting_power: IDL.Opt(IDL.Nat64), + total_deciding_voting_power: 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), + potential_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)) + }); + const GovernanceCachedMetrics = IDL.Record({ + total_maturity_e8s_equivalent: IDL.Nat64, + not_dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, + garbage_collectable_neurons_count: IDL.Nat64, + dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + neurons_with_invalid_stake_count: IDL.Nat64, + not_dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + ect_neuron_count: IDL.Nat64, + total_supply_icp: IDL.Nat64, + neurons_with_less_than_6_months_dissolve_delay_count: IDL.Nat64, + dissolved_neurons_count: IDL.Nat64, + community_fund_total_maturity_e8s_equivalent: IDL.Nat64, + total_staked_e8s_seed: IDL.Nat64, + total_staked_maturity_e8s_equivalent_ect: IDL.Nat64, + total_staked_e8s: IDL.Nat64, + fully_lost_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), + 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)), + spawning_neurons_count: IDL.Nat64, + declining_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), + 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( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + 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 + }); + const VotingPowerEconomics = IDL.Record({ + start_reducing_voting_power_after_seconds: IDL.Opt(IDL.Nat64), + neuron_minimum_dissolve_delay_to_vote_seconds: IDL.Opt(IDL.Nat64), + clear_following_after_seconds: IDL.Opt(IDL.Nat64) + }); + const Percentage = IDL.Record({basis_points: IDL.Opt(IDL.Nat64)}); + const Decimal = IDL.Record({human_readable: IDL.Opt(IDL.Text)}); + const NeuronsFundMatchedFundingCurveCoefficients = IDL.Record({ + contribution_threshold_xdr: IDL.Opt(Decimal), + one_third_participation_milestone_xdr: IDL.Opt(Decimal), + full_participation_milestone_xdr: IDL.Opt(Decimal) + }); + const NeuronsFundEconomics = IDL.Record({ + maximum_icp_xdr_rate: IDL.Opt(Percentage), + neurons_fund_matched_funding_curve_coefficients: IDL.Opt( + NeuronsFundMatchedFundingCurveCoefficients + ), + max_theoretical_neurons_fund_participation_amount_xdr: IDL.Opt(Decimal), + minimum_icp_xdr_rate: IDL.Opt(Percentage) + }); + const NetworkEconomics = IDL.Record({ + neuron_minimum_stake_e8s: IDL.Nat64, + voting_power_economics: IDL.Opt(VotingPowerEconomics), + max_proposals_to_keep_per_topic: IDL.Nat32, + neuron_management_fee_per_proposal_e8s: IDL.Nat64, + reject_cost_e8s: IDL.Nat64, + transaction_fee_e8s: IDL.Nat64, + neuron_spawn_dissolve_delay_seconds: IDL.Nat64, + minimum_icp_xdr_rate: IDL.Nat64, + maximum_node_provider_rewards_e8s: IDL.Nat64, + neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) + }); + const RestoreAgingNeuronGroup = IDL.Record({ + count: IDL.Opt(IDL.Nat64), + previous_total_stake_e8s: IDL.Opt(IDL.Nat64), + current_total_stake_e8s: IDL.Opt(IDL.Nat64), + group_type: IDL.Int32 + }); + const RestoreAgingSummary = IDL.Record({ + groups: IDL.Vec(RestoreAgingNeuronGroup), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const ProposalId = IDL.Record({id: IDL.Nat64}); + const RewardEvent = IDL.Record({ + rounds_since_last_distribution: IDL.Opt(IDL.Nat64), + day_after_genesis: IDL.Nat64, + actual_timestamp_seconds: IDL.Nat64, + total_available_e8s_equivalent: IDL.Nat64, + latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), + distributed_e8s_equivalent: IDL.Nat64, + settled_proposals: IDL.Vec(ProposalId) + }); + const NeuronStakeTransfer = IDL.Record({ + to_subaccount: IDL.Vec(IDL.Nat8), + neuron_stake_e8s: IDL.Nat64, + from: IDL.Opt(IDL.Principal), + memo: IDL.Nat64, + from_subaccount: IDL.Vec(IDL.Nat8), + transfer_timestamp: IDL.Nat64, + block_height: IDL.Nat64 + }); + const GovernanceError = IDL.Record({ + error_message: IDL.Text, + error_type: IDL.Int32 + }); + const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); + const SwapParticipationLimits = IDL.Record({ + min_participant_icp_e8s: IDL.Opt(IDL.Nat64), + max_participant_icp_e8s: IDL.Opt(IDL.Nat64), + min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundNeuronPortion = IDL.Record({ + 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), + amount_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundSnapshot = IDL.Record({ + neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuronPortion) + }); + const IdealMatchedParticipationFunction = IDL.Record({ + serialized_representation: IDL.Opt(IDL.Text) + }); + const NeuronsFundParticipation = IDL.Record({ + total_maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), + intended_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), + direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + swap_participation_limits: IDL.Opt(SwapParticipationLimits), + max_neurons_fund_swap_participation_icp_e8s: IDL.Opt(IDL.Nat64), + neurons_fund_reserves: IDL.Opt(NeuronsFundSnapshot), + ideal_matched_participation_function: IDL.Opt(IdealMatchedParticipationFunction), + allocated_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundData = IDL.Record({ + final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) + }); + const CanisterStatusResultV2 = IDL.Record({ + status: IDL.Opt(IDL.Int32), + freezing_threshold: IDL.Opt(IDL.Nat64), + controllers: IDL.Vec(IDL.Principal), + memory_size: IDL.Opt(IDL.Nat64), + cycles: IDL.Opt(IDL.Nat64), + idle_cycles_burned_per_day: IDL.Opt(IDL.Nat64), + module_hash: IDL.Vec(IDL.Nat8) + }); + const CanisterSummary = IDL.Record({ + status: IDL.Opt(CanisterStatusResultV2), + canister_id: IDL.Opt(IDL.Principal) + }); + const SwapBackgroundInformation = IDL.Record({ + ledger_index_canister_summary: IDL.Opt(CanisterSummary), + fallback_controller_principal_ids: IDL.Vec(IDL.Principal), + ledger_archive_canister_summaries: IDL.Vec(CanisterSummary), + ledger_canister_summary: IDL.Opt(CanisterSummary), + swap_canister_summary: IDL.Opt(CanisterSummary), + governance_canister_summary: IDL.Opt(CanisterSummary), + root_canister_summary: IDL.Opt(CanisterSummary), + dapp_canister_summaries: IDL.Vec(CanisterSummary) + }); + const DerivedProposalInformation = IDL.Record({ + swap_background_information: IDL.Opt(SwapBackgroundInformation) + }); + const Tally = IDL.Record({ + no: IDL.Nat64, + yes: IDL.Nat64, + total: IDL.Nat64, + timestamp_seconds: IDL.Nat64 + }); + const TopicToFollow = IDL.Variant({ + Kyc: IDL.Null, + ServiceNervousSystemManagement: IDL.Null, + ApiBoundaryNodeManagement: IDL.Null, + ApplicationCanisterManagement: IDL.Null, + SubnetRental: IDL.Null, + NeuronManagement: IDL.Null, + NodeProviderRewards: IDL.Null, + SubnetManagement: IDL.Null, + ExchangeRate: IDL.Null, + CatchAll: IDL.Null, + NodeAdmin: IDL.Null, + IcOsVersionElection: IDL.Null, + ProtocolCanisterManagement: IDL.Null, + NetworkEconomics: IDL.Null, + IcOsVersionDeployment: IDL.Null, + ParticipantManagement: IDL.Null, + Governance: IDL.Null, + SnsAndCommunityFund: IDL.Null + }); const KnownNeuronData = IDL.Record({ name: IDL.Text, - description: IDL.Opt(IDL.Text) + committed_topics: IDL.Opt(IDL.Vec(IDL.Opt(TopicToFollow))), + description: IDL.Opt(IDL.Text), + links: IDL.Opt(IDL.Vec(IDL.Text)) }); const KnownNeuron = IDL.Record({ id: IDL.Opt(NeuronId), known_neuron_data: IDL.Opt(KnownNeuronData) }); + const FulfillSubnetRentalRequest = IDL.Record({ + user: IDL.Opt(IDL.Principal), + replica_version_id: IDL.Opt(IDL.Text), + node_ids: IDL.Opt(IDL.Vec(IDL.Principal)) + }); const Spawn = IDL.Record({ percentage_to_spawn: IDL.Opt(IDL.Nat32), new_controller: IDL.Opt(IDL.Principal), nonce: IDL.Opt(IDL.Nat64) }); - const Split = IDL.Record({amount_e8s: IDL.Nat64}); + const Split = IDL.Record({ + memo: IDL.Opt(IDL.Nat64), + amount_e8s: IDL.Nat64 + }); const Follow = IDL.Record({ topic: IDL.Int32, followees: IDL.Vec(NeuronId) @@ -34,6 +301,7 @@ export const idlFactory = ({IDL}) => { subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)) }); const DisburseMaturity = IDL.Record({ + to_account_identifier: IDL.Opt(AccountIdentifier), to_account: IDL.Opt(Account), percentage_to_disburse: IDL.Nat32 }); @@ -75,7 +343,6 @@ export const idlFactory = ({IDL}) => { 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(ProposalId) @@ -88,17 +355,23 @@ export const idlFactory = ({IDL}) => { new_controller: IDL.Opt(IDL.Principal), nonce: IDL.Nat64 }); + const FolloweesForTopic = IDL.Record({ + topic: IDL.Opt(IDL.Int32), + followees: IDL.Opt(IDL.Vec(NeuronId)) + }); + const SetFollowing = IDL.Record({ + topic_following: IDL.Opt(IDL.Vec(FolloweesForTopic)) + }); const StakeMaturity = IDL.Record({ percentage_to_stake: IDL.Opt(IDL.Nat32) }); const MergeMaturity = IDL.Record({percentage_to_merge: IDL.Nat32}); - const AccountIdentifier = IDL.Record({hash: IDL.Vec(IDL.Nat8)}); const Amount = IDL.Record({e8s: IDL.Nat64}); const Disburse = IDL.Record({ to_account: IDL.Opt(AccountIdentifier), amount: IDL.Opt(Amount) }); - const Command = IDL.Variant({ + const ManageNeuronProposalCommand = IDL.Variant({ Spawn: Spawn, Split: Split, Follow: Follow, @@ -109,6 +382,7 @@ export const idlFactory = ({IDL}) => { RegisterVote: RegisterVote, Merge: Merge, DisburseToNeuron: DisburseToNeuron, + SetFollowing: SetFollowing, MakeProposal: Proposal, StakeMaturity: StakeMaturity, MergeMaturity: MergeMaturity, @@ -118,9 +392,9 @@ export const idlFactory = ({IDL}) => { Subaccount: IDL.Vec(IDL.Nat8), NeuronId: NeuronId }); - const ManageNeuron = IDL.Record({ + const ManageNeuronProposal = IDL.Record({ id: IDL.Opt(NeuronId), - command: IDL.Opt(Command), + command: IDL.Opt(ManageNeuronProposalCommand), neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) }); const Controllers = IDL.Record({controllers: IDL.Vec(IDL.Principal)}); @@ -144,11 +418,11 @@ export const idlFactory = ({IDL}) => { arg_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), install_mode: IDL.Opt(IDL.Int32) }); + const DeregisterKnownNeuron = IDL.Record({id: IDL.Opt(NeuronId)}); 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)}); const VotingRewardParameters = IDL.Record({ @@ -232,23 +506,6 @@ export const idlFactory = ({IDL}) => { nns_function: IDL.Int32, payload: IDL.Vec(IDL.Nat8) }); - const NodeProvider = IDL.Record({ - id: IDL.Opt(IDL.Principal), - reward_account: IDL.Opt(AccountIdentifier) - }); - const RewardToNeuron = IDL.Record({dissolve_delay_seconds: IDL.Nat64}); - const RewardToAccount = IDL.Record({ - to_account: IDL.Opt(AccountIdentifier) - }); - const RewardMode = IDL.Variant({ - RewardToNeuron: RewardToNeuron, - RewardToAccount: RewardToAccount - }); - const RewardNodeProvider = IDL.Record({ - node_provider: IDL.Opt(NodeProvider), - reward_mode: IDL.Opt(RewardMode), - amount_e8s: IDL.Nat64 - }); const NeuronBasketConstructionParameters_1 = IDL.Record({ dissolve_delay_interval_seconds: IDL.Nat64, count: IDL.Nat64 @@ -289,37 +546,6 @@ export const idlFactory = ({IDL}) => { use_registry_derived_rewards: IDL.Opt(IDL.Bool), rewards: IDL.Vec(RewardNodeProvider) }); - const VotingPowerEconomics = IDL.Record({ - start_reducing_voting_power_after_seconds: IDL.Opt(IDL.Nat64), - neuron_minimum_dissolve_delay_to_vote_seconds: IDL.Opt(IDL.Nat64), - clear_following_after_seconds: IDL.Opt(IDL.Nat64) - }); - const Decimal = IDL.Record({human_readable: IDL.Opt(IDL.Text)}); - const NeuronsFundMatchedFundingCurveCoefficients = IDL.Record({ - contribution_threshold_xdr: IDL.Opt(Decimal), - one_third_participation_milestone_xdr: IDL.Opt(Decimal), - full_participation_milestone_xdr: IDL.Opt(Decimal) - }); - const NeuronsFundEconomics = IDL.Record({ - maximum_icp_xdr_rate: IDL.Opt(Percentage), - neurons_fund_matched_funding_curve_coefficients: IDL.Opt( - NeuronsFundMatchedFundingCurveCoefficients - ), - max_theoretical_neurons_fund_participation_amount_xdr: IDL.Opt(Decimal), - minimum_icp_xdr_rate: IDL.Opt(Percentage) - }); - const NetworkEconomics = IDL.Record({ - neuron_minimum_stake_e8s: IDL.Nat64, - voting_power_economics: IDL.Opt(VotingPowerEconomics), - max_proposals_to_keep_per_topic: IDL.Nat32, - neuron_management_fee_per_proposal_e8s: IDL.Nat64, - reject_cost_e8s: IDL.Nat64, - transaction_fee_e8s: IDL.Nat64, - neuron_spawn_dissolve_delay_seconds: IDL.Nat64, - minimum_icp_xdr_rate: IDL.Nat64, - maximum_node_provider_rewards_e8s: IDL.Nat64, - neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) - }); const Principals = IDL.Record({principals: IDL.Vec(IDL.Principal)}); const Change = IDL.Variant({ ToRemove: NodeProvider, @@ -329,9 +555,11 @@ export const idlFactory = ({IDL}) => { const Motion = IDL.Record({motion_text: IDL.Text}); const Action = IDL.Variant({ RegisterKnownNeuron: KnownNeuron, - ManageNeuron: ManageNeuron, + FulfillSubnetRentalRequest: FulfillSubnetRentalRequest, + ManageNeuron: ManageNeuronProposal, UpdateCanisterSettings: UpdateCanisterSettings, InstallCode: InstallCode, + DeregisterKnownNeuron: DeregisterKnownNeuron, StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, @@ -343,206 +571,38 @@ export const idlFactory = ({IDL}) => { ManageNetworkEconomics: NetworkEconomics, ApproveGenesisKyc: Principals, AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, - Motion: Motion - }); - Proposal.fill( - IDL.Record({ - url: IDL.Text, - title: IDL.Opt(IDL.Text), - action: IDL.Opt(Action), - summary: IDL.Text - }) - ); - const MakingSnsProposal = IDL.Record({ - proposal: IDL.Opt(Proposal), - caller: IDL.Opt(IDL.Principal), - proposer_id: IDL.Opt(NeuronId) - }); - 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), - 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), - deciding_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - total_staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), - total_potential_voting_power: IDL.Opt(IDL.Nat64), - total_deciding_voting_power: 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), - potential_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)) - }); - const GovernanceCachedMetrics = IDL.Record({ - total_maturity_e8s_equivalent: IDL.Nat64, - not_dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), - dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, - garbage_collectable_neurons_count: IDL.Nat64, - dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( - IDL.Tuple(IDL.Nat64, IDL.Float64) - ), - neurons_with_invalid_stake_count: IDL.Nat64, - not_dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - ect_neuron_count: IDL.Nat64, - total_supply_icp: IDL.Nat64, - neurons_with_less_than_6_months_dissolve_delay_count: IDL.Nat64, - dissolved_neurons_count: IDL.Nat64, - community_fund_total_maturity_e8s_equivalent: IDL.Nat64, - total_staked_e8s_seed: IDL.Nat64, - total_staked_maturity_e8s_equivalent_ect: IDL.Nat64, - total_staked_e8s: IDL.Nat64, - fully_lost_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), - 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)), - declining_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), - 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( - IDL.Tuple(IDL.Nat64, IDL.Float64) - ), - 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 - }); - const RestoreAgingNeuronGroup = IDL.Record({ - count: IDL.Opt(IDL.Nat64), - previous_total_stake_e8s: IDL.Opt(IDL.Nat64), - current_total_stake_e8s: IDL.Opt(IDL.Nat64), - group_type: IDL.Int32 - }); - const RestoreAgingSummary = IDL.Record({ - groups: IDL.Vec(RestoreAgingNeuronGroup), - timestamp_seconds: IDL.Opt(IDL.Nat64) - }); - const RewardEvent = IDL.Record({ - rounds_since_last_distribution: IDL.Opt(IDL.Nat64), - day_after_genesis: IDL.Nat64, - actual_timestamp_seconds: IDL.Nat64, - total_available_e8s_equivalent: IDL.Nat64, - latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), - distributed_e8s_equivalent: IDL.Nat64, - settled_proposals: IDL.Vec(ProposalId) - }); - const NeuronStakeTransfer = IDL.Record({ - to_subaccount: IDL.Vec(IDL.Nat8), - neuron_stake_e8s: IDL.Nat64, - from: IDL.Opt(IDL.Principal), - memo: IDL.Nat64, - from_subaccount: IDL.Vec(IDL.Nat8), - transfer_timestamp: IDL.Nat64, - block_height: IDL.Nat64 - }); - const Followers = IDL.Record({followers: IDL.Vec(NeuronId)}); - const FollowersMap = IDL.Record({ - followers_map: IDL.Vec(IDL.Tuple(IDL.Nat64, Followers)) - }); - const GovernanceError = IDL.Record({ - error_message: IDL.Text, - error_type: IDL.Int32 - }); - const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); - const SwapParticipationLimits = IDL.Record({ - min_participant_icp_e8s: IDL.Opt(IDL.Nat64), - max_participant_icp_e8s: IDL.Opt(IDL.Nat64), - min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), - max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) - }); - const NeuronsFundNeuronPortion = IDL.Record({ - 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), - amount_icp_e8s: IDL.Opt(IDL.Nat64) - }); - const NeuronsFundSnapshot = IDL.Record({ - neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuronPortion) - }); - const IdealMatchedParticipationFunction = IDL.Record({ - serialized_representation: IDL.Opt(IDL.Text) - }); - const NeuronsFundParticipation = IDL.Record({ - total_maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), - intended_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), - direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), - swap_participation_limits: IDL.Opt(SwapParticipationLimits), - max_neurons_fund_swap_participation_icp_e8s: IDL.Opt(IDL.Nat64), - neurons_fund_reserves: IDL.Opt(NeuronsFundSnapshot), - ideal_matched_participation_function: IDL.Opt(IdealMatchedParticipationFunction), - allocated_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64) - }); - const NeuronsFundData = IDL.Record({ - final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), - initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), - neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) - }); - const CanisterStatusResultV2 = IDL.Record({ - status: IDL.Opt(IDL.Int32), - freezing_threshold: IDL.Opt(IDL.Nat64), - controllers: IDL.Vec(IDL.Principal), - memory_size: IDL.Opt(IDL.Nat64), - cycles: IDL.Opt(IDL.Nat64), - idle_cycles_burned_per_day: IDL.Opt(IDL.Nat64), - module_hash: IDL.Vec(IDL.Nat8) - }); - const CanisterSummary = IDL.Record({ - status: IDL.Opt(CanisterStatusResultV2), - canister_id: IDL.Opt(IDL.Principal) - }); - const SwapBackgroundInformation = IDL.Record({ - ledger_index_canister_summary: IDL.Opt(CanisterSummary), - fallback_controller_principal_ids: IDL.Vec(IDL.Principal), - ledger_archive_canister_summaries: IDL.Vec(CanisterSummary), - ledger_canister_summary: IDL.Opt(CanisterSummary), - swap_canister_summary: IDL.Opt(CanisterSummary), - governance_canister_summary: IDL.Opt(CanisterSummary), - root_canister_summary: IDL.Opt(CanisterSummary), - dapp_canister_summaries: IDL.Vec(CanisterSummary) - }); - const DerivedProposalInformation = IDL.Record({ - swap_background_information: IDL.Opt(SwapBackgroundInformation) + Motion: Motion }); - const Tally = IDL.Record({ - no: IDL.Nat64, - yes: IDL.Nat64, - total: IDL.Nat64, - timestamp_seconds: IDL.Nat64 + SelfDescribingValue.fill( + IDL.Variant({ + Int: IDL.Int, + Map: IDL.Vec(IDL.Tuple(IDL.Text, SelfDescribingValue)), + Nat: IDL.Nat, + Blob: IDL.Vec(IDL.Nat8), + Text: IDL.Text, + Array: IDL.Vec(SelfDescribingValue) + }) + ); + const SelfDescribingProposalAction = IDL.Record({ + type_description: IDL.Opt(IDL.Text), + type_name: IDL.Opt(IDL.Text), + value: IDL.Opt(SelfDescribingValue) }); + Proposal.fill( + IDL.Record({ + url: IDL.Text, + title: IDL.Opt(IDL.Text), + action: IDL.Opt(Action), + summary: IDL.Text, + self_describing_action: IDL.Opt(SelfDescribingProposalAction) + }) + ); const WaitForQuietState = IDL.Record({ current_deadline_timestamp_seconds: IDL.Nat64 }); const ProposalData = IDL.Record({ id: IDL.Opt(ProposalId), + topic: IDL.Opt(IDL.Int32), failure_reason: IDL.Opt(GovernanceError), ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), proposal_timestamp_seconds: IDL.Nat64, @@ -580,6 +640,13 @@ export const idlFactory = ({IDL}) => { vote: IDL.Int32, proposal_id: IDL.Opt(ProposalId) }); + const MaturityDisbursement = IDL.Record({ + account_identifier_to_disburse_to: IDL.Opt(AccountIdentifier), + timestamp_of_disbursement_seconds: IDL.Opt(IDL.Nat64), + amount_e8s: IDL.Opt(IDL.Nat64), + account_to_disburse_to: IDL.Opt(Account), + finalize_disbursement_timestamp_seconds: IDL.Opt(IDL.Nat64) + }); const DissolveState = IDL.Variant({ DissolveDelaySeconds: IDL.Nat64, WhenDissolvedTimestampSeconds: IDL.Nat64 @@ -603,6 +670,7 @@ export const idlFactory = ({IDL}) => { hot_keys: IDL.Vec(IDL.Principal), account: IDL.Vec(IDL.Nat8), joined_community_fund_timestamp_seconds: IDL.Opt(IDL.Nat64), + maturity_disbursements_in_progress: IDL.Opt(IDL.Vec(MaturityDisbursement)), dissolve_state: IDL.Opt(DissolveState), followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), neuron_fees_e8s: IDL.Nat64, @@ -613,7 +681,6 @@ 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(MonthlyNodeProviderRewards), maturity_modulation_last_updated_at_timestamp_seconds: IDL.Opt(IDL.Nat64), wait_for_quiet_threshold_seconds: IDL.Nat64, @@ -627,7 +694,6 @@ export const idlFactory = ({IDL}) => { latest_reward_event: IDL.Opt(RewardEvent), to_claim_transfers: IDL.Vec(NeuronStakeTransfer), short_voting_period_seconds: IDL.Nat64, - topic_followee_index: IDL.Vec(IDL.Tuple(IDL.Int32, FollowersMap)), proposals: IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), xdr_conversion_rate: IDL.Opt(XdrConversionRate), in_flight_commands: IDL.Vec(IDL.Tuple(IDL.Nat64, NeuronInFlightCommand)), @@ -651,7 +717,12 @@ export const idlFactory = ({IDL}) => { Ok: MonthlyNodeProviderRewards, Err: GovernanceError }); + const GetNeuronIndexRequest = IDL.Record({ + page_size: IDL.Opt(IDL.Nat32), + exclusive_start_neuron_id: IDL.Opt(NeuronId) + }); const NeuronInfo = IDL.Record({ + id: IDL.Opt(NeuronId), dissolve_delay_seconds: IDL.Nat64, recent_ballots: IDL.Vec(BallotInfo), voting_power_refreshed_timestamp_seconds: IDL.Opt(IDL.Nat64), @@ -668,6 +739,11 @@ export const idlFactory = ({IDL}) => { voting_power: IDL.Nat64, age_seconds: IDL.Nat64 }); + const NeuronIndexData = IDL.Record({neurons: IDL.Vec(NeuronInfo)}); + const GetNeuronIndexResult = IDL.Variant({ + Ok: NeuronIndexData, + Err: GovernanceError + }); const Result_5 = IDL.Variant({Ok: NeuronInfo, Err: GovernanceError}); const GetNeuronsFundAuditInfoRequest = IDL.Record({ nns_proposal_id: IDL.Opt(ProposalId) @@ -688,6 +764,9 @@ export const idlFactory = ({IDL}) => { Ok: NodeProvider, Err: GovernanceError }); + const GetPendingProposalsRequest = IDL.Record({ + return_self_describing_action: IDL.Opt(IDL.Bool) + }); const ProposalInfo = IDL.Record({ id: IDL.Opt(ProposalId), status: IDL.Int32, @@ -711,6 +790,27 @@ export const idlFactory = ({IDL}) => { const ListKnownNeuronsResponse = IDL.Record({ known_neurons: IDL.Vec(KnownNeuron) }); + const ListNeuronVotesRequest = IDL.Record({ + before_proposal: IDL.Opt(ProposalId), + limit: IDL.Opt(IDL.Nat64), + neuron_id: IDL.Opt(NeuronId) + }); + const Vote = IDL.Variant({ + No: IDL.Null, + Yes: IDL.Null, + Unspecified: IDL.Null + }); + const NeuronVote = IDL.Record({ + vote: IDL.Opt(Vote), + proposal_id: IDL.Opt(ProposalId) + }); + const ListNeuronVotesResponse = IDL.Variant({ + Ok: IDL.Record({ + votes: IDL.Opt(IDL.Vec(NeuronVote)), + all_finalized_before_proposal: IDL.Opt(ProposalId) + }), + Err: GovernanceError + }); const NeuronSubaccount = IDL.Record({subaccount: IDL.Vec(IDL.Nat8)}); const ListNeurons = IDL.Record({ page_size: IDL.Opt(IDL.Nat64), @@ -739,7 +839,8 @@ export const idlFactory = ({IDL}) => { const ListNodeProvidersResponse = IDL.Record({ node_providers: IDL.Vec(NodeProvider) }); - const ListProposalInfo = IDL.Record({ + const ListProposalInfoRequest = IDL.Record({ + return_self_describing_action: IDL.Opt(IDL.Bool), include_reward_status: IDL.Vec(IDL.Int32), omit_large_fields: IDL.Opt(IDL.Bool), before_proposal: IDL.Opt(ProposalId), @@ -760,9 +861,11 @@ export const idlFactory = ({IDL}) => { }); const ProposalActionRequest = IDL.Variant({ RegisterKnownNeuron: KnownNeuron, + FulfillSubnetRentalRequest: FulfillSubnetRentalRequest, ManageNeuron: ManageNeuronRequest, UpdateCanisterSettings: UpdateCanisterSettings, InstallCode: InstallCodeRequest, + DeregisterKnownNeuron: DeregisterKnownNeuron, StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, @@ -790,6 +893,7 @@ export const idlFactory = ({IDL}) => { RegisterVote: RegisterVote, Merge: Merge, DisburseToNeuron: DisburseToNeuron, + SetFollowing: SetFollowing, MakeProposal: MakeProposalRequest, StakeMaturity: StakeMaturity, MergeMaturity: MergeMaturity, @@ -816,6 +920,7 @@ export const idlFactory = ({IDL}) => { target_neuron_info: IDL.Opt(NeuronInfo), source_neuron_info: IDL.Opt(NeuronInfo) }); + const SetFollowingResponse = IDL.Record({}); const MakeProposalResponse = IDL.Record({ message: IDL.Opt(IDL.Text), proposal_id: IDL.Opt(ProposalId) @@ -841,6 +946,7 @@ export const idlFactory = ({IDL}) => { RegisterVote: IDL.Record({}), Merge: MergeResponse, DisburseToNeuron: SpawnResponse, + SetFollowing: SetFollowingResponse, MakeProposal: MakeProposalResponse, StakeMaturity: StakeMaturityResponse, MergeMaturity: MergeMaturityResponse, @@ -911,6 +1017,7 @@ export const idlFactory = ({IDL}) => { ), get_network_economics_parameters: IDL.Func([], [NetworkEconomics], ['query']), get_neuron_ids: IDL.Func([], [IDL.Vec(IDL.Nat64)], ['query']), + get_neuron_index: IDL.Func([GetNeuronIndexRequest], [GetNeuronIndexResult], ['query']), get_neuron_info: IDL.Func([IDL.Nat64], [Result_5], ['query']), get_neuron_info_by_id_or_subaccount: IDL.Func([NeuronIdOrSubaccount], [Result_5], ['query']), get_neurons_fund_audit_info: IDL.Func( @@ -919,10 +1026,15 @@ export const idlFactory = ({IDL}) => { ['query'] ), get_node_provider_by_caller: IDL.Func([IDL.Null], [Result_7], ['query']), - get_pending_proposals: IDL.Func([], [IDL.Vec(ProposalInfo)], ['query']), + get_pending_proposals: IDL.Func( + [IDL.Opt(GetPendingProposalsRequest)], + [IDL.Vec(ProposalInfo)], + ['query'] + ), get_proposal_info: IDL.Func([IDL.Nat64], [IDL.Opt(ProposalInfo)], ['query']), get_restore_aging_summary: IDL.Func([], [RestoreAgingSummary], ['query']), list_known_neurons: IDL.Func([], [ListKnownNeuronsResponse], ['query']), + list_neuron_votes: IDL.Func([ListNeuronVotesRequest], [ListNeuronVotesResponse], ['query']), list_neurons: IDL.Func([ListNeurons], [ListNeuronsResponse], ['query']), list_node_provider_rewards: IDL.Func( [ListNodeProviderRewardsRequest], @@ -930,7 +1042,7 @@ export const idlFactory = ({IDL}) => { ['query'] ), list_node_providers: IDL.Func([], [ListNodeProvidersResponse], ['query']), - list_proposals: IDL.Func([ListProposalInfo], [ListProposalInfoResponse], ['query']), + list_proposals: IDL.Func([ListProposalInfoRequest], [ListProposalInfoResponse], ['query']), manage_neuron: IDL.Func([ManageNeuronRequest], [ManageNeuronResponse], []), settle_community_fund_participation: IDL.Func([SettleCommunityFundParticipation], [Result], []), settle_neurons_fund_participation: IDL.Func( @@ -942,26 +1054,293 @@ export const idlFactory = ({IDL}) => { transfer_gtc_neuron: IDL.Func([NeuronId, NeuronId], [Result], []), update_node_provider: IDL.Func([UpdateNodeProvider], [Result], []) }); -}; - -export const init = ({IDL}) => { - const Proposal = IDL.Rec(); - const NeuronId = IDL.Record({id: IDL.Nat64}); - const Followees = IDL.Record({followees: IDL.Vec(NeuronId)}); +}; + +export const init = ({IDL}) => { + const Proposal = IDL.Rec(); + const SelfDescribingValue = IDL.Rec(); + const NeuronId = IDL.Record({id: IDL.Nat64}); + const Followees = IDL.Record({followees: IDL.Vec(NeuronId)}); + const DateUtc = IDL.Record({ + day: IDL.Nat32, + month: IDL.Nat32, + year: IDL.Nat32 + }); + const AccountIdentifier = IDL.Record({hash: IDL.Vec(IDL.Nat8)}); + const NodeProvider = IDL.Record({ + id: IDL.Opt(IDL.Principal), + reward_account: IDL.Opt(AccountIdentifier) + }); + const RewardToNeuron = IDL.Record({dissolve_delay_seconds: IDL.Nat64}); + const RewardToAccount = IDL.Record({ + to_account: IDL.Opt(AccountIdentifier) + }); + const RewardMode = IDL.Variant({ + RewardToNeuron: RewardToNeuron, + RewardToAccount: RewardToAccount + }); + const RewardNodeProvider = IDL.Record({ + node_provider: IDL.Opt(NodeProvider), + reward_mode: IDL.Opt(RewardMode), + amount_e8s: IDL.Nat64 + }); + const XdrConversionRate = IDL.Record({ + xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const MonthlyNodeProviderRewards = IDL.Record({ + algorithm_version: IDL.Opt(IDL.Nat32), + minimum_xdr_permyriad_per_icp: IDL.Opt(IDL.Nat64), + end_date: IDL.Opt(DateUtc), + registry_version: IDL.Opt(IDL.Nat64), + node_providers: IDL.Vec(NodeProvider), + start_date: IDL.Opt(DateUtc), + timestamp: IDL.Nat64, + 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), + deciding_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + total_staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), + total_potential_voting_power: IDL.Opt(IDL.Nat64), + total_deciding_voting_power: 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), + potential_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)) + }); + const GovernanceCachedMetrics = IDL.Record({ + total_maturity_e8s_equivalent: IDL.Nat64, + not_dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), + dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, + garbage_collectable_neurons_count: IDL.Nat64, + dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + neurons_with_invalid_stake_count: IDL.Nat64, + not_dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + ect_neuron_count: IDL.Nat64, + total_supply_icp: IDL.Nat64, + neurons_with_less_than_6_months_dissolve_delay_count: IDL.Nat64, + dissolved_neurons_count: IDL.Nat64, + community_fund_total_maturity_e8s_equivalent: IDL.Nat64, + total_staked_e8s_seed: IDL.Nat64, + total_staked_maturity_e8s_equivalent_ect: IDL.Nat64, + total_staked_e8s: IDL.Nat64, + fully_lost_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), + 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)), + spawning_neurons_count: IDL.Nat64, + declining_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), + 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( + IDL.Tuple(IDL.Nat64, IDL.Float64) + ), + 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 + }); + const VotingPowerEconomics = IDL.Record({ + start_reducing_voting_power_after_seconds: IDL.Opt(IDL.Nat64), + neuron_minimum_dissolve_delay_to_vote_seconds: IDL.Opt(IDL.Nat64), + clear_following_after_seconds: IDL.Opt(IDL.Nat64) + }); + const Percentage = IDL.Record({basis_points: IDL.Opt(IDL.Nat64)}); + const Decimal = IDL.Record({human_readable: IDL.Opt(IDL.Text)}); + const NeuronsFundMatchedFundingCurveCoefficients = IDL.Record({ + contribution_threshold_xdr: IDL.Opt(Decimal), + one_third_participation_milestone_xdr: IDL.Opt(Decimal), + full_participation_milestone_xdr: IDL.Opt(Decimal) + }); + const NeuronsFundEconomics = IDL.Record({ + maximum_icp_xdr_rate: IDL.Opt(Percentage), + neurons_fund_matched_funding_curve_coefficients: IDL.Opt( + NeuronsFundMatchedFundingCurveCoefficients + ), + max_theoretical_neurons_fund_participation_amount_xdr: IDL.Opt(Decimal), + minimum_icp_xdr_rate: IDL.Opt(Percentage) + }); + const NetworkEconomics = IDL.Record({ + neuron_minimum_stake_e8s: IDL.Nat64, + voting_power_economics: IDL.Opt(VotingPowerEconomics), + max_proposals_to_keep_per_topic: IDL.Nat32, + neuron_management_fee_per_proposal_e8s: IDL.Nat64, + reject_cost_e8s: IDL.Nat64, + transaction_fee_e8s: IDL.Nat64, + neuron_spawn_dissolve_delay_seconds: IDL.Nat64, + minimum_icp_xdr_rate: IDL.Nat64, + maximum_node_provider_rewards_e8s: IDL.Nat64, + neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) + }); + const RestoreAgingNeuronGroup = IDL.Record({ + count: IDL.Opt(IDL.Nat64), + previous_total_stake_e8s: IDL.Opt(IDL.Nat64), + current_total_stake_e8s: IDL.Opt(IDL.Nat64), + group_type: IDL.Int32 + }); + const RestoreAgingSummary = IDL.Record({ + groups: IDL.Vec(RestoreAgingNeuronGroup), + timestamp_seconds: IDL.Opt(IDL.Nat64) + }); + const ProposalId = IDL.Record({id: IDL.Nat64}); + const RewardEvent = IDL.Record({ + rounds_since_last_distribution: IDL.Opt(IDL.Nat64), + day_after_genesis: IDL.Nat64, + actual_timestamp_seconds: IDL.Nat64, + total_available_e8s_equivalent: IDL.Nat64, + latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), + distributed_e8s_equivalent: IDL.Nat64, + settled_proposals: IDL.Vec(ProposalId) + }); + const NeuronStakeTransfer = IDL.Record({ + to_subaccount: IDL.Vec(IDL.Nat8), + neuron_stake_e8s: IDL.Nat64, + from: IDL.Opt(IDL.Principal), + memo: IDL.Nat64, + from_subaccount: IDL.Vec(IDL.Nat8), + transfer_timestamp: IDL.Nat64, + block_height: IDL.Nat64 + }); + const GovernanceError = IDL.Record({ + error_message: IDL.Text, + error_type: IDL.Int32 + }); + const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); + const SwapParticipationLimits = IDL.Record({ + min_participant_icp_e8s: IDL.Opt(IDL.Nat64), + max_participant_icp_e8s: IDL.Opt(IDL.Nat64), + min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundNeuronPortion = IDL.Record({ + 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), + amount_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundSnapshot = IDL.Record({ + neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuronPortion) + }); + const IdealMatchedParticipationFunction = IDL.Record({ + serialized_representation: IDL.Opt(IDL.Text) + }); + const NeuronsFundParticipation = IDL.Record({ + total_maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), + intended_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), + direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), + swap_participation_limits: IDL.Opt(SwapParticipationLimits), + max_neurons_fund_swap_participation_icp_e8s: IDL.Opt(IDL.Nat64), + neurons_fund_reserves: IDL.Opt(NeuronsFundSnapshot), + ideal_matched_participation_function: IDL.Opt(IdealMatchedParticipationFunction), + allocated_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64) + }); + const NeuronsFundData = IDL.Record({ + final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), + neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) + }); + const CanisterStatusResultV2 = IDL.Record({ + status: IDL.Opt(IDL.Int32), + freezing_threshold: IDL.Opt(IDL.Nat64), + controllers: IDL.Vec(IDL.Principal), + memory_size: IDL.Opt(IDL.Nat64), + cycles: IDL.Opt(IDL.Nat64), + idle_cycles_burned_per_day: IDL.Opt(IDL.Nat64), + module_hash: IDL.Vec(IDL.Nat8) + }); + const CanisterSummary = IDL.Record({ + status: IDL.Opt(CanisterStatusResultV2), + canister_id: IDL.Opt(IDL.Principal) + }); + const SwapBackgroundInformation = IDL.Record({ + ledger_index_canister_summary: IDL.Opt(CanisterSummary), + fallback_controller_principal_ids: IDL.Vec(IDL.Principal), + ledger_archive_canister_summaries: IDL.Vec(CanisterSummary), + ledger_canister_summary: IDL.Opt(CanisterSummary), + swap_canister_summary: IDL.Opt(CanisterSummary), + governance_canister_summary: IDL.Opt(CanisterSummary), + root_canister_summary: IDL.Opt(CanisterSummary), + dapp_canister_summaries: IDL.Vec(CanisterSummary) + }); + const DerivedProposalInformation = IDL.Record({ + swap_background_information: IDL.Opt(SwapBackgroundInformation) + }); + const Tally = IDL.Record({ + no: IDL.Nat64, + yes: IDL.Nat64, + total: IDL.Nat64, + timestamp_seconds: IDL.Nat64 + }); + const TopicToFollow = IDL.Variant({ + Kyc: IDL.Null, + ServiceNervousSystemManagement: IDL.Null, + ApiBoundaryNodeManagement: IDL.Null, + ApplicationCanisterManagement: IDL.Null, + SubnetRental: IDL.Null, + NeuronManagement: IDL.Null, + NodeProviderRewards: IDL.Null, + SubnetManagement: IDL.Null, + ExchangeRate: IDL.Null, + CatchAll: IDL.Null, + NodeAdmin: IDL.Null, + IcOsVersionElection: IDL.Null, + ProtocolCanisterManagement: IDL.Null, + NetworkEconomics: IDL.Null, + IcOsVersionDeployment: IDL.Null, + ParticipantManagement: IDL.Null, + Governance: IDL.Null, + SnsAndCommunityFund: IDL.Null + }); const KnownNeuronData = IDL.Record({ name: IDL.Text, - description: IDL.Opt(IDL.Text) + committed_topics: IDL.Opt(IDL.Vec(IDL.Opt(TopicToFollow))), + description: IDL.Opt(IDL.Text), + links: IDL.Opt(IDL.Vec(IDL.Text)) }); const KnownNeuron = IDL.Record({ id: IDL.Opt(NeuronId), known_neuron_data: IDL.Opt(KnownNeuronData) }); + const FulfillSubnetRentalRequest = IDL.Record({ + user: IDL.Opt(IDL.Principal), + replica_version_id: IDL.Opt(IDL.Text), + node_ids: IDL.Opt(IDL.Vec(IDL.Principal)) + }); const Spawn = IDL.Record({ percentage_to_spawn: IDL.Opt(IDL.Nat32), new_controller: IDL.Opt(IDL.Principal), nonce: IDL.Opt(IDL.Nat64) }); - const Split = IDL.Record({amount_e8s: IDL.Nat64}); + const Split = IDL.Record({ + memo: IDL.Opt(IDL.Nat64), + amount_e8s: IDL.Nat64 + }); const Follow = IDL.Record({ topic: IDL.Int32, followees: IDL.Vec(NeuronId) @@ -971,6 +1350,7 @@ export const init = ({IDL}) => { subaccount: IDL.Opt(IDL.Vec(IDL.Nat8)) }); const DisburseMaturity = IDL.Record({ + to_account_identifier: IDL.Opt(AccountIdentifier), to_account: IDL.Opt(Account), percentage_to_disburse: IDL.Nat32 }); @@ -1012,7 +1392,6 @@ export const init = ({IDL}) => { 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(ProposalId) @@ -1025,17 +1404,23 @@ export const init = ({IDL}) => { new_controller: IDL.Opt(IDL.Principal), nonce: IDL.Nat64 }); + const FolloweesForTopic = IDL.Record({ + topic: IDL.Opt(IDL.Int32), + followees: IDL.Opt(IDL.Vec(NeuronId)) + }); + const SetFollowing = IDL.Record({ + topic_following: IDL.Opt(IDL.Vec(FolloweesForTopic)) + }); const StakeMaturity = IDL.Record({ percentage_to_stake: IDL.Opt(IDL.Nat32) }); const MergeMaturity = IDL.Record({percentage_to_merge: IDL.Nat32}); - const AccountIdentifier = IDL.Record({hash: IDL.Vec(IDL.Nat8)}); const Amount = IDL.Record({e8s: IDL.Nat64}); const Disburse = IDL.Record({ to_account: IDL.Opt(AccountIdentifier), amount: IDL.Opt(Amount) }); - const Command = IDL.Variant({ + const ManageNeuronProposalCommand = IDL.Variant({ Spawn: Spawn, Split: Split, Follow: Follow, @@ -1046,6 +1431,7 @@ export const init = ({IDL}) => { RegisterVote: RegisterVote, Merge: Merge, DisburseToNeuron: DisburseToNeuron, + SetFollowing: SetFollowing, MakeProposal: Proposal, StakeMaturity: StakeMaturity, MergeMaturity: MergeMaturity, @@ -1055,9 +1441,9 @@ export const init = ({IDL}) => { Subaccount: IDL.Vec(IDL.Nat8), NeuronId: NeuronId }); - const ManageNeuron = IDL.Record({ + const ManageNeuronProposal = IDL.Record({ id: IDL.Opt(NeuronId), - command: IDL.Opt(Command), + command: IDL.Opt(ManageNeuronProposalCommand), neuron_id_or_subaccount: IDL.Opt(NeuronIdOrSubaccount) }); const Controllers = IDL.Record({controllers: IDL.Vec(IDL.Principal)}); @@ -1081,11 +1467,11 @@ export const init = ({IDL}) => { arg_hash: IDL.Opt(IDL.Vec(IDL.Nat8)), install_mode: IDL.Opt(IDL.Int32) }); + const DeregisterKnownNeuron = IDL.Record({id: IDL.Opt(NeuronId)}); 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)}); const VotingRewardParameters = IDL.Record({ @@ -1169,23 +1555,6 @@ export const init = ({IDL}) => { nns_function: IDL.Int32, payload: IDL.Vec(IDL.Nat8) }); - const NodeProvider = IDL.Record({ - id: IDL.Opt(IDL.Principal), - reward_account: IDL.Opt(AccountIdentifier) - }); - const RewardToNeuron = IDL.Record({dissolve_delay_seconds: IDL.Nat64}); - const RewardToAccount = IDL.Record({ - to_account: IDL.Opt(AccountIdentifier) - }); - const RewardMode = IDL.Variant({ - RewardToNeuron: RewardToNeuron, - RewardToAccount: RewardToAccount - }); - const RewardNodeProvider = IDL.Record({ - node_provider: IDL.Opt(NodeProvider), - reward_mode: IDL.Opt(RewardMode), - amount_e8s: IDL.Nat64 - }); const NeuronBasketConstructionParameters_1 = IDL.Record({ dissolve_delay_interval_seconds: IDL.Nat64, count: IDL.Nat64 @@ -1226,37 +1595,6 @@ export const init = ({IDL}) => { use_registry_derived_rewards: IDL.Opt(IDL.Bool), rewards: IDL.Vec(RewardNodeProvider) }); - const VotingPowerEconomics = IDL.Record({ - start_reducing_voting_power_after_seconds: IDL.Opt(IDL.Nat64), - neuron_minimum_dissolve_delay_to_vote_seconds: IDL.Opt(IDL.Nat64), - clear_following_after_seconds: IDL.Opt(IDL.Nat64) - }); - const Decimal = IDL.Record({human_readable: IDL.Opt(IDL.Text)}); - const NeuronsFundMatchedFundingCurveCoefficients = IDL.Record({ - contribution_threshold_xdr: IDL.Opt(Decimal), - one_third_participation_milestone_xdr: IDL.Opt(Decimal), - full_participation_milestone_xdr: IDL.Opt(Decimal) - }); - const NeuronsFundEconomics = IDL.Record({ - maximum_icp_xdr_rate: IDL.Opt(Percentage), - neurons_fund_matched_funding_curve_coefficients: IDL.Opt( - NeuronsFundMatchedFundingCurveCoefficients - ), - max_theoretical_neurons_fund_participation_amount_xdr: IDL.Opt(Decimal), - minimum_icp_xdr_rate: IDL.Opt(Percentage) - }); - const NetworkEconomics = IDL.Record({ - neuron_minimum_stake_e8s: IDL.Nat64, - voting_power_economics: IDL.Opt(VotingPowerEconomics), - max_proposals_to_keep_per_topic: IDL.Nat32, - neuron_management_fee_per_proposal_e8s: IDL.Nat64, - reject_cost_e8s: IDL.Nat64, - transaction_fee_e8s: IDL.Nat64, - neuron_spawn_dissolve_delay_seconds: IDL.Nat64, - minimum_icp_xdr_rate: IDL.Nat64, - maximum_node_provider_rewards_e8s: IDL.Nat64, - neurons_fund_economics: IDL.Opt(NeuronsFundEconomics) - }); const Principals = IDL.Record({principals: IDL.Vec(IDL.Principal)}); const Change = IDL.Variant({ ToRemove: NodeProvider, @@ -1266,9 +1604,11 @@ export const init = ({IDL}) => { const Motion = IDL.Record({motion_text: IDL.Text}); const Action = IDL.Variant({ RegisterKnownNeuron: KnownNeuron, - ManageNeuron: ManageNeuron, + FulfillSubnetRentalRequest: FulfillSubnetRentalRequest, + ManageNeuron: ManageNeuronProposal, UpdateCanisterSettings: UpdateCanisterSettings, InstallCode: InstallCode, + DeregisterKnownNeuron: DeregisterKnownNeuron, StopOrStartCanister: StopOrStartCanister, CreateServiceNervousSystem: CreateServiceNervousSystem, ExecuteNnsFunction: ExecuteNnsFunction, @@ -1282,204 +1622,36 @@ export const init = ({IDL}) => { AddOrRemoveNodeProvider: AddOrRemoveNodeProvider, Motion: Motion }); + SelfDescribingValue.fill( + IDL.Variant({ + Int: IDL.Int, + Map: IDL.Vec(IDL.Tuple(IDL.Text, SelfDescribingValue)), + Nat: IDL.Nat, + Blob: IDL.Vec(IDL.Nat8), + Text: IDL.Text, + Array: IDL.Vec(SelfDescribingValue) + }) + ); + const SelfDescribingProposalAction = IDL.Record({ + type_description: IDL.Opt(IDL.Text), + type_name: IDL.Opt(IDL.Text), + value: IDL.Opt(SelfDescribingValue) + }); Proposal.fill( IDL.Record({ url: IDL.Text, title: IDL.Opt(IDL.Text), action: IDL.Opt(Action), - summary: IDL.Text + summary: IDL.Text, + self_describing_action: IDL.Opt(SelfDescribingProposalAction) }) ); - const MakingSnsProposal = IDL.Record({ - proposal: IDL.Opt(Proposal), - caller: IDL.Opt(IDL.Principal), - proposer_id: IDL.Opt(NeuronId) - }); - 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), - 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), - deciding_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - total_staked_maturity_e8s_equivalent: IDL.Opt(IDL.Nat64), - total_potential_voting_power: IDL.Opt(IDL.Nat64), - total_deciding_voting_power: 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), - potential_voting_power_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)) - }); - const GovernanceCachedMetrics = IDL.Record({ - total_maturity_e8s_equivalent: IDL.Nat64, - not_dissolving_neurons_e8s_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Float64)), - dissolving_neurons_staked_maturity_e8s_equivalent_sum: IDL.Nat64, - garbage_collectable_neurons_count: IDL.Nat64, - dissolving_neurons_staked_maturity_e8s_equivalent_buckets: IDL.Vec( - IDL.Tuple(IDL.Nat64, IDL.Float64) - ), - neurons_with_invalid_stake_count: IDL.Nat64, - not_dissolving_neurons_count_buckets: IDL.Vec(IDL.Tuple(IDL.Nat64, IDL.Nat64)), - ect_neuron_count: IDL.Nat64, - total_supply_icp: IDL.Nat64, - neurons_with_less_than_6_months_dissolve_delay_count: IDL.Nat64, - dissolved_neurons_count: IDL.Nat64, - community_fund_total_maturity_e8s_equivalent: IDL.Nat64, - total_staked_e8s_seed: IDL.Nat64, - total_staked_maturity_e8s_equivalent_ect: IDL.Nat64, - total_staked_e8s: IDL.Nat64, - fully_lost_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), - 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)), - declining_voting_power_neuron_subset_metrics: IDL.Opt(NeuronSubsetMetrics), - 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( - IDL.Tuple(IDL.Nat64, IDL.Float64) - ), - 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 - }); - const RestoreAgingNeuronGroup = IDL.Record({ - count: IDL.Opt(IDL.Nat64), - previous_total_stake_e8s: IDL.Opt(IDL.Nat64), - current_total_stake_e8s: IDL.Opt(IDL.Nat64), - group_type: IDL.Int32 - }); - const RestoreAgingSummary = IDL.Record({ - groups: IDL.Vec(RestoreAgingNeuronGroup), - timestamp_seconds: IDL.Opt(IDL.Nat64) - }); - const RewardEvent = IDL.Record({ - rounds_since_last_distribution: IDL.Opt(IDL.Nat64), - day_after_genesis: IDL.Nat64, - actual_timestamp_seconds: IDL.Nat64, - total_available_e8s_equivalent: IDL.Nat64, - latest_round_available_e8s_equivalent: IDL.Opt(IDL.Nat64), - distributed_e8s_equivalent: IDL.Nat64, - settled_proposals: IDL.Vec(ProposalId) - }); - const NeuronStakeTransfer = IDL.Record({ - to_subaccount: IDL.Vec(IDL.Nat8), - neuron_stake_e8s: IDL.Nat64, - from: IDL.Opt(IDL.Principal), - memo: IDL.Nat64, - from_subaccount: IDL.Vec(IDL.Nat8), - transfer_timestamp: IDL.Nat64, - block_height: IDL.Nat64 - }); - const Followers = IDL.Record({followers: IDL.Vec(NeuronId)}); - const FollowersMap = IDL.Record({ - followers_map: IDL.Vec(IDL.Tuple(IDL.Nat64, Followers)) - }); - const GovernanceError = IDL.Record({ - error_message: IDL.Text, - error_type: IDL.Int32 - }); - const Ballot = IDL.Record({vote: IDL.Int32, voting_power: IDL.Nat64}); - const SwapParticipationLimits = IDL.Record({ - min_participant_icp_e8s: IDL.Opt(IDL.Nat64), - max_participant_icp_e8s: IDL.Opt(IDL.Nat64), - min_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), - max_direct_participation_icp_e8s: IDL.Opt(IDL.Nat64) - }); - const NeuronsFundNeuronPortion = IDL.Record({ - 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), - amount_icp_e8s: IDL.Opt(IDL.Nat64) - }); - const NeuronsFundSnapshot = IDL.Record({ - neurons_fund_neuron_portions: IDL.Vec(NeuronsFundNeuronPortion) - }); - const IdealMatchedParticipationFunction = IDL.Record({ - serialized_representation: IDL.Opt(IDL.Text) - }); - const NeuronsFundParticipation = IDL.Record({ - total_maturity_equivalent_icp_e8s: IDL.Opt(IDL.Nat64), - intended_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64), - direct_participation_icp_e8s: IDL.Opt(IDL.Nat64), - swap_participation_limits: IDL.Opt(SwapParticipationLimits), - max_neurons_fund_swap_participation_icp_e8s: IDL.Opt(IDL.Nat64), - neurons_fund_reserves: IDL.Opt(NeuronsFundSnapshot), - ideal_matched_participation_function: IDL.Opt(IdealMatchedParticipationFunction), - allocated_neurons_fund_participation_icp_e8s: IDL.Opt(IDL.Nat64) - }); - const NeuronsFundData = IDL.Record({ - final_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), - initial_neurons_fund_participation: IDL.Opt(NeuronsFundParticipation), - neurons_fund_refunds: IDL.Opt(NeuronsFundSnapshot) - }); - const CanisterStatusResultV2 = IDL.Record({ - status: IDL.Opt(IDL.Int32), - freezing_threshold: IDL.Opt(IDL.Nat64), - controllers: IDL.Vec(IDL.Principal), - memory_size: IDL.Opt(IDL.Nat64), - cycles: IDL.Opt(IDL.Nat64), - idle_cycles_burned_per_day: IDL.Opt(IDL.Nat64), - module_hash: IDL.Vec(IDL.Nat8) - }); - const CanisterSummary = IDL.Record({ - status: IDL.Opt(CanisterStatusResultV2), - canister_id: IDL.Opt(IDL.Principal) - }); - const SwapBackgroundInformation = IDL.Record({ - ledger_index_canister_summary: IDL.Opt(CanisterSummary), - fallback_controller_principal_ids: IDL.Vec(IDL.Principal), - ledger_archive_canister_summaries: IDL.Vec(CanisterSummary), - ledger_canister_summary: IDL.Opt(CanisterSummary), - swap_canister_summary: IDL.Opt(CanisterSummary), - governance_canister_summary: IDL.Opt(CanisterSummary), - root_canister_summary: IDL.Opt(CanisterSummary), - dapp_canister_summaries: IDL.Vec(CanisterSummary) - }); - const DerivedProposalInformation = IDL.Record({ - swap_background_information: IDL.Opt(SwapBackgroundInformation) - }); - const Tally = IDL.Record({ - no: IDL.Nat64, - yes: IDL.Nat64, - total: IDL.Nat64, - timestamp_seconds: IDL.Nat64 - }); const WaitForQuietState = IDL.Record({ current_deadline_timestamp_seconds: IDL.Nat64 }); const ProposalData = IDL.Record({ id: IDL.Opt(ProposalId), + topic: IDL.Opt(IDL.Int32), failure_reason: IDL.Opt(GovernanceError), ballots: IDL.Vec(IDL.Tuple(IDL.Nat64, Ballot)), proposal_timestamp_seconds: IDL.Nat64, @@ -1517,6 +1689,13 @@ export const init = ({IDL}) => { vote: IDL.Int32, proposal_id: IDL.Opt(ProposalId) }); + const MaturityDisbursement = IDL.Record({ + account_identifier_to_disburse_to: IDL.Opt(AccountIdentifier), + timestamp_of_disbursement_seconds: IDL.Opt(IDL.Nat64), + amount_e8s: IDL.Opt(IDL.Nat64), + account_to_disburse_to: IDL.Opt(Account), + finalize_disbursement_timestamp_seconds: IDL.Opt(IDL.Nat64) + }); const DissolveState = IDL.Variant({ DissolveDelaySeconds: IDL.Nat64, WhenDissolvedTimestampSeconds: IDL.Nat64 @@ -1540,6 +1719,7 @@ export const init = ({IDL}) => { hot_keys: IDL.Vec(IDL.Principal), account: IDL.Vec(IDL.Nat8), joined_community_fund_timestamp_seconds: IDL.Opt(IDL.Nat64), + maturity_disbursements_in_progress: IDL.Opt(IDL.Vec(MaturityDisbursement)), dissolve_state: IDL.Opt(DissolveState), followees: IDL.Vec(IDL.Tuple(IDL.Int32, Followees)), neuron_fees_e8s: IDL.Nat64, @@ -1550,7 +1730,6 @@ 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(MonthlyNodeProviderRewards), maturity_modulation_last_updated_at_timestamp_seconds: IDL.Opt(IDL.Nat64), wait_for_quiet_threshold_seconds: IDL.Nat64, @@ -1564,7 +1743,6 @@ export const init = ({IDL}) => { latest_reward_event: IDL.Opt(RewardEvent), to_claim_transfers: IDL.Vec(NeuronStakeTransfer), short_voting_period_seconds: IDL.Nat64, - topic_followee_index: IDL.Vec(IDL.Tuple(IDL.Int32, FollowersMap)), proposals: IDL.Vec(IDL.Tuple(IDL.Nat64, ProposalData)), xdr_conversion_rate: IDL.Opt(XdrConversionRate), in_flight_commands: IDL.Vec(IDL.Tuple(IDL.Nat64, NeuronInFlightCommand)), diff --git a/cli/src/declarations/icp_ledger.d.ts b/cli/src/declarations/icp_ledger.d.ts index a086432..a5e6255 100644 --- a/cli/src/declarations/icp_ledger.d.ts +++ b/cli/src/declarations/icp_ledger.d.ts @@ -36,6 +36,15 @@ export interface AllowanceArgs { account: Account; spender: Account; } +/** + * The allowances returned by the `get_allowances` endpoint. + */ +export type Allowances = Array<{ + from_account_id: TextAccountIdentifier; + to_spender_id: TextAccountIdentifier; + allowance: Tokens; + expires_at: [] | [bigint]; +}>; export interface ApproveArgs { fee: [] | [Icrc1Tokens]; memo: [] | [Uint8Array]; @@ -133,6 +142,21 @@ export interface Duration { export interface FeatureFlags { icrc2: boolean; } +export interface FieldsDisplay { + fields: Array<[string, Icrc21Value]>; + intent: string; +} +/** + * The arguments for the `get_allowances` endpoint. + * The `prev_spender_id` argument can be used for pagination. If specified + * the endpoint returns allowances that are lexicographically greater than + * (`from_account_id`, `prev_spender_id`) - start with spender after `prev_spender_id`. + */ +export interface GetAllowancesArgs { + prev_spender_id: [] | [TextAccountIdentifier]; + from_account_id: TextAccountIdentifier; + take: [] | [bigint]; +} export interface GetBlocksArgs { /** * The index of the first block to fetch. @@ -161,6 +185,17 @@ export type Icrc1TransferError = | {TooOld: null} | {InsufficientFunds: {balance: Icrc1Tokens}}; export type Icrc1TransferResult = {Ok: Icrc1BlockIndex} | {Err: Icrc1TransferError}; +export type Icrc21Value = + | {Text: {content: string}} + | { + TokenAmount: { + decimals: number; + amount: bigint; + symbol: string; + }; + } + | {TimestampSeconds: {amount: bigint}} + | {DurationSeconds: {amount: bigint}}; export interface InitArgs { send_whitelist: Array; token_symbol: [] | [string]; @@ -301,6 +336,11 @@ export interface QueryEncodedBlocksResponse { first_block_index: bigint; archived_blocks: Array; } +export interface RemoveApprovalArgs { + fee: [] | [Icrc1Tokens]; + from_subaccount: [] | [SubAccount]; + spender: AccountIdentifier; +} /** * Arguments for the `send_dfx` call. */ @@ -328,6 +368,10 @@ export type TextAccountIdentifier = string; export interface TimeStamp { timestamp_nanos: bigint; } +export interface TipOfChainRes { + certification: [] | [Uint8Array]; + tip_index: BlockIndex; +} /** * Amount of tokens, measured in 10^-8 of a token. */ @@ -463,7 +507,7 @@ export interface icrc21_consent_info { } export type icrc21_consent_message = | { - LineDisplayMessage: {pages: Array<{lines: Array}>}; + FieldsDisplayMessage: FieldsDisplay; } | {GenericDisplayMessage: string}; export interface icrc21_consent_message_metadata { @@ -478,17 +522,7 @@ export interface icrc21_consent_message_request { export type icrc21_consent_message_response = {Ok: icrc21_consent_info} | {Err: icrc21_error}; export interface icrc21_consent_message_spec { metadata: icrc21_consent_message_metadata; - device_spec: - | [] - | [ - | {GenericDisplay: null} - | { - LineDisplay: { - characters_per_line: number; - lines_per_page: number; - }; - } - ]; + device_spec: [] | [{GenericDisplay: null} | {FieldsDisplay: null}]; } export type icrc21_error = | { @@ -521,6 +555,7 @@ export interface _SERVICE { * Returns token decimals. */ decimals: ActorMethod<[], {decimals: number}>; + get_allowances: ActorMethod<[GetAllowancesArgs], Allowances>; icrc10_supported_standards: ActorMethod<[], Array<{url: string; name: string}>>; icrc1_balance_of: ActorMethod<[Account], Icrc1Tokens>; icrc1_decimals: ActorMethod<[], number>; @@ -556,11 +591,13 @@ export interface _SERVICE { * Queries encoded blocks in the specified range */ query_encoded_blocks: ActorMethod<[GetBlocksArgs], QueryEncodedBlocksResponse>; + remove_approval: ActorMethod<[RemoveApprovalArgs], ApproveResult>; send_dfx: ActorMethod<[SendArgs], BlockIndex>; /** * Returns token symbol. */ symbol: ActorMethod<[], {symbol: string}>; + tip_of_chain: ActorMethod<[], TipOfChainRes>; /** * Transfers tokens from a subaccount of the caller to the destination address. * The source address is computed from the principal of the caller and the specified subaccount. diff --git a/cli/src/declarations/icp_ledger.did b/cli/src/declarations/icp_ledger.did index 7466333..77d6201 100644 --- a/cli/src/declarations/icp_ledger.did +++ b/cli/src/declarations/icp_ledger.did @@ -2,12 +2,12 @@ // Amount of tokens, measured in 10^-8 of a token. type Tokens = record { - e8s : nat64; + e8s : nat64 }; // Number of nanoseconds from the UNIX epoch in UTC timezone. type TimeStamp = record { - timestamp_nanos: nat64; + timestamp_nanos : nat64 }; // AccountIdentifier is a 32-byte array. @@ -23,10 +23,10 @@ type SubAccount = blob; type BlockIndex = nat64; type Transaction = record { - memo : Memo; - icrc1_memo: opt blob; - operation : opt Operation; - created_at_time : TimeStamp; + memo : Memo; + icrc1_memo : opt blob; + operation : opt Operation; + created_at_time : TimeStamp }; // An arbitrary number associated with a transaction. @@ -35,148 +35,146 @@ type Memo = nat64; // Arguments for the `transfer` call. type TransferArgs = record { - // Transaction memo. - // See comments for the `Memo` type. - memo: Memo; - // The amount that the caller wants to transfer to the destination address. - amount: Tokens; - // The amount that the caller pays for the transaction. - // Must be 10000 e8s. - fee: Tokens; - // The subaccount from which the caller wants to transfer funds. - // If null, the ledger uses the default (all zeros) subaccount to compute the source address. - // See comments for the `SubAccount` type. - from_subaccount: opt SubAccount; - // The destination account. - // If the transfer is successful, the balance of this address increases by `amount`. - to: AccountIdentifier; - // The point in time when the caller created this request. - // If null, the ledger uses current IC time as the timestamp. - created_at_time: opt TimeStamp; + // Transaction memo. + // See comments for the `Memo` type. + memo : Memo; + // The amount that the caller wants to transfer to the destination address. + amount : Tokens; + // The amount that the caller pays for the transaction. + // Must be 10000 e8s. + fee : Tokens; + // The subaccount from which the caller wants to transfer funds. + // If null, the ledger uses the default (all zeros) subaccount to compute the source address. + // See comments for the `SubAccount` type. + from_subaccount : opt SubAccount; + // The destination account. + // If the transfer is successful, the balance of this address increases by `amount`. + to : AccountIdentifier; + // The point in time when the caller created this request. + // If null, the ledger uses current IC time as the timestamp. + created_at_time : opt TimeStamp }; type TransferError = variant { - // The fee that the caller specified in the transfer request was not the one that ledger expects. - // The caller can change the transfer fee to the `expected_fee` and retry the request. - BadFee : record { expected_fee : Tokens; }; - // The account specified by the caller doesn't have enough funds. - InsufficientFunds : record { balance: Tokens; }; - // The request is too old. - // The ledger only accepts requests created within 24 hours window. - // This is a non-recoverable error. - TxTooOld : record { allowed_window_nanos: nat64 }; - // The caller specified `created_at_time` that is too far in future. - // The caller can retry the request later. - TxCreatedInFuture : null; - // The ledger has already executed the request. - // `duplicate_of` field is equal to the index of the block containing the original transaction. - TxDuplicate : record { duplicate_of: BlockIndex; } + // The fee that the caller specified in the transfer request was not the one that ledger expects. + // The caller can change the transfer fee to the `expected_fee` and retry the request. + BadFee : record { expected_fee : Tokens }; + // The account specified by the caller doesn't have enough funds. + InsufficientFunds : record { balance : Tokens }; + // The request is too old. + // The ledger only accepts requests created within 24 hours window. + // This is a non-recoverable error. + TxTooOld : record { allowed_window_nanos : nat64 }; + // The caller specified `created_at_time` that is too far in future. + // The caller can retry the request later. + TxCreatedInFuture : null; + // The ledger has already executed the request. + // `duplicate_of` field is equal to the index of the block containing the original transaction. + TxDuplicate : record { duplicate_of : BlockIndex } }; type TransferResult = variant { - Ok : BlockIndex; - Err : TransferError; + Ok : BlockIndex; + Err : TransferError }; // Arguments for the `account_balance` call. type AccountBalanceArgs = record { - account: AccountIdentifier; + account : AccountIdentifier }; type TransferFeeArg = record {}; type TransferFee = record { - // The fee to pay to perform a transfer - transfer_fee: Tokens; + // The fee to pay to perform a transfer + transfer_fee : Tokens }; type GetBlocksArgs = record { - // The index of the first block to fetch. - start : BlockIndex; - // Max number of blocks to fetch. - length : nat64; + // The index of the first block to fetch. + start : BlockIndex; + // Max number of blocks to fetch. + length : nat64 }; type Operation = variant { - Mint : record { - to : AccountIdentifier; - amount : Tokens; - }; - Burn : record { - from : AccountIdentifier; - spender : opt AccountIdentifier; - amount : Tokens; - }; - Transfer : record { - from : AccountIdentifier; - to : AccountIdentifier; - amount : Tokens; - fee : Tokens; - spender : opt vec nat8; - }; - Approve : record { - from : AccountIdentifier; - spender : AccountIdentifier; - // This field is deprecated and should not be used. - allowance_e8s : int; - allowance: Tokens; - fee : Tokens; - expires_at : opt TimeStamp; - expected_allowance : opt Tokens; - }; -}; - - + Mint : record { + to : AccountIdentifier; + amount : Tokens + }; + Burn : record { + from : AccountIdentifier; + spender : opt AccountIdentifier; + amount : Tokens + }; + Transfer : record { + from : AccountIdentifier; + to : AccountIdentifier; + amount : Tokens; + fee : Tokens; + spender : opt vec nat8 + }; + Approve : record { + from : AccountIdentifier; + spender : AccountIdentifier; + // This field is deprecated and should not be used. + allowance_e8s : int; + allowance : Tokens; + fee : Tokens; + expires_at : opt TimeStamp; + expected_allowance : opt Tokens + } +}; type Block = record { - parent_hash : opt blob; - transaction : Transaction; - timestamp : TimeStamp; + parent_hash : opt blob; + transaction : Transaction; + timestamp : TimeStamp }; // A prefix of the block range specified in the [GetBlocksArgs] request. type BlockRange = record { - // A prefix of the requested block range. - // The index of the first block is equal to [GetBlocksArgs.from]. - // - // Note that the number of blocks might be less than the requested - // [GetBlocksArgs.len] for various reasons, for example: - // - // 1. The query might have hit the replica with an outdated state - // that doesn't have the full block range yet. - // 2. The requested range is too large to fit into a single reply. - // - // NOTE: the list of blocks can be empty if: - // 1. [GetBlocksArgs.len] was zero. - // 2. [GetBlocksArgs.from] was larger than the last block known to the canister. - blocks : vec Block; + // A prefix of the requested block range. + // The index of the first block is equal to [GetBlocksArgs.from]. + // + // Note that the number of blocks might be less than the requested + // [GetBlocksArgs.len] for various reasons, for example: + // + // 1. The query might have hit the replica with an outdated state + // that doesn't have the full block range yet. + // 2. The requested range is too large to fit into a single reply. + // + // NOTE: the list of blocks can be empty if: + // 1. [GetBlocksArgs.len] was zero. + // 2. [GetBlocksArgs.from] was larger than the last block known to the canister. + blocks : vec Block }; // An error indicating that the arguments passed to [QueryArchiveFn] were invalid. type QueryArchiveError = variant { - // [GetBlocksArgs.from] argument was smaller than the first block - // served by the canister that received the request. - BadFirstBlockIndex : record { - requested_index : BlockIndex; - first_valid_index : BlockIndex; - }; + // [GetBlocksArgs.from] argument was smaller than the first block + // served by the canister that received the request. + BadFirstBlockIndex : record { + requested_index : BlockIndex; + first_valid_index : BlockIndex + }; - // Reserved for future use. - Other : record { - error_code : nat64; - error_message : text; - }; + // Reserved for future use. + Other : record { + error_code : nat64; + error_message : text + } }; type QueryArchiveResult = variant { - // Successfully fetched zero or more blocks. - Ok : BlockRange; - // The [GetBlocksArgs] request was invalid. - Err : QueryArchiveError; + // Successfully fetched zero or more blocks. + Ok : BlockRange; + // The [GetBlocksArgs] request was invalid. + Err : QueryArchiveError }; // A function that is used for fetching archived ledger blocks. -type QueryArchiveFn = func (GetBlocksArgs) -> (QueryArchiveResult) query; +type QueryArchiveFn = func(GetBlocksArgs) -> (QueryArchiveResult) query; // The result of a "query_blocks" call. // @@ -184,89 +182,89 @@ type QueryArchiveFn = func (GetBlocksArgs) -> (QueryArchiveResult) query; // not have all the blocks that the caller requested: One or more "archive" canisters might // store some of the requested blocks. // -// Note: as of Q4 2021 when this interface is authored, the IC doesn't support making nested +// Note: as of Q4 2021 when this interface is authored, the IC doesn't support making nested // query calls within a query call. type QueryBlocksResponse = record { - // The total number of blocks in the chain. - // If the chain length is positive, the index of the last block is `chain_len - 1`. - chain_length : nat64; - - // System certificate for the hash of the latest block in the chain. - // Only present if `query_blocks` is called in a non-replicated query context. - certificate : opt blob; - - // List of blocks that were available in the ledger when it processed the call. - // - // The blocks form a contiguous range, with the first block having index - // [first_block_index] (see below), and the last block having index - // [first_block_index] + len(blocks) - 1. - // - // The block range can be an arbitrary sub-range of the originally requested range. - blocks : vec Block; - - // The index of the first block in "blocks". - // If the blocks vector is empty, the exact value of this field is not specified. - first_block_index : BlockIndex; - - // Encoding of instructions for fetching archived blocks whose indices fall into the - // requested range. - // - // For each entry `e` in [archived_blocks], `[e.from, e.from + len)` is a sub-range - // of the originally requested block range. - archived_blocks : vec ArchivedBlocksRange; + // The total number of blocks in the chain. + // If the chain length is positive, the index of the last block is `chain_len - 1`. + chain_length : nat64; + + // System certificate for the hash of the latest block in the chain. + // Only present if `query_blocks` is called in a non-replicated query context. + certificate : opt blob; + + // List of blocks that were available in the ledger when it processed the call. + // + // The blocks form a contiguous range, with the first block having index + // [first_block_index] (see below), and the last block having index + // [first_block_index] + len(blocks) - 1. + // + // The block range can be an arbitrary sub-range of the originally requested range. + blocks : vec Block; + + // The index of the first block in "blocks". + // If the blocks vector is empty, the exact value of this field is not specified. + first_block_index : BlockIndex; + + // Encoding of instructions for fetching archived blocks whose indices fall into the + // requested range. + // + // For each entry `e` in [archived_blocks], `[e.from, e.from + len)` is a sub-range + // of the originally requested block range. + archived_blocks : vec ArchivedBlocksRange }; type ArchivedBlocksRange = record { - // The index of the first archived block that can be fetched using the callback. - start : BlockIndex; + // The index of the first archived block that can be fetched using the callback. + start : BlockIndex; - // The number of blocks that can be fetch using the callback. - length : nat64; + // The number of blocks that can be fetch using the callback. + length : nat64; - // The function that should be called to fetch the archived blocks. - // The range of the blocks accessible using this function is given by [from] - // and [len] fields above. - callback : QueryArchiveFn; + // The function that should be called to fetch the archived blocks. + // The range of the blocks accessible using this function is given by [from] + // and [len] fields above. + callback : QueryArchiveFn }; type ArchivedEncodedBlocksRange = record { - callback : func (GetBlocksArgs) -> ( - variant { Ok : vec blob; Err : QueryArchiveError }, - ) query; - start : nat64; - length : nat64; + callback : func(GetBlocksArgs) -> ( + variant { Ok : vec blob; Err : QueryArchiveError } + ) query; + start : nat64; + length : nat64 }; type QueryEncodedBlocksResponse = record { - certificate : opt blob; - blocks : vec blob; - chain_length : nat64; - first_block_index : nat64; - archived_blocks : vec ArchivedEncodedBlocksRange; + certificate : opt blob; + blocks : vec blob; + chain_length : nat64; + first_block_index : nat64; + archived_blocks : vec ArchivedEncodedBlocksRange }; type Archive = record { - canister_id: principal; + canister_id : principal }; type Archives = record { - archives: vec Archive; + archives : vec Archive }; type Duration = record { - secs: nat64; - nanos: nat32; + secs : nat64; + nanos : nat32 }; type ArchiveOptions = record { - trigger_threshold : nat64; - num_blocks_to_archive : nat64; - node_max_memory_size_bytes : opt nat64; - max_message_size_bytes : opt nat64; - controller_id : principal; - more_controller_ids: opt vec principal; - cycles_for_archive_creation : opt nat64; - max_transactions_per_response : opt nat64; + trigger_threshold : nat64; + num_blocks_to_archive : nat64; + node_max_memory_size_bytes : opt nat64; + max_message_size_bytes : opt nat64; + controller_id : principal; + more_controller_ids : opt vec principal; + cycles_for_archive_creation : opt nat64; + max_transactions_per_response : opt nat64 }; // Account identifier encoded as a 64-byte ASCII hex string. @@ -274,34 +272,34 @@ type TextAccountIdentifier = text; // Arguments for the `send_dfx` call. type SendArgs = record { - memo: Memo; - amount: Tokens; - fee: Tokens; - from_subaccount: opt SubAccount; - to: TextAccountIdentifier; - created_at_time: opt TimeStamp; + memo : Memo; + amount : Tokens; + fee : Tokens; + from_subaccount : opt SubAccount; + to : TextAccountIdentifier; + created_at_time : opt TimeStamp }; type AccountBalanceArgsDfx = record { - account: TextAccountIdentifier; + account : TextAccountIdentifier }; type FeatureFlags = record { - icrc2 : bool; + icrc2 : bool }; type InitArgs = record { - minting_account: TextAccountIdentifier; - icrc1_minting_account: opt Account; - initial_values: vec record {TextAccountIdentifier; Tokens}; - max_message_size_bytes: opt nat64; - transaction_window: opt Duration; - archive_options: opt ArchiveOptions; - send_whitelist: vec principal; - transfer_fee: opt Tokens; - token_symbol: opt text; - token_name: opt text; - feature_flags : opt FeatureFlags; + minting_account : TextAccountIdentifier; + icrc1_minting_account : opt Account; + initial_values : vec record { TextAccountIdentifier; Tokens }; + max_message_size_bytes : opt nat64; + transaction_window : opt Duration; + archive_options : opt ArchiveOptions; + send_whitelist : vec principal; + transfer_fee : opt Tokens; + token_symbol : opt text; + token_name : opt text; + feature_flags : opt FeatureFlags }; type Icrc1BlockIndex = nat; @@ -310,229 +308,279 @@ type Icrc1Timestamp = nat64; type Icrc1Tokens = nat; type Account = record { - owner : principal; - subaccount : opt SubAccount; + owner : principal; + subaccount : opt SubAccount }; type TransferArg = record { - from_subaccount : opt SubAccount; - to : Account; - amount : Icrc1Tokens; - fee : opt Icrc1Tokens; - memo : opt blob; - created_at_time: opt Icrc1Timestamp; + from_subaccount : opt SubAccount; + to : Account; + amount : Icrc1Tokens; + fee : opt Icrc1Tokens; + memo : opt blob; + created_at_time : opt Icrc1Timestamp }; type Icrc1TransferError = variant { - BadFee : record { expected_fee : Icrc1Tokens }; - BadBurn : record { min_burn_amount : Icrc1Tokens }; - InsufficientFunds : record { balance : Icrc1Tokens }; - TooOld; - CreatedInFuture : record { ledger_time : nat64 }; - TemporarilyUnavailable; - Duplicate : record { duplicate_of : Icrc1BlockIndex }; - GenericError : record { error_code : nat; message : text }; + BadFee : record { expected_fee : Icrc1Tokens }; + BadBurn : record { min_burn_amount : Icrc1Tokens }; + InsufficientFunds : record { balance : Icrc1Tokens }; + TooOld; + CreatedInFuture : record { ledger_time : nat64 }; + TemporarilyUnavailable; + Duplicate : record { duplicate_of : Icrc1BlockIndex }; + GenericError : record { error_code : nat; message : text } }; type Icrc1TransferResult = variant { - Ok : Icrc1BlockIndex; - Err : Icrc1TransferError; + Ok : Icrc1BlockIndex; + Err : Icrc1TransferError }; // The value returned from the [icrc1_metadata] endpoint. type Value = variant { - Nat : nat; - Int : int; - Text : text; - Blob : blob; + Nat : nat; + Int : int; + Text : text; + Blob : blob }; type UpgradeArgs = record { icrc1_minting_account : opt Account; - feature_flags : opt FeatureFlags; + feature_flags : opt FeatureFlags }; type LedgerCanisterPayload = variant { - Init: InitArgs; - Upgrade: opt UpgradeArgs; + Init : InitArgs; + Upgrade : opt UpgradeArgs }; type ApproveArgs = record { - from_subaccount : opt SubAccount; - spender : Account; - amount : Icrc1Tokens; - expected_allowance : opt Icrc1Tokens; - expires_at : opt Icrc1Timestamp; - fee : opt Icrc1Tokens; - memo : opt blob; - created_at_time: opt Icrc1Timestamp; + from_subaccount : opt SubAccount; + spender : Account; + amount : Icrc1Tokens; + expected_allowance : opt Icrc1Tokens; + expires_at : opt Icrc1Timestamp; + fee : opt Icrc1Tokens; + memo : opt blob; + created_at_time : opt Icrc1Timestamp }; type ApproveError = variant { - BadFee : record { expected_fee : Icrc1Tokens }; - InsufficientFunds : record { balance : Icrc1Tokens }; - AllowanceChanged : record { current_allowance : Icrc1Tokens }; - Expired : record { ledger_time : nat64 }; - TooOld; - CreatedInFuture : record { ledger_time : nat64 }; - Duplicate : record { duplicate_of : Icrc1BlockIndex }; - TemporarilyUnavailable; - GenericError : record { error_code : nat; message : text }; + BadFee : record { expected_fee : Icrc1Tokens }; + InsufficientFunds : record { balance : Icrc1Tokens }; + AllowanceChanged : record { current_allowance : Icrc1Tokens }; + Expired : record { ledger_time : nat64 }; + TooOld; + CreatedInFuture : record { ledger_time : nat64 }; + Duplicate : record { duplicate_of : Icrc1BlockIndex }; + TemporarilyUnavailable; + GenericError : record { error_code : nat; message : text } }; type ApproveResult = variant { - Ok : Icrc1BlockIndex; - Err : ApproveError; + Ok : Icrc1BlockIndex; + Err : ApproveError }; type AllowanceArgs = record { - account : Account; - spender : Account; + account : Account; + spender : Account }; type Allowance = record { - allowance : Icrc1Tokens; - expires_at : opt Icrc1Timestamp; + allowance : Icrc1Tokens; + expires_at : opt Icrc1Timestamp }; type TransferFromArgs = record { - spender_subaccount : opt SubAccount; - from : Account; - to : Account; - amount : Icrc1Tokens; - fee : opt Icrc1Tokens; - memo : opt blob; - created_at_time: opt Icrc1Timestamp; + spender_subaccount : opt SubAccount; + from : Account; + to : Account; + amount : Icrc1Tokens; + fee : opt Icrc1Tokens; + memo : opt blob; + created_at_time : opt Icrc1Timestamp }; type TransferFromResult = variant { - Ok : Icrc1BlockIndex; - Err : TransferFromError; + Ok : Icrc1BlockIndex; + Err : TransferFromError }; type TransferFromError = variant { - BadFee : record { expected_fee : Icrc1Tokens }; - BadBurn : record { min_burn_amount : Icrc1Tokens }; - InsufficientFunds : record { balance : Icrc1Tokens }; - InsufficientAllowance : record { allowance : Icrc1Tokens }; - TooOld; - CreatedInFuture : record { ledger_time : Icrc1Timestamp }; - Duplicate : record { duplicate_of : Icrc1BlockIndex }; - TemporarilyUnavailable; - GenericError : record { error_code : nat; message : text }; + BadFee : record { expected_fee : Icrc1Tokens }; + BadBurn : record { min_burn_amount : Icrc1Tokens }; + InsufficientFunds : record { balance : Icrc1Tokens }; + InsufficientAllowance : record { allowance : Icrc1Tokens }; + TooOld; + CreatedInFuture : record { ledger_time : Icrc1Timestamp }; + Duplicate : record { duplicate_of : Icrc1BlockIndex }; + TemporarilyUnavailable; + GenericError : record { error_code : nat; message : text } }; type icrc21_consent_message_metadata = record { - language: text; - utc_offset_minutes: opt int16; + language : text; + utc_offset_minutes : opt int16 }; type icrc21_consent_message_spec = record { - metadata: icrc21_consent_message_metadata; - device_spec: opt variant { - GenericDisplay; - LineDisplay: record { - characters_per_line: nat16; - lines_per_page: nat16; - }; - }; + metadata : icrc21_consent_message_metadata; + device_spec : opt variant { + GenericDisplay; + FieldsDisplay + } }; type icrc21_consent_message_request = record { - method: text; - arg: blob; - user_preferences: icrc21_consent_message_spec; + method : text; + arg : blob; + user_preferences : icrc21_consent_message_spec +}; + +type Icrc21Value = variant { + TokenAmount : record { + decimals : nat8; + amount : nat64; + symbol : text + }; + TimestampSeconds : record { + amount : nat64 + }; + DurationSeconds : record { + amount : nat64 + }; + Text : record { + content : text + } +}; + +type FieldsDisplay = record { + intent : text; + fields : vec record { text; Icrc21Value } }; type icrc21_consent_message = variant { - GenericDisplayMessage: text; - LineDisplayMessage: record { - pages: vec record { - lines: vec text; - }; - }; + GenericDisplayMessage : text; + FieldsDisplayMessage : FieldsDisplay }; type icrc21_consent_info = record { - consent_message: icrc21_consent_message; - metadata: icrc21_consent_message_metadata; + consent_message : icrc21_consent_message; + metadata : icrc21_consent_message_metadata }; type icrc21_error_info = record { - description: text; + description : text }; type icrc21_error = variant { - UnsupportedCanisterCall: icrc21_error_info; - ConsentMessageUnavailable: icrc21_error_info; - InsufficientPayment: icrc21_error_info; + UnsupportedCanisterCall : icrc21_error_info; + ConsentMessageUnavailable : icrc21_error_info; + InsufficientPayment : icrc21_error_info; - // Any error not covered by the above variants. - GenericError: record { - error_code: nat; - description: text; - }; + // Any error not covered by the above variants. + GenericError : record { + error_code : nat; + description : text + } }; type icrc21_consent_message_response = variant { - Ok: icrc21_consent_info; - Err: icrc21_error; -}; - -service: (LedgerCanisterPayload) -> { - // Transfers tokens from a subaccount of the caller to the destination address. - // The source address is computed from the principal of the caller and the specified subaccount. - // When successful, returns the index of the block containing the transaction. - transfer : (TransferArgs) -> (TransferResult); - - // Returns the amount of Tokens on the specified account. - account_balance : (AccountBalanceArgs) -> (Tokens) query; - - // Returns the account identifier for the given Principal and subaccount. - account_identifier : (Account) -> (AccountIdentifier) query; - - // Returns the current transfer_fee. - transfer_fee : (TransferFeeArg) -> (TransferFee) query; - - // Queries blocks in the specified range. - query_blocks : (GetBlocksArgs) -> (QueryBlocksResponse) query; - - // Queries encoded blocks in the specified range - query_encoded_blocks : (GetBlocksArgs) -> (QueryEncodedBlocksResponse) query; - - // Returns token symbol. - symbol : () -> (record { symbol: text }) query; - - // Returns token name. - name : () -> (record { name: text }) query; - - // Returns token decimals. - decimals : () -> (record { decimals: nat32 }) query; - - // Returns the existing archive canisters information. - archives : () -> (Archives) query; - - send_dfx : (SendArgs) -> (BlockIndex); - account_balance_dfx : (AccountBalanceArgsDfx) -> (Tokens) query; - - // The following methods implement the ICRC-1 Token Standard. - // https://github.com/dfinity/ICRC-1/tree/main/standards/ICRC-1 - icrc1_name : () -> (text) query; - icrc1_symbol : () -> (text) query; - icrc1_decimals : () -> (nat8) query; - icrc1_metadata : () -> (vec record { text; Value }) query; - icrc1_total_supply : () -> (Icrc1Tokens) query; - icrc1_fee : () -> (Icrc1Tokens) query; - icrc1_minting_account : () -> (opt Account) query; - icrc1_balance_of : (Account) -> (Icrc1Tokens) query; - icrc1_transfer : (TransferArg) -> (Icrc1TransferResult); - icrc1_supported_standards : () -> (vec record { name : text; url : text }) query; - icrc2_approve : (ApproveArgs) -> (ApproveResult); - icrc2_allowance : (AllowanceArgs) -> (Allowance) query; - icrc2_transfer_from : (TransferFromArgs) -> (TransferFromResult); - - icrc21_canister_call_consent_message: (icrc21_consent_message_request) -> (icrc21_consent_message_response); - icrc10_supported_standards : () -> (vec record { name : text; url : text }) query; - - is_ledger_ready: () -> (bool) query; + Ok : icrc21_consent_info; + Err : icrc21_error +}; + +// The arguments for the `get_allowances` endpoint. +// The `prev_spender_id` argument can be used for pagination. If specified +// the endpoint returns allowances that are lexicographically greater than +// (`from_account_id`, `prev_spender_id`) - start with spender after `prev_spender_id`. +type GetAllowancesArgs = record { + from_account_id : TextAccountIdentifier; + prev_spender_id : opt TextAccountIdentifier; + take : opt nat64 +}; + +// The allowances returned by the `get_allowances` endpoint. +type Allowances = vec record { + from_account_id : TextAccountIdentifier; + to_spender_id : TextAccountIdentifier; + allowance : Tokens; + expires_at : opt nat64 +}; + +type TipOfChainRes = record { + certification : opt blob; + tip_index : BlockIndex +}; + +type RemoveApprovalArgs = record { + from_subaccount : opt SubAccount; + spender : AccountIdentifier; + fee : opt Icrc1Tokens +}; + +service : (LedgerCanisterPayload) -> { + // Transfers tokens from a subaccount of the caller to the destination address. + // The source address is computed from the principal of the caller and the specified subaccount. + // When successful, returns the index of the block containing the transaction. + transfer : (TransferArgs) -> (TransferResult); + + // Returns the amount of Tokens on the specified account. + account_balance : (AccountBalanceArgs) -> (Tokens) query; + + // Returns the account identifier for the given Principal and subaccount. + account_identifier : (Account) -> (AccountIdentifier) query; + + // Returns the current transfer_fee. + transfer_fee : (TransferFeeArg) -> (TransferFee) query; + + // Queries blocks in the specified range. + query_blocks : (GetBlocksArgs) -> (QueryBlocksResponse) query; + + // Queries encoded blocks in the specified range + query_encoded_blocks : (GetBlocksArgs) -> (QueryEncodedBlocksResponse) query; + + // Returns token symbol. + symbol : () -> (record { symbol : text }) query; + + // Returns token name. + name : () -> (record { name : text }) query; + + // Returns token decimals. + decimals : () -> (record { decimals : nat32 }) query; + + // Returns the existing archive canisters information. + archives : () -> (Archives) query; + + send_dfx : (SendArgs) -> (BlockIndex); + account_balance_dfx : (AccountBalanceArgsDfx) -> (Tokens) query; + + // The following methods implement the ICRC-1 Token Standard. + // https://github.com/dfinity/ICRC-1/tree/main/standards/ICRC-1 + icrc1_name : () -> (text) query; + icrc1_symbol : () -> (text) query; + icrc1_decimals : () -> (nat8) query; + icrc1_metadata : () -> (vec record { text; Value }) query; + icrc1_total_supply : () -> (Icrc1Tokens) query; + icrc1_fee : () -> (Icrc1Tokens) query; + icrc1_minting_account : () -> (opt Account) query; + icrc1_balance_of : (Account) -> (Icrc1Tokens) query; + icrc1_transfer : (TransferArg) -> (Icrc1TransferResult); + icrc1_supported_standards : () -> (vec record { name : text; url : text }) query; + icrc2_approve : (ApproveArgs) -> (ApproveResult); + icrc2_allowance : (AllowanceArgs) -> (Allowance) query; + icrc2_transfer_from : (TransferFromArgs) -> (TransferFromResult); + + remove_approval : (RemoveApprovalArgs) -> (ApproveResult); + + icrc21_canister_call_consent_message : (icrc21_consent_message_request) -> (icrc21_consent_message_response); + icrc10_supported_standards : () -> (vec record { name : text; url : text }) query; + + get_allowances : (GetAllowancesArgs) -> (Allowances) query; + + tip_of_chain : () -> (TipOfChainRes) query; + + is_ledger_ready : () -> (bool) query } diff --git a/cli/src/declarations/icp_ledger.idl.js b/cli/src/declarations/icp_ledger.idl.js index 3fbac0a..d94d373 100644 --- a/cli/src/declarations/icp_ledger.idl.js +++ b/cli/src/declarations/icp_ledger.idl.js @@ -54,6 +54,19 @@ export const idlFactory = ({IDL}) => { }); const Archive = IDL.Record({canister_id: IDL.Principal}); const Archives = IDL.Record({archives: IDL.Vec(Archive)}); + const GetAllowancesArgs = IDL.Record({ + prev_spender_id: IDL.Opt(TextAccountIdentifier), + from_account_id: TextAccountIdentifier, + take: IDL.Opt(IDL.Nat64) + }); + const Allowances = IDL.Vec( + IDL.Record({ + from_account_id: TextAccountIdentifier, + to_spender_id: TextAccountIdentifier, + allowance: Tokens, + expires_at: IDL.Opt(IDL.Nat64) + }) + ); const Icrc1Tokens = IDL.Nat; const Value = IDL.Variant({ Int: IDL.Int, @@ -94,25 +107,29 @@ export const idlFactory = ({IDL}) => { }); const icrc21_consent_message_spec = IDL.Record({ metadata: icrc21_consent_message_metadata, - device_spec: IDL.Opt( - IDL.Variant({ - GenericDisplay: IDL.Null, - LineDisplay: IDL.Record({ - characters_per_line: IDL.Nat16, - lines_per_page: IDL.Nat16 - }) - }) - ) + device_spec: IDL.Opt(IDL.Variant({GenericDisplay: IDL.Null, FieldsDisplay: IDL.Null})) }); const icrc21_consent_message_request = IDL.Record({ arg: IDL.Vec(IDL.Nat8), method: IDL.Text, user_preferences: icrc21_consent_message_spec }); - const icrc21_consent_message = IDL.Variant({ - LineDisplayMessage: IDL.Record({ - pages: IDL.Vec(IDL.Record({lines: IDL.Vec(IDL.Text)})) + const Icrc21Value = IDL.Variant({ + Text: IDL.Record({content: IDL.Text}), + TokenAmount: IDL.Record({ + decimals: IDL.Nat8, + amount: IDL.Nat64, + symbol: IDL.Text }), + TimestampSeconds: IDL.Record({amount: IDL.Nat64}), + DurationSeconds: IDL.Record({amount: IDL.Nat64}) + }); + const FieldsDisplay = IDL.Record({ + fields: IDL.Vec(IDL.Tuple(IDL.Text, Icrc21Value)), + intent: IDL.Text + }); + const icrc21_consent_message = IDL.Variant({ + FieldsDisplayMessage: FieldsDisplay, GenericDisplayMessage: IDL.Text }); const icrc21_consent_info = IDL.Record({ @@ -287,6 +304,11 @@ export const idlFactory = ({IDL}) => { first_block_index: IDL.Nat64, archived_blocks: IDL.Vec(ArchivedEncodedBlocksRange) }); + const RemoveApprovalArgs = IDL.Record({ + fee: IDL.Opt(Icrc1Tokens), + from_subaccount: IDL.Opt(SubAccount), + spender: AccountIdentifier + }); const SendArgs = IDL.Record({ to: TextAccountIdentifier, fee: Tokens, @@ -295,6 +317,10 @@ export const idlFactory = ({IDL}) => { created_at_time: IDL.Opt(TimeStamp), amount: Tokens }); + const TipOfChainRes = IDL.Record({ + certification: IDL.Opt(IDL.Vec(IDL.Nat8)), + tip_index: BlockIndex + }); const TransferArgs = IDL.Record({ to: AccountIdentifier, fee: Tokens, @@ -323,6 +349,7 @@ export const idlFactory = ({IDL}) => { account_identifier: IDL.Func([Account], [AccountIdentifier], ['query']), archives: IDL.Func([], [Archives], ['query']), decimals: IDL.Func([], [IDL.Record({decimals: IDL.Nat32})], ['query']), + get_allowances: IDL.Func([GetAllowancesArgs], [Allowances], ['query']), icrc10_supported_standards: IDL.Func( [], [IDL.Vec(IDL.Record({url: IDL.Text, name: IDL.Text}))], @@ -354,8 +381,10 @@ export const idlFactory = ({IDL}) => { name: IDL.Func([], [IDL.Record({name: IDL.Text})], ['query']), query_blocks: IDL.Func([GetBlocksArgs], [QueryBlocksResponse], ['query']), query_encoded_blocks: IDL.Func([GetBlocksArgs], [QueryEncodedBlocksResponse], ['query']), + remove_approval: IDL.Func([RemoveApprovalArgs], [ApproveResult], []), send_dfx: IDL.Func([SendArgs], [BlockIndex], []), symbol: IDL.Func([], [IDL.Record({symbol: IDL.Text})], ['query']), + tip_of_chain: IDL.Func([], [TipOfChainRes], ['query']), transfer: IDL.Func([TransferArgs], [TransferResult], []), transfer_fee: IDL.Func([TransferFeeArg], [TransferFee], ['query']) }); diff --git a/cli/src/declarations/internet_identity.d.ts b/cli/src/declarations/internet_identity.d.ts index 27b6822..7c62afd 100644 --- a/cli/src/declarations/internet_identity.d.ts +++ b/cli/src/declarations/internet_identity.d.ts @@ -10,7 +10,12 @@ import type {ActorMethod} from '@icp-sdk/core/agent'; import type {IDL} from '@icp-sdk/core/candid'; import type {Principal} from '@icp-sdk/core/principal'; -export interface Account { +export type Aaguid = Uint8Array; +export type AccountDelegationError = + | {NoSuchDelegation: null} + | {InternalCanisterError: string} + | {Unauthorized: Principal}; +export interface AccountInfo { /** * Configurable properties */ @@ -113,12 +118,16 @@ export interface AuthnMethodConfirmationCode { expiration: Timestamp; } export type AuthnMethodConfirmationError = + | { + InternalCanisterError: string; + } | { /** * Authentication method registration mode is off, either due to timeout or because it was never enabled. */ RegistrationModeOff: null; } + | {Unauthorized: Principal} | { /** * There is no registered authentication method to be confirmed. @@ -190,12 +199,30 @@ export interface AuthnMethodRegistrationInfo { */ expiration: Timestamp; /** - * If present, the user has registered a new authentication method. This - * new authentication needs to be verified before 'expiration' in order to - * be added to the identity. + * If present, the user has registered a new session. This new session needs to be confirmed before + * 'expiration' in order for it be authorized to register an authentication method to the identity. + */ + session: [] | [Principal]; + /** + * If present, the user has registered a new authentication method. This new authentication + * method needs to be confirmed before 'expiration' in order to be added to the identity. */ authn_method: [] | [AuthnMethodData]; } +export type AuthnMethodRegistrationModeEnterError = + | { + InvalidRegistrationId: string; + } + | {InternalCanisterError: string} + | {AlreadyInProgress: null} + | {Unauthorized: Principal}; +export type AuthnMethodRegistrationModeExitError = + | { + InternalCanisterError: string; + } + | {RegistrationModeOff: null} + | {Unauthorized: Principal} + | {InvalidMetadata: string}; export type AuthnMethodReplaceError = | { /** @@ -214,6 +241,10 @@ export type AuthnMethodSecuritySettingsReplaceError = { */ AuthnMethodNotFound: null; }; +export interface AuthnMethodSessionInfo { + name: [] | [string]; + created_at: [] | [Timestamp]; +} export interface BufferedArchiveEntry { sequence_number: bigint; entry: Uint8Array; @@ -294,7 +325,11 @@ export type CheckCaptchaError = */ WrongSolution: {new_captcha_png_base64: string}; }; -export type CreateAccountError = {InternalCanisterError: string}; +export type CreateAccountError = + | {AccountLimitReached: null} + | {InternalCanisterError: string} + | {Unauthorized: Principal} + | {NameTooLong: null}; export type CredentialId = Uint8Array; export interface Delegation { pubkey: PublicKey; @@ -336,6 +371,7 @@ export interface DeviceData { protection: DeviceProtection; pubkey: DeviceKey; key_type: KeyType; + aaguid: [] | [Aaguid]; purpose: Purpose; credential_id: [] | [CredentialId]; } @@ -355,9 +391,8 @@ export type DeviceProtection = {unprotected: null} | {protected: null}; */ export interface DeviceRegistrationInfo { /** - * If present, the user has tentatively added a new device. This - * new device needs to be verified (see relevant endpoint) before - * 'expiration'. + * If present, the user has registered a new authentication method. This new authentication + * method needs to be confirmed before 'expiration' in order to be added to the identity. */ tentative_device: [] | [DeviceData]; /** @@ -365,6 +400,11 @@ export interface DeviceRegistrationInfo { * (and the tentative device will be forgotten, if any, and if not verified) */ expiration: Timestamp; + /** + * If present, the user has registered a new session. This new session needs to be confirmed before + * 'expiration' in order for it be authorized to register an authentication method to the identity. + */ + tentative_session: [] | [Principal]; } /** * The same as `DeviceData` but with the `last_usage` field. @@ -378,10 +418,26 @@ export interface DeviceWithUsage { protection: DeviceProtection; pubkey: DeviceKey; key_type: KeyType; + aaguid: [] | [Aaguid]; purpose: Purpose; credential_id: [] | [CredentialId]; } +export interface DummyAuthConfig { + /** + * Prompts user for a index value (0 - 255) when set to true, + * this is used in e2e to have multiple dummy auth identities. + */ + prompt_for_index: boolean; +} export type FrontendHostname = string; +export type GetAccountsError = {InternalCanisterError: string} | {Unauthorized: Principal}; +export type GetDefaultAccountError = + | { + NoSuchOrigin: {anchor_number: UserNumber}; + } + | {NoSuchAnchor: null} + | {InternalCanisterError: string} + | {Unauthorized: Principal}; export type GetDelegationResponse = | { /** @@ -471,12 +527,6 @@ export type IdRegFinishError = */ InvalidAuthnMethod: string; } - | { - /** - * The configured maximum number of identities has been reached. - */ - IdentityLimitReached: null; - } | { /** * Error while persisting the new identity. @@ -519,6 +569,10 @@ export interface IdentityAnchorInfo { * The name of the Internet Identity */ name: [] | [string]; + /** + * The timestamp at which the anchor was created + */ + created_at: [] | [Timestamp]; /** * All devices that can authenticate to this anchor */ @@ -542,6 +596,11 @@ export interface IdentityInfo { * Authentication method independent metadata */ metadata: MetadataMapV2; + name: [] | [string]; + /** + * The timestamp at which the anchor was created + */ + created_at: [] | [Timestamp]; authn_method_registration: [] | [AuthnMethodRegistrationInfo]; openid_credentials: [] | [Array]; } @@ -581,13 +640,28 @@ export type IdentityMetadataReplaceError = }; }; export type IdentityNumber = bigint; +export interface IdentityPropertiesReplace { + name: [] | [string]; +} +export type IdentityPropertiesReplaceError = + | { + InternalCanisterError: string; + } + | {Unauthorized: Principal} + | {NameTooLong: {limit: bigint}} + | { + StorageSpaceExceeded: { + space_required: bigint; + space_available: bigint; + }; + }; /** * Init arguments of II which can be supplied on install and upgrade. * * Each field is wrapped is `opt` to indicate whether the field should * keep the previous value or update to a new value (e.g. `null` keeps the previous value). * - * Some fields, like `openid_google`, have an additional nested `opt`, this indicates + * Some fields, like `analytics_config`, have an additional nested `opt`, this indicates * enable/disable status (e.g. `opt null` disables a feature while `null` leaves it untouched). */ export interface InternetIdentityInit { @@ -595,10 +669,6 @@ export interface InternetIdentityInit { * Configuration to fetch root key or not from frontend assets */ fetch_root_key: [] | [boolean]; - /** - * Configuration for OpenID Google client - */ - openid_google: [] | [[] | [OpenIdConfig]]; /** * Configuration to set the canister as production mode. * For now, this is used only to show or hide the banner. @@ -612,6 +682,11 @@ export interface InternetIdentityInit { * Set lowest and highest anchor */ assigned_user_number_range: [] | [[bigint, bigint]]; + /** + * Configuration for New Origin Flows. + * If present, list of origins using the new authentication flow. + */ + new_flow_origins: [] | [Array]; /** * Configuration parameters related to the II archive. * Note: some parameters changes (like the polling interval) will only take effect after an archive deployment. @@ -634,10 +709,18 @@ export interface InternetIdentityInit { * If present, list of origins from where registration is allowed. */ related_origins: [] | [Array]; + /** + * Configurations for OpenID clients + */ + openid_configs: [] | [Array]; /** * Configuration of the captcha in the registration flow. */ captcha_config: [] | [CaptchaConfig]; + /** + * Configuration for dummy authentication used in e2e tests. + */ + dummy_auth: [] | [[] | [DummyAuthConfig]]; /** * Rate limit for the `register` call. */ @@ -663,6 +746,7 @@ export type KeyType = | {cross_platform: null} | {unknown: null} | {browser_storage_key: null}; +export type LookupByRegistrationIdError = {InvalidRegistrationId: string}; /** * Map with some variants for the value type. * Note, due to the Candid mapping this must be a tuple type thus we cannot name the fields `key` and `value`. @@ -679,9 +763,17 @@ export type MetadataMapV2 = Array< >; export interface OpenIDRegFinishArg { jwt: JWT; + name: string; salt: Salt; } export interface OpenIdConfig { + auth_uri: string; + jwks_uri: string; + logo: string; + name: string; + fedcm_uri: [] | [string]; + issuer: string; + auth_scope: Array; client_id: string; } export interface OpenIdCredential { @@ -696,6 +788,7 @@ export type OpenIdCredentialAddError = OpenIdCredentialAlreadyRegistered: null; } | {InternalCanisterError: string} + | {JwtExpired: null} | {Unauthorized: Principal} | {JwtVerificationFailed: null}; export type OpenIdCredentialKey = [Iss, Sub]; @@ -706,12 +799,17 @@ export type OpenIdCredentialRemoveError = export type OpenIdDelegationError = | {NoSuchDelegation: null} | {NoSuchAnchor: null} + | {JwtExpired: null} | {JwtVerificationFailed: null}; export interface OpenIdPrepareDelegationResponse { user_key: UserKey; expiration: Timestamp; anchor_number: UserNumber; } +export interface PrepareAccountDelegation { + user_key: UserKey; + expiration: Timestamp; +} export type PrepareIdAliasError = | { /** @@ -809,8 +907,22 @@ export type RegistrationFlowNextStep = */ Finish: null; }; +export type RegistrationId = string; export type Salt = Uint8Array; export type SessionKey = PublicKey; +export type SetDefaultAccountError = + | { + NoSuchOrigin: {anchor_number: UserNumber}; + } + | {NoSuchAnchor: null} + | {InternalCanisterError: string} + | {Unauthorized: Principal} + | { + NoSuchAccount: { + origin: FrontendHostname; + anchor_number: UserNumber; + }; + }; export interface SignedDelegation { signature: Uint8Array; delegation: Delegation; @@ -830,7 +942,11 @@ export type StreamingStrategy = { export type Sub = string; export type Timestamp = bigint; export type Token = {}; -export type UpdateAccountError = {InternalCanisterError: string}; +export type UpdateAccountError = + | {AccountLimitReached: null} + | {InternalCanisterError: string} + | {Unauthorized: Principal} + | {NameTooLong: null}; export type UserKey = PublicKey; export type UserNumber = bigint; export type VerifyTentativeDeviceResponse = @@ -866,6 +982,10 @@ export type VerifyTentativeDeviceResponse = */ export interface WebAuthn { pubkey: PublicKey; + /** + * Authenticator Attestation Global Unique Identifier (AAGUID) + */ + aaguid: [] | [Aaguid]; credential_id: CredentialId; } export interface WebAuthnCredential { @@ -919,14 +1039,17 @@ export interface _SERVICE { * Requires authentication. */ authn_method_registration_mode_enter: ActorMethod< - [IdentityNumber], - {Ok: {expiration: Timestamp}} | {Err: null} + [IdentityNumber, [] | [RegistrationId]], + {Ok: {expiration: Timestamp}} | {Err: AuthnMethodRegistrationModeEnterError} >; /** * Exits the authentication method registration mode for the identity. * Requires authentication. */ - authn_method_registration_mode_exit: ActorMethod<[IdentityNumber], {Ok: null} | {Err: null}>; + authn_method_registration_mode_exit: ActorMethod< + [IdentityNumber, [] | [AuthnMethodData]], + {Ok: null} | {Err: AuthnMethodRegistrationModeExitError} + >; /** * Removes the authentication method associated with the public key from the identity. * Requires authentication. @@ -950,6 +1073,18 @@ export interface _SERVICE { [IdentityNumber, PublicKey, AuthnMethodSecuritySettings], {Ok: null} | {Err: AuthnMethodSecuritySettingsReplaceError} >; + /** + * Returns session info when session is confirmed and caller matches session. + */ + authn_method_session_info: ActorMethod<[IdentityNumber], [] | [AuthnMethodSessionInfo]>; + /** + * Registers a new session for the identity. + * This session needs to be confirmed before it can be used to register an authentication method on this identity. + */ + authn_method_session_register: ActorMethod< + [IdentityNumber], + {Ok: AuthnMethodConfirmationCode} | {Err: AuthnMethodRegisterError} + >; /** * Check the captcha challenge * If successful, the registration can be finished with `identity_registration_finish`. @@ -961,7 +1096,7 @@ export interface _SERVICE { config: ActorMethod<[], InternetIdentityInit>; create_account: ActorMethod< [UserNumber, FrontendHostname, string], - {Ok: Account} | {Err: CreateAccountError} + {Ok: AccountInfo} | {Err: CreateAccountError} >; create_challenge: ActorMethod<[], Challenge>; deploy_archive: ActorMethod<[Uint8Array], DeployArchiveResult>; @@ -974,15 +1109,22 @@ export interface _SERVICE { */ fetch_entries: ActorMethod<[], Array>; get_account_delegation: ActorMethod< - [UserNumber, FrontendHostname, AccountNumber, SessionKey, Timestamp], - GetDelegationResponse + [UserNumber, FrontendHostname, [] | [AccountNumber], SessionKey, Timestamp], + {Ok: SignedDelegation} | {Err: AccountDelegationError} >; /** * Multiple accounts */ - get_accounts: ActorMethod<[UserNumber, FrontendHostname], Array>; + get_accounts: ActorMethod< + [UserNumber, FrontendHostname], + {Ok: Array} | {Err: GetAccountsError} + >; get_anchor_credentials: ActorMethod<[UserNumber], AnchorCredentials>; get_anchor_info: ActorMethod<[UserNumber], IdentityAnchorInfo>; + get_default_account: ActorMethod< + [UserNumber, FrontendHostname], + {Ok: AccountInfo} | {Err: GetDefaultAccountError} + >; get_delegation: ActorMethod< [UserNumber, FrontendHostname, SessionKey, Timestamp], GetDelegationResponse @@ -994,7 +1136,6 @@ export interface _SERVICE { * ===================== */ http_request: ActorMethod<[HttpRequest], HttpResponse>; - http_request_update: ActorMethod<[HttpRequest], HttpResponse>; /** * 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. @@ -1014,6 +1155,15 @@ export interface _SERVICE { [IdentityNumber, MetadataMapV2], {Ok: null} | {Err: IdentityMetadataReplaceError} >; + /** + * Replaces the identity properties. + * The existing properties will be overwritten. + * Requires authentication. + */ + identity_properties_replace: ActorMethod< + [IdentityNumber, IdentityPropertiesReplace], + {Ok: null} | {Err: IdentityPropertiesReplaceError} + >; /** * Starts the identity registration flow to create a new identity. */ @@ -1036,6 +1186,11 @@ export interface _SERVICE { * Deprecated: Use 'get_anchor_credentials' instead. */ lookup: ActorMethod<[UserNumber], Array>; + lookup_by_registration_mode_id: ActorMethod<[RegistrationId], [] | [IdentityNumber]>; + /** + * Looks up identity number when called with a recovery phrase + */ + lookup_caller_identity_by_recovery_phrase: ActorMethod<[], [] | [IdentityNumber]>; /** * Discoverable passkeys protocol */ @@ -1066,7 +1221,7 @@ export interface _SERVICE { >; prepare_account_delegation: ActorMethod< [UserNumber, FrontendHostname, [] | [AccountNumber], SessionKey, [] | [bigint]], - [UserKey, Timestamp] + {Ok: PrepareAccountDelegation} | {Err: AccountDelegationError} >; /** * Authentication protocol @@ -1091,11 +1246,15 @@ export interface _SERVICE { * Atomically replace device matching the device key with the new device data */ replace: ActorMethod<[UserNumber, DeviceKey, DeviceData], undefined>; + set_default_account: ActorMethod< + [UserNumber, FrontendHostname, [] | [AccountNumber]], + {Ok: AccountInfo} | {Err: SetDefaultAccountError} + >; stats: ActorMethod<[], InternetIdentityStats>; update: ActorMethod<[UserNumber, DeviceKey, DeviceData], undefined>; update_account: ActorMethod< [UserNumber, FrontendHostname, [] | [AccountNumber], AccountUpdate], - {Ok: Account} | {Err: UpdateAccountError} + {Ok: AccountInfo} | {Err: UpdateAccountError} >; verify_tentative_device: ActorMethod<[UserNumber, string], VerifyTentativeDeviceResponse>; } diff --git a/cli/src/declarations/internet_identity.did b/cli/src/declarations/internet_identity.did index 5a23170..22ea667 100644 --- a/cli/src/declarations/internet_identity.did +++ b/cli/src/declarations/internet_identity.did @@ -2,6 +2,7 @@ type UserNumber = nat64; type AccountNumber = nat64; type PublicKey = blob; type CredentialId = blob; +type Aaguid = blob; type DeviceKey = PublicKey; type UserKey = PublicKey; type SessionKey = PublicKey; @@ -73,6 +74,7 @@ type DeviceData = record { pubkey : DeviceKey; alias : text; credential_id : opt CredentialId; + aaguid : opt Aaguid; purpose : Purpose; key_type : KeyType; protection : DeviceProtection; @@ -92,6 +94,7 @@ type DeviceWithUsage = record { pubkey : DeviceKey; alias : text; credential_id : opt CredentialId; + aaguid : opt Aaguid; purpose : Purpose; key_type : KeyType; protection : DeviceProtection; @@ -247,7 +250,7 @@ type CaptchaConfig = record { // Each field is wrapped is `opt` to indicate whether the field should // keep the previous value or update to a new value (e.g. `null` keeps the previous value). // -// Some fields, like `openid_google`, have an additional nested `opt`, this indicates +// Some fields, like `analytics_config`, have an additional nested `opt`, this indicates // enable/disable status (e.g. `opt null` disables a feature while `null` leaves it untouched). type InternetIdentityInit = record { // Set lowest and highest anchor @@ -271,8 +274,11 @@ type InternetIdentityInit = record { // Configuration for Related Origins Requests. // If present, list of origins from where registration is allowed. related_origins : opt vec text; - // Configuration for OpenID Google client - openid_google : opt opt OpenIdConfig; + // Configuration for New Origin Flows. + // If present, list of origins using the new authentication flow. + new_flow_origins : opt vec text; + // Configurations for OpenID clients + openid_configs : opt vec OpenIdConfig; // Configuration for Web Analytics analytics_config : opt opt AnalyticsConfig; // Configuration to fetch root key or not from frontend assets @@ -282,6 +288,8 @@ type InternetIdentityInit = record { // Configuration to set the canister as production mode. // For now, this is used only to show or hide the banner. is_production : opt bool; + // Configuration for dummy authentication used in e2e tests. + dummy_auth : opt opt DummyAuthConfig; }; type ChallengeKey = text; @@ -294,10 +302,12 @@ type CaptchaResult = ChallengeResult; // Extra information about registration status for new devices type DeviceRegistrationInfo = record { - // If present, the user has tentatively added a new device. This - // new device needs to be verified (see relevant endpoint) before - // 'expiration'. + // If present, the user has registered a new authentication method. This new authentication + // method needs to be confirmed before 'expiration' in order to be added to the identity. tentative_device : opt DeviceData; + // If present, the user has registered a new session. This new session needs to be confirmed before + // 'expiration' in order for it be authorized to register an authentication method to the identity. + tentative_session : opt principal; // The timestamp at which the anchor will turn off registration mode // (and the tentative device will be forgotten, if any, and if not verified) expiration : Timestamp; @@ -313,6 +323,8 @@ type IdentityAnchorInfo = record { openid_credentials : opt vec OpenIdCredential; // The name of the Internet Identity name : opt text; + // The timestamp at which the anchor was created + created_at : opt Timestamp; }; type AnchorCredentials = record { @@ -352,7 +364,14 @@ type JWT = text; type Salt = blob; type OpenIdConfig = record { + name : text; + logo : text; + issuer : text; client_id : text; + jwks_uri : text; + auth_uri : text; + auth_scope : vec text; + fedcm_uri : opt text; }; type OpenIdCredentialKey = record { Iss; Sub }; @@ -379,6 +398,7 @@ type OpenIdCredentialAddError = variant { JwtVerificationFailed; OpenIdCredentialAlreadyRegistered; InternalCanisterError : text; + JwtExpired; }; type OpenIdCredentialRemoveError = variant { @@ -391,6 +411,7 @@ type OpenIdDelegationError = variant { NoSuchAnchor; JwtVerificationFailed; NoSuchDelegation; + JwtExpired; }; type OpenIdPrepareDelegationResponse = record { @@ -418,6 +439,9 @@ type MetadataMapV2 = vec record { type WebAuthn = record { credential_id : CredentialId; pubkey : PublicKey; + + // Authenticator Attestation Global Unique Identifier (AAGUID) + aaguid : opt Aaguid; }; // Authentication method using generic signatures @@ -468,14 +492,18 @@ type AuthnMethodData = record { type OpenIDRegFinishArg = record { jwt : JWT; salt : Salt; + name : text; }; // Extra information about registration status for new authentication methods type AuthnMethodRegistrationInfo = record { - // If present, the user has registered a new authentication method. This - // new authentication needs to be verified before 'expiration' in order to - // be added to the identity. + + // If present, the user has registered a new authentication method. This new authentication + // method needs to be confirmed before 'expiration' in order to be added to the identity. authn_method : opt AuthnMethodData; + // If present, the user has registered a new session. This new session needs to be confirmed before + // 'expiration' in order for it be authorized to register an authentication method to the identity. + session : opt principal; // The timestamp at which the identity will turn off registration mode // (and the authentication method will be forgotten, if any, and if not verified) expiration : Timestamp; @@ -486,6 +514,13 @@ type AuthnMethodConfirmationCode = record { expiration : Timestamp; }; +type AuthnMethodSessionInfo = record { + name : opt text; + created_at : opt Timestamp; +}; + +type RegistrationId = text; + type AuthnMethodRegisterError = variant { // Authentication method registration mode is off, either due to timeout or because it was never enabled. RegistrationModeOff; @@ -496,6 +531,8 @@ type AuthnMethodRegisterError = variant { }; type AuthnMethodConfirmationError = variant { + Unauthorized : principal; + InternalCanisterError : text; // Wrong confirmation code entered. Retry with correct code. WrongCode : record { retries_left : nat8; @@ -506,6 +543,24 @@ type AuthnMethodConfirmationError = variant { NoAuthnMethodToConfirm; }; +type AuthnMethodRegistrationModeEnterError = variant { + InvalidRegistrationId : text; + Unauthorized : principal; + AlreadyInProgress; + InternalCanisterError : text; +}; + +type AuthnMethodRegistrationModeExitError = variant { + Unauthorized : principal; + InternalCanisterError : text; + RegistrationModeOff; + InvalidMetadata : text; +}; + +type LookupByRegistrationIdError = variant { + InvalidRegistrationId : text; +}; + type IdentityAuthnInfo = record { authn_methods : vec AuthnMethod; recovery_authn_methods : vec AuthnMethod; @@ -517,6 +572,9 @@ type IdentityInfo = record { openid_credentials : opt vec OpenIdCredential; // Authentication method independent metadata metadata : MetadataMapV2; + name : opt text; + // The timestamp at which the anchor was created + created_at : opt Timestamp; }; type IdentityInfoError = variant { @@ -561,10 +619,54 @@ type IdentityMetadataReplaceError = variant { type CreateAccountError = variant { InternalCanisterError : text; + AccountLimitReached; + Unauthorized : principal; + NameTooLong; }; type UpdateAccountError = variant { InternalCanisterError : text; + AccountLimitReached; + Unauthorized : principal; + NameTooLong; +}; + +type AccountDelegationError = variant { + InternalCanisterError : text; + Unauthorized : principal; + NoSuchDelegation; +}; + +type GetDefaultAccountError = variant { + InternalCanisterError : text; + Unauthorized : principal; + NoSuchAnchor; + NoSuchOrigin : record { + anchor_number : UserNumber; + }; +}; + +type SetDefaultAccountError = variant { + InternalCanisterError : text; + Unauthorized : principal; + NoSuchAnchor; + NoSuchOrigin : record { + anchor_number : UserNumber; + }; + NoSuchAccount : record { + anchor_number : UserNumber; + origin : FrontendHostname; + }; +}; + +type PrepareAccountDelegation = record { + user_key : UserKey; + expiration : Timestamp; +}; + +type GetAccountsError = variant { + InternalCanisterError : text; + Unauthorized : principal; }; type PrepareIdAliasRequest = record { @@ -676,8 +778,6 @@ type IdRegFinishResult = record { }; 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; @@ -690,7 +790,7 @@ type IdRegFinishError = variant { StorageError : text; }; -type Account = record { +type AccountInfo = record { // Null is unreserved default account account_number : opt AccountNumber; origin : text; @@ -703,6 +803,27 @@ type AccountUpdate = record { name : opt text; }; +type DummyAuthConfig = record { + // Prompts user for a index value (0 - 255) when set to true, + // this is used in e2e to have multiple dummy auth identities. + prompt_for_index : bool; +}; + +type IdentityPropertiesReplace = record { + name : opt text; +}; + +type IdentityPropertiesReplaceError = variant { + Unauthorized : principal; + StorageSpaceExceeded : record { + space_available : nat64; + space_required : nat64; + }; + NameTooLong : record { + limit : nat64; + }; + InternalCanisterError : text; +}; service : (opt InternetIdentityInit) -> { // Legacy identity management API @@ -755,6 +876,11 @@ service : (opt InternetIdentityInit) -> { // Requires authentication. identity_metadata_replace : (IdentityNumber, MetadataMapV2) -> (variant { Ok; Err : IdentityMetadataReplaceError }); + // Replaces the identity properties. + // The existing properties will be overwritten. + // Requires authentication. + identity_properties_replace : (IdentityNumber, IdentityPropertiesReplace) -> (variant { Ok; Err : IdentityPropertiesReplaceError }); + // Adds a new authentication method to the identity. // Requires authentication. authn_method_add : (IdentityNumber, AuthnMethodData) -> (variant { Ok; Err : AuthnMethodAddError }); @@ -783,22 +909,31 @@ service : (opt InternetIdentityInit) -> { // confirmed before it can be used for authentication on this identity. // The registration mode is automatically exited after the returned expiration timestamp. // Requires authentication. - authn_method_registration_mode_enter : (IdentityNumber) -> (variant { Ok : record { expiration : Timestamp }; Err }); + authn_method_registration_mode_enter : (IdentityNumber, opt RegistrationId) -> (variant { Ok : record { expiration : Timestamp }; Err : AuthnMethodRegistrationModeEnterError }); // Exits the authentication method registration mode for the identity. // Requires authentication. - authn_method_registration_mode_exit : (IdentityNumber) -> (variant { Ok; Err }); + authn_method_registration_mode_exit : (IdentityNumber, opt AuthnMethodData) -> (variant { Ok; Err : AuthnMethodRegistrationModeExitError }); // Registers a new authentication method to the identity. // This authentication method needs to be confirmed before it can be used for authentication on this identity. authn_method_register : (IdentityNumber, AuthnMethodData) -> (variant { Ok : AuthnMethodConfirmationCode; Err : AuthnMethodRegisterError }); + // Registers a new session for the identity. + // This session needs to be confirmed before it can be used to register an authentication method on this identity. + authn_method_session_register : (IdentityNumber) -> (variant { Ok : AuthnMethodConfirmationCode; Err : AuthnMethodRegisterError }); + + // Returns session info when session is confirmed and caller matches session. + authn_method_session_info : (IdentityNumber) -> (opt AuthnMethodSessionInfo) query; + // Confirms a previously registered authentication method. // On successful confirmation, the authentication method is permanently added to the identity and can // subsequently be used for authentication for that identity. // Requires authentication. authn_method_confirm : (IdentityNumber, confirmation_code : text) -> (variant { Ok; Err : AuthnMethodConfirmationError }); + lookup_by_registration_mode_id : (RegistrationId) -> (opt IdentityNumber) query; + // Authentication protocol // ======================= prepare_delegation : (UserNumber, FrontendHostname, SessionKey, maxTimeToLive : opt nat64) -> (UserKey, Timestamp); @@ -821,7 +956,6 @@ service : (opt InternetIdentityInit) -> { // HTTP Gateway protocol // ===================== http_request : (request : HttpRequest) -> (HttpResponse) query; - http_request_update : (request : HttpRequest) -> (HttpResponse); // Internal Methods // ================ @@ -843,20 +977,20 @@ service : (opt InternetIdentityInit) -> { get_accounts : ( anchor_number : UserNumber, origin : FrontendHostname, - ) -> (vec Account) query; + ) -> (variant { Ok : vec AccountInfo; Err: GetAccountsError }) query; create_account : ( anchor_number : UserNumber, origin : FrontendHostname, name : text - ) -> (variant { Ok : Account; Err: CreateAccountError }); + ) -> (variant { Ok : AccountInfo; Err: CreateAccountError }); update_account : ( anchor_number : UserNumber, origin : FrontendHostname, account_number : opt AccountNumber, // Null is unreserved default account update : AccountUpdate - ) -> (variant { Ok : Account; Err: UpdateAccountError }); + ) -> (variant { Ok : AccountInfo; Err: UpdateAccountError }); prepare_account_delegation : ( anchor_number : UserNumber, @@ -864,13 +998,27 @@ service : (opt InternetIdentityInit) -> { account_number : opt AccountNumber, // Null is unreserved default account session_key : SessionKey, max_ttl : opt nat64 - ) -> (UserKey, Timestamp); + ) -> (variant { Ok : PrepareAccountDelegation; Err : AccountDelegationError }); get_account_delegation : ( anchor_number : UserNumber, origin : FrontendHostname, - account_number : AccountNumber, // Null is unreserved default account + account_number : opt AccountNumber, // Null is unreserved default account session_key : SessionKey, expiration : Timestamp - ) -> (GetDelegationResponse) query; + ) -> (variant { Ok : SignedDelegation; Err : AccountDelegationError }) query; + + get_default_account : ( + anchor_number : UserNumber, + origin : FrontendHostname, + ) -> (variant { Ok : AccountInfo; Err: GetDefaultAccountError }) query; + + set_default_account : ( + anchor_number : UserNumber, + origin : FrontendHostname, + account_number : opt AccountNumber + ) -> (variant { Ok : AccountInfo; Err: SetDefaultAccountError }); + + // Looks up identity number when called with a recovery phrase + lookup_caller_identity_by_recovery_phrase : () -> (opt IdentityNumber) query; }; diff --git a/cli/src/declarations/internet_identity.idl.js b/cli/src/declarations/internet_identity.idl.js index 1a74225..2d81fdf 100644 --- a/cli/src/declarations/internet_identity.idl.js +++ b/cli/src/declarations/internet_identity.idl.js @@ -9,7 +9,6 @@ export const idlFactory = ({IDL}) => { const MetadataMap = IDL.Rec(); const MetadataMapV2 = IDL.Rec(); - const OpenIdConfig = IDL.Record({client_id: IDL.Text}); const ArchiveConfig = IDL.Record({ polling_interval_ns: IDL.Nat64, entries_buffer_limit: IDL.Nat64, @@ -24,6 +23,16 @@ export const idlFactory = ({IDL}) => { api_host: IDL.Opt(IDL.Text) }) }); + const OpenIdConfig = IDL.Record({ + auth_uri: IDL.Text, + jwks_uri: IDL.Text, + logo: IDL.Text, + name: IDL.Text, + fedcm_uri: IDL.Opt(IDL.Text), + issuer: IDL.Text, + auth_scope: IDL.Vec(IDL.Text), + client_id: IDL.Text + }); const CaptchaConfig = IDL.Record({ max_unsolved_captchas: IDL.Nat64, captcha_trigger: IDL.Variant({ @@ -38,21 +47,24 @@ export const idlFactory = ({IDL}) => { }) }) }); + const DummyAuthConfig = IDL.Record({prompt_for_index: IDL.Bool}); const RateLimitConfig = IDL.Record({ max_tokens: IDL.Nat64, time_per_token_ns: IDL.Nat64 }); const InternetIdentityInit = IDL.Record({ fetch_root_key: IDL.Opt(IDL.Bool), - openid_google: IDL.Opt(IDL.Opt(OpenIdConfig)), is_production: IDL.Opt(IDL.Bool), enable_dapps_explorer: IDL.Opt(IDL.Bool), assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + new_flow_origins: IDL.Opt(IDL.Vec(IDL.Text)), archive_config: IDL.Opt(ArchiveConfig), canister_creation_cycles_cost: IDL.Opt(IDL.Nat64), analytics_config: IDL.Opt(IDL.Opt(AnalyticsConfig)), related_origins: IDL.Opt(IDL.Vec(IDL.Text)), + openid_configs: IDL.Opt(IDL.Vec(OpenIdConfig)), captcha_config: IDL.Opt(CaptchaConfig), + dummy_auth: IDL.Opt(IDL.Opt(DummyAuthConfig)), register_rate_limit: IDL.Opt(RateLimitConfig) }); const UserNumber = IDL.Nat64; @@ -81,6 +93,7 @@ export const idlFactory = ({IDL}) => { unknown: IDL.Null, browser_storage_key: IDL.Null }); + const Aaguid = IDL.Vec(IDL.Nat8); const Purpose = IDL.Variant({ authentication: IDL.Null, recovery: IDL.Null @@ -93,6 +106,7 @@ export const idlFactory = ({IDL}) => { protection: DeviceProtection, pubkey: DeviceKey, key_type: KeyType, + aaguid: IDL.Opt(Aaguid), purpose: Purpose, credential_id: IDL.Opt(CredentialId) }); @@ -133,6 +147,7 @@ export const idlFactory = ({IDL}) => { const PublicKeyAuthn = IDL.Record({pubkey: PublicKey}); const WebAuthn = IDL.Record({ pubkey: PublicKey, + aaguid: IDL.Opt(Aaguid), credential_id: CredentialId }); const AuthnMethod = IDL.Variant({ @@ -147,7 +162,9 @@ export const idlFactory = ({IDL}) => { }); const AuthnMethodAddError = IDL.Variant({InvalidMetadata: IDL.Text}); const AuthnMethodConfirmationError = IDL.Variant({ + InternalCanisterError: IDL.Text, RegistrationModeOff: IDL.Null, + Unauthorized: IDL.Principal, NoAuthnMethodToConfirm: IDL.Null, WrongCode: IDL.Record({retries_left: IDL.Nat8}) }); @@ -164,6 +181,19 @@ export const idlFactory = ({IDL}) => { RegistrationAlreadyInProgress: IDL.Null, InvalidMetadata: IDL.Text }); + const RegistrationId = IDL.Text; + const AuthnMethodRegistrationModeEnterError = IDL.Variant({ + InvalidRegistrationId: IDL.Text, + InternalCanisterError: IDL.Text, + AlreadyInProgress: IDL.Null, + Unauthorized: IDL.Principal + }); + const AuthnMethodRegistrationModeExitError = IDL.Variant({ + InternalCanisterError: IDL.Text, + RegistrationModeOff: IDL.Null, + Unauthorized: IDL.Principal, + InvalidMetadata: IDL.Text + }); const AuthnMethodReplaceError = IDL.Variant({ AuthnMethodNotFound: IDL.Null, InvalidMetadata: IDL.Text @@ -171,6 +201,10 @@ export const idlFactory = ({IDL}) => { const AuthnMethodSecuritySettingsReplaceError = IDL.Variant({ AuthnMethodNotFound: IDL.Null }); + const AuthnMethodSessionInfo = IDL.Record({ + name: IDL.Opt(IDL.Text), + created_at: IDL.Opt(Timestamp) + }); const CheckCaptchaArg = IDL.Record({solution: IDL.Text}); const RegistrationFlowNextStep = IDL.Variant({ CheckCaptcha: IDL.Record({captcha_png_base64: IDL.Text}), @@ -186,14 +220,17 @@ export const idlFactory = ({IDL}) => { }); const FrontendHostname = IDL.Text; const AccountNumber = IDL.Nat64; - const Account = IDL.Record({ + const AccountInfo = IDL.Record({ name: IDL.Opt(IDL.Text), origin: IDL.Text, account_number: IDL.Opt(AccountNumber), last_used: IDL.Opt(Timestamp) }); const CreateAccountError = IDL.Variant({ - InternalCanisterError: IDL.Text + AccountLimitReached: IDL.Null, + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal, + NameTooLong: IDL.Null }); const ChallengeKey = IDL.Text; const Challenge = IDL.Record({ @@ -221,9 +258,14 @@ export const idlFactory = ({IDL}) => { signature: IDL.Vec(IDL.Nat8), delegation: Delegation }); - const GetDelegationResponse = IDL.Variant({ - no_such_delegation: IDL.Null, - signed_delegation: SignedDelegation + const AccountDelegationError = IDL.Variant({ + NoSuchDelegation: IDL.Null, + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal + }); + const GetAccountsError = IDL.Variant({ + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal }); const WebAuthnCredential = IDL.Record({ pubkey: PublicKey, @@ -242,6 +284,7 @@ export const idlFactory = ({IDL}) => { protection: DeviceProtection, pubkey: DeviceKey, key_type: KeyType, + aaguid: IDL.Opt(Aaguid), purpose: Purpose, credential_id: IDL.Opt(CredentialId) }); @@ -257,14 +300,26 @@ export const idlFactory = ({IDL}) => { }); const DeviceRegistrationInfo = IDL.Record({ tentative_device: IDL.Opt(DeviceData), - expiration: Timestamp + expiration: Timestamp, + tentative_session: IDL.Opt(IDL.Principal) }); const IdentityAnchorInfo = IDL.Record({ name: IDL.Opt(IDL.Text), + created_at: IDL.Opt(Timestamp), devices: IDL.Vec(DeviceWithUsage), openid_credentials: IDL.Opt(IDL.Vec(OpenIdCredential)), device_registration: IDL.Opt(DeviceRegistrationInfo) }); + const GetDefaultAccountError = IDL.Variant({ + NoSuchOrigin: IDL.Record({anchor_number: UserNumber}), + NoSuchAnchor: IDL.Null, + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal + }); + const GetDelegationResponse = IDL.Variant({ + no_such_delegation: IDL.Null, + signed_delegation: SignedDelegation + }); const GetIdAliasRequest = IDL.Record({ rp_id_alias_jwt: IDL.Text, issuer: FrontendHostname, @@ -318,11 +373,14 @@ export const idlFactory = ({IDL}) => { }); const AuthnMethodRegistrationInfo = IDL.Record({ expiration: Timestamp, + session: IDL.Opt(IDL.Principal), authn_method: IDL.Opt(AuthnMethodData) }); const IdentityInfo = IDL.Record({ authn_methods: IDL.Vec(AuthnMethodData), metadata: MetadataMapV2, + name: IDL.Opt(IDL.Text), + created_at: IDL.Opt(Timestamp), authn_method_registration: IDL.Opt(AuthnMethodRegistrationInfo), openid_credentials: IDL.Opt(IDL.Vec(OpenIdCredential)) }); @@ -338,6 +396,16 @@ export const idlFactory = ({IDL}) => { space_available: IDL.Nat64 }) }); + const IdentityPropertiesReplace = IDL.Record({name: IDL.Opt(IDL.Text)}); + const IdentityPropertiesReplaceError = IDL.Variant({ + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal, + NameTooLong: IDL.Record({limit: IDL.Nat64}), + StorageSpaceExceeded: IDL.Record({ + space_required: IDL.Nat64, + space_available: IDL.Nat64 + }) + }); const IdRegFinishArg = IDL.Record({ name: IDL.Opt(IDL.Text), authn_method: AuthnMethodData @@ -347,7 +415,6 @@ export const idlFactory = ({IDL}) => { NoRegistrationFlow: IDL.Null, UnexpectedCall: IDL.Record({next_step: RegistrationFlowNextStep}), InvalidAuthnMethod: IDL.Text, - IdentityLimitReached: IDL.Null, StorageError: IDL.Text }); const IdRegStartError = IDL.Variant({ @@ -364,6 +431,7 @@ export const idlFactory = ({IDL}) => { const OpenIdCredentialAddError = IDL.Variant({ OpenIdCredentialAlreadyRegistered: IDL.Null, InternalCanisterError: IDL.Text, + JwtExpired: IDL.Null, Unauthorized: IDL.Principal, JwtVerificationFailed: IDL.Null }); @@ -376,15 +444,24 @@ export const idlFactory = ({IDL}) => { const OpenIdDelegationError = IDL.Variant({ NoSuchDelegation: IDL.Null, NoSuchAnchor: IDL.Null, + JwtExpired: IDL.Null, JwtVerificationFailed: IDL.Null }); - const OpenIDRegFinishArg = IDL.Record({jwt: JWT, salt: Salt}); + const OpenIDRegFinishArg = IDL.Record({ + jwt: JWT, + name: IDL.Text, + salt: Salt + }); const UserKey = PublicKey; const OpenIdPrepareDelegationResponse = IDL.Record({ user_key: UserKey, expiration: Timestamp, anchor_number: UserNumber }); + const PrepareAccountDelegation = IDL.Record({ + user_key: UserKey, + expiration: Timestamp + }); const PrepareIdAliasRequest = IDL.Record({ issuer: FrontendHostname, relying_party: FrontendHostname, @@ -408,6 +485,16 @@ export const idlFactory = ({IDL}) => { canister_full: IDL.Null, registered: IDL.Record({user_number: UserNumber}) }); + const SetDefaultAccountError = IDL.Variant({ + NoSuchOrigin: IDL.Record({anchor_number: UserNumber}), + NoSuchAnchor: IDL.Null, + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal, + NoSuchAccount: IDL.Record({ + origin: FrontendHostname, + anchor_number: UserNumber + }) + }); const ArchiveInfo = IDL.Record({ archive_config: IDL.Opt(ArchiveConfig), archive_canister: IDL.Opt(IDL.Principal) @@ -422,7 +509,10 @@ export const idlFactory = ({IDL}) => { }); const AccountUpdate = IDL.Record({name: IDL.Opt(IDL.Text)}); const UpdateAccountError = IDL.Variant({ - InternalCanisterError: IDL.Text + AccountLimitReached: IDL.Null, + InternalCanisterError: IDL.Text, + Unauthorized: IDL.Principal, + NameTooLong: IDL.Null }); const VerifyTentativeDeviceResponse = IDL.Variant({ device_registration_mode_off: IDL.Null, @@ -471,18 +561,23 @@ export const idlFactory = ({IDL}) => { [] ), authn_method_registration_mode_enter: IDL.Func( - [IdentityNumber], + [IdentityNumber, IDL.Opt(RegistrationId)], [ IDL.Variant({ Ok: IDL.Record({expiration: Timestamp}), - Err: IDL.Null + Err: AuthnMethodRegistrationModeEnterError }) ], [] ), authn_method_registration_mode_exit: IDL.Func( - [IdentityNumber], - [IDL.Variant({Ok: IDL.Null, Err: IDL.Null})], + [IdentityNumber, IDL.Opt(AuthnMethodData)], + [ + IDL.Variant({ + Ok: IDL.Null, + Err: AuthnMethodRegistrationModeExitError + }) + ], [] ), authn_method_remove: IDL.Func( @@ -505,6 +600,21 @@ export const idlFactory = ({IDL}) => { ], [] ), + authn_method_session_info: IDL.Func( + [IdentityNumber], + [IDL.Opt(AuthnMethodSessionInfo)], + ['query'] + ), + authn_method_session_register: IDL.Func( + [IdentityNumber], + [ + IDL.Variant({ + Ok: AuthnMethodConfirmationCode, + Err: AuthnMethodRegisterError + }) + ], + [] + ), check_captcha: IDL.Func( [CheckCaptchaArg], [ @@ -518,7 +628,7 @@ export const idlFactory = ({IDL}) => { config: IDL.Func([], [InternetIdentityInit], ['query']), create_account: IDL.Func( [UserNumber, FrontendHostname, IDL.Text], - [IDL.Variant({Ok: Account, Err: CreateAccountError})], + [IDL.Variant({Ok: AccountInfo, Err: CreateAccountError})], [] ), create_challenge: IDL.Func([], [Challenge], []), @@ -527,13 +637,32 @@ export const idlFactory = ({IDL}) => { exit_device_registration_mode: IDL.Func([UserNumber], [], []), fetch_entries: IDL.Func([], [IDL.Vec(BufferedArchiveEntry)], []), get_account_delegation: IDL.Func( - [UserNumber, FrontendHostname, AccountNumber, SessionKey, Timestamp], - [GetDelegationResponse], + [UserNumber, FrontendHostname, IDL.Opt(AccountNumber), SessionKey, Timestamp], + [ + IDL.Variant({ + Ok: SignedDelegation, + Err: AccountDelegationError + }) + ], + ['query'] + ), + get_accounts: IDL.Func( + [UserNumber, FrontendHostname], + [ + IDL.Variant({ + Ok: IDL.Vec(AccountInfo), + Err: GetAccountsError + }) + ], ['query'] ), - get_accounts: IDL.Func([UserNumber, FrontendHostname], [IDL.Vec(Account)], ['query']), get_anchor_credentials: IDL.Func([UserNumber], [AnchorCredentials], ['query']), get_anchor_info: IDL.Func([UserNumber], [IdentityAnchorInfo], []), + get_default_account: IDL.Func( + [UserNumber, FrontendHostname], + [IDL.Variant({Ok: AccountInfo, Err: GetDefaultAccountError})], + ['query'] + ), get_delegation: IDL.Func( [UserNumber, FrontendHostname, SessionKey, Timestamp], [GetDelegationResponse], @@ -546,7 +675,6 @@ export const idlFactory = ({IDL}) => { ), get_principal: IDL.Func([UserNumber, FrontendHostname], [IDL.Principal], ['query']), http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']), - http_request_update: IDL.Func([HttpRequest], [HttpResponse], []), identity_authn_info: IDL.Func( [IdentityNumber], [IDL.Variant({Ok: IdentityAuthnInfo, Err: IDL.Null})], @@ -567,6 +695,16 @@ export const idlFactory = ({IDL}) => { ], [] ), + identity_properties_replace: IDL.Func( + [IdentityNumber, IdentityPropertiesReplace], + [ + IDL.Variant({ + Ok: IDL.Null, + Err: IdentityPropertiesReplaceError + }) + ], + [] + ), identity_registration_finish: IDL.Func( [IdRegFinishArg], [IDL.Variant({Ok: IdRegFinishResult, Err: IdRegFinishError})], @@ -579,6 +717,12 @@ export const idlFactory = ({IDL}) => { ), init_salt: IDL.Func([], [], []), lookup: IDL.Func([UserNumber], [IDL.Vec(DeviceData)], ['query']), + lookup_by_registration_mode_id: IDL.Func( + [RegistrationId], + [IDL.Opt(IdentityNumber)], + ['query'] + ), + lookup_caller_identity_by_recovery_phrase: IDL.Func([], [IDL.Opt(IdentityNumber)], ['query']), lookup_device_key: IDL.Func([IDL.Vec(IDL.Nat8)], [IDL.Opt(DeviceKeyWithAnchor)], ['query']), openid_credential_add: IDL.Func( [IdentityNumber, JWT, Salt], @@ -617,7 +761,12 @@ export const idlFactory = ({IDL}) => { ), prepare_account_delegation: IDL.Func( [UserNumber, FrontendHostname, IDL.Opt(AccountNumber), SessionKey, IDL.Opt(IDL.Nat64)], - [UserKey, Timestamp], + [ + IDL.Variant({ + Ok: PrepareAccountDelegation, + Err: AccountDelegationError + }) + ], [] ), prepare_delegation: IDL.Func( @@ -637,11 +786,16 @@ export const idlFactory = ({IDL}) => { ), remove: IDL.Func([UserNumber, DeviceKey], [], []), replace: IDL.Func([UserNumber, DeviceKey, DeviceData], [], []), + set_default_account: IDL.Func( + [UserNumber, FrontendHostname, IDL.Opt(AccountNumber)], + [IDL.Variant({Ok: AccountInfo, Err: SetDefaultAccountError})], + [] + ), stats: IDL.Func([], [InternetIdentityStats], ['query']), update: IDL.Func([UserNumber, DeviceKey, DeviceData], [], []), update_account: IDL.Func( [UserNumber, FrontendHostname, IDL.Opt(AccountNumber), AccountUpdate], - [IDL.Variant({Ok: Account, Err: UpdateAccountError})], + [IDL.Variant({Ok: AccountInfo, Err: UpdateAccountError})], [] ), verify_tentative_device: IDL.Func([UserNumber, IDL.Text], [VerifyTentativeDeviceResponse], []) @@ -649,7 +803,6 @@ export const idlFactory = ({IDL}) => { }; export const init = ({IDL}) => { - const OpenIdConfig = IDL.Record({client_id: IDL.Text}); const ArchiveConfig = IDL.Record({ polling_interval_ns: IDL.Nat64, entries_buffer_limit: IDL.Nat64, @@ -664,6 +817,16 @@ export const init = ({IDL}) => { api_host: IDL.Opt(IDL.Text) }) }); + const OpenIdConfig = IDL.Record({ + auth_uri: IDL.Text, + jwks_uri: IDL.Text, + logo: IDL.Text, + name: IDL.Text, + fedcm_uri: IDL.Opt(IDL.Text), + issuer: IDL.Text, + auth_scope: IDL.Vec(IDL.Text), + client_id: IDL.Text + }); const CaptchaConfig = IDL.Record({ max_unsolved_captchas: IDL.Nat64, captcha_trigger: IDL.Variant({ @@ -678,21 +841,24 @@ export const init = ({IDL}) => { }) }) }); + const DummyAuthConfig = IDL.Record({prompt_for_index: IDL.Bool}); const RateLimitConfig = IDL.Record({ max_tokens: IDL.Nat64, time_per_token_ns: IDL.Nat64 }); const InternetIdentityInit = IDL.Record({ fetch_root_key: IDL.Opt(IDL.Bool), - openid_google: IDL.Opt(IDL.Opt(OpenIdConfig)), is_production: IDL.Opt(IDL.Bool), enable_dapps_explorer: IDL.Opt(IDL.Bool), assigned_user_number_range: IDL.Opt(IDL.Tuple(IDL.Nat64, IDL.Nat64)), + new_flow_origins: IDL.Opt(IDL.Vec(IDL.Text)), archive_config: IDL.Opt(ArchiveConfig), canister_creation_cycles_cost: IDL.Opt(IDL.Nat64), analytics_config: IDL.Opt(IDL.Opt(AnalyticsConfig)), related_origins: IDL.Opt(IDL.Vec(IDL.Text)), + openid_configs: IDL.Opt(IDL.Vec(OpenIdConfig)), captcha_config: IDL.Opt(CaptchaConfig), + dummy_auth: IDL.Opt(IDL.Opt(DummyAuthConfig)), register_rate_limit: IDL.Opt(RateLimitConfig) }); diff --git a/cli/src/modules/governance/governance.install.ts b/cli/src/modules/governance/governance.install.ts index 43b28f6..65e5cfb 100644 --- a/cli/src/modules/governance/governance.install.ts +++ b/cli/src/modules/governance/governance.install.ts @@ -76,7 +76,6 @@ export const prepareGovernanceArgs = ({ const gov: Governance = { default_followees: [], - making_sns_proposal: [], most_recent_monthly_node_provider_rewards: [], maturity_modulation_last_updated_at_timestamp_seconds: [], wait_for_quiet_threshold_seconds: BigInt(60 * 60 * 24 * 4), // 4 days @@ -90,7 +89,6 @@ export const prepareGovernanceArgs = ({ latest_reward_event: [], to_claim_transfers: [], short_voting_period_seconds: BigInt(60 * 60 * 12), // 12 hours - topic_followee_index: [], proposals: [], xdr_conversion_rate: [xdr], in_flight_commands: [], @@ -136,7 +134,8 @@ const prepareNeuron = ({identity}: {identity: Identity}): Neuron => { spawn_at_timestamp_seconds: [], voting_power_refreshed_timestamp_seconds: [], potential_voting_power: [], - deciding_voting_power: [] + deciding_voting_power: [], + maturity_disbursements_in_progress: [] }; return neuron; diff --git a/cli/src/modules/internet-identity.ts b/cli/src/modules/internet-identity.ts index d345511..f6cfae1 100644 --- a/cli/src/modules/internet-identity.ts +++ b/cli/src/modules/internet-identity.ts @@ -27,11 +27,13 @@ class InternetIdentityModule extends Module { } }), fetch_root_key: [true], - openid_google: [], is_production: [false], enable_dapps_explorer: [false], analytics_config: [], - related_origins: [] + related_origins: [], + new_flow_origins: [], + openid_configs: [], + dummy_auth: [] }; // Type definitions generated by Candid are not clean enough.