From ac743036e77ebdd1235c28fe6bffeb8499fff56e Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Fri, 21 Jun 2024 20:41:26 +0200 Subject: [PATCH 1/4] might be working --- .../src/canisters/nns_governance/api.rs | 48 ++++--------------- .../src/canisters/nns_registry/api.rs | 45 +++++------------ rs/proposals/src/canisters/sns_wasm/api.rs | 5 +- scripts/did2rs.sh | 17 +++---- scripts/proposals/did2rs | 2 +- 5 files changed, 30 insertions(+), 87 deletions(-) diff --git a/rs/proposals/src/canisters/nns_governance/api.rs b/rs/proposals/src/canisters/nns_governance/api.rs index 728af939bee..52d8c69a169 100644 --- a/rs/proposals/src/canisters/nns_governance/api.rs +++ b/rs/proposals/src/canisters/nns_governance/api.rs @@ -730,11 +730,7 @@ pub struct Governance { pub neurons: Vec<(u64, Neuron)>, pub genesis_timestamp_seconds: u64, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result_ { - Ok, - Err(GovernanceError), -} +pub type Result_ = std::result::Result<(), GovernanceError>; #[derive(Serialize, CandidType, Deserialize)] pub enum Result1 { Error(GovernanceError), @@ -744,21 +740,9 @@ pub enum Result1 { pub struct ClaimOrRefreshNeuronFromAccountResponse { pub result: Option, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result2 { - Ok(Neuron), - Err(GovernanceError), -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result3 { - Ok(GovernanceCachedMetrics), - Err(GovernanceError), -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result4 { - Ok(RewardNodeProviders), - Err(GovernanceError), -} +pub type Result2 = std::result::Result; +pub type Result3 = std::result::Result; +pub type Result4 = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct NeuronInfo { pub dissolve_delay_seconds: u64, @@ -773,11 +757,7 @@ pub struct NeuronInfo { pub voting_power: u64, pub age_seconds: u64, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result5 { - Ok(NeuronInfo), - Err(GovernanceError), -} +pub type Result5 = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct GetNeuronsFundAuditInfoRequest { pub nns_proposal_id: Option, @@ -792,20 +772,12 @@ pub struct NeuronsFundAuditInfo { pub struct Ok { pub neurons_fund_audit_info: Option, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result6 { - Ok(Ok), - Err(GovernanceError), -} +pub type Result6 = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct GetNeuronsFundAuditInfoResponse { pub result: Option, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result7 { - Ok(NodeProvider), - Err(GovernanceError), -} +pub type Result7 = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct ProposalInfo { pub id: Option, @@ -955,11 +927,7 @@ pub struct NeuronsFundNeuron { pub struct Ok1 { pub neurons_fund_neuron_portions: Vec, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result10 { - Ok(Ok1), - Err(GovernanceError), -} +pub type Result10 = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct SettleNeuronsFundParticipationResponse { pub result: Option, diff --git a/rs/proposals/src/canisters/nns_registry/api.rs b/rs/proposals/src/canisters/nns_registry/api.rs index 294211e92c3..7c578c9a326 100644 --- a/rs/proposals/src/canisters/nns_registry/api.rs +++ b/rs/proposals/src/canisters/nns_registry/api.rs @@ -216,29 +216,22 @@ pub struct NodeOperatorRecord { pub node_provider_principal_id: serde_bytes::ByteBuf, pub dc_id: String, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum GetNodeOperatorsAndDcsOfNodeProviderResponse { - Ok(Vec<(DataCenterRecord, NodeOperatorRecord)>), - Err(String), -} +pub type GetNodeOperatorsAndDcsOfNodeProviderResponse = + std::result::Result, String>; #[derive(Serialize, CandidType, Deserialize)] pub struct NodeProvidersMonthlyXdrRewards { pub rewards: Vec<(String, u64)>, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum GetNodeProvidersMonthlyXdrRewardsResponse { - Ok(NodeProvidersMonthlyXdrRewards), - Err(String), -} +pub type GetNodeProvidersMonthlyXdrRewardsResponse = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct GetSubnetForCanisterRequest { pub principal: Option, } #[derive(Serialize, CandidType, Deserialize)] -pub enum GetSubnetForCanisterResponse { - Ok { subnet_id: Option }, - Err(String), +pub struct GetSubnetForCanisterResponseOk { + pub subnet_id: Option, } +pub type GetSubnetForCanisterResponse = std::result::Result; #[derive(Serialize, CandidType, Deserialize)] pub struct PrepareCanisterMigrationPayload { pub canister_id_ranges: Vec, @@ -329,21 +322,13 @@ pub struct UpdateNodeDomainDirectlyPayload { pub node_id: Principal, pub domain: Option, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum UpdateNodeDomainDirectlyResponse { - Ok, - Err(String), -} +pub type UpdateNodeDomainDirectlyResponse = std::result::Result<(), String>; #[derive(Serialize, CandidType, Deserialize)] pub struct UpdateNodeIPv4ConfigDirectlyPayload { pub ipv4_config: Option, pub node_id: Principal, } -#[derive(Serialize, CandidType, Deserialize)] -pub enum UpdateNodeIpv4ConfigDirectlyResponse { - Ok, - Err(String), -} +pub type UpdateNodeIpv4ConfigDirectlyResponse = std::result::Result<(), String>; #[derive(Serialize, CandidType, Deserialize)] pub struct UpdateNodeOperatorConfigPayload { pub node_operator_id: Option, @@ -464,10 +449,7 @@ impl Service { pub async fn create_subnet(&self, arg0: CreateSubnetPayload) -> CallResult<()> { ic_cdk::call(self.0, "create_subnet", (arg0,)).await } - pub async fn deploy_guestos_to_all_subnet_nodes( - &self, - arg0: DeployGuestosToAllSubnetNodesPayload, - ) -> CallResult<()> { + pub async fn deploy_guestos_to_all_subnet_nodes(&self, arg0: DeployGuestosToAllSubnetNodesPayload) -> CallResult<()> { ic_cdk::call(self.0, "deploy_guestos_to_all_subnet_nodes", (arg0,)).await } pub async fn deploy_guestos_to_all_unassigned_nodes( @@ -485,9 +467,7 @@ impl Service { ) -> CallResult<(GetNodeOperatorsAndDcsOfNodeProviderResponse,)> { ic_cdk::call(self.0, "get_node_operators_and_dcs_of_node_provider", (arg0,)).await } - pub async fn get_node_providers_monthly_xdr_rewards( - &self, - ) -> CallResult<(GetNodeProvidersMonthlyXdrRewardsResponse,)> { + pub async fn get_node_providers_monthly_xdr_rewards(&self) -> CallResult<(GetNodeProvidersMonthlyXdrRewardsResponse,)> { ic_cdk::call(self.0, "get_node_providers_monthly_xdr_rewards", ()).await } pub async fn get_subnet_for_canister( @@ -532,10 +512,7 @@ impl Service { pub async fn set_firewall_config(&self, arg0: SetFirewallConfigPayload) -> CallResult<()> { ic_cdk::call(self.0, "set_firewall_config", (arg0,)).await } - pub async fn update_api_boundary_nodes_version( - &self, - arg0: UpdateApiBoundaryNodesVersionPayload, - ) -> CallResult<()> { + pub async fn update_api_boundary_nodes_version(&self, arg0: UpdateApiBoundaryNodesVersionPayload) -> CallResult<()> { ic_cdk::call(self.0, "update_api_boundary_nodes_version", (arg0,)).await } pub async fn update_elected_hostos_versions(&self, arg0: UpdateElectedHostosVersionsPayload) -> CallResult<()> { diff --git a/rs/proposals/src/canisters/sns_wasm/api.rs b/rs/proposals/src/canisters/sns_wasm/api.rs index 2ae957a8d31..c9307dbf619 100644 --- a/rs/proposals/src/canisters/sns_wasm/api.rs +++ b/rs/proposals/src/canisters/sns_wasm/api.rs @@ -382,10 +382,7 @@ impl Service { pub async fn get_latest_sns_version_pretty(&self, arg0: ()) -> CallResult<(Vec<(String, String)>,)> { ic_cdk::call(self.0, "get_latest_sns_version_pretty", (arg0,)).await } - pub async fn get_next_sns_version( - &self, - arg0: GetNextSnsVersionRequest, - ) -> CallResult<(GetNextSnsVersionResponse,)> { + pub async fn get_next_sns_version(&self, arg0: GetNextSnsVersionRequest) -> CallResult<(GetNextSnsVersionResponse,)> { ic_cdk::call(self.0, "get_next_sns_version", (arg0,)).await } pub async fn get_proposal_id_that_added_wasm( diff --git a/scripts/did2rs.sh b/scripts/did2rs.sh index 9d2b53d71f2..a975bd731f1 100755 --- a/scripts/did2rs.sh +++ b/scripts/did2rs.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +set -xeuo pipefail SOURCE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" PATH="$SOURCE_DIR:$PATH" @@ -119,16 +119,18 @@ cd "$GIT_ROOT" # - Any corrections to the output of the sed script. sed is not a Rust parser; the sed output # is not guaranteed to be correct. # shellcheck disable=SC2016 - didc bind "${DID_PATH}" --target rs | + if [[ "$DID_PATH" == *nns_governance.did ]]; then + #METHODS_ARGS=("--methods" "list_proposals") + METHODS_ARGS=() + else + METHODS_ARGS=() + fi + didc bind "${DID_PATH}" --target rs "${METHODS_ARGS[@]}" | rustfmt --edition 2021 | "$sed" -E ' # Comment out the header "use", "//!" and "#!" lines. s@^(use |//!|#!)@// &@; - # Make types and fields public: - s/^(struct|enum|type) /pub &/; - s/^ [a-z].*:/ pub&/;s/^( *pub ) *pub /\1/; - # Add traits s/#\[derive\(/&'"${TRAITS:-}${TRAITS:+, }"'/; @@ -138,8 +140,7 @@ cd "$GIT_ROOT" # Replace invalid "{}" in generated Rust code with "EmptyRecord": /^pub (struct|enum) /,/^}/{s/ *\{\},$/(EmptyRecord),/g}; ' | - "$sed" -z 's/candid::define_function!(pub \([^ ]*\) [^;]*;\n#\[derive([^)]*)\]/pub type \1 = candid::Func;\n#[derive(CandidType, Deserialize)]/g' | - rustfmt --edition 2021 + "$sed" -z 's/candid::define_function!(pub \([^ ]*\) [^;]*;\n#\[derive([^)]*)\]/pub type \1 = candid::Func;\n#[derive(CandidType, Deserialize)]/g' } >"${RUST_PATH}" if test -f "${EDIT_PATH}"; then ( diff --git a/scripts/proposals/did2rs b/scripts/proposals/did2rs index 719a78d83a6..4feca7da0b1 100755 --- a/scripts/proposals/did2rs +++ b/scripts/proposals/did2rs @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -euo pipefail +set -xeuo pipefail SOURCE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.." print_help() { cat <<-EOF From 03964c5967ebf277bd601afc6fcb282fe71a603e Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Fri, 21 Jun 2024 21:21:20 +0200 Subject: [PATCH 2/4] sns-aggregator working --- .../src/canisters/nns_governance/api.rs | 640 ++---------------- .../src/types/ic_sns_governance.rs | 6 +- rs/sns_aggregator/src/types/ic_sns_ledger.rs | 18 +- rs/sns_aggregator/src/types/ic_sns_swap.rs | 42 +- scripts/did2rs.sh | 5 +- 5 files changed, 64 insertions(+), 647 deletions(-) diff --git a/rs/proposals/src/canisters/nns_governance/api.rs b/rs/proposals/src/canisters/nns_governance/api.rs index 52d8c69a169..6d2dc7151db 100644 --- a/rs/proposals/src/canisters/nns_governance/api.rs +++ b/rs/proposals/src/canisters/nns_governance/api.rs @@ -22,8 +22,51 @@ pub struct NeuronId { pub id: u64, } #[derive(Serialize, CandidType, Deserialize)] -pub struct Followees { - pub followees: Vec, +pub struct GovernanceError { + pub error_message: String, + pub error_type: i32, +} +#[derive(Serialize, CandidType, Deserialize)] +pub struct Ballot { + pub vote: i32, + pub voting_power: u64, +} +#[derive(Serialize, CandidType, Deserialize)] +pub struct CanisterStatusResultV2 { + pub status: Option, + pub freezing_threshold: Option, + pub controllers: Vec, + pub memory_size: Option, + pub cycles: Option, + pub idle_cycles_burned_per_day: Option, + pub module_hash: serde_bytes::ByteBuf, +} +#[derive(Serialize, CandidType, Deserialize)] +pub struct CanisterSummary { + pub status: Option, + pub canister_id: Option, +} +#[derive(Serialize, CandidType, Deserialize)] +pub struct SwapBackgroundInformation { + pub ledger_index_canister_summary: Option, + pub fallback_controller_principal_ids: Vec, + pub ledger_archive_canister_summaries: Vec, + pub ledger_canister_summary: Option, + pub swap_canister_summary: Option, + pub governance_canister_summary: Option, + pub root_canister_summary: Option, + pub dapp_canister_summaries: Vec, +} +#[derive(Serialize, CandidType, Deserialize)] +pub struct DerivedProposalInformation { + pub swap_background_information: Option, +} +#[derive(Serialize, CandidType, Deserialize)] +pub struct Tally { + pub no: u64, + pub yes: u64, + pub total: u64, + pub timestamp_seconds: u64, } #[derive(Serialize, CandidType, Deserialize)] pub struct KnownNeuronData { @@ -345,6 +388,10 @@ pub struct SetSnsTokenSwapOpenTimeWindow { pub swap_canister_id: Option, } #[derive(Serialize, CandidType, Deserialize)] +pub struct Followees { + pub followees: Vec, +} +#[derive(Serialize, CandidType, Deserialize)] pub struct SetDefaultFollowees { pub default_followees: Vec<(i32, Followees)>, } @@ -423,362 +470,6 @@ pub struct Proposal { pub summary: String, } #[derive(Serialize, CandidType, Deserialize)] -pub struct MakingSnsProposal { - pub proposal: Option>, - pub caller: Option, - pub proposer_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct MostRecentMonthlyNodeProviderRewards { - pub timestamp: u64, - pub rewards: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GovernanceCachedMetrics { - pub total_maturity_e8s_equivalent: u64, - pub not_dissolving_neurons_e8s_buckets: Vec<(u64, f64)>, - pub dissolving_neurons_staked_maturity_e8s_equivalent_sum: u64, - pub garbage_collectable_neurons_count: u64, - pub dissolving_neurons_staked_maturity_e8s_equivalent_buckets: Vec<(u64, f64)>, - pub neurons_with_invalid_stake_count: u64, - pub not_dissolving_neurons_count_buckets: Vec<(u64, u64)>, - pub ect_neuron_count: u64, - pub total_supply_icp: u64, - pub neurons_with_less_than_6_months_dissolve_delay_count: u64, - pub dissolved_neurons_count: u64, - pub community_fund_total_maturity_e8s_equivalent: u64, - pub total_staked_e8s_seed: u64, - pub total_staked_maturity_e8s_equivalent_ect: u64, - pub total_staked_e8s: u64, - pub not_dissolving_neurons_count: u64, - pub total_locked_e8s: u64, - pub neurons_fund_total_active_neurons: u64, - pub total_staked_maturity_e8s_equivalent: u64, - pub not_dissolving_neurons_e8s_buckets_ect: Vec<(u64, f64)>, - pub total_staked_e8s_ect: u64, - pub not_dissolving_neurons_staked_maturity_e8s_equivalent_sum: u64, - pub dissolved_neurons_e8s: u64, - pub dissolving_neurons_e8s_buckets_seed: Vec<(u64, f64)>, - pub neurons_with_less_than_6_months_dissolve_delay_e8s: u64, - pub not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets: Vec<(u64, f64)>, - pub dissolving_neurons_count_buckets: Vec<(u64, u64)>, - pub dissolving_neurons_e8s_buckets_ect: Vec<(u64, f64)>, - pub dissolving_neurons_count: u64, - pub dissolving_neurons_e8s_buckets: Vec<(u64, f64)>, - pub total_staked_maturity_e8s_equivalent_seed: u64, - pub community_fund_total_staked_e8s: u64, - pub not_dissolving_neurons_e8s_buckets_seed: Vec<(u64, f64)>, - pub timestamp_seconds: u64, - pub seed_neuron_count: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct RestoreAgingNeuronGroup { - pub count: Option, - pub previous_total_stake_e8s: Option, - pub current_total_stake_e8s: Option, - pub group_type: i32, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct RestoreAgingSummary { - pub groups: Vec, - pub timestamp_seconds: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct RewardEvent { - pub rounds_since_last_distribution: Option, - pub day_after_genesis: u64, - pub actual_timestamp_seconds: u64, - pub total_available_e8s_equivalent: u64, - pub latest_round_available_e8s_equivalent: Option, - pub distributed_e8s_equivalent: u64, - pub settled_proposals: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronStakeTransfer { - pub to_subaccount: serde_bytes::ByteBuf, - pub neuron_stake_e8s: u64, - pub from: Option, - pub memo: u64, - pub from_subaccount: serde_bytes::ByteBuf, - pub transfer_timestamp: u64, - pub block_height: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Followers { - pub followers: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct FollowersMap { - pub followers_map: Vec<(u64, Followers)>, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Progress { - LastNeuronId(NeuronId), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Migration { - pub status: Option, - pub failure_reason: Option, - pub progress: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Migrations { - pub neuron_indexes_migration: Option, - pub copy_inactive_neurons_to_stable_memory_migration: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GovernanceError { - pub error_message: String, - pub error_type: i32, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct CfNeuron { - pub has_created_neuron_recipes: Option, - pub nns_neuron_id: u64, - pub amount_icp_e8s: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct CfParticipant { - pub hotkey_principal: String, - pub cf_neurons: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Ballot { - pub vote: i32, - pub voting_power: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SwapParticipationLimits { - pub min_participant_icp_e8s: Option, - pub max_participant_icp_e8s: Option, - pub min_direct_participation_icp_e8s: Option, - pub max_direct_participation_icp_e8s: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundNeuronPortion { - pub hotkey_principal: Option, - pub is_capped: Option, - pub maturity_equivalent_icp_e8s: Option, - pub nns_neuron_id: Option, - pub amount_icp_e8s: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundSnapshot { - pub neurons_fund_neuron_portions: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct IdealMatchedParticipationFunction { - pub serialized_representation: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundParticipation { - pub total_maturity_equivalent_icp_e8s: Option, - pub intended_neurons_fund_participation_icp_e8s: Option, - pub direct_participation_icp_e8s: Option, - pub swap_participation_limits: Option, - pub max_neurons_fund_swap_participation_icp_e8s: Option, - pub neurons_fund_reserves: Option, - pub ideal_matched_participation_function: Option, - pub allocated_neurons_fund_participation_icp_e8s: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundData { - pub final_neurons_fund_participation: Option, - pub initial_neurons_fund_participation: Option, - pub neurons_fund_refunds: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct CanisterStatusResultV2 { - pub status: Option, - pub freezing_threshold: Option, - pub controllers: Vec, - pub memory_size: Option, - pub cycles: Option, - pub idle_cycles_burned_per_day: Option, - pub module_hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct CanisterSummary { - pub status: Option, - pub canister_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SwapBackgroundInformation { - pub ledger_index_canister_summary: Option, - pub fallback_controller_principal_ids: Vec, - pub ledger_archive_canister_summaries: Vec, - pub ledger_canister_summary: Option, - pub swap_canister_summary: Option, - pub governance_canister_summary: Option, - pub root_canister_summary: Option, - pub dapp_canister_summaries: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DerivedProposalInformation { - pub swap_background_information: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Tally { - pub no: u64, - pub yes: u64, - pub total: u64, - pub timestamp_seconds: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct WaitForQuietState { - pub current_deadline_timestamp_seconds: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ProposalData { - pub id: Option, - pub failure_reason: Option, - pub cf_participants: Vec, - pub ballots: Vec<(u64, Ballot)>, - pub proposal_timestamp_seconds: u64, - pub reward_event_round: u64, - pub failed_timestamp_seconds: u64, - pub neurons_fund_data: Option, - pub reject_cost_e8s: u64, - pub derived_proposal_information: Option, - pub latest_tally: Option, - pub sns_token_swap_lifecycle: Option, - pub decided_timestamp_seconds: u64, - pub proposal: Option>, - pub proposer: Option, - pub wait_for_quiet_state: Option, - pub executed_timestamp_seconds: u64, - pub original_total_community_fund_maturity_e8s_equivalent: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct XdrConversionRate { - pub xdr_permyriad_per_icp: Option, - pub timestamp_seconds: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Command2 { - Spawn(NeuronId), - Split(Split), - Configure(Configure), - Merge(Merge), - DisburseToNeuron(DisburseToNeuron), - SyncCommand(EmptyRecord), - ClaimOrRefreshNeuron(ClaimOrRefresh), - MergeMaturity(MergeMaturity), - Disburse(Disburse), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronInFlightCommand { - pub command: Option, - pub timestamp: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct BallotInfo { - pub vote: i32, - pub proposal_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum DissolveState { - DissolveDelaySeconds(u64), - WhenDissolvedTimestampSeconds(u64), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Neuron { - pub id: Option, - pub staked_maturity_e8s_equivalent: Option, - pub controller: Option, - pub recent_ballots: Vec, - pub kyc_verified: bool, - pub neuron_type: Option, - pub not_for_profit: bool, - pub maturity_e8s_equivalent: u64, - pub cached_neuron_stake_e8s: u64, - pub created_timestamp_seconds: u64, - pub auto_stake_maturity: Option, - pub aging_since_timestamp_seconds: u64, - pub hot_keys: Vec, - pub account: serde_bytes::ByteBuf, - pub joined_community_fund_timestamp_seconds: Option, - pub dissolve_state: Option, - pub followees: Vec<(i32, Followees)>, - pub neuron_fees_e8s: u64, - pub transfer: Option, - pub known_neuron_data: Option, - pub spawn_at_timestamp_seconds: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Governance { - pub default_followees: Vec<(i32, Followees)>, - pub making_sns_proposal: Option, - pub most_recent_monthly_node_provider_rewards: Option, - pub maturity_modulation_last_updated_at_timestamp_seconds: Option, - pub wait_for_quiet_threshold_seconds: u64, - pub metrics: Option, - pub neuron_management_voting_period_seconds: Option, - pub node_providers: Vec, - pub cached_daily_maturity_modulation_basis_points: Option, - pub economics: Option, - pub restore_aging_summary: Option, - pub spawning_neurons: Option, - pub latest_reward_event: Option, - pub to_claim_transfers: Vec, - pub short_voting_period_seconds: u64, - pub topic_followee_index: Vec<(i32, FollowersMap)>, - pub migrations: Option, - pub proposals: Vec<(u64, ProposalData)>, - pub xdr_conversion_rate: Option, - pub in_flight_commands: Vec<(u64, NeuronInFlightCommand)>, - pub neurons: Vec<(u64, Neuron)>, - pub genesis_timestamp_seconds: u64, -} -pub type Result_ = std::result::Result<(), GovernanceError>; -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result1 { - Error(GovernanceError), - NeuronId(NeuronId), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ClaimOrRefreshNeuronFromAccountResponse { - pub result: Option, -} -pub type Result2 = std::result::Result; -pub type Result3 = std::result::Result; -pub type Result4 = std::result::Result; -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronInfo { - pub dissolve_delay_seconds: u64, - pub recent_ballots: Vec, - pub neuron_type: Option, - pub created_timestamp_seconds: u64, - pub state: i32, - pub stake_e8s: u64, - pub joined_community_fund_timestamp_seconds: Option, - pub retrieved_at_timestamp_seconds: u64, - pub known_neuron_data: Option, - pub voting_power: u64, - pub age_seconds: u64, -} -pub type Result5 = std::result::Result; -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetNeuronsFundAuditInfoRequest { - pub nns_proposal_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundAuditInfo { - pub final_neurons_fund_participation: Option, - pub initial_neurons_fund_participation: Option, - pub neurons_fund_refunds: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Ok { - pub neurons_fund_audit_info: Option, -} -pub type Result6 = std::result::Result; -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetNeuronsFundAuditInfoResponse { - pub result: Option, -} -pub type Result7 = std::result::Result; -#[derive(Serialize, CandidType, Deserialize)] pub struct ProposalInfo { pub id: Option, pub status: i32, @@ -798,243 +489,10 @@ pub struct ProposalInfo { pub proposer: Option, pub executed_timestamp_seconds: u64, } -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListKnownNeuronsResponse { - pub known_neurons: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListNeurons { - pub neuron_ids: Vec, - pub include_neurons_readable_by_caller: bool, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListNeuronsResponse { - pub neuron_infos: Vec<(u64, NeuronInfo)>, - pub full_neurons: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListNodeProvidersResponse { - pub node_providers: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListProposalInfo { - pub include_reward_status: Vec, - pub omit_large_fields: Option, - pub before_proposal: Option, - pub limit: u32, - pub exclude_topic: Vec, - pub include_all_manage_neuron_proposals: Option, - pub include_status: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListProposalInfoResponse { - pub proposal_info: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SpawnResponse { - pub created_neuron_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ClaimOrRefreshResponse { - pub refreshed_neuron_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct MergeResponse { - pub target_neuron: Option, - pub source_neuron: Option, - pub target_neuron_info: Option, - pub source_neuron_info: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct MakeProposalResponse { - pub message: Option, - pub proposal_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct StakeMaturityResponse { - pub maturity_e8s: u64, - pub staked_maturity_e8s: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct MergeMaturityResponse { - pub merged_maturity_e8s: u64, - pub new_stake_e8s: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DisburseResponse { - pub transfer_block_height: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Command1 { - Error(GovernanceError), - Spawn(SpawnResponse), - Split(SpawnResponse), - Follow(EmptyRecord), - ClaimOrRefresh(ClaimOrRefreshResponse), - Configure(EmptyRecord), - RegisterVote(EmptyRecord), - Merge(MergeResponse), - DisburseToNeuron(SpawnResponse), - MakeProposal(MakeProposalResponse), - StakeMaturity(StakeMaturityResponse), - MergeMaturity(MergeMaturityResponse), - Disburse(DisburseResponse), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ManageNeuronResponse { - pub command: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Committed { - pub total_direct_contribution_icp_e8s: Option, - pub total_neurons_fund_contribution_icp_e8s: Option, - pub sns_governance_canister_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result8 { - Committed(Committed), - Aborted(EmptyRecord), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SettleCommunityFundParticipation { - pub result: Option, - pub open_sns_token_swap_proposal_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Committed1 { - pub total_direct_participation_icp_e8s: Option, - pub total_neurons_fund_participation_icp_e8s: Option, - pub sns_governance_canister_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result9 { - Committed(Committed1), - Aborted(EmptyRecord), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SettleNeuronsFundParticipationRequest { - pub result: Option, - pub nns_proposal_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundNeuron { - pub hotkey_principal: Option, - pub is_capped: Option, - pub nns_neuron_id: Option, - pub amount_icp_e8s: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Ok1 { - pub neurons_fund_neuron_portions: Vec, -} -pub type Result10 = std::result::Result; -#[derive(Serialize, CandidType, Deserialize)] -pub struct SettleNeuronsFundParticipationResponse { - pub result: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct UpdateNodeProvider { - pub reward_account: Option, -} pub struct Service(pub Principal); impl Service { - pub async fn claim_gtc_neurons(&self, arg0: Principal, arg1: Vec) -> CallResult<(Result_,)> { - ic_cdk::call(self.0, "claim_gtc_neurons", (arg0, arg1)).await - } - pub async fn claim_or_refresh_neuron_from_account( - &self, - arg0: ClaimOrRefreshNeuronFromAccount, - ) -> CallResult<(ClaimOrRefreshNeuronFromAccountResponse,)> { - ic_cdk::call(self.0, "claim_or_refresh_neuron_from_account", (arg0,)).await - } - pub async fn get_build_metadata(&self) -> CallResult<(String,)> { - ic_cdk::call(self.0, "get_build_metadata", ()).await - } - pub async fn get_full_neuron(&self, arg0: u64) -> CallResult<(Result2,)> { - ic_cdk::call(self.0, "get_full_neuron", (arg0,)).await - } - pub async fn get_full_neuron_by_id_or_subaccount(&self, arg0: NeuronIdOrSubaccount) -> CallResult<(Result2,)> { - ic_cdk::call(self.0, "get_full_neuron_by_id_or_subaccount", (arg0,)).await - } - pub async fn get_latest_reward_event(&self) -> CallResult<(RewardEvent,)> { - ic_cdk::call(self.0, "get_latest_reward_event", ()).await - } - pub async fn get_metrics(&self) -> CallResult<(Result3,)> { - ic_cdk::call(self.0, "get_metrics", ()).await - } - pub async fn get_monthly_node_provider_rewards(&self) -> CallResult<(Result4,)> { - ic_cdk::call(self.0, "get_monthly_node_provider_rewards", ()).await - } - pub async fn get_most_recent_monthly_node_provider_rewards( - &self, - ) -> CallResult<(Option,)> { - ic_cdk::call(self.0, "get_most_recent_monthly_node_provider_rewards", ()).await - } - pub async fn get_network_economics_parameters(&self) -> CallResult<(NetworkEconomics,)> { - ic_cdk::call(self.0, "get_network_economics_parameters", ()).await - } - pub async fn get_neuron_ids(&self) -> CallResult<(Vec,)> { - ic_cdk::call(self.0, "get_neuron_ids", ()).await - } - pub async fn get_neuron_info(&self, arg0: u64) -> CallResult<(Result5,)> { - ic_cdk::call(self.0, "get_neuron_info", (arg0,)).await - } - pub async fn get_neuron_info_by_id_or_subaccount(&self, arg0: NeuronIdOrSubaccount) -> CallResult<(Result5,)> { - ic_cdk::call(self.0, "get_neuron_info_by_id_or_subaccount", (arg0,)).await - } - pub async fn get_neurons_fund_audit_info( - &self, - arg0: GetNeuronsFundAuditInfoRequest, - ) -> CallResult<(GetNeuronsFundAuditInfoResponse,)> { - ic_cdk::call(self.0, "get_neurons_fund_audit_info", (arg0,)).await - } - pub async fn get_node_provider_by_caller(&self, arg0: ()) -> CallResult<(Result7,)> { - ic_cdk::call(self.0, "get_node_provider_by_caller", (arg0,)).await - } - pub async fn get_pending_proposals(&self) -> CallResult<(Vec,)> { - ic_cdk::call(self.0, "get_pending_proposals", ()).await - } pub async fn get_proposal_info(&self, arg0: u64) -> CallResult<(Option,)> { ic_cdk::call(self.0, "get_proposal_info", (arg0,)).await } - pub async fn get_restore_aging_summary(&self) -> CallResult<(RestoreAgingSummary,)> { - ic_cdk::call(self.0, "get_restore_aging_summary", ()).await - } - pub async fn list_known_neurons(&self) -> CallResult<(ListKnownNeuronsResponse,)> { - ic_cdk::call(self.0, "list_known_neurons", ()).await - } - pub async fn list_neurons(&self, arg0: ListNeurons) -> CallResult<(ListNeuronsResponse,)> { - ic_cdk::call(self.0, "list_neurons", (arg0,)).await - } - pub async fn list_node_providers(&self) -> CallResult<(ListNodeProvidersResponse,)> { - ic_cdk::call(self.0, "list_node_providers", ()).await - } - pub async fn list_proposals(&self, arg0: ListProposalInfo) -> CallResult<(ListProposalInfoResponse,)> { - ic_cdk::call(self.0, "list_proposals", (arg0,)).await - } - pub async fn manage_neuron(&self, arg0: ManageNeuron) -> CallResult<(ManageNeuronResponse,)> { - ic_cdk::call(self.0, "manage_neuron", (arg0,)).await - } - pub async fn settle_community_fund_participation( - &self, - arg0: SettleCommunityFundParticipation, - ) -> CallResult<(Result_,)> { - ic_cdk::call(self.0, "settle_community_fund_participation", (arg0,)).await - } - pub async fn settle_neurons_fund_participation( - &self, - arg0: SettleNeuronsFundParticipationRequest, - ) -> CallResult<(SettleNeuronsFundParticipationResponse,)> { - ic_cdk::call(self.0, "settle_neurons_fund_participation", (arg0,)).await - } - pub async fn simulate_manage_neuron(&self, arg0: ManageNeuron) -> CallResult<(ManageNeuronResponse,)> { - ic_cdk::call(self.0, "simulate_manage_neuron", (arg0,)).await - } - pub async fn transfer_gtc_neuron(&self, arg0: NeuronId, arg1: NeuronId) -> CallResult<(Result_,)> { - ic_cdk::call(self.0, "transfer_gtc_neuron", (arg0, arg1)).await - } - pub async fn update_node_provider(&self, arg0: UpdateNodeProvider) -> CallResult<(Result_,)> { - ic_cdk::call(self.0, "update_node_provider", (arg0,)).await - } } diff --git a/rs/sns_aggregator/src/types/ic_sns_governance.rs b/rs/sns_aggregator/src/types/ic_sns_governance.rs index a9ed2c0009e..7ad18bc559f 100644 --- a/rs/sns_aggregator/src/types/ic_sns_governance.rs +++ b/rs/sns_aggregator/src/types/ic_sns_governance.rs @@ -499,11 +499,7 @@ pub struct SwapNeuron { pub struct ClaimedSwapNeurons { pub swap_neurons: Vec, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum ClaimSwapNeuronsResult { - Ok(ClaimedSwapNeurons), - Err(i32), -} +pub type ClaimSwapNeuronsResult = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct ClaimSwapNeuronsResponse { pub claim_swap_neurons_result: Option, diff --git a/rs/sns_aggregator/src/types/ic_sns_ledger.rs b/rs/sns_aggregator/src/types/ic_sns_ledger.rs index 923c0e99680..f033e63f979 100644 --- a/rs/sns_aggregator/src/types/ic_sns_ledger.rs +++ b/rs/sns_aggregator/src/types/ic_sns_ledger.rs @@ -238,11 +238,7 @@ pub enum TransferError { TooOld, InsufficientFunds { balance: Tokens }, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum TransferResult { - Ok(BlockIndex), - Err(TransferError), -} +pub type TransferResult = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct AllowanceArgs { pub account: Account, @@ -276,11 +272,7 @@ pub enum ApproveError { Expired { ledger_time: Timestamp }, InsufficientFunds { balance: candid::Nat }, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum ApproveResult { - Ok(BlockIndex), - Err(ApproveError), -} +pub type ApproveResult = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct TransferFromArgs { pub to: Account, @@ -303,11 +295,7 @@ pub enum TransferFromError { TooOld, InsufficientFunds { balance: Tokens }, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum TransferFromResult { - Ok(BlockIndex), - Err(TransferFromError), -} +pub type TransferFromResult = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct GetArchivesArgs { pub from: Option, diff --git a/rs/sns_aggregator/src/types/ic_sns_swap.rs b/rs/sns_aggregator/src/types/ic_sns_swap.rs index 427c387a711..740c758cfbc 100644 --- a/rs/sns_aggregator/src/types/ic_sns_swap.rs +++ b/rs/sns_aggregator/src/types/ic_sns_swap.rs @@ -101,11 +101,7 @@ pub struct Err { pub description: Option, pub error_type: Option, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result_ { - Ok(Ok), - Err(Err), -} +pub type Result_ = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct ErrorRefundIcpResponse { pub result: Option, @@ -126,11 +122,7 @@ pub struct FailedUpdate { pub struct SetDappControllersResponse { pub failed_updates: Vec, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Possibility { - Ok(SetDappControllersResponse), - Err(CanisterCallError), -} +pub type Possibility = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct SetDappControllersCallResult { pub possibility: Option, @@ -152,11 +144,7 @@ pub struct GovernanceError { pub struct Response { pub governance_error: Option, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Possibility1 { - Ok(Response), - Err(CanisterCallError), -} +pub type Possibility1 = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct SettleCommunityFundParticipationResult { pub possibility: Option, @@ -170,20 +158,14 @@ pub struct Ok1 { pub struct Error { pub message: Option, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Possibility2 { - Ok(Ok1), - Err(Error), -} +pub type Possibility2 = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct SettleNeuronsFundParticipationResult { pub possibility: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Possibility3 { - Ok(EmptyRecord), - Err(CanisterCallError), -} +pub struct Possibility3Ok {} +pub type Possibility3 = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct SetModeCallResult { pub possibility: Option, @@ -310,11 +292,7 @@ pub struct Ok2 { pub struct Err1 { pub error_type: Option, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result1 { - Ok(Ok2), - Err(Err1), -} +pub type Result1 = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct GetOpenTicketResponse { pub result: Option, @@ -451,11 +429,7 @@ pub struct Err2 { pub existing_ticket: Option, pub error_type: i32, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result2 { - Ok(Ok2), - Err(Err2), -} +pub type Result2 = std::result::Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct NewSaleTicketResponse { pub result: Option, diff --git a/scripts/did2rs.sh b/scripts/did2rs.sh index a975bd731f1..1dd19714251 100755 --- a/scripts/did2rs.sh +++ b/scripts/did2rs.sh @@ -120,8 +120,9 @@ cd "$GIT_ROOT" # is not guaranteed to be correct. # shellcheck disable=SC2016 if [[ "$DID_PATH" == *nns_governance.did ]]; then - #METHODS_ARGS=("--methods" "list_proposals") - METHODS_ARGS=() + METHODS_ARGS=("--methods" "get_proposal_info") + elif [[ "$DID_PATH" == *nns_registry.did ]]; then + METHODS_ARGS=("--methods" "add_api_boundary_nodes") else METHODS_ARGS=() fi From dab0fa61dc41cb3ce72f093bf2138266dc20a3ff Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Fri, 21 Jun 2024 22:09:47 +0200 Subject: [PATCH 3/4] more work needed --- rs/proposals/src/canisters/sns_wasm/api.rs | 317 +--------- rs/sns_aggregator/src/types.rs | 2 +- .../src/types/ic_sns_governance.rs | 583 +++--------------- .../src/types/ic_sns_ledger.patch | 31 - rs/sns_aggregator/src/types/ic_sns_ledger.rs | 376 ----------- rs/sns_aggregator/src/types/ic_sns_wasm.rs | 392 +----------- rs/sns_aggregator/src/types/upstream.rs | 2 +- scripts/did2rs.sh | 16 +- scripts/proposals/did2rs | 2 +- 9 files changed, 115 insertions(+), 1606 deletions(-) delete mode 100644 rs/sns_aggregator/src/types/ic_sns_ledger.patch diff --git a/rs/proposals/src/canisters/sns_wasm/api.rs b/rs/proposals/src/canisters/sns_wasm/api.rs index c9307dbf619..a7bade8c6ab 100644 --- a/rs/proposals/src/canisters/sns_wasm/api.rs +++ b/rs/proposals/src/canisters/sns_wasm/api.rs @@ -17,12 +17,6 @@ pub struct EmptyRecord {} // use candid::{self, CandidType, Deserialize, Principal}; // use ic_cdk::api::call::CallResult as Result; -#[derive(Serialize, CandidType, Deserialize)] -pub struct SnsWasmCanisterInitPayload { - pub allowed_principals: Vec, - pub access_controls_enabled: bool, - pub sns_subnet_ids: Vec, -} #[derive(Serialize, CandidType, Deserialize)] pub struct SnsWasm { pub wasm: serde_bytes::ByteBuf, @@ -48,187 +42,6 @@ pub struct AddWasmResponse { pub result: Option, } #[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronBasketConstructionParameters { - pub dissolve_delay_interval_seconds: u64, - pub count: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Canister { - pub id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DappCanisters { - pub canisters: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct LinearScalingCoefficient { - pub slope_numerator: Option, - pub intercept_icp_e8s: Option, - pub from_direct_participation_icp_e8s: Option, - pub slope_denominator: Option, - pub to_direct_participation_icp_e8s: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct IdealMatchedParticipationFunction { - pub serialized_representation: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundParticipationConstraints { - pub coefficient_intervals: Vec, - pub max_neurons_fund_participation_icp_e8s: Option, - pub min_direct_participation_threshold_icp_e8s: Option, - pub ideal_matched_participation_function: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct CfNeuron { - pub has_created_neuron_recipes: Option, - pub nns_neuron_id: u64, - pub amount_icp_e8s: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct CfParticipant { - pub hotkey_principal: String, - pub cf_neurons: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronsFundParticipants { - pub participants: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct TreasuryDistribution { - pub total_e8s: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct NeuronDistribution { - pub controller: Option, - pub dissolve_delay_seconds: u64, - pub memo: u64, - pub stake_e8s: u64, - pub vesting_period_seconds: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DeveloperDistribution { - pub developer_neurons: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct AirdropDistribution { - pub airdrop_neurons: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SwapDistribution { - pub total_e8s: u64, - pub initial_swap_amount_e8s: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct FractionalDeveloperVotingPower { - pub treasury_distribution: Option, - pub developer_distribution: Option, - pub airdrop_distribution: Option, - pub swap_distribution: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum InitialTokenDistribution { - FractionalDeveloperVotingPower(FractionalDeveloperVotingPower), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Countries { - pub iso_codes: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SnsInitPayload { - pub url: Option, - pub max_dissolve_delay_seconds: Option, - pub max_dissolve_delay_bonus_percentage: Option, - pub nns_proposal_id: Option, - pub neurons_fund_participation: Option, - pub min_participant_icp_e8s: Option, - pub neuron_basket_construction_parameters: Option, - pub fallback_controller_principal_ids: Vec, - pub token_symbol: Option, - pub final_reward_rate_basis_points: Option, - pub max_icp_e8s: Option, - pub neuron_minimum_stake_e8s: Option, - pub confirmation_text: Option, - pub logo: Option, - pub name: Option, - pub swap_start_timestamp_seconds: Option, - pub swap_due_timestamp_seconds: Option, - pub initial_voting_period_seconds: Option, - pub neuron_minimum_dissolve_delay_to_vote_seconds: Option, - pub description: Option, - pub max_neuron_age_seconds_for_age_bonus: Option, - pub min_participants: Option, - pub initial_reward_rate_basis_points: Option, - pub wait_for_quiet_deadline_increase_seconds: Option, - pub transaction_fee_e8s: Option, - pub dapp_canisters: Option, - pub neurons_fund_participation_constraints: Option, - pub neurons_fund_participants: Option, - pub max_age_bonus_percentage: Option, - pub initial_token_distribution: Option, - pub reward_rate_transition_duration_seconds: Option, - pub token_logo: Option, - pub token_name: Option, - pub max_participant_icp_e8s: Option, - pub min_direct_participation_icp_e8s: Option, - pub proposal_reject_cost_e8s: Option, - pub restricted_countries: Option, - pub min_icp_e8s: Option, - pub max_direct_participation_icp_e8s: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DeployNewSnsRequest { - pub sns_init_payload: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DappCanistersTransferResult { - pub restored_dapp_canisters: Vec, - pub nns_controlled_dapp_canisters: Vec, - pub sns_controlled_dapp_canisters: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct SnsCanisterIds { - pub root: Option, - pub swap: Option, - pub ledger: Option, - pub index: Option, - pub governance: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DeployNewSnsResponse { - pub dapp_canisters_transfer_result: Option, - pub subnet_id: Option, - pub error: Option, - pub canisters: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetAllowedPrincipalsArg {} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetAllowedPrincipalsResponse { - pub allowed_principals: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetDeployedSnsByProposalIdRequest { - pub proposal_id: u64, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct DeployedSns { - pub root_canister_id: Option, - pub governance_canister_id: Option, - pub index_canister_id: Option, - pub swap_canister_id: Option, - pub ledger_canister_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum GetDeployedSnsByProposalIdResult { - Error(SnsWasmError), - DeployedSns(DeployedSns), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetDeployedSnsByProposalIdResponse { - pub get_deployed_sns_by_proposal_id_result: Option, -} -#[derive(Serialize, CandidType, Deserialize)] pub struct SnsVersion { pub archive_wasm_hash: serde_bytes::ByteBuf, pub root_wasm_hash: serde_bytes::ByteBuf, @@ -238,60 +51,6 @@ pub struct SnsVersion { pub index_wasm_hash: serde_bytes::ByteBuf, } #[derive(Serialize, CandidType, Deserialize)] -pub struct GetNextSnsVersionRequest { - pub governance_canister_id: Option, - pub current_version: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetNextSnsVersionResponse { - pub next_version: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetProposalIdThatAddedWasmRequest { - pub hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetProposalIdThatAddedWasmResponse { - pub proposal_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetSnsSubnetIdsArg {} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetSnsSubnetIdsResponse { - pub sns_subnet_ids: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetWasmRequest { - pub hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetWasmResponse { - pub wasm: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetWasmMetadataRequest { - pub hash: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct MetadataSection { - pub contents: Option, - pub name: Option, - pub visibility: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct Ok { - pub sections: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub enum Result1 { - Ok(Ok), - Error(SnsWasmError), -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct GetWasmMetadataResponse { - pub result: Option, -} -#[derive(Serialize, CandidType, Deserialize)] pub struct SnsUpgrade { pub next_version: Option, pub current_version: Option, @@ -306,41 +65,15 @@ pub struct InsertUpgradePathEntriesResponse { pub error: Option, } #[derive(Serialize, CandidType, Deserialize)] -pub struct ListDeployedSnsesArg {} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListDeployedSnsesResponse { - pub instances: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListUpgradeStepsRequest { - pub limit: u32, - pub starting_at: Option, - pub sns_governance_canister_id: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct PrettySnsVersion { - pub archive_wasm_hash: String, - pub root_wasm_hash: String, - pub swap_wasm_hash: String, - pub ledger_wasm_hash: String, - pub governance_wasm_hash: String, - pub index_wasm_hash: String, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListUpgradeStep { - pub pretty_version: Option, - pub version: Option, -} -#[derive(Serialize, CandidType, Deserialize)] -pub struct ListUpgradeStepsResponse { - pub steps: Vec, -} -#[derive(Serialize, CandidType, Deserialize)] pub struct UpdateAllowedPrincipalsRequest { pub added_principals: Vec, pub removed_principals: Vec, } #[derive(Serialize, CandidType, Deserialize)] +pub struct GetAllowedPrincipalsResponse { + pub allowed_principals: Vec, +} +#[derive(Serialize, CandidType, Deserialize)] pub enum UpdateAllowedPrincipalsResult { Error(SnsWasmError), AllowedPrincipals(GetAllowedPrincipalsResponse), @@ -364,54 +97,12 @@ impl Service { pub async fn add_wasm(&self, arg0: AddWasmRequest) -> CallResult<(AddWasmResponse,)> { ic_cdk::call(self.0, "add_wasm", (arg0,)).await } - pub async fn deploy_new_sns(&self, arg0: DeployNewSnsRequest) -> CallResult<(DeployNewSnsResponse,)> { - ic_cdk::call(self.0, "deploy_new_sns", (arg0,)).await - } - pub async fn get_allowed_principals( - &self, - arg0: GetAllowedPrincipalsArg, - ) -> CallResult<(GetAllowedPrincipalsResponse,)> { - ic_cdk::call(self.0, "get_allowed_principals", (arg0,)).await - } - pub async fn get_deployed_sns_by_proposal_id( - &self, - arg0: GetDeployedSnsByProposalIdRequest, - ) -> CallResult<(GetDeployedSnsByProposalIdResponse,)> { - ic_cdk::call(self.0, "get_deployed_sns_by_proposal_id", (arg0,)).await - } - pub async fn get_latest_sns_version_pretty(&self, arg0: ()) -> CallResult<(Vec<(String, String)>,)> { - ic_cdk::call(self.0, "get_latest_sns_version_pretty", (arg0,)).await - } - pub async fn get_next_sns_version(&self, arg0: GetNextSnsVersionRequest) -> CallResult<(GetNextSnsVersionResponse,)> { - ic_cdk::call(self.0, "get_next_sns_version", (arg0,)).await - } - pub async fn get_proposal_id_that_added_wasm( - &self, - arg0: GetProposalIdThatAddedWasmRequest, - ) -> CallResult<(GetProposalIdThatAddedWasmResponse,)> { - ic_cdk::call(self.0, "get_proposal_id_that_added_wasm", (arg0,)).await - } - pub async fn get_sns_subnet_ids(&self, arg0: GetSnsSubnetIdsArg) -> CallResult<(GetSnsSubnetIdsResponse,)> { - ic_cdk::call(self.0, "get_sns_subnet_ids", (arg0,)).await - } - pub async fn get_wasm(&self, arg0: GetWasmRequest) -> CallResult<(GetWasmResponse,)> { - ic_cdk::call(self.0, "get_wasm", (arg0,)).await - } - pub async fn get_wasm_metadata(&self, arg0: GetWasmMetadataRequest) -> CallResult<(GetWasmMetadataResponse,)> { - ic_cdk::call(self.0, "get_wasm_metadata", (arg0,)).await - } pub async fn insert_upgrade_path_entries( &self, arg0: InsertUpgradePathEntriesRequest, ) -> CallResult<(InsertUpgradePathEntriesResponse,)> { ic_cdk::call(self.0, "insert_upgrade_path_entries", (arg0,)).await } - pub async fn list_deployed_snses(&self, arg0: ListDeployedSnsesArg) -> CallResult<(ListDeployedSnsesResponse,)> { - ic_cdk::call(self.0, "list_deployed_snses", (arg0,)).await - } - pub async fn list_upgrade_steps(&self, arg0: ListUpgradeStepsRequest) -> CallResult<(ListUpgradeStepsResponse,)> { - ic_cdk::call(self.0, "list_upgrade_steps", (arg0,)).await - } pub async fn update_allowed_principals( &self, arg0: UpdateAllowedPrincipalsRequest, diff --git a/rs/sns_aggregator/src/types.rs b/rs/sns_aggregator/src/types.rs index 4c0d4658cfd..c47fe8bfba3 100644 --- a/rs/sns_aggregator/src/types.rs +++ b/rs/sns_aggregator/src/types.rs @@ -14,7 +14,7 @@ pub mod upstream; // Re-export commonly used types to ensure that different versions of the same type are not used. pub use candid::{CandidType, Deserialize}; pub use ic_sns_governance::{GetMetadataResponse, ListNervousSystemFunctionsResponse}; -pub use ic_sns_ledger::{Tokens as SnsTokens, Value as Icrc1Value}; +pub use ic_sns_ledger::{Tokens as SnsTokens, MetadataValue as Icrc1Value}; pub use ic_sns_root::ListSnsCanistersResponse; pub use ic_sns_swap::GetStateResponse; pub use serde::Serialize; diff --git a/rs/sns_aggregator/src/types/ic_sns_governance.rs b/rs/sns_aggregator/src/types/ic_sns_governance.rs index 7ad18bc559f..577876b166e 100644 --- a/rs/sns_aggregator/src/types/ic_sns_governance.rs +++ b/rs/sns_aggregator/src/types/ic_sns_governance.rs @@ -16,6 +16,15 @@ use ic_cdk::api::call::CallResult; // use candid::{self, CandidType, Deserialize, Principal}; // use ic_cdk::api::call::CallResult as Result; +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct GetMetadataArg {} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize, Default)] +pub struct GetMetadataResponse { + pub url: Option, + pub logo: Option, + pub name: Option, + pub description: Option, +} #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct GenericNervousSystemFunction { pub validator_canister_id: Option, @@ -35,34 +44,87 @@ pub struct NervousSystemFunction { pub description: Option, pub function_type: Option, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GovernanceCachedMetrics { - pub not_dissolving_neurons_e8s_buckets: Vec<(u64, f64)>, - pub garbage_collectable_neurons_count: u64, - pub neurons_with_invalid_stake_count: u64, - pub not_dissolving_neurons_count_buckets: Vec<(u64, u64)>, - pub neurons_with_less_than_6_months_dissolve_delay_count: u64, - pub dissolved_neurons_count: u64, - pub total_staked_e8s: u64, - pub total_supply_governance_tokens: u64, - pub not_dissolving_neurons_count: u64, - pub dissolved_neurons_e8s: u64, - pub neurons_with_less_than_6_months_dissolve_delay_e8s: u64, - pub dissolving_neurons_count_buckets: Vec<(u64, u64)>, - pub dissolving_neurons_count: u64, - pub dissolving_neurons_e8s_buckets: Vec<(u64, f64)>, - pub timestamp_seconds: u64, +#[derive(Serialize, Clone, Debug, CandidType, Deserialize, Default)] +pub struct ListNervousSystemFunctionsResponse { + pub reserved_ids: Vec, + pub functions: Vec, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct MaturityModulation { - pub current_basis_points: Option, - pub updated_at_timestamp_seconds: Option, +pub struct Split { + pub memo: u64, + pub amount_e8s: u64, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct NeuronId { pub id: serde_bytes::ByteBuf, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct Follow { + pub function_id: u64, + pub followees: Vec, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct Subaccount { + pub subaccount: serde_bytes::ByteBuf, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct Account { + pub owner: Option, + pub subaccount: Option, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct DisburseMaturity { + pub to_account: Option, + pub percentage_to_disburse: u32, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct MemoAndController { + pub controller: Option, + pub memo: u64, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub enum By { + MemoAndController(MemoAndController), + NeuronId(EmptyRecord), +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct ClaimOrRefresh { + pub by: Option, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct ChangeAutoStakeMaturity { + pub requested_setting_for_auto_stake_maturity: bool, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct IncreaseDissolveDelay { + pub additional_dissolve_delay_seconds: u32, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct SetDissolveTimestamp { + pub dissolve_timestamp_seconds: u64, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub enum Operation { + ChangeAutoStakeMaturity(ChangeAutoStakeMaturity), + StopDissolving(EmptyRecord), + StartDissolving(EmptyRecord), + IncreaseDissolveDelay(IncreaseDissolveDelay), + SetDissolveTimestamp(SetDissolveTimestamp), +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct Configure { + pub operation: Option, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct ProposalId { + pub id: u64, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct RegisterVote { + pub vote: i32, + pub proposal: Option, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct Followees { pub followees: Vec, } @@ -105,97 +167,6 @@ pub struct NervousSystemParameters { pub max_number_of_principals_per_neuron: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Version { - pub archive_wasm_hash: serde_bytes::ByteBuf, - pub root_wasm_hash: serde_bytes::ByteBuf, - pub swap_wasm_hash: serde_bytes::ByteBuf, - pub ledger_wasm_hash: serde_bytes::ByteBuf, - pub governance_wasm_hash: serde_bytes::ByteBuf, - pub index_wasm_hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ProposalId { - pub id: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct RewardEvent { - pub rounds_since_last_distribution: Option, - pub actual_timestamp_seconds: u64, - pub end_timestamp_seconds: Option, - pub total_available_e8s_equivalent: Option, - pub distributed_e8s_equivalent: u64, - pub round: u64, - pub settled_proposals: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct UpgradeInProgress { - pub mark_failed_at_seconds: u64, - pub checking_upgrade_lock: u64, - pub proposal_id: u64, - pub target_version: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GovernanceError { - pub error_message: String, - pub error_type: i32, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Subaccount { - pub subaccount: serde_bytes::ByteBuf, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Account { - pub owner: Option, - pub subaccount: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Decimal { - pub human_readable: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Tokens { - pub e8s: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ValuationFactors { - pub xdrs_per_icp: Option, - pub icps_per_token: Option, - pub tokens: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Valuation { - pub token: Option, - pub account: Option, - pub valuation_factors: Option, - pub timestamp_seconds: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct MintSnsTokensActionAuxiliary { - pub valuation: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum ActionAuxiliary { - TransferSnsTreasuryFunds(MintSnsTokensActionAuxiliary), - MintSnsTokens(MintSnsTokensActionAuxiliary), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Ballot { - pub vote: i32, - pub cast_timestamp_seconds: u64, - pub voting_power: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Percentage { - pub basis_points: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Tally { - pub no: u64, - pub yes: u64, - pub total: u64, - pub timestamp_seconds: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct ManageDappCanisterSettings { pub freezing_threshold: Option, pub canister_ids: Vec, @@ -285,96 +256,8 @@ pub struct Proposal { pub summary: String, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct WaitForQuietState { - pub current_deadline_timestamp_seconds: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ProposalData { - pub id: Option, - pub payload_text_rendering: Option, - pub action: u64, - pub failure_reason: Option, - pub action_auxiliary: Option, - pub ballots: Vec<(String, Ballot)>, - pub minimum_yes_proportion_of_total: Option, - pub reward_event_round: u64, - pub failed_timestamp_seconds: u64, - pub reward_event_end_timestamp_seconds: Option, - pub proposal_creation_timestamp_seconds: u64, - pub initial_voting_period_seconds: u64, - pub reject_cost_e8s: u64, - pub latest_tally: Option, - pub wait_for_quiet_deadline_increase_seconds: u64, - pub decided_timestamp_seconds: u64, - pub proposal: Option, - pub proposer: Option, - pub wait_for_quiet_state: Option, - pub minimum_yes_proportion_of_exercised: Option, - pub is_eligible_for_rewards: bool, - pub executed_timestamp_seconds: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Split { - pub memo: u64, - pub amount_e8s: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Follow { - pub function_id: u64, - pub followees: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DisburseMaturity { - pub to_account: Option, - pub percentage_to_disburse: u32, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ChangeAutoStakeMaturity { - pub requested_setting_for_auto_stake_maturity: bool, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct IncreaseDissolveDelay { - pub additional_dissolve_delay_seconds: u32, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SetDissolveTimestamp { - pub dissolve_timestamp_seconds: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Operation { - ChangeAutoStakeMaturity(ChangeAutoStakeMaturity), - StopDissolving(EmptyRecord), - StartDissolving(EmptyRecord), - IncreaseDissolveDelay(IncreaseDissolveDelay), - SetDissolveTimestamp(SetDissolveTimestamp), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Configure { - pub operation: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct RegisterVote { - pub vote: i32, - pub proposal: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct FinalizeDisburseMaturity { - pub amount_to_be_disbursed_e8s: u64, - pub to_account: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct MemoAndController { - pub controller: Option, - pub memo: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum By { - MemoAndController(MemoAndController), - NeuronId(EmptyRecord), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ClaimOrRefresh { - pub by: Option, +pub struct StakeMaturity { + pub percentage_to_stake: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct RemoveNeuronPermissions { @@ -400,232 +283,6 @@ pub struct Disburse { pub amount: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Command2 { - Split(Split), - Follow(Follow), - DisburseMaturity(DisburseMaturity), - Configure(Configure), - RegisterVote(RegisterVote), - SyncCommand(EmptyRecord), - MakeProposal(Proposal), - FinalizeDisburseMaturity(FinalizeDisburseMaturity), - ClaimOrRefreshNeuron(ClaimOrRefresh), - RemoveNeuronPermissions(RemoveNeuronPermissions), - AddNeuronPermissions(AddNeuronPermissions), - MergeMaturity(MergeMaturity), - Disburse(Disburse), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronInFlightCommand { - pub command: Option, - pub timestamp: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronPermission { - pub principal: Option, - pub permission_type: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum DissolveState { - DissolveDelaySeconds(u64), - WhenDissolvedTimestampSeconds(u64), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DisburseMaturityInProgress { - pub timestamp_of_disbursement_seconds: u64, - pub amount_e8s: u64, - pub account_to_disburse_to: Option, - pub finalize_disbursement_timestamp_seconds: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Neuron { - pub id: Option, - pub staked_maturity_e8s_equivalent: Option, - pub permissions: Vec, - pub maturity_e8s_equivalent: u64, - pub cached_neuron_stake_e8s: u64, - pub created_timestamp_seconds: u64, - pub source_nns_neuron_id: Option, - pub auto_stake_maturity: Option, - pub aging_since_timestamp_seconds: u64, - pub dissolve_state: Option, - pub voting_power_percentage_multiplier: u64, - pub vesting_period_seconds: Option, - pub disburse_maturity_in_progress: Vec, - pub followees: Vec<(u64, Followees)>, - pub neuron_fees_e8s: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Governance { - pub root_canister_id: Option, - pub id_to_nervous_system_functions: Vec<(u64, NervousSystemFunction)>, - pub metrics: Option, - pub maturity_modulation: Option, - pub mode: i32, - pub parameters: Option, - pub is_finalizing_disburse_maturity: Option, - pub deployed_version: Option, - pub sns_initialization_parameters: String, - pub latest_reward_event: Option, - pub pending_version: Option, - pub swap_canister_id: Option, - pub ledger_canister_id: Option, - pub proposals: Vec<(u64, ProposalData)>, - pub in_flight_commands: Vec<(String, NeuronInFlightCommand)>, - pub sns_metadata: Option, - pub neurons: Vec<(String, Neuron)>, - pub genesis_timestamp_seconds: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronParameters { - pub controller: Option, - pub dissolve_delay_seconds: Option, - pub source_nns_neuron_id: Option, - pub stake_e8s: Option, - pub followees: Vec, - pub hotkey: Option, - pub neuron_id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ClaimSwapNeuronsRequest { - pub neuron_parameters: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SwapNeuron { - pub id: Option, - pub status: i32, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ClaimedSwapNeurons { - pub swap_neurons: Vec, -} -pub type ClaimSwapNeuronsResult = std::result::Result; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ClaimSwapNeuronsResponse { - pub claim_swap_neurons_result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct FailStuckUpgradeInProgressArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct FailStuckUpgradeInProgressRet {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetMaturityModulationArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetMaturityModulationResponse { - pub maturity_modulation: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetMetadataArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize, Default)] -pub struct GetMetadataResponse { - pub url: Option, - pub logo: Option, - pub name: Option, - pub description: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetModeArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetModeResponse { - pub mode: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetNeuron { - pub neuron_id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result_ { - Error(GovernanceError), - Neuron(Neuron), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetNeuronResponse { - pub result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetProposal { - pub proposal_id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result1 { - Error(GovernanceError), - Proposal(ProposalData), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetProposalResponse { - pub result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum CanisterStatusType { - #[serde(rename = "stopped")] - Stopped, - #[serde(rename = "stopping")] - Stopping, - #[serde(rename = "running")] - Running, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DefiniteCanisterSettingsArgs { - pub freezing_threshold: candid::Nat, - pub controllers: Vec, - pub memory_allocation: candid::Nat, - pub compute_allocation: candid::Nat, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct CanisterStatusResultV2 { - pub status: CanisterStatusType, - pub memory_size: candid::Nat, - pub cycles: candid::Nat, - pub settings: DefiniteCanisterSettingsArgs, - pub idle_cycles_burned_per_day: candid::Nat, - pub module_hash: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetRunningSnsVersionArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetRunningSnsVersionResponse { - pub deployed_version: Option, - pub pending_version: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetSnsInitializationParametersArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetSnsInitializationParametersResponse { - pub sns_initialization_parameters: String, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize, Default)] -pub struct ListNervousSystemFunctionsResponse { - pub reserved_ids: Vec, - pub functions: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListNeurons { - pub of_principal: Option, - pub limit: u32, - pub start_page_at: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListNeuronsResponse { - pub neurons: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListProposals { - pub include_reward_status: Vec, - pub before_proposal: Option, - pub limit: u32, - pub exclude_type: Vec, - pub include_status: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListProposalsResponse { - pub include_ballots_by_caller: Option, - pub proposals: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct StakeMaturity { - pub percentage_to_stake: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub enum Command { Split(Split), Follow(Follow), @@ -646,6 +303,11 @@ pub struct ManageNeuron { pub command: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct GovernanceError { + pub error_message: String, + pub error_type: i32, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct SplitResponse { pub created_neuron_id: Option, } @@ -659,6 +321,10 @@ pub struct ClaimOrRefreshResponse { pub refreshed_neuron_id: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] +pub struct GetProposal { + pub proposal_id: Option, +} +#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct StakeMaturityResponse { pub maturity_e8s: u64, pub staked_maturity_e8s: u64, @@ -692,79 +358,16 @@ pub enum Command1 { pub struct ManageNeuronResponse { pub command: Option, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SetMode { - pub mode: i32, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SetModeRet {} pub struct Service(pub Principal); impl Service { - pub async fn claim_swap_neurons(&self, arg0: ClaimSwapNeuronsRequest) -> CallResult<(ClaimSwapNeuronsResponse,)> { - ic_cdk::call(self.0, "claim_swap_neurons", (arg0,)).await - } - pub async fn fail_stuck_upgrade_in_progress( - &self, - arg0: FailStuckUpgradeInProgressArg, - ) -> CallResult<(FailStuckUpgradeInProgressRet,)> { - ic_cdk::call(self.0, "fail_stuck_upgrade_in_progress", (arg0,)).await - } - pub async fn get_build_metadata(&self) -> CallResult<(String,)> { - ic_cdk::call(self.0, "get_build_metadata", ()).await - } - pub async fn get_latest_reward_event(&self) -> CallResult<(RewardEvent,)> { - ic_cdk::call(self.0, "get_latest_reward_event", ()).await - } - pub async fn get_maturity_modulation( - &self, - arg0: GetMaturityModulationArg, - ) -> CallResult<(GetMaturityModulationResponse,)> { - ic_cdk::call(self.0, "get_maturity_modulation", (arg0,)).await - } pub async fn get_metadata(&self, arg0: GetMetadataArg) -> CallResult<(GetMetadataResponse,)> { ic_cdk::call(self.0, "get_metadata", (arg0,)).await } - pub async fn get_mode(&self, arg0: GetModeArg) -> CallResult<(GetModeResponse,)> { - ic_cdk::call(self.0, "get_mode", (arg0,)).await - } - pub async fn get_nervous_system_parameters(&self, arg0: ()) -> CallResult<(NervousSystemParameters,)> { - ic_cdk::call(self.0, "get_nervous_system_parameters", (arg0,)).await - } - pub async fn get_neuron(&self, arg0: GetNeuron) -> CallResult<(GetNeuronResponse,)> { - ic_cdk::call(self.0, "get_neuron", (arg0,)).await - } - pub async fn get_proposal(&self, arg0: GetProposal) -> CallResult<(GetProposalResponse,)> { - ic_cdk::call(self.0, "get_proposal", (arg0,)).await - } - pub async fn get_root_canister_status(&self, arg0: ()) -> CallResult<(CanisterStatusResultV2,)> { - ic_cdk::call(self.0, "get_root_canister_status", (arg0,)).await - } - pub async fn get_running_sns_version( - &self, - arg0: GetRunningSnsVersionArg, - ) -> CallResult<(GetRunningSnsVersionResponse,)> { - ic_cdk::call(self.0, "get_running_sns_version", (arg0,)).await - } - pub async fn get_sns_initialization_parameters( - &self, - arg0: GetSnsInitializationParametersArg, - ) -> CallResult<(GetSnsInitializationParametersResponse,)> { - ic_cdk::call(self.0, "get_sns_initialization_parameters", (arg0,)).await - } pub async fn list_nervous_system_functions(&self) -> CallResult<(ListNervousSystemFunctionsResponse,)> { ic_cdk::call(self.0, "list_nervous_system_functions", ()).await } - pub async fn list_neurons(&self, arg0: ListNeurons) -> CallResult<(ListNeuronsResponse,)> { - ic_cdk::call(self.0, "list_neurons", (arg0,)).await - } - pub async fn list_proposals(&self, arg0: ListProposals) -> CallResult<(ListProposalsResponse,)> { - ic_cdk::call(self.0, "list_proposals", (arg0,)).await - } pub async fn manage_neuron(&self, arg0: ManageNeuron) -> CallResult<(ManageNeuronResponse,)> { ic_cdk::call(self.0, "manage_neuron", (arg0,)).await } - pub async fn set_mode(&self, arg0: SetMode) -> CallResult<(SetModeRet,)> { - ic_cdk::call(self.0, "set_mode", (arg0,)).await - } } diff --git a/rs/sns_aggregator/src/types/ic_sns_ledger.patch b/rs/sns_aggregator/src/types/ic_sns_ledger.patch deleted file mode 100644 index 9f5ea03ec33..00000000000 --- a/rs/sns_aggregator/src/types/ic_sns_ledger.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git b/rs/sns_aggregator/src/types/ic_sns_ledger.rs a/rs/sns_aggregator/src/types/ic_sns_ledger.rs -index 7566582df..00c91ff35 100644 ---- b/rs/sns_aggregator/src/types/ic_sns_ledger.rs -+++ a/rs/sns_aggregator/src/types/ic_sns_ledger.rs -@@ -129,7 +129,7 @@ pub struct GetBlocksResponseArchivedBlocksItem { - pub start: BlockIndex, - pub length: candid::Nat, - } --#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -+#[derive(CandidType, Deserialize)] - pub struct GetBlocksResponse { - pub certificate: Option, - pub first_index: BlockIndex, -@@ -205,7 +205,7 @@ pub struct GetTransactionsResponseArchivedTransactionsItem { - pub start: TxIndex, - pub length: candid::Nat, - } --#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -+#[derive(CandidType, Deserialize)] - pub struct GetTransactionsResponse { - pub first_index: TxIndex, - pub log_length: candid::Nat, -@@ -339,7 +339,7 @@ pub struct GetBlocksResultArchivedBlocksItem { - pub args: Vec, - pub callback: GetBlocksResultArchivedBlocksItemCallback, - } --#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -+#[derive(CandidType, Deserialize)] - pub struct GetBlocksResult { - pub log_length: candid::Nat, - pub blocks: Vec, diff --git a/rs/sns_aggregator/src/types/ic_sns_ledger.rs b/rs/sns_aggregator/src/types/ic_sns_ledger.rs index f033e63f979..cc8d7d5cfb3 100644 --- a/rs/sns_aggregator/src/types/ic_sns_ledger.rs +++ b/rs/sns_aggregator/src/types/ic_sns_ledger.rs @@ -16,17 +16,6 @@ use ic_cdk::api::call::CallResult; // use candid::{self, CandidType, Deserialize, Principal}; // use ic_cdk::api::call::CallResult as Result; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ChangeArchiveOptions { - pub num_blocks_to_archive: Option, - pub max_transactions_per_response: Option, - pub trigger_threshold: Option, - pub more_controller_ids: Option>, - pub max_message_size_bytes: Option, - pub cycles_for_archive_creation: Option, - pub node_max_memory_size_bytes: Option, - pub controller_id: Option, -} #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub enum MetadataValue { Int(candid::Int), @@ -34,379 +23,14 @@ pub enum MetadataValue { Blob(serde_bytes::ByteBuf), Text(String), } -pub type Subaccount = serde_bytes::ByteBuf; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Account { - pub owner: Principal, - pub subaccount: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum ChangeFeeCollector { - SetTo(Account), - Unset, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct FeatureFlags { - pub icrc2: bool, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct UpgradeArgs { - pub change_archive_options: Option, - pub token_symbol: Option, - pub transfer_fee: Option, - pub metadata: Option>, - pub maximum_number_of_accounts: Option, - pub accounts_overflow_trim_quantity: Option, - pub change_fee_collector: Option, - pub max_memo_length: Option, - pub token_name: Option, - pub feature_flags: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct InitArgsArchiveOptions { - pub num_blocks_to_archive: u64, - pub max_transactions_per_response: Option, - pub trigger_threshold: u64, - pub more_controller_ids: Option>, - pub max_message_size_bytes: Option, - pub cycles_for_archive_creation: Option, - pub node_max_memory_size_bytes: Option, - pub controller_id: Principal, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct InitArgs { - pub decimals: Option, - pub token_symbol: String, - pub transfer_fee: candid::Nat, - pub metadata: Vec<(String, MetadataValue)>, - pub minting_account: Account, - pub initial_balances: Vec<(Account, candid::Nat)>, - pub maximum_number_of_accounts: Option, - pub accounts_overflow_trim_quantity: Option, - pub fee_collector_account: Option, - pub archive_options: InitArgsArchiveOptions, - pub max_memo_length: Option, - pub token_name: String, - pub feature_flags: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum LedgerArg { - Upgrade(Option), - Init(InitArgs), -} -pub type BlockIndex = candid::Nat; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ArchiveInfo { - pub block_range_end: BlockIndex, - pub canister_id: Principal, - pub block_range_start: BlockIndex, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetBlocksArgs { - pub start: BlockIndex, - pub length: candid::Nat, -} -pub type Map = Vec<(String, Box)>; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Value { - Int(candid::Int), - Map(Map), - Nat(candid::Nat), - Nat64(u64), - Blob(serde_bytes::ByteBuf), - Text(String), - Array(Vec>), -} -pub type Block = Box; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct BlockRange { - pub blocks: Vec, -} -pub type QueryBlockArchiveFn = candid::Func; -#[derive(CandidType, Deserialize)] -pub struct GetBlocksResponseArchivedBlocksItem { - pub callback: QueryBlockArchiveFn, - pub start: BlockIndex, - pub length: candid::Nat, -} -#[derive(CandidType, Deserialize)] -pub struct GetBlocksResponse { - pub certificate: Option, - pub first_index: BlockIndex, - pub blocks: Vec, - pub chain_length: u64, - pub archived_blocks: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DataCertificate { - pub certificate: Option, - pub hash_tree: serde_bytes::ByteBuf, -} -pub type TxIndex = candid::Nat; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetTransactionsRequest { - pub start: TxIndex, - pub length: candid::Nat, -} -pub type Timestamp = u64; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Burn { - pub from: Account, - pub memo: Option, - pub created_at_time: Option, - pub amount: candid::Nat, - pub spender: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Mint { - pub to: Account, - pub memo: Option, - pub created_at_time: Option, - pub amount: candid::Nat, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Approve { - pub fee: Option, - pub from: Account, - pub memo: Option, - pub created_at_time: Option, - pub amount: candid::Nat, - pub expected_allowance: Option, - pub expires_at: Option, - pub spender: Account, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Transfer { - pub to: Account, - pub fee: Option, - pub from: Account, - pub memo: Option, - pub created_at_time: Option, - pub amount: candid::Nat, - pub spender: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Transaction { - pub burn: Option, - pub kind: String, - pub mint: Option, - pub approve: Option, - pub timestamp: Timestamp, - pub transfer: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct TransactionRange { - pub transactions: Vec, -} -pub type QueryArchiveFn = candid::Func; -#[derive(CandidType, Deserialize)] -pub struct GetTransactionsResponseArchivedTransactionsItem { - pub callback: QueryArchiveFn, - pub start: TxIndex, - pub length: candid::Nat, -} -#[derive(CandidType, Deserialize)] -pub struct GetTransactionsResponse { - pub first_index: TxIndex, - pub log_length: candid::Nat, - pub transactions: Vec, - pub archived_transactions: Vec, -} pub type Tokens = candid::Nat; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct StandardRecord { - pub url: String, - pub name: String, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct TransferArg { - pub to: Account, - pub fee: Option, - pub memo: Option, - pub from_subaccount: Option, - pub created_at_time: Option, - pub amount: Tokens, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum TransferError { - GenericError { message: String, error_code: candid::Nat }, - TemporarilyUnavailable, - BadBurn { min_burn_amount: Tokens }, - Duplicate { duplicate_of: BlockIndex }, - BadFee { expected_fee: Tokens }, - CreatedInFuture { ledger_time: Timestamp }, - TooOld, - InsufficientFunds { balance: Tokens }, -} -pub type TransferResult = std::result::Result; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct AllowanceArgs { - pub account: Account, - pub spender: Account, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Allowance { - pub allowance: candid::Nat, - pub expires_at: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ApproveArgs { - pub fee: Option, - pub memo: Option, - pub from_subaccount: Option, - pub created_at_time: Option, - pub amount: candid::Nat, - pub expected_allowance: Option, - pub expires_at: Option, - pub spender: Account, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum ApproveError { - GenericError { message: String, error_code: candid::Nat }, - TemporarilyUnavailable, - Duplicate { duplicate_of: BlockIndex }, - BadFee { expected_fee: candid::Nat }, - AllowanceChanged { current_allowance: candid::Nat }, - CreatedInFuture { ledger_time: Timestamp }, - TooOld, - Expired { ledger_time: Timestamp }, - InsufficientFunds { balance: candid::Nat }, -} -pub type ApproveResult = std::result::Result; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct TransferFromArgs { - pub to: Account, - pub fee: Option, - pub spender_subaccount: Option, - pub from: Account, - pub memo: Option, - pub created_at_time: Option, - pub amount: Tokens, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum TransferFromError { - GenericError { message: String, error_code: candid::Nat }, - TemporarilyUnavailable, - InsufficientAllowance { allowance: Tokens }, - BadBurn { min_burn_amount: Tokens }, - Duplicate { duplicate_of: BlockIndex }, - BadFee { expected_fee: Tokens }, - CreatedInFuture { ledger_time: Timestamp }, - TooOld, - InsufficientFunds { balance: Tokens }, -} -pub type TransferFromResult = std::result::Result; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetArchivesArgs { - pub from: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetArchivesResultItem { - pub end: candid::Nat, - pub canister_id: Principal, - pub start: candid::Nat, -} -pub type GetArchivesResult = Vec; -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Icrc3Value { - Int(candid::Int), - Map(Vec<(String, Box)>), - Nat(candid::Nat), - Blob(serde_bytes::ByteBuf), - Text(String), - Array(Vec>), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetBlocksResultBlocksItem { - pub id: candid::Nat, - pub block: Box, -} -pub type GetBlocksResultArchivedBlocksItemCallback = candid::Func; -#[derive(CandidType, Deserialize)] -pub struct GetBlocksResultArchivedBlocksItem { - pub args: Vec, - pub callback: GetBlocksResultArchivedBlocksItemCallback, -} -#[derive(CandidType, Deserialize)] -pub struct GetBlocksResult { - pub log_length: candid::Nat, - pub blocks: Vec, - pub archived_blocks: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Icrc3DataCertificate { - pub certificate: serde_bytes::ByteBuf, - pub hash_tree: serde_bytes::ByteBuf, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Icrc3SupportedBlockTypesRetItem { - pub url: String, - pub block_type: String, -} pub struct Service(pub Principal); impl Service { - pub async fn archives(&self) -> CallResult<(Vec,)> { - ic_cdk::call(self.0, "archives", ()).await - } - pub async fn get_blocks(&self, arg0: GetBlocksArgs) -> CallResult<(GetBlocksResponse,)> { - ic_cdk::call(self.0, "get_blocks", (arg0,)).await - } - pub async fn get_data_certificate(&self) -> CallResult<(DataCertificate,)> { - ic_cdk::call(self.0, "get_data_certificate", ()).await - } - pub async fn get_transactions(&self, arg0: GetTransactionsRequest) -> CallResult<(GetTransactionsResponse,)> { - ic_cdk::call(self.0, "get_transactions", (arg0,)).await - } - pub async fn icrc_1_balance_of(&self, arg0: Account) -> CallResult<(Tokens,)> { - ic_cdk::call(self.0, "icrc1_balance_of", (arg0,)).await - } - pub async fn icrc_1_decimals(&self) -> CallResult<(u8,)> { - ic_cdk::call(self.0, "icrc1_decimals", ()).await - } - pub async fn icrc_1_fee(&self) -> CallResult<(Tokens,)> { - ic_cdk::call(self.0, "icrc1_fee", ()).await - } pub async fn icrc_1_metadata(&self) -> CallResult<(Vec<(String, MetadataValue)>,)> { ic_cdk::call(self.0, "icrc1_metadata", ()).await } - pub async fn icrc_1_minting_account(&self) -> CallResult<(Option,)> { - ic_cdk::call(self.0, "icrc1_minting_account", ()).await - } - pub async fn icrc_1_name(&self) -> CallResult<(String,)> { - ic_cdk::call(self.0, "icrc1_name", ()).await - } - pub async fn icrc_1_supported_standards(&self) -> CallResult<(Vec,)> { - ic_cdk::call(self.0, "icrc1_supported_standards", ()).await - } - pub async fn icrc_1_symbol(&self) -> CallResult<(String,)> { - ic_cdk::call(self.0, "icrc1_symbol", ()).await - } pub async fn icrc_1_total_supply(&self) -> CallResult<(Tokens,)> { ic_cdk::call(self.0, "icrc1_total_supply", ()).await } - pub async fn icrc_1_transfer(&self, arg0: TransferArg) -> CallResult<(TransferResult,)> { - ic_cdk::call(self.0, "icrc1_transfer", (arg0,)).await - } - pub async fn icrc_2_allowance(&self, arg0: AllowanceArgs) -> CallResult<(Allowance,)> { - ic_cdk::call(self.0, "icrc2_allowance", (arg0,)).await - } - pub async fn icrc_2_approve(&self, arg0: ApproveArgs) -> CallResult<(ApproveResult,)> { - ic_cdk::call(self.0, "icrc2_approve", (arg0,)).await - } - pub async fn icrc_2_transfer_from(&self, arg0: TransferFromArgs) -> CallResult<(TransferFromResult,)> { - ic_cdk::call(self.0, "icrc2_transfer_from", (arg0,)).await - } - pub async fn icrc_3_get_archives(&self, arg0: GetArchivesArgs) -> CallResult<(GetArchivesResult,)> { - ic_cdk::call(self.0, "icrc3_get_archives", (arg0,)).await - } - pub async fn icrc_3_get_blocks(&self, arg0: Vec) -> CallResult<(GetBlocksResult,)> { - ic_cdk::call(self.0, "icrc3_get_blocks", (arg0,)).await - } - pub async fn icrc_3_get_tip_certificate(&self) -> CallResult<(Option,)> { - ic_cdk::call(self.0, "icrc3_get_tip_certificate", ()).await - } - pub async fn icrc_3_supported_block_types(&self) -> CallResult<(Vec,)> { - ic_cdk::call(self.0, "icrc3_supported_block_types", ()).await - } } diff --git a/rs/sns_aggregator/src/types/ic_sns_wasm.rs b/rs/sns_aggregator/src/types/ic_sns_wasm.rs index 3d8af48b8b3..49b5bde2ada 100644 --- a/rs/sns_aggregator/src/types/ic_sns_wasm.rs +++ b/rs/sns_aggregator/src/types/ic_sns_wasm.rs @@ -17,199 +17,7 @@ use ic_cdk::api::call::CallResult; // use ic_cdk::api::call::CallResult as Result; #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsWasmCanisterInitPayload { - pub allowed_principals: Vec, - pub access_controls_enabled: bool, - pub sns_subnet_ids: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsWasm { - pub wasm: serde_bytes::ByteBuf, - pub proposal_id: Option, - pub canister_type: i32, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct AddWasmRequest { - pub hash: serde_bytes::ByteBuf, - pub wasm: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsWasmError { - pub message: String, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result_ { - Error(SnsWasmError), - Hash(serde_bytes::ByteBuf), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct AddWasmResponse { - pub result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronBasketConstructionParameters { - pub dissolve_delay_interval_seconds: u64, - pub count: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Canister { - pub id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DappCanisters { - pub canisters: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct LinearScalingCoefficient { - pub slope_numerator: Option, - pub intercept_icp_e8s: Option, - pub from_direct_participation_icp_e8s: Option, - pub slope_denominator: Option, - pub to_direct_participation_icp_e8s: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct IdealMatchedParticipationFunction { - pub serialized_representation: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronsFundParticipationConstraints { - pub coefficient_intervals: Vec, - pub max_neurons_fund_participation_icp_e8s: Option, - pub min_direct_participation_threshold_icp_e8s: Option, - pub ideal_matched_participation_function: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct CfNeuron { - pub has_created_neuron_recipes: Option, - pub nns_neuron_id: u64, - pub amount_icp_e8s: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct CfParticipant { - pub hotkey_principal: String, - pub cf_neurons: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronsFundParticipants { - pub participants: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct TreasuryDistribution { - pub total_e8s: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct NeuronDistribution { - pub controller: Option, - pub dissolve_delay_seconds: u64, - pub memo: u64, - pub stake_e8s: u64, - pub vesting_period_seconds: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DeveloperDistribution { - pub developer_neurons: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct AirdropDistribution { - pub airdrop_neurons: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SwapDistribution { - pub total_e8s: u64, - pub initial_swap_amount_e8s: u64, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct FractionalDeveloperVotingPower { - pub treasury_distribution: Option, - pub developer_distribution: Option, - pub airdrop_distribution: Option, - pub swap_distribution: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum InitialTokenDistribution { - FractionalDeveloperVotingPower(FractionalDeveloperVotingPower), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Countries { - pub iso_codes: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsInitPayload { - pub url: Option, - pub max_dissolve_delay_seconds: Option, - pub max_dissolve_delay_bonus_percentage: Option, - pub nns_proposal_id: Option, - pub neurons_fund_participation: Option, - pub min_participant_icp_e8s: Option, - pub neuron_basket_construction_parameters: Option, - pub fallback_controller_principal_ids: Vec, - pub token_symbol: Option, - pub final_reward_rate_basis_points: Option, - pub max_icp_e8s: Option, - pub neuron_minimum_stake_e8s: Option, - pub confirmation_text: Option, - pub logo: Option, - pub name: Option, - pub swap_start_timestamp_seconds: Option, - pub swap_due_timestamp_seconds: Option, - pub initial_voting_period_seconds: Option, - pub neuron_minimum_dissolve_delay_to_vote_seconds: Option, - pub description: Option, - pub max_neuron_age_seconds_for_age_bonus: Option, - pub min_participants: Option, - pub initial_reward_rate_basis_points: Option, - pub wait_for_quiet_deadline_increase_seconds: Option, - pub transaction_fee_e8s: Option, - pub dapp_canisters: Option, - pub neurons_fund_participation_constraints: Option, - pub neurons_fund_participants: Option, - pub max_age_bonus_percentage: Option, - pub initial_token_distribution: Option, - pub reward_rate_transition_duration_seconds: Option, - pub token_logo: Option, - pub token_name: Option, - pub max_participant_icp_e8s: Option, - pub min_direct_participation_icp_e8s: Option, - pub proposal_reject_cost_e8s: Option, - pub restricted_countries: Option, - pub min_icp_e8s: Option, - pub max_direct_participation_icp_e8s: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DeployNewSnsRequest { - pub sns_init_payload: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DappCanistersTransferResult { - pub restored_dapp_canisters: Vec, - pub nns_controlled_dapp_canisters: Vec, - pub sns_controlled_dapp_canisters: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsCanisterIds { - pub root: Option, - pub swap: Option, - pub ledger: Option, - pub index: Option, - pub governance: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct DeployNewSnsResponse { - pub dapp_canisters_transfer_result: Option, - pub subnet_id: Option, - pub error: Option, - pub canisters: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetAllowedPrincipalsArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetAllowedPrincipalsResponse { - pub allowed_principals: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetDeployedSnsByProposalIdRequest { - pub proposal_id: u64, -} +pub struct ListDeployedSnsesArg {} #[derive(Serialize, Clone, Debug, CandidType, Deserialize, Default)] pub struct DeployedSns { pub root_canister_id: Option, @@ -219,211 +27,13 @@ pub struct DeployedSns { pub ledger_canister_id: Option, } #[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum GetDeployedSnsByProposalIdResult { - Error(SnsWasmError), - DeployedSns(DeployedSns), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetDeployedSnsByProposalIdResponse { - pub get_deployed_sns_by_proposal_id_result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsVersion { - pub archive_wasm_hash: serde_bytes::ByteBuf, - pub root_wasm_hash: serde_bytes::ByteBuf, - pub swap_wasm_hash: serde_bytes::ByteBuf, - pub ledger_wasm_hash: serde_bytes::ByteBuf, - pub governance_wasm_hash: serde_bytes::ByteBuf, - pub index_wasm_hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetNextSnsVersionRequest { - pub governance_canister_id: Option, - pub current_version: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetNextSnsVersionResponse { - pub next_version: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetProposalIdThatAddedWasmRequest { - pub hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetProposalIdThatAddedWasmResponse { - pub proposal_id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetSnsSubnetIdsArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetSnsSubnetIdsResponse { - pub sns_subnet_ids: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetWasmRequest { - pub hash: serde_bytes::ByteBuf, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetWasmResponse { - pub wasm: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetWasmMetadataRequest { - pub hash: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct MetadataSection { - pub contents: Option, - pub name: Option, - pub visibility: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct Ok { - pub sections: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum Result1 { - Ok(Ok), - Error(SnsWasmError), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct GetWasmMetadataResponse { - pub result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct SnsUpgrade { - pub next_version: Option, - pub current_version: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct InsertUpgradePathEntriesRequest { - pub upgrade_path: Vec, - pub sns_governance_canister_id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct InsertUpgradePathEntriesResponse { - pub error: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListDeployedSnsesArg {} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] pub struct ListDeployedSnsesResponse { pub instances: Vec, } -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListUpgradeStepsRequest { - pub limit: u32, - pub starting_at: Option, - pub sns_governance_canister_id: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct PrettySnsVersion { - pub archive_wasm_hash: String, - pub root_wasm_hash: String, - pub swap_wasm_hash: String, - pub ledger_wasm_hash: String, - pub governance_wasm_hash: String, - pub index_wasm_hash: String, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListUpgradeStep { - pub pretty_version: Option, - pub version: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct ListUpgradeStepsResponse { - pub steps: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct UpdateAllowedPrincipalsRequest { - pub added_principals: Vec, - pub removed_principals: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub enum UpdateAllowedPrincipalsResult { - Error(SnsWasmError), - AllowedPrincipals(GetAllowedPrincipalsResponse), -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct UpdateAllowedPrincipalsResponse { - pub update_allowed_principals_result: Option, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct UpdateSnsSubnetListRequest { - pub sns_subnet_ids_to_add: Vec, - pub sns_subnet_ids_to_remove: Vec, -} -#[derive(Serialize, Clone, Debug, CandidType, Deserialize)] -pub struct UpdateSnsSubnetListResponse { - pub error: Option, -} pub struct Service(pub Principal); impl Service { - pub async fn add_wasm(&self, arg0: AddWasmRequest) -> CallResult<(AddWasmResponse,)> { - ic_cdk::call(self.0, "add_wasm", (arg0,)).await - } - pub async fn deploy_new_sns(&self, arg0: DeployNewSnsRequest) -> CallResult<(DeployNewSnsResponse,)> { - ic_cdk::call(self.0, "deploy_new_sns", (arg0,)).await - } - pub async fn get_allowed_principals( - &self, - arg0: GetAllowedPrincipalsArg, - ) -> CallResult<(GetAllowedPrincipalsResponse,)> { - ic_cdk::call(self.0, "get_allowed_principals", (arg0,)).await - } - pub async fn get_deployed_sns_by_proposal_id( - &self, - arg0: GetDeployedSnsByProposalIdRequest, - ) -> CallResult<(GetDeployedSnsByProposalIdResponse,)> { - ic_cdk::call(self.0, "get_deployed_sns_by_proposal_id", (arg0,)).await - } - pub async fn get_latest_sns_version_pretty(&self, arg0: ()) -> CallResult<(Vec<(String, String)>,)> { - ic_cdk::call(self.0, "get_latest_sns_version_pretty", (arg0,)).await - } - pub async fn get_next_sns_version( - &self, - arg0: GetNextSnsVersionRequest, - ) -> CallResult<(GetNextSnsVersionResponse,)> { - ic_cdk::call(self.0, "get_next_sns_version", (arg0,)).await - } - pub async fn get_proposal_id_that_added_wasm( - &self, - arg0: GetProposalIdThatAddedWasmRequest, - ) -> CallResult<(GetProposalIdThatAddedWasmResponse,)> { - ic_cdk::call(self.0, "get_proposal_id_that_added_wasm", (arg0,)).await - } - pub async fn get_sns_subnet_ids(&self, arg0: GetSnsSubnetIdsArg) -> CallResult<(GetSnsSubnetIdsResponse,)> { - ic_cdk::call(self.0, "get_sns_subnet_ids", (arg0,)).await - } - pub async fn get_wasm(&self, arg0: GetWasmRequest) -> CallResult<(GetWasmResponse,)> { - ic_cdk::call(self.0, "get_wasm", (arg0,)).await - } - pub async fn get_wasm_metadata(&self, arg0: GetWasmMetadataRequest) -> CallResult<(GetWasmMetadataResponse,)> { - ic_cdk::call(self.0, "get_wasm_metadata", (arg0,)).await - } - pub async fn insert_upgrade_path_entries( - &self, - arg0: InsertUpgradePathEntriesRequest, - ) -> CallResult<(InsertUpgradePathEntriesResponse,)> { - ic_cdk::call(self.0, "insert_upgrade_path_entries", (arg0,)).await - } pub async fn list_deployed_snses(&self, arg0: ListDeployedSnsesArg) -> CallResult<(ListDeployedSnsesResponse,)> { ic_cdk::call(self.0, "list_deployed_snses", (arg0,)).await } - pub async fn list_upgrade_steps(&self, arg0: ListUpgradeStepsRequest) -> CallResult<(ListUpgradeStepsResponse,)> { - ic_cdk::call(self.0, "list_upgrade_steps", (arg0,)).await - } - pub async fn update_allowed_principals( - &self, - arg0: UpdateAllowedPrincipalsRequest, - ) -> CallResult<(UpdateAllowedPrincipalsResponse,)> { - ic_cdk::call(self.0, "update_allowed_principals", (arg0,)).await - } - pub async fn update_sns_subnet_list( - &self, - arg0: UpdateSnsSubnetListRequest, - ) -> CallResult<(UpdateSnsSubnetListResponse,)> { - ic_cdk::call(self.0, "update_sns_subnet_list", (arg0,)).await - } } diff --git a/rs/sns_aggregator/src/types/upstream.rs b/rs/sns_aggregator/src/types/upstream.rs index 7e83133df1e..aa894501f4c 100644 --- a/rs/sns_aggregator/src/types/upstream.rs +++ b/rs/sns_aggregator/src/types/upstream.rs @@ -1,6 +1,6 @@ //! Data types for storing upstream SNS data. use super::ic_sns_governance::{GetMetadataResponse, ListNervousSystemFunctionsResponse, NervousSystemParameters}; -use super::ic_sns_ledger::Value as Icrc1Value; +use super::ic_sns_ledger::MetadataValue as Icrc1Value; use super::ic_sns_root::ListSnsCanistersResponse; use super::ic_sns_swap::{GetSaleParametersResponse, GetStateResponse}; use super::ic_sns_wasm::DeployedSns; diff --git a/scripts/did2rs.sh b/scripts/did2rs.sh index 1dd19714251..9cde90a4d19 100755 --- a/scripts/did2rs.sh +++ b/scripts/did2rs.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -xeuo pipefail +set -euo pipefail SOURCE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" PATH="$SOURCE_DIR:$PATH" @@ -122,7 +122,19 @@ cd "$GIT_ROOT" if [[ "$DID_PATH" == *nns_governance.did ]]; then METHODS_ARGS=("--methods" "get_proposal_info") elif [[ "$DID_PATH" == *nns_registry.did ]]; then - METHODS_ARGS=("--methods" "add_api_boundary_nodes") + #METHODS_ARGS=("--methods" "add_api_boundary_nodes,update_elected_hostos_versions,update_nodes_hostos_version,update_ssh_readonly_access_for_all_unassigned_nodes,deploy_guestos_to_all_unassigned_nodes,remove_api_boundary_nodes,ReviseElectedGuestosVersionsPayload,revise_elected_replica_versions,retire_replica_version,change_subnet_membership,complete_canister_migration") + METHODS_ARGS=() + elif [[ "$DID_PATH" == *sns_wasm.did ]]; then + if [[ "$CRATE" == "proposals" ]]; then + METHODS_ARGS=("--methods" "insert_upgrade_path_entries,update_allowed_principals,update_sns_subnet_list,add_wasm") + else + METHODS_ARGS=("--methods" "list_deployed_snses") + #METHODS_ARGS=() + fi + elif [[ "$DID_PATH" == *sns_governance.did ]]; then + METHODS_ARGS=("--methods" "manage_neuron,get_metadata,list_nervous_system_functions") + elif [[ "$DID_PATH" == *sns_ledger.did ]]; then + METHODS_ARGS=("--methods" "icrc1_metadata,icrc1_total_supply") else METHODS_ARGS=() fi diff --git a/scripts/proposals/did2rs b/scripts/proposals/did2rs index 4feca7da0b1..719a78d83a6 100755 --- a/scripts/proposals/did2rs +++ b/scripts/proposals/did2rs @@ -1,5 +1,5 @@ #!/usr/bin/env bash -set -xeuo pipefail +set -euo pipefail SOURCE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")/.." print_help() { cat <<-EOF From 94bbee201896912c169627c06cc20cc1cbdec85f Mon Sep 17 00:00:00 2001 From: David de Kloet Date: Fri, 21 Jun 2024 22:13:16 +0200 Subject: [PATCH 4/4] format --- rs/proposals/src/canisters/nns_registry/api.rs | 14 +++++++++++--- scripts/did2rs.sh | 3 ++- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/rs/proposals/src/canisters/nns_registry/api.rs b/rs/proposals/src/canisters/nns_registry/api.rs index 7c578c9a326..18b69985606 100644 --- a/rs/proposals/src/canisters/nns_registry/api.rs +++ b/rs/proposals/src/canisters/nns_registry/api.rs @@ -449,7 +449,10 @@ impl Service { pub async fn create_subnet(&self, arg0: CreateSubnetPayload) -> CallResult<()> { ic_cdk::call(self.0, "create_subnet", (arg0,)).await } - pub async fn deploy_guestos_to_all_subnet_nodes(&self, arg0: DeployGuestosToAllSubnetNodesPayload) -> CallResult<()> { + pub async fn deploy_guestos_to_all_subnet_nodes( + &self, + arg0: DeployGuestosToAllSubnetNodesPayload, + ) -> CallResult<()> { ic_cdk::call(self.0, "deploy_guestos_to_all_subnet_nodes", (arg0,)).await } pub async fn deploy_guestos_to_all_unassigned_nodes( @@ -467,7 +470,9 @@ impl Service { ) -> CallResult<(GetNodeOperatorsAndDcsOfNodeProviderResponse,)> { ic_cdk::call(self.0, "get_node_operators_and_dcs_of_node_provider", (arg0,)).await } - pub async fn get_node_providers_monthly_xdr_rewards(&self) -> CallResult<(GetNodeProvidersMonthlyXdrRewardsResponse,)> { + pub async fn get_node_providers_monthly_xdr_rewards( + &self, + ) -> CallResult<(GetNodeProvidersMonthlyXdrRewardsResponse,)> { ic_cdk::call(self.0, "get_node_providers_monthly_xdr_rewards", ()).await } pub async fn get_subnet_for_canister( @@ -512,7 +517,10 @@ impl Service { pub async fn set_firewall_config(&self, arg0: SetFirewallConfigPayload) -> CallResult<()> { ic_cdk::call(self.0, "set_firewall_config", (arg0,)).await } - pub async fn update_api_boundary_nodes_version(&self, arg0: UpdateApiBoundaryNodesVersionPayload) -> CallResult<()> { + pub async fn update_api_boundary_nodes_version( + &self, + arg0: UpdateApiBoundaryNodesVersionPayload, + ) -> CallResult<()> { ic_cdk::call(self.0, "update_api_boundary_nodes_version", (arg0,)).await } pub async fn update_elected_hostos_versions(&self, arg0: UpdateElectedHostosVersionsPayload) -> CallResult<()> { diff --git a/scripts/did2rs.sh b/scripts/did2rs.sh index 9cde90a4d19..65d9390909f 100755 --- a/scripts/did2rs.sh +++ b/scripts/did2rs.sh @@ -153,7 +153,8 @@ cd "$GIT_ROOT" # Replace invalid "{}" in generated Rust code with "EmptyRecord": /^pub (struct|enum) /,/^}/{s/ *\{\},$/(EmptyRecord),/g}; ' | - "$sed" -z 's/candid::define_function!(pub \([^ ]*\) [^;]*;\n#\[derive([^)]*)\]/pub type \1 = candid::Func;\n#[derive(CandidType, Deserialize)]/g' + "$sed" -z 's/candid::define_function!(pub \([^ ]*\) [^;]*;\n#\[derive([^)]*)\]/pub type \1 = candid::Func;\n#[derive(CandidType, Deserialize)]/g' | + rustfmt --edition 2021 } >"${RUST_PATH}" if test -f "${EDIT_PATH}"; then (