@dfinity/sns 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var as=Object.defineProperty;var Ds=Object.getOwnPropertyDescriptor;var Ls=Object.getOwnPropertyNames;var eo=Object.prototype.hasOwnProperty;var to=(e,s)=>{for(var t in s)as(e,t,{get:s[t],enumerable:!0})},so=(e,s,t,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let n of Ls(s))!eo.call(e,n)&&n!==t&&as(e,n,{get:()=>s[n],enumerable:!(o=Ds(s,n))||o.enumerable});return e};var oo=e=>so(as({},"__esModule",{value:!0}),e);var So={};to(So,{GetOpenTicketErrorType:()=>As,NewSaleTicketResponseErrorType:()=>qs,SnsGovernanceCanister:()=>Ut,SnsGovernanceError:()=>b,SnsGovernanceTestCanister:()=>$t,SnsNeuronPermissionType:()=>bs,SnsProposalDecisionStatus:()=>Cs,SnsProposalRewardStatus:()=>Fs,SnsRootCanister:()=>Et,SnsSwapCanister:()=>zt,SnsSwapGetOpenTicketError:()=>Jt,SnsSwapLifecycle:()=>Ms,SnsSwapNewTicketError:()=>Qt,SnsVote:()=>ks,SnsWrapper:()=>Ht,UnsupportedMethodError:()=>Wt,fromCandidAction:()=>xs,initSnsWrapper:()=>vo,neuronSubaccount:()=>ds});module.exports=oo(So);var d=require("@dfinity/utils");var Gt=({neuronId:{id:e},command:s})=>({subaccount:e,command:[s]}),jt=({neuronId:e,operation:s})=>Gt({neuronId:e,command:{Configure:{operation:[s]}}}),us=({owner:e,subaccount:s})=>({owner:(0,d.toNullable)(e),subaccount:s===void 0?[]:(0,d.toNullable)({subaccount:s})}),ls=({neuronId:e,permissions:s,principal:t})=>Gt({neuronId:e,command:{AddNeuronPermissions:{permissions_to_add:[{permissions:Int32Array.from(s)}],principal_id:[t]}}}),ms=({neuronId:e,permissions:s,principal:t})=>Gt({neuronId:e,command:{RemoveNeuronPermissions:{permissions_to_remove:[{permissions:Int32Array.from(s)}],principal_id:[t]}}}),Ns=({neuronId:e,memo:s,amount:t})=>Gt({neuronId:e,command:{Split:{memo:s,amount_e8s:t}}}),Os=({neuronId:e,amount:s,toAccount:t})=>Gt({neuronId:e,command:{Disburse:{to_account:t===void 0?[]:(0,d.toNullable)(us(t)),amount:s===void 0?[]:[{e8s:s}]}}}),Rs=e=>jt({neuronId:e,operation:{StartDissolving:{}}}),gs=e=>jt({neuronId:e,operation:{StopDissolving:{}}}),ys=({neuronId:e,percentageToStake:s})=>Gt({neuronId:e,command:{StakeMaturity:{percentage_to_stake:(0,d.toNullable)(s)}}}),fs=({neuronId:e,percentageToDisburse:s,toAccount:t})=>Gt({neuronId:e,command:{DisburseMaturity:{to_account:t===void 0?[]:(0,d.toNullable)(us(t)),percentage_to_disburse:s}}}),vs=({neuronId:e,autoStake:s})=>jt({neuronId:e,operation:{ChangeAutoStakeMaturity:{requested_setting_for_auto_stake_maturity:s}}}),Ss=({neuronId:e,dissolveTimestampSeconds:s})=>jt({neuronId:e,operation:{SetDissolveTimestamp:{dissolve_timestamp_seconds:s}}}),hs=({neuronId:e,additionalDissolveDelaySeconds:s})=>jt({neuronId:e,operation:{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:s}}}),ws=({neuronId:e,functionId:s,followees:t})=>({subaccount:e.id,command:[{Follow:{function_id:s,followees:t}}]}),Ts=({neuronId:e,topicFollowing:s})=>({subaccount:e.id,command:[{SetFollowing:{topic_following:s.map(({topic:t,followees:o})=>({topic:[t],followees:o.map(({neuronId:n,alias:a})=>({neuron_id:(0,d.toNullable)(n),alias:(0,d.toNullable)(a)}))}))}}]}),Ps=({neuronId:e,proposalId:s,vote:t})=>({subaccount:e.id,command:[{RegisterVote:{vote:t,proposal:[s]}}]}),rs=({subaccount:e,memo:s,controller:t})=>({subaccount:e,command:[{ClaimOrRefresh:{by:[s===void 0?{NeuronId:{}}:{MemoAndController:{memo:s,controller:(0,d.toNullable)(t)}}]}}]}),Vs=({excludeType:e,beforeProposal:s,includeRewardStatus:t,includeStatus:o,limit:n})=>({exclude_type:BigUint64Array.from(e??[]),before_proposal:(0,d.toNullable)(s),include_reward_status:Int32Array.from(t??[]),include_status:Int32Array.from(o??[]),limit:n??10}),xs=e=>{if("ManageNervousSystemParameters"in e)return{ManageNervousSystemParameters:mo(e.ManageNervousSystemParameters)};if("AddGenericNervousSystemFunction"in e)return{AddGenericNervousSystemFunction:uo(e.AddGenericNervousSystemFunction)};if("SetTopicsForCustomProposals"in e)return{SetTopicsForCustomProposals:e.SetTopicsForCustomProposals};if("RemoveGenericNervousSystemFunction"in e)return{RemoveGenericNervousSystemFunction:e.RemoveGenericNervousSystemFunction};if("UpgradeSnsToNextVersion"in e)return{UpgradeSnsToNextVersion:e.UpgradeSnsToNextVersion};if("RegisterDappCanisters"in e)return{RegisterDappCanisters:e.RegisterDappCanisters};if("TransferSnsTreasuryFunds"in e)return{TransferSnsTreasuryFunds:co(e.TransferSnsTreasuryFunds)};if("UpgradeSnsControlledCanister"in e)return{UpgradeSnsControlledCanister:io(e.UpgradeSnsControlledCanister)};if("DeregisterDappCanisters"in e)return{DeregisterDappCanisters:e.DeregisterDappCanisters};if("Unspecified"in e)return{Unspecified:e.Unspecified};if("ManageSnsMetadata"in e)return{ManageSnsMetadata:ao(e.ManageSnsMetadata)};if("ExecuteGenericNervousSystemFunction"in e)return{ExecuteGenericNervousSystemFunction:e.ExecuteGenericNervousSystemFunction};if("Motion"in e)return{Motion:e.Motion};throw new Error(`Unknown action type ${JSON.stringify(e)}`)},ao=e=>({url:(0,d.fromNullable)(e.url),logo:(0,d.fromNullable)(e.logo),name:(0,d.fromNullable)(e.name),description:(0,d.fromNullable)(e.description)}),ro=e=>{if(e!==void 0)return{wasm_module_hash:e.wasm_module_hash,store_canister_id:(0,d.fromNullable)(e.store_canister_id),chunk_hashes_list:e.chunk_hashes_list}},io=e=>({new_canister_wasm:e.new_canister_wasm,chunked_canister_wasm:ro((0,d.fromNullable)(e.chunked_canister_wasm)),canister_id:(0,d.fromNullable)(e.canister_id),canister_upgrade_arg:(0,d.fromNullable)(e.canister_upgrade_arg),mode:(0,d.fromNullable)(e.mode)}),co=e=>({from_treasury:e.from_treasury,to_principal:(0,d.fromNullable)(e.to_principal),to_subaccount:(0,d.fromNullable)(e.to_subaccount),memo:(0,d.fromNullable)(e.memo),amount_e8s:e.amount_e8s}),_o=e=>({validator_canister_id:(0,d.fromNullable)(e.validator_canister_id),target_canister_id:(0,d.fromNullable)(e.target_canister_id),validator_method_name:(0,d.fromNullable)(e.validator_method_name),target_method_name:(0,d.fromNullable)(e.target_method_name),topic:(0,d.fromNullable)(e.topic)}),po=e=>{if(e!==void 0){if("NativeNervousSystemFunction"in e)return{NativeNervousSystemFunction:e.NativeNervousSystemFunction};if("GenericNervousSystemFunction"in e)return{GenericNervousSystemFunction:_o(e.GenericNervousSystemFunction)};throw new Error(`Unknown FunctionType ${JSON.stringify(e)}`)}},uo=e=>({id:e.id,name:e.name,description:(0,d.fromNullable)(e.description),function_type:po((0,d.fromNullable)(e.function_type))}),lo=e=>e&&{final_reward_rate_basis_points:(0,d.fromNullable)(e.final_reward_rate_basis_points),initial_reward_rate_basis_points:(0,d.fromNullable)(e.initial_reward_rate_basis_points),reward_rate_transition_duration_seconds:(0,d.fromNullable)(e.reward_rate_transition_duration_seconds),round_duration_seconds:(0,d.fromNullable)(e.round_duration_seconds)},mo=e=>({default_followees:(0,d.fromNullable)(e.default_followees),max_dissolve_delay_seconds:(0,d.fromNullable)(e.max_dissolve_delay_seconds),max_dissolve_delay_bonus_percentage:(0,d.fromNullable)(e.max_dissolve_delay_bonus_percentage),max_followees_per_function:(0,d.fromNullable)(e.max_followees_per_function),neuron_claimer_permissions:(0,d.fromNullable)(e.neuron_claimer_permissions),neuron_minimum_stake_e8s:(0,d.fromNullable)(e.neuron_minimum_stake_e8s),max_neuron_age_for_age_bonus:(0,d.fromNullable)(e.max_neuron_age_for_age_bonus),initial_voting_period_seconds:(0,d.fromNullable)(e.initial_voting_period_seconds),neuron_minimum_dissolve_delay_to_vote_seconds:(0,d.fromNullable)(e.neuron_minimum_dissolve_delay_to_vote_seconds),reject_cost_e8s:(0,d.fromNullable)(e.reject_cost_e8s),max_proposals_to_keep_per_action:(0,d.fromNullable)(e.max_proposals_to_keep_per_action),wait_for_quiet_deadline_increase_seconds:(0,d.fromNullable)(e.wait_for_quiet_deadline_increase_seconds),max_number_of_neurons:(0,d.fromNullable)(e.max_number_of_neurons),transaction_fee_e8s:(0,d.fromNullable)(e.transaction_fee_e8s),max_number_of_proposals_with_ballots:(0,d.fromNullable)(e.max_number_of_proposals_with_ballots),max_age_bonus_percentage:(0,d.fromNullable)(e.max_age_bonus_percentage),neuron_grantable_permissions:(0,d.fromNullable)(e.neuron_grantable_permissions),voting_rewards_parameters:lo((0,d.fromNullable)(e.voting_rewards_parameters)),max_number_of_principals_per_neuron:(0,d.fromNullable)(e.max_number_of_principals_per_neuron),automatically_advance_target_version:(0,d.fromNullable)(e.automatically_advance_target_version)});var bs=(c=>(c[c.NEURON_PERMISSION_TYPE_UNSPECIFIED=0]="NEURON_PERMISSION_TYPE_UNSPECIFIED",c[c.NEURON_PERMISSION_TYPE_CONFIGURE_DISSOLVE_STATE=1]="NEURON_PERMISSION_TYPE_CONFIGURE_DISSOLVE_STATE",c[c.NEURON_PERMISSION_TYPE_MANAGE_PRINCIPALS=2]="NEURON_PERMISSION_TYPE_MANAGE_PRINCIPALS",c[c.NEURON_PERMISSION_TYPE_SUBMIT_PROPOSAL=3]="NEURON_PERMISSION_TYPE_SUBMIT_PROPOSAL",c[c.NEURON_PERMISSION_TYPE_VOTE=4]="NEURON_PERMISSION_TYPE_VOTE",c[c.NEURON_PERMISSION_TYPE_DISBURSE=5]="NEURON_PERMISSION_TYPE_DISBURSE",c[c.NEURON_PERMISSION_TYPE_SPLIT=6]="NEURON_PERMISSION_TYPE_SPLIT",c[c.NEURON_PERMISSION_TYPE_MERGE_MATURITY=7]="NEURON_PERMISSION_TYPE_MERGE_MATURITY",c[c.NEURON_PERMISSION_TYPE_DISBURSE_MATURITY=8]="NEURON_PERMISSION_TYPE_DISBURSE_MATURITY",c[c.NEURON_PERMISSION_TYPE_STAKE_MATURITY=9]="NEURON_PERMISSION_TYPE_STAKE_MATURITY",c[c.NEURON_PERMISSION_TYPE_MANAGE_VOTING_PERMISSION=10]="NEURON_PERMISSION_TYPE_MANAGE_VOTING_PERMISSION",c))(bs||{}),Fs=(n=>(n[n.PROPOSAL_REWARD_STATUS_UNSPECIFIED=0]="PROPOSAL_REWARD_STATUS_UNSPECIFIED",n[n.PROPOSAL_REWARD_STATUS_ACCEPT_VOTES=1]="PROPOSAL_REWARD_STATUS_ACCEPT_VOTES",n[n.PROPOSAL_REWARD_STATUS_READY_TO_SETTLE=2]="PROPOSAL_REWARD_STATUS_READY_TO_SETTLE",n[n.PROPOSAL_REWARD_STATUS_SETTLED=3]="PROPOSAL_REWARD_STATUS_SETTLED",n))(Fs||{}),Cs=(r=>(r[r.PROPOSAL_DECISION_STATUS_UNSPECIFIED=0]="PROPOSAL_DECISION_STATUS_UNSPECIFIED",r[r.PROPOSAL_DECISION_STATUS_OPEN=1]="PROPOSAL_DECISION_STATUS_OPEN",r[r.PROPOSAL_DECISION_STATUS_REJECTED=2]="PROPOSAL_DECISION_STATUS_REJECTED",r[r.PROPOSAL_DECISION_STATUS_ADOPTED=3]="PROPOSAL_DECISION_STATUS_ADOPTED",r[r.PROPOSAL_DECISION_STATUS_EXECUTED=4]="PROPOSAL_DECISION_STATUS_EXECUTED",r[r.PROPOSAL_DECISION_STATUS_FAILED=5]="PROPOSAL_DECISION_STATUS_FAILED",r))(Cs||{}),ks=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Yes=1]="Yes",o[o.No=2]="No",o))(ks||{});var Ms=(r=>(r[r.Unspecified=0]="Unspecified",r[r.Pending=1]="Pending",r[r.Open=2]="Open",r[r.Committed=3]="Committed",r[r.Aborted=4]="Aborted",r[r.Adopted=5]="Adopted",r))(Ms||{}),As=(o=>(o[o.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",o[o.TYPE_SALE_NOT_OPEN=1]="TYPE_SALE_NOT_OPEN",o[o.TYPE_SALE_CLOSED=2]="TYPE_SALE_CLOSED",o))(As||{}),qs=(i=>(i[i.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",i[i.TYPE_SALE_NOT_OPEN=1]="TYPE_SALE_NOT_OPEN",i[i.TYPE_SALE_CLOSED=2]="TYPE_SALE_CLOSED",i[i.TYPE_TICKET_EXISTS=3]="TYPE_TICKET_EXISTS",i[i.TYPE_INVALID_USER_AMOUNT=4]="TYPE_INVALID_USER_AMOUNT",i[i.TYPE_INVALID_SUBACCOUNT=5]="TYPE_INVALID_SUBACCOUNT",i[i.TYPE_INVALID_PRINCIPAL=6]="TYPE_INVALID_PRINCIPAL",i))(qs||{});var Wt=class extends Error{constructor(t){super();this.methodName=t}};var b=class extends Error{};var Qt=class extends Error{constructor({errorType:s,invalidUserAmount:t,existingTicket:o}){super(),this.errorType=s,this.invalidUserAmount=t,this.existingTicket=o}},Jt=class extends Error{constructor(t){super();this.errorType=t}};var F=require("@dfinity/utils");var Gs=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),n=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),a=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(a),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),P=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),V=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(V)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,a))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(a),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(a),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Pe=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Ve=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Ve,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Pe,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),Lt=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(n),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(P),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({principals:e.Vec(e.Principal)}),Je=e.Record({nns_neuron_hotkeys:e.Opt(Qe),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ye=e.Variant({NeuronsFund:Je,Direct:e.Record({})}),He=e.Record({neuron_ids:e.Vec(p)}),$e=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ye),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(He),neuron_id:e.Opt(p)}),Xe=e.Record({neuron_recipes:e.Vec($e)}),Ke=e.Record({neuron_recipes:e.Opt(Xe)}),Ze=e.Record({id:e.Opt(p),status:e.Int32}),Ie=e.Record({swap_neurons:e.Vec(Ze)}),De=e.Variant({Ok:Ie,Err:e.Int32}),Le=e.Record({claim_swap_neurons_result:e.Opt(De)}),et=e.Record({maturity_modulation:e.Opt(l)}),tt=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),st=e.Record({mode:e.Opt(e.Int32)}),ot=e.Record({neuron_id:e.Opt(p)}),nt=e.Variant({Error:O,Neuron:A}),at=e.Record({result:e.Opt(nt)}),Me=e.Record({proposal_id:e.Opt(u)}),rt=e.Variant({Error:O,Proposal:x}),it=e.Record({result:e.Opt(rt)}),ct=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),Ae=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),_t=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),pt=e.Record({status:ct,memory_size:e.Nat,cycles:e.Nat,settings:Ae,query_stats:e.Opt(_t),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),dt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),ut=e.Record({sns_initialization_parameters:e.Text}),lt=e.Record({timers:e.Opt(s)}),mt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),Nt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),Ot=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),Rt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),gt=e.Record({neurons:e.Vec(A)}),yt=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_status:e.Vec(e.Int32)}),ft=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x)}),vt=e.Record({}),St=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(a),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),ht=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(St))}),wt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Tt=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:wt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Pt=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(Tt)}),Vt=e.Record({created_neuron_id:e.Opt(p)}),xt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),bt=e.Record({refreshed_neuron_id:e.Opt(p)}),Ft=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),Ct=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),kt=e.Record({transfer_block_height:e.Nat64}),Mt=e.Variant({Error:O,Split:Vt,Follow:e.Record({}),DisburseMaturity:xt,ClaimOrRefresh:bt,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Me,RemoveNeuronPermission:e.Record({}),StakeMaturity:Ft,MergeMaturity:Ct,Disburse:kt,AddNeuronPermission:e.Record({})}),At=e.Record({command:e.Opt(Mt)}),qt=e.Record({mode:e.Int32});return e.Service({claim_swap_neurons:e.Func([Ke],[Le],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],[]),get_latest_reward_event:e.Func([],[P],[]),get_maturity_modulation:e.Func([e.Record({})],[et],[]),get_metadata:e.Func([e.Record({})],[tt],[]),get_mode:e.Func([e.Record({})],[st],[]),get_nervous_system_parameters:e.Func([e.Null],[f],[]),get_neuron:e.Func([ot],[at],[]),get_proposal:e.Func([Me],[it],[]),get_root_canister_status:e.Func([e.Null],[pt],[]),get_running_sns_version:e.Func([e.Record({})],[dt],[]),get_sns_initialization_parameters:e.Func([e.Record({})],[ut],[]),get_timers:e.Func([e.Record({})],[lt],[]),get_upgrade_journal:e.Func([mt],[Nt],[]),list_nervous_system_functions:e.Func([],[Ot],[]),list_neurons:e.Func([Rt],[gt],[]),list_proposals:e.Func([yt],[ft],[]),list_topics:e.Func([vt],[ht],[]),manage_neuron:e.Func([Pt],[At],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([qt],[e.Record({})],[])})};var Us=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),n=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),a=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(a),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),P=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),V=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(V)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,a))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(a),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(a),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Pe=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Ve=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Ve,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Pe,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),Lt=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(n),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(P),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({principals:e.Vec(e.Principal)}),Je=e.Record({nns_neuron_hotkeys:e.Opt(Qe),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ye=e.Variant({NeuronsFund:Je,Direct:e.Record({})}),He=e.Record({neuron_ids:e.Vec(p)}),$e=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ye),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(He),neuron_id:e.Opt(p)}),Xe=e.Record({neuron_recipes:e.Vec($e)}),Ke=e.Record({neuron_recipes:e.Opt(Xe)}),Ze=e.Record({id:e.Opt(p),status:e.Int32}),Ie=e.Record({swap_neurons:e.Vec(Ze)}),De=e.Variant({Ok:Ie,Err:e.Int32}),Le=e.Record({claim_swap_neurons_result:e.Opt(De)}),et=e.Record({maturity_modulation:e.Opt(l)}),tt=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),st=e.Record({mode:e.Opt(e.Int32)}),ot=e.Record({neuron_id:e.Opt(p)}),nt=e.Variant({Error:O,Neuron:A}),at=e.Record({result:e.Opt(nt)}),Me=e.Record({proposal_id:e.Opt(u)}),rt=e.Variant({Error:O,Proposal:x}),it=e.Record({result:e.Opt(rt)}),ct=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),Ae=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),_t=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),pt=e.Record({status:ct,memory_size:e.Nat,cycles:e.Nat,settings:Ae,query_stats:e.Opt(_t),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),dt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),ut=e.Record({sns_initialization_parameters:e.Text}),lt=e.Record({timers:e.Opt(s)}),mt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),Nt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),Ot=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),Rt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),gt=e.Record({neurons:e.Vec(A)}),yt=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_status:e.Vec(e.Int32)}),ft=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x)}),vt=e.Record({}),St=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(a),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),ht=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(St))}),wt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Tt=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:wt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Pt=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(Tt)}),Vt=e.Record({created_neuron_id:e.Opt(p)}),xt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),bt=e.Record({refreshed_neuron_id:e.Opt(p)}),Ft=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),Ct=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),kt=e.Record({transfer_block_height:e.Nat64}),Mt=e.Variant({Error:O,Split:Vt,Follow:e.Record({}),DisburseMaturity:xt,ClaimOrRefresh:bt,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Me,RemoveNeuronPermission:e.Record({}),StakeMaturity:Ft,MergeMaturity:Ct,Disburse:kt,AddNeuronPermission:e.Record({})}),At=e.Record({command:e.Opt(Mt)}),qt=e.Record({mode:e.Int32});return e.Service({claim_swap_neurons:e.Func([Ke],[Le],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_latest_reward_event:e.Func([],[P],["query"]),get_maturity_modulation:e.Func([e.Record({})],[et],[]),get_metadata:e.Func([e.Record({})],[tt],["query"]),get_mode:e.Func([e.Record({})],[st],["query"]),get_nervous_system_parameters:e.Func([e.Null],[f],["query"]),get_neuron:e.Func([ot],[at],["query"]),get_proposal:e.Func([Me],[it],["query"]),get_root_canister_status:e.Func([e.Null],[pt],[]),get_running_sns_version:e.Func([e.Record({})],[dt],["query"]),get_sns_initialization_parameters:e.Func([e.Record({})],[ut],["query"]),get_timers:e.Func([e.Record({})],[lt],["query"]),get_upgrade_journal:e.Func([mt],[Nt],["query"]),list_nervous_system_functions:e.Func([],[Ot],["query"]),list_neurons:e.Func([Rt],[gt],["query"]),list_proposals:e.Func([yt],[ft],["query"]),list_topics:e.Func([vt],[ht],["query"]),manage_neuron:e.Func([Pt],[At],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([qt],[e.Record({})],[])})};var Ut=class e extends F.Canister{constructor(){super(...arguments);this.listNeurons=async t=>{let{principal:o,limit:n,beforeNeuronId:a}=t,{neurons:r}=await this.caller(t).list_neurons({of_principal:(0,F.toNullable)(o),limit:n??100,start_page_at:(0,F.toNullable)(a)});return r};this.listProposals=async t=>{let{certified:o}=t;return await this.caller({certified:o}).list_proposals(Vs(t))};this.listTopics=async t=>{let{certified:o}=t;return await this.caller({certified:o}).list_topics({})};this.getProposal=async t=>{let{proposalId:o}=t,{result:n}=await this.caller(t).get_proposal({proposal_id:(0,F.toNullable)(o)}),a=(0,F.fromNullable)(n);if(a===void 0||"Error"in a)throw new b((a==null?void 0:a.Error.error_message)??"Response type not supported");return a.Proposal};this.listNervousSystemFunctions=async t=>this.caller(t).list_nervous_system_functions();this.metadata=t=>this.caller(t).get_metadata({});this.nervousSystemParameters=t=>this.caller(t).get_nervous_system_parameters(null);this.getNeuron=async t=>{let{neuronId:o}=t,{result:n}=await this.caller(t).get_neuron({neuron_id:(0,F.toNullable)(o)}),a=(0,F.fromNullable)(n);if(a===void 0||"Error"in a)throw new b((a==null?void 0:a.Error.error_message)??"Response type not supported");return a.Neuron};this.queryNeuron=async t=>{try{return await this.getNeuron(t)}catch(o){if(o instanceof Error&&o.message.includes("No neuron for given NeuronId"))return;throw o}};this.manageNeuron=async t=>{let o=await this.caller({certified:!0}).manage_neuron(t);return this.assertManageNeuronError(o),o};this.addNeuronPermissions=async t=>{let o=ls(t);await this.manageNeuron(o)};this.removeNeuronPermissions=async t=>{let o=ms(t);await this.manageNeuron(o)};this.splitNeuron=async t=>{let o=Ns(t),{command:n}=await this.manageNeuron(o),a=(0,F.fromNullable)(n),r=i=>`Split neuron failed (${i})`;if(a===void 0)throw new b(r("no response"));if("Split"in a){let i=a.Split,_=(0,F.fromNullable)(i.created_neuron_id);if(_!==void 0)return _;throw new b(r("no id"))}throw new b(r("unknown"))};this.disburse=async t=>{let o=Os(t);await this.manageNeuron(o)};this.startDissolving=async t=>{let o=Rs(t);await this.manageNeuron(o)};this.stopDissolving=async t=>{let o=gs(t);await this.manageNeuron(o)};this.stakeMaturity=async({neuronId:t,percentageToStake:o})=>{(0,F.assertPercentageNumber)(o??100);let n=ys({neuronId:t,percentageToStake:o});await this.manageNeuron(n)};this.disburseMaturity=async t=>{(0,F.assertPercentageNumber)(t.percentageToDisburse);let o=fs(t);await this.manageNeuron(o)};this.autoStakeMaturity=async t=>{let o=vs(t);await this.manageNeuron(o)};this.setDissolveTimestamp=async t=>{let o=Ss(t);await this.manageNeuron(o)};this.increaseDissolveDelay=async t=>{let o=hs(t);await this.manageNeuron(o)};this.setTopicFollowees=async t=>{let o=ws(t);await this.manageNeuron(o)};this.setFollowing=async t=>{let o=Ts(t);await this.manageNeuron(o)};this.registerVote=async t=>{let o=Ps(t);await this.manageNeuron(o)};this.refreshNeuron=async t=>{let o=rs({subaccount:t.id});await this.manageNeuron(o)};this.claimNeuron=async({memo:t,controller:o,subaccount:n})=>{let a=rs({subaccount:n,memo:t,controller:o}),{command:r}=await this.manageNeuron(a),i=(0,F.fromNullable)(r);if(i===void 0)throw new b("Claim neuron failed");if("ClaimOrRefresh"in i){let _=(0,F.fromNullable)(i.ClaimOrRefresh.refreshed_neuron_id);if(_===void 0)throw new b("Claim neuron failed");return _}throw new b("Claim neuron failed")};this.assertManageNeuronError=({command:t})=>{let o=t[0];if(o!==void 0&&"Error"in o)throw new b(o.Error.error_message)}}static create(t){let{service:o,certifiedService:n,canisterId:a}=(0,F.createServices)({options:t,idlFactory:Us,certifiedIdlFactory:Gs});return new e(a,o,n)}};var Fe=require("@dfinity/utils");var Es=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),n=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),a=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(a),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),P=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),V=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(V)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,a))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(a),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(a),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Pe=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Ve=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Ve,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Pe,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),Lt=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(n),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(P),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({id:e.Opt(p),amount_e8s:e.Opt(e.Nat64)}),Je=e.Record({new_maturity_e8s:e.Opt(e.Nat64)}),Ye=e.Record({target_version:e.Opt(t)}),He=e.Record({}),$e=e.Record({principals:e.Vec(e.Principal)}),Xe=e.Record({nns_neuron_hotkeys:e.Opt($e),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ke=e.Variant({NeuronsFund:Xe,Direct:e.Record({})}),Ze=e.Record({neuron_ids:e.Vec(p)}),Ie=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ke),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(Ze),neuron_id:e.Opt(p)}),De=e.Record({neuron_recipes:e.Vec(Ie)}),Le=e.Record({neuron_recipes:e.Opt(De)}),et=e.Record({id:e.Opt(p),status:e.Int32}),tt=e.Record({swap_neurons:e.Vec(et)}),st=e.Variant({Ok:tt,Err:e.Int32}),ot=e.Record({claim_swap_neurons_result:e.Opt(st)}),nt=e.Record({maturity_modulation:e.Opt(l)}),at=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),Me=e.Record({mode:e.Opt(e.Int32)}),rt=e.Record({neuron_id:e.Opt(p)}),it=e.Variant({Error:O,Neuron:A}),ct=e.Record({result:e.Opt(it)}),Ae=e.Record({proposal_id:e.Opt(u)}),_t=e.Variant({Error:O,Proposal:x}),pt=e.Record({result:e.Opt(_t)}),dt=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),ut=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),lt=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),mt=e.Record({status:dt,memory_size:e.Nat,cycles:e.Nat,settings:ut,query_stats:e.Opt(lt),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),Nt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),Ot=e.Record({sns_initialization_parameters:e.Text}),Rt=e.Record({timers:e.Opt(s)}),gt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),yt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),ft=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),vt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),St=e.Record({neurons:e.Vec(A)}),ht=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_status:e.Vec(e.Int32)}),wt=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x)}),Tt=e.Record({}),Pt=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(a),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),Vt=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(Pt))}),xt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),bt=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:xt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Ft=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(bt)}),Ct=e.Record({created_neuron_id:e.Opt(p)}),kt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),Mt=e.Record({refreshed_neuron_id:e.Opt(p)}),At=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),qt=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),es=e.Record({transfer_block_height:e.Nat64}),ts=e.Variant({Error:O,Split:Ct,Follow:e.Record({}),DisburseMaturity:kt,ClaimOrRefresh:Mt,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Ae,RemoveNeuronPermission:e.Record({}),StakeMaturity:At,MergeMaturity:qt,Disburse:es,AddNeuronPermission:e.Record({})}),ss=e.Record({command:e.Opt(ts)}),os=e.Record({recipient:e.Opt(R),amount_e8s:e.Opt(e.Nat64)}),ns=e.Record({mode:e.Int32});return e.Service({add_maturity:e.Func([Qe],[Je],[]),advance_target_version:e.Func([Ye],[He],[]),claim_swap_neurons:e.Func([Le],[ot],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],[]),get_latest_reward_event:e.Func([],[P],[]),get_maturity_modulation:e.Func([e.Record({})],[nt],[]),get_metadata:e.Func([e.Record({})],[at],[]),get_mode:e.Func([e.Record({})],[Me],[]),get_nervous_system_parameters:e.Func([e.Null],[f],[]),get_neuron:e.Func([rt],[ct],[]),get_proposal:e.Func([Ae],[pt],[]),get_root_canister_status:e.Func([e.Null],[mt],[]),get_running_sns_version:e.Func([e.Record({})],[Nt],[]),get_sns_initialization_parameters:e.Func([e.Record({})],[Ot],[]),get_timers:e.Func([e.Record({})],[Rt],[]),get_upgrade_journal:e.Func([gt],[yt],[]),list_nervous_system_functions:e.Func([],[ft],[]),list_neurons:e.Func([vt],[St],[]),list_proposals:e.Func([ht],[wt],[]),list_topics:e.Func([Tt],[Vt],[]),manage_neuron:e.Func([Ft],[ss],[]),mint_tokens:e.Func([os],[e.Record({})],[]),refresh_cached_upgrade_steps:e.Func([e.Record({})],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([ns],[e.Record({})],[]),update_neuron:e.Func([A],[e.Opt(O)],[])})};var Bs=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),n=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),a=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(a),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),P=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),V=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(V)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,a))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(V),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(a),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(a),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Pe=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Ve=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Ve,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Pe,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),Lt=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(n),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(P),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({id:e.Opt(p),amount_e8s:e.Opt(e.Nat64)}),Je=e.Record({new_maturity_e8s:e.Opt(e.Nat64)}),Ye=e.Record({target_version:e.Opt(t)}),He=e.Record({}),$e=e.Record({principals:e.Vec(e.Principal)}),Xe=e.Record({nns_neuron_hotkeys:e.Opt($e),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ke=e.Variant({NeuronsFund:Xe,Direct:e.Record({})}),Ze=e.Record({neuron_ids:e.Vec(p)}),Ie=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ke),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(Ze),neuron_id:e.Opt(p)}),De=e.Record({neuron_recipes:e.Vec(Ie)}),Le=e.Record({neuron_recipes:e.Opt(De)}),et=e.Record({id:e.Opt(p),status:e.Int32}),tt=e.Record({swap_neurons:e.Vec(et)}),st=e.Variant({Ok:tt,Err:e.Int32}),ot=e.Record({claim_swap_neurons_result:e.Opt(st)}),nt=e.Record({maturity_modulation:e.Opt(l)}),at=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),Me=e.Record({mode:e.Opt(e.Int32)}),rt=e.Record({neuron_id:e.Opt(p)}),it=e.Variant({Error:O,Neuron:A}),ct=e.Record({result:e.Opt(it)}),Ae=e.Record({proposal_id:e.Opt(u)}),_t=e.Variant({Error:O,Proposal:x}),pt=e.Record({result:e.Opt(_t)}),dt=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),ut=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),lt=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),mt=e.Record({status:dt,memory_size:e.Nat,cycles:e.Nat,settings:ut,query_stats:e.Opt(lt),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),Nt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),Ot=e.Record({sns_initialization_parameters:e.Text}),Rt=e.Record({timers:e.Opt(s)}),gt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),yt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),ft=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),vt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),St=e.Record({neurons:e.Vec(A)}),ht=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_status:e.Vec(e.Int32)}),wt=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x)}),Tt=e.Record({}),Pt=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(a),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),Vt=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(Pt))}),xt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),bt=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:xt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Ft=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(bt)}),Ct=e.Record({created_neuron_id:e.Opt(p)}),kt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),Mt=e.Record({refreshed_neuron_id:e.Opt(p)}),At=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),qt=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),es=e.Record({transfer_block_height:e.Nat64}),ts=e.Variant({Error:O,Split:Ct,Follow:e.Record({}),DisburseMaturity:kt,ClaimOrRefresh:Mt,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Ae,RemoveNeuronPermission:e.Record({}),StakeMaturity:At,MergeMaturity:qt,Disburse:es,AddNeuronPermission:e.Record({})}),ss=e.Record({command:e.Opt(ts)}),os=e.Record({recipient:e.Opt(R),amount_e8s:e.Opt(e.Nat64)}),ns=e.Record({mode:e.Int32});return e.Service({add_maturity:e.Func([Qe],[Je],[]),advance_target_version:e.Func([Ye],[He],[]),claim_swap_neurons:e.Func([Le],[ot],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_latest_reward_event:e.Func([],[P],["query"]),get_maturity_modulation:e.Func([e.Record({})],[nt],[]),get_metadata:e.Func([e.Record({})],[at],["query"]),get_mode:e.Func([e.Record({})],[Me],["query"]),get_nervous_system_parameters:e.Func([e.Null],[f],["query"]),get_neuron:e.Func([rt],[ct],["query"]),get_proposal:e.Func([Ae],[pt],["query"]),get_root_canister_status:e.Func([e.Null],[mt],[]),get_running_sns_version:e.Func([e.Record({})],[Nt],["query"]),get_sns_initialization_parameters:e.Func([e.Record({})],[Ot],["query"]),get_timers:e.Func([e.Record({})],[Rt],["query"]),get_upgrade_journal:e.Func([gt],[yt],["query"]),list_nervous_system_functions:e.Func([],[ft],["query"]),list_neurons:e.Func([vt],[St],["query"]),list_proposals:e.Func([ht],[wt],["query"]),list_topics:e.Func([Tt],[Vt],["query"]),manage_neuron:e.Func([Ft],[ss],[]),mint_tokens:e.Func([os],[e.Record({})],[]),refresh_cached_upgrade_steps:e.Func([e.Record({})],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([ns],[e.Record({})],[]),update_neuron:e.Func([A],[e.Opt(O)],[])})};var $t=class e extends Fe.Canister{constructor(){super(...arguments);this.addMaturity=async t=>{let{id:o,amountE8s:n}=t,{new_maturity_e8s:a}=await this.caller(t).add_maturity({id:(0,Fe.toNullable)(o),amount_e8s:(0,Fe.toNullable)(n)}),r=(0,Fe.fromNullable)(a);if((0,Fe.isNullish)(r)||r<n)throw new b("No maturity added")}}static create(t){let{service:o,certifiedService:n,canisterId:a}=(0,Fe.createServices)({options:t,idlFactory:Bs,certifiedIdlFactory:Es});return new e(a,o,n)}};var Xt=require("@dfinity/utils");var zs=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({dapp_canister_ids:e.Vec(e.Principal),timers:e.Opt(s),testflight:e.Bool,archive_canister_ids:e.Vec(e.Principal),governance_canister_id:e.Opt(e.Principal),index_canister_id:e.Opt(e.Principal),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal)}),o=e.Record({canister_id:e.Principal}),n=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),a=e.Variant({controllers:e.Null,public:e.Null,allowed_viewers:e.Vec(e.Principal)}),r=e.Record({freezing_threshold:e.Opt(e.Nat),wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(a),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),i=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_=e.Record({status:n,memory_size:e.Nat,cycles:e.Nat,settings:r,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Opt(e.Nat),module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Opt(e.Nat)}),N=e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),l=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Principal}),c=e.Record({arg:e.Vec(e.Nat8),wasm_module:e.Vec(e.Nat8),stop_before_installing:e.Bool,mode:N,canister_id:e.Principal,chunked_canister_wasm:e.Opt(l),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),g=e.Record({update_canister_list:e.Opt(e.Bool)}),v=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:n,memory_size:e.Nat,cycles:e.Nat,settings:v,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),m=e.Record({status:e.Opt(u),canister_id:e.Opt(e.Principal)}),q=e.Record({root:e.Opt(m),swap:e.Opt(m),ledger:e.Opt(m),index:e.Opt(m),governance:e.Opt(m),dapps:e.Vec(m),archives:e.Vec(m)}),S=e.Record({timers:e.Opt(s)}),G=e.Record({root:e.Opt(e.Principal),swap:e.Opt(e.Principal),ledger:e.Opt(e.Principal),index:e.Opt(e.Principal),governance:e.Opt(e.Principal),dapps:e.Vec(e.Principal),archives:e.Vec(e.Principal)}),w=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),p=e.Record({failure_reason:e.Opt(e.Text)}),T=e.Record({canister_id:e.Opt(e.Principal)}),C=e.Record({canister_ids:e.Vec(e.Principal)}),y=e.Record({canister_ids:e.Opt(C),controller_principal_ids:e.Vec(e.Principal)}),U=e.Record({code:e.Opt(e.Int32),description:e.Text}),f=e.Record({err:e.Opt(U),dapp_canister_id:e.Opt(e.Principal)}),P=e.Record({failed_updates:e.Vec(f)});return e.Service({canister_status:e.Func([o],[_],[]),change_canister:e.Func([c],[],[]),get_build_metadata:e.Func([],[e.Text],[]),get_sns_canisters_summary:e.Func([g],[q],[]),get_timers:e.Func([e.Record({})],[S],[]),list_sns_canisters:e.Func([e.Record({})],[G],[]),manage_dapp_canister_settings:e.Func([w],[p],[]),register_dapp_canister:e.Func([T],[e.Record({})],[]),register_dapp_canisters:e.Func([C],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_dapp_controllers:e.Func([y],[P],[])})};var js=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({dapp_canister_ids:e.Vec(e.Principal),timers:e.Opt(s),testflight:e.Bool,archive_canister_ids:e.Vec(e.Principal),governance_canister_id:e.Opt(e.Principal),index_canister_id:e.Opt(e.Principal),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal)}),o=e.Record({canister_id:e.Principal}),n=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),a=e.Variant({controllers:e.Null,public:e.Null,allowed_viewers:e.Vec(e.Principal)}),r=e.Record({freezing_threshold:e.Opt(e.Nat),wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(a),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),i=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_=e.Record({status:n,memory_size:e.Nat,cycles:e.Nat,settings:r,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Opt(e.Nat),module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Opt(e.Nat)}),N=e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),l=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Principal}),c=e.Record({arg:e.Vec(e.Nat8),wasm_module:e.Vec(e.Nat8),stop_before_installing:e.Bool,mode:N,canister_id:e.Principal,chunked_canister_wasm:e.Opt(l),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),g=e.Record({update_canister_list:e.Opt(e.Bool)}),v=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:n,memory_size:e.Nat,cycles:e.Nat,settings:v,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),m=e.Record({status:e.Opt(u),canister_id:e.Opt(e.Principal)}),q=e.Record({root:e.Opt(m),swap:e.Opt(m),ledger:e.Opt(m),index:e.Opt(m),governance:e.Opt(m),dapps:e.Vec(m),archives:e.Vec(m)}),S=e.Record({timers:e.Opt(s)}),G=e.Record({root:e.Opt(e.Principal),swap:e.Opt(e.Principal),ledger:e.Opt(e.Principal),index:e.Opt(e.Principal),governance:e.Opt(e.Principal),dapps:e.Vec(e.Principal),archives:e.Vec(e.Principal)}),w=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),p=e.Record({failure_reason:e.Opt(e.Text)}),T=e.Record({canister_id:e.Opt(e.Principal)}),C=e.Record({canister_ids:e.Vec(e.Principal)}),y=e.Record({canister_ids:e.Opt(C),controller_principal_ids:e.Vec(e.Principal)}),U=e.Record({code:e.Opt(e.Int32),description:e.Text}),f=e.Record({err:e.Opt(U),dapp_canister_id:e.Opt(e.Principal)}),P=e.Record({failed_updates:e.Vec(f)});return e.Service({canister_status:e.Func([o],[_],[]),change_canister:e.Func([c],[],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_sns_canisters_summary:e.Func([g],[q],[]),get_timers:e.Func([e.Record({})],[S],["query"]),list_sns_canisters:e.Func([e.Record({})],[G],["query"]),manage_dapp_canister_settings:e.Func([w],[p],[]),register_dapp_canister:e.Func([T],[e.Record({})],[]),register_dapp_canisters:e.Func([C],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_dapp_controllers:e.Func([y],[P],[])})};var Et=class e extends Xt.Canister{constructor(){super(...arguments);this.listSnsCanisters=async({certified:t=!0})=>this.caller({certified:t}).list_sns_canisters({})}static create(t){let{service:o,certifiedService:n,canisterId:a}=(0,Xt.createServices)({options:t,idlFactory:js,certifiedIdlFactory:zs});return new e(a,o,n)}};var Dt=require("@dfinity/ledger-icrc"),ke=require("@dfinity/utils");var Yt=require("@dfinity/utils");var Bt=require("@dfinity/utils");function Oo(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function is(e,...s){if(!Oo(e))throw new Error("Uint8Array expected");if(s.length>0&&!s.includes(e.length))throw new Error(`Uint8Array expected of length ${s}, not of length=${e.length}`)}function cs(e,s=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(s&&e.finished)throw new Error("Hash#digest() has already been called")}function Ws(e,s){is(e);let t=s.outputLen;if(e.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Zt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ce=(e,s)=>e<<32-s|e>>>s;var Lo=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ro(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function _s(e){return typeof e=="string"&&(e=Ro(e)),is(e),e}var Kt=class{clone(){return this._cloneInto()}},en={}.toString;function Qs(e){let s=o=>e().update(_s(o)).digest(),t=e();return s.outputLen=t.outputLen,s.blockLen=t.blockLen,s.create=()=>e(),s}function go(e,s,t,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(s,t,o);let n=BigInt(32),a=BigInt(4294967295),r=Number(t>>n&a),i=Number(t&a),_=o?4:0,N=o?0:4;e.setUint32(s+_,r,o),e.setUint32(s+N,i,o)}var Js=(e,s,t)=>e&s^~e&t,Ys=(e,s,t)=>e&s^e&t^s&t,It=class extends Kt{constructor(s,t,o,n){super(),this.blockLen=s,this.outputLen=t,this.padOffset=o,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(s),this.view=Zt(this.buffer)}update(s){cs(this);let{view:t,buffer:o,blockLen:n}=this;s=_s(s);let a=s.length;for(let r=0;r<a;){let i=Math.min(n-this.pos,a-r);if(i===n){let _=Zt(s);for(;n<=a-r;r+=n)this.process(_,r);continue}o.set(s.subarray(r,r+i),this.pos),this.pos+=i,r+=i,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){cs(this),Ws(s,this),this.finished=!0;let{buffer:t,view:o,blockLen:n,isLE:a}=this,{pos:r}=this;t[r++]=128,this.buffer.subarray(r).fill(0),this.padOffset>n-r&&(this.process(o,0),r=0);for(let c=r;c<n;c++)t[c]=0;go(o,n-8,BigInt(this.length*8),a),this.process(o,0);let i=Zt(s),_=this.outputLen;if(_%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let N=_/4,l=this.get();if(N>l.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;c<N;c++)i.setUint32(4*c,l[c],a)}digest(){let{buffer:s,outputLen:t}=this;this.digestInto(s);let o=s.slice(0,t);return this.destroy(),o}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());let{blockLen:t,buffer:o,length:n,finished:a,destroyed:r,pos:i}=this;return s.length=n,s.pos=i,s.finished=a,s.destroyed=r,n%t&&s.buffer.set(o),s}};var yo=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),qe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ge=new Uint32Array(64),ps=class extends It{constructor(){super(64,32,8,!1),this.A=qe[0]|0,this.B=qe[1]|0,this.C=qe[2]|0,this.D=qe[3]|0,this.E=qe[4]|0,this.F=qe[5]|0,this.G=qe[6]|0,this.H=qe[7]|0}get(){let{A:s,B:t,C:o,D:n,E:a,F:r,G:i,H:_}=this;return[s,t,o,n,a,r,i,_]}set(s,t,o,n,a,r,i,_){this.A=s|0,this.B=t|0,this.C=o|0,this.D=n|0,this.E=a|0,this.F=r|0,this.G=i|0,this.H=_|0}process(s,t){for(let c=0;c<16;c++,t+=4)Ge[c]=s.getUint32(t,!1);for(let c=16;c<64;c++){let g=Ge[c-15],v=Ge[c-2],u=Ce(g,7)^Ce(g,18)^g>>>3,m=Ce(v,17)^Ce(v,19)^v>>>10;Ge[c]=m+Ge[c-7]+u+Ge[c-16]|0}let{A:o,B:n,C:a,D:r,E:i,F:_,G:N,H:l}=this;for(let c=0;c<64;c++){let g=Ce(i,6)^Ce(i,11)^Ce(i,25),v=l+g+Js(i,_,N)+yo[c]+Ge[c]|0,m=(Ce(o,2)^Ce(o,13)^Ce(o,22))+Ys(o,n,a)|0;l=N,N=_,_=i,i=r+v|0,r=a,a=n,n=o,o=v+m|0}o=o+this.A|0,n=n+this.B|0,a=a+this.C|0,r=r+this.D|0,i=i+this.E|0,_=_+this.F|0,N=N+this.G|0,l=l+this.H|0,this.set(o,n,a,r,i,_,N,l)}roundClean(){Ge.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Hs=Qs(()=>new ps);var ds=({index:e,controller:s})=>{let o=[12,...(0,Bt.asciiStringToByteArray)("neuron-stake"),...s.toUint8Array(),...(0,Bt.numberToUint8Array)(e)],n=Hs.create();return n.update((0,Bt.arrayOfNumberToUint8Array)(o)),n.digest()};var Ht=class{constructor({root:s,governance:t,ledger:o,swap:n,index:a,certified:r}){this.listNeurons=s=>this.governance.listNeurons(this.mergeParams(s));this.listProposals=s=>this.governance.listProposals(this.mergeParams(s));this.getProposal=s=>this.governance.getProposal(this.mergeParams(s));this.listNervousSystemFunctions=s=>this.governance.listNervousSystemFunctions(this.mergeParams(s));this.metadata=s=>Promise.all([this.governance.metadata(this.mergeParams(s)),this.ledger.metadata(this.mergeParams(s))]);this.nervousSystemParameters=s=>this.governance.nervousSystemParameters(this.mergeParams(s));this.ledgerMetadata=s=>this.ledger.metadata(this.mergeParams(s));this.transactionFee=s=>this.ledger.transactionFee(this.mergeParams(s));this.totalTokensSupply=s=>this.ledger.totalTokensSupply(this.mergeParams(s));this.balance=s=>this.ledger.balance(this.mergeParams(s));this.transfer=s=>this.ledger.transfer(s);this.getNeuron=s=>this.governance.getNeuron(this.mergeParams(s));this.queryNeuron=s=>this.governance.queryNeuron(this.mergeParams(s));this.nextNeuronAccount=async s=>{for(let t=0;t<65536;t++){let o=ds({index:t,controller:s}),n={id:o},a=await this.governance.queryNeuron({neuronId:n,certified:!1});if(a===void 0&&(a=await this.governance.queryNeuron({neuronId:n,certified:!0}),a===void 0))return{account:{...this.owner,subaccount:o},index:BigInt(t)}}throw new b("No more neuron accounts available")};this.stakeNeuron=async({stakeE8s:s,source:t,controller:o,createdAt:n,fee:a})=>{this.assertCertified("stakeNeuron");let{account:r,index:i}=await this.nextNeuronAccount(o);if(r.subaccount===void 0)throw new b("There was an error creating the neuron subaccount");return await this.ledger.transfer({amount:s,to:{owner:r.owner,subaccount:(0,Yt.toNullable)(r.subaccount)},from_subaccount:t.subaccount,memo:(0,Yt.bigIntToUint8Array)(i),created_at_time:n,fee:a}),this.governance.claimNeuron({memo:BigInt(i),controller:o,subaccount:r.subaccount})};this.increaseStakeNeuron=async({stakeE8s:s,source:t,neuronId:o})=>(this.assertCertified("stakeNeuron"),await this.ledger.transfer({amount:s,to:{...this.owner,subaccount:(0,Yt.toNullable)(Uint8Array.from(o.id))},from_subaccount:t.subaccount}),this.governance.refreshNeuron(o));this.getNeuronBalance=async s=>{let t={...this.owner,subaccount:Uint8Array.from(s.id)};return this.ledger.balance({...t,certified:this.certified})};this.addNeuronPermissions=s=>this.governance.addNeuronPermissions(s);this.refreshNeuron=s=>this.governance.refreshNeuron(s);this.claimNeuron=s=>this.governance.claimNeuron(s);this.removeNeuronPermissions=s=>this.governance.removeNeuronPermissions(s);this.splitNeuron=s=>this.governance.splitNeuron(s);this.disburse=s=>this.governance.disburse(s);this.startDissolving=s=>this.governance.startDissolving(s);this.stopDissolving=s=>this.governance.stopDissolving(s);this.setDissolveTimestamp=s=>this.governance.setDissolveTimestamp(s);this.increaseDissolveDelay=s=>this.governance.increaseDissolveDelay(s);this.setTopicFollowees=s=>this.governance.setTopicFollowees(s);this.setFollowing=s=>this.governance.setFollowing(s);this.registerVote=async s=>this.governance.registerVote(s);this.swapState=s=>this.swap.state(this.mergeParams(s));this.notifyPaymentFailure=()=>this.swap.notifyPaymentFailure();this.notifyParticipation=s=>this.swap.notifyParticipation(s);this.getUserCommitment=s=>this.swap.getUserCommitment(this.mergeParams(s));this.getOpenTicket=s=>this.swap.getOpenTicket(this.mergeParams(s));this.newSaleTicket=s=>this.swap.newSaleTicket(s);this.getLifecycle=s=>this.swap.getLifecycle(this.mergeParams(s));this.getFinalizationStatus=s=>this.swap.getFinalizationStatus(this.mergeParams(s));this.getSaleParameters=s=>this.swap.getSaleParameters(this.mergeParams(s));this.getDerivedState=s=>this.swap.getDerivedState(this.mergeParams(s));this.getTransactions=s=>this.index.getTransactions(s);this.stakeMaturity=s=>this.governance.stakeMaturity(s);this.disburseMaturity=s=>this.governance.disburseMaturity(s);this.autoStakeMaturity=s=>this.governance.autoStakeMaturity(s);this.assertCertified=s=>{if(!this.certified)throw new b(`Call to ${s} needs to be certified`)};this.root=s,this.governance=t,this.ledger=o,this.swap=n,this.index=a,this.certified=r}get canisterIds(){return{rootCanisterId:this.root.canisterId,ledgerCanisterId:this.ledger.canisterId,governanceCanisterId:this.governance.canisterId,swapCanisterId:this.swap.canisterId,indexCanisterId:this.index.canisterId}}mergeParams(s){return{...s,certified:this.certified}}get owner(){return{owner:this.canisterIds.governanceCanisterId}}};var ee=require("@dfinity/utils");var $s=({IDL:e})=>{let s=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),t=e.Record({slope_numerator:e.Opt(e.Nat64),intercept_icp_e8s:e.Opt(e.Nat64),from_direct_participation_icp_e8s:e.Opt(e.Nat64),slope_denominator:e.Opt(e.Nat64),to_direct_participation_icp_e8s:e.Opt(e.Nat64)}),o=e.Record({serialized_representation:e.Opt(e.Text)}),n=e.Record({coefficient_intervals:e.Vec(t),max_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),min_direct_participation_threshold_icp_e8s:e.Opt(e.Nat64),ideal_matched_participation_function:e.Opt(o)}),a=e.Record({iso_codes:e.Vec(e.Text)}),r=e.Record({nns_proposal_id:e.Opt(e.Nat64),sns_root_canister_id:e.Text,neurons_fund_participation:e.Opt(e.Bool),min_participant_icp_e8s:e.Opt(e.Nat64),neuron_basket_construction_parameters:e.Opt(s),fallback_controller_principal_ids:e.Vec(e.Text),max_icp_e8s:e.Opt(e.Nat64),neuron_minimum_stake_e8s:e.Opt(e.Nat64),confirmation_text:e.Opt(e.Text),swap_start_timestamp_seconds:e.Opt(e.Nat64),swap_due_timestamp_seconds:e.Opt(e.Nat64),min_participants:e.Opt(e.Nat32),sns_token_e8s:e.Opt(e.Nat64),nns_governance_canister_id:e.Text,transaction_fee_e8s:e.Opt(e.Nat64),icp_ledger_canister_id:e.Text,sns_ledger_canister_id:e.Text,neurons_fund_participation_constraints:e.Opt(n),should_auto_finalize:e.Opt(e.Bool),max_participant_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Text,min_direct_participation_icp_e8s:e.Opt(e.Nat64),restricted_countries:e.Opt(a),min_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),i=e.Record({source_principal_id:e.Opt(e.Principal)}),_=e.Record({block_height:e.Opt(e.Nat64)}),N=e.Record({description:e.Opt(e.Text),error_type:e.Opt(e.Int32)}),l=e.Variant({Ok:_,Err:N}),c=e.Record({result:e.Opt(l)}),g=e.Record({code:e.Opt(e.Int32),description:e.Text}),v=e.Record({err:e.Opt(g),dapp_canister_id:e.Opt(e.Principal)}),u=e.Record({failed_updates:e.Vec(v)}),m=e.Variant({Ok:u,Err:g}),q=e.Record({possibility:e.Opt(m)}),S=e.Record({failure:e.Nat32,skipped:e.Nat32,invalid:e.Nat32,success:e.Nat32,global_failures:e.Nat32}),G=e.Record({error_message:e.Text,error_type:e.Int32}),w=e.Record({governance_error:e.Opt(G)}),p=e.Variant({Ok:w,Err:g}),T=e.Record({possibility:e.Opt(p)}),C=e.Record({neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_neurons_count:e.Opt(e.Nat64)}),y=e.Record({message:e.Opt(e.Text)}),U=e.Variant({Ok:C,Err:y}),f=e.Record({possibility:e.Opt(U)}),P=e.Variant({Ok:e.Record({}),Err:g}),ae=e.Record({possibility:e.Opt(P)}),O=e.Record({set_dapp_controllers_call_result:e.Opt(q),create_sns_neuron_recipes_result:e.Opt(S),settle_community_fund_participation_result:e.Opt(T),error_message:e.Opt(e.Text),settle_neurons_fund_participation_result:e.Opt(f),set_mode_call_result:e.Opt(ae),sweep_icp_result:e.Opt(S),claim_neuron_result:e.Opt(S),sweep_sns_result:e.Opt(S)}),V=e.Record({auto_finalize_swap_response:e.Opt(O),has_auto_finalize_been_attempted:e.Opt(e.Bool),is_auto_finalize_enabled:e.Opt(e.Bool)}),R=e.Record({principal_id:e.Opt(e.Principal)}),k=e.Record({transfer_fee_paid_e8s:e.Opt(e.Nat64),transfer_start_timestamp_seconds:e.Nat64,amount_e8s:e.Nat64,amount_transferred_e8s:e.Opt(e.Nat64),transfer_success_timestamp_seconds:e.Nat64}),E=e.Record({icp:e.Opt(k),has_created_neuron_recipes:e.Opt(e.Bool)}),re=e.Record({buyer_state:e.Opt(E)}),ie=e.Record({buyers_total:e.Nat64}),B=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),z=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),ce=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_e=e.Record({status:B,memory_size:e.Nat,cycles:e.Nat,settings:z,query_stats:e.Opt(ce),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),pe=e.Record({sns_tokens_per_icp:e.Opt(e.Float64),buyer_total_icp_e8s:e.Opt(e.Nat64),cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),j=e.Record({init:e.Opt(r)}),de=e.Record({decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),lifecycle:e.Opt(e.Int32),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64)}),ue=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(e.Vec(e.Nat8))}),te=e.Record({creation_time:e.Nat64,ticket_id:e.Nat64,account:e.Opt(ue),amount_icp_e8s:e.Nat64}),W=e.Record({ticket:e.Opt(te)}),le=e.Record({error_type:e.Opt(e.Int32)}),me=e.Variant({Ok:W,Err:le}),Ne=e.Record({result:e.Opt(me)}),se=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(s),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Oe=e.Record({params:e.Opt(se)}),Re=e.Record({id:e.Vec(e.Nat8)}),Q=e.Record({dissolve_delay_seconds:e.Nat64,memo:e.Nat64,followees:e.Vec(Re)}),oe=e.Record({principals:e.Vec(e.Principal)}),ge=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64}),ye=e.Record({buyer_principal:e.Text}),fe=e.Variant({CommunityFund:ge,Direct:ye}),h=e.Record({sns:e.Opt(k),claimed_status:e.Opt(e.Int32),neuron_attributes:e.Opt(Q),investor:e.Opt(fe)}),ne=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),x=e.Record({has_created_neuron_recipes:e.Opt(e.Bool),hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64,amount_icp_e8s:e.Nat64}),M=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,cf_neurons:e.Vec(x)}),J=e.Record({auto_finalize_swap_response:e.Opt(O),neuron_recipes:e.Vec(h),next_ticket_id:e.Opt(e.Nat64),decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),finalize_swap_in_progress:e.Opt(e.Bool),timers:e.Opt(ne),cf_participants:e.Vec(M),init:e.Opt(r),already_tried_to_auto_finalize:e.Opt(e.Bool),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),purge_old_tickets_last_completion_timestamp_nanoseconds:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),lifecycle:e.Int32,purge_old_tickets_next_principal:e.Opt(e.Vec(e.Nat8)),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64),buyers:e.Vec(e.Tuple(e.Text,E)),params:e.Opt(se),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),Y=e.Record({sns_tokens_per_icp:e.Float32,buyer_total_icp_e8s:e.Nat64,cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),ve=e.Record({swap:e.Opt(J),derived:e.Opt(Y)}),Se=e.Record({timers:e.Opt(ne)}),he=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),we=e.Record({cf_participants:e.Vec(M)}),H=e.Record({offset:e.Opt(e.Nat32),limit:e.Opt(e.Nat32)}),$=e.Record({participation:e.Opt(E),participant_id:e.Opt(e.Principal)}),Te=e.Record({participants:e.Vec($)}),X=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),K=e.Record({sns_neuron_recipes:e.Vec(h)}),Pe=e.Record({subaccount:e.Opt(e.Vec(e.Nat8)),amount_icp_e8s:e.Nat64}),Ve=e.Record({min_amount_icp_e8s_included:e.Nat64,max_amount_icp_e8s_included:e.Nat64}),xe=e.Record({invalid_user_amount:e.Opt(Ve),existing_ticket:e.Opt(te),error_type:e.Int32}),Z=e.Variant({Ok:W,Err:xe}),I=e.Record({result:e.Opt(Z)}),D=e.Record({confirmation_text:e.Opt(e.Text),buyer:e.Text}),L=e.Record({icp_accepted_participation_e8s:e.Nat64,icp_ledger_account_balance_e8s:e.Nat64});return e.Service({error_refund_icp:e.Func([i],[c],[]),finalize_swap:e.Func([e.Record({})],[O],[]),get_auto_finalization_status:e.Func([e.Record({})],[V],[]),get_buyer_state:e.Func([R],[re],[]),get_buyers_total:e.Func([e.Record({})],[ie],[]),get_canister_status:e.Func([e.Record({})],[_e],[]),get_derived_state:e.Func([e.Record({})],[pe],[]),get_init:e.Func([e.Record({})],[j],[]),get_lifecycle:e.Func([e.Record({})],[de],[]),get_open_ticket:e.Func([e.Record({})],[Ne],[]),get_sale_parameters:e.Func([e.Record({})],[Oe],[]),get_state:e.Func([e.Record({})],[ve],[]),get_timers:e.Func([e.Record({})],[Se],[]),list_community_fund_participants:e.Func([he],[we],[]),list_direct_participants:e.Func([H],[Te],[]),list_sns_neuron_recipes:e.Func([X],[K],[]),new_sale_ticket:e.Func([Pe],[I],[]),notify_payment_failure:e.Func([e.Record({})],[W],[]),refresh_buyer_tokens:e.Func([D],[L],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[])})};var Xs=({IDL:e})=>{let s=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),t=e.Record({slope_numerator:e.Opt(e.Nat64),intercept_icp_e8s:e.Opt(e.Nat64),from_direct_participation_icp_e8s:e.Opt(e.Nat64),slope_denominator:e.Opt(e.Nat64),to_direct_participation_icp_e8s:e.Opt(e.Nat64)}),o=e.Record({serialized_representation:e.Opt(e.Text)}),n=e.Record({coefficient_intervals:e.Vec(t),max_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),min_direct_participation_threshold_icp_e8s:e.Opt(e.Nat64),ideal_matched_participation_function:e.Opt(o)}),a=e.Record({iso_codes:e.Vec(e.Text)}),r=e.Record({nns_proposal_id:e.Opt(e.Nat64),sns_root_canister_id:e.Text,neurons_fund_participation:e.Opt(e.Bool),min_participant_icp_e8s:e.Opt(e.Nat64),neuron_basket_construction_parameters:e.Opt(s),fallback_controller_principal_ids:e.Vec(e.Text),max_icp_e8s:e.Opt(e.Nat64),neuron_minimum_stake_e8s:e.Opt(e.Nat64),confirmation_text:e.Opt(e.Text),swap_start_timestamp_seconds:e.Opt(e.Nat64),swap_due_timestamp_seconds:e.Opt(e.Nat64),min_participants:e.Opt(e.Nat32),sns_token_e8s:e.Opt(e.Nat64),nns_governance_canister_id:e.Text,transaction_fee_e8s:e.Opt(e.Nat64),icp_ledger_canister_id:e.Text,sns_ledger_canister_id:e.Text,neurons_fund_participation_constraints:e.Opt(n),should_auto_finalize:e.Opt(e.Bool),max_participant_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Text,min_direct_participation_icp_e8s:e.Opt(e.Nat64),restricted_countries:e.Opt(a),min_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),i=e.Record({source_principal_id:e.Opt(e.Principal)}),_=e.Record({block_height:e.Opt(e.Nat64)}),N=e.Record({description:e.Opt(e.Text),error_type:e.Opt(e.Int32)}),l=e.Variant({Ok:_,Err:N}),c=e.Record({result:e.Opt(l)}),g=e.Record({code:e.Opt(e.Int32),description:e.Text}),v=e.Record({err:e.Opt(g),dapp_canister_id:e.Opt(e.Principal)}),u=e.Record({failed_updates:e.Vec(v)}),m=e.Variant({Ok:u,Err:g}),q=e.Record({possibility:e.Opt(m)}),S=e.Record({failure:e.Nat32,skipped:e.Nat32,invalid:e.Nat32,success:e.Nat32,global_failures:e.Nat32}),G=e.Record({error_message:e.Text,error_type:e.Int32}),w=e.Record({governance_error:e.Opt(G)}),p=e.Variant({Ok:w,Err:g}),T=e.Record({possibility:e.Opt(p)}),C=e.Record({neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_neurons_count:e.Opt(e.Nat64)}),y=e.Record({message:e.Opt(e.Text)}),U=e.Variant({Ok:C,Err:y}),f=e.Record({possibility:e.Opt(U)}),P=e.Variant({Ok:e.Record({}),Err:g}),ae=e.Record({possibility:e.Opt(P)}),O=e.Record({set_dapp_controllers_call_result:e.Opt(q),create_sns_neuron_recipes_result:e.Opt(S),settle_community_fund_participation_result:e.Opt(T),error_message:e.Opt(e.Text),settle_neurons_fund_participation_result:e.Opt(f),set_mode_call_result:e.Opt(ae),sweep_icp_result:e.Opt(S),claim_neuron_result:e.Opt(S),sweep_sns_result:e.Opt(S)}),V=e.Record({auto_finalize_swap_response:e.Opt(O),has_auto_finalize_been_attempted:e.Opt(e.Bool),is_auto_finalize_enabled:e.Opt(e.Bool)}),R=e.Record({principal_id:e.Opt(e.Principal)}),k=e.Record({transfer_fee_paid_e8s:e.Opt(e.Nat64),transfer_start_timestamp_seconds:e.Nat64,amount_e8s:e.Nat64,amount_transferred_e8s:e.Opt(e.Nat64),transfer_success_timestamp_seconds:e.Nat64}),E=e.Record({icp:e.Opt(k),has_created_neuron_recipes:e.Opt(e.Bool)}),re=e.Record({buyer_state:e.Opt(E)}),ie=e.Record({buyers_total:e.Nat64}),B=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),z=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),ce=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_e=e.Record({status:B,memory_size:e.Nat,cycles:e.Nat,settings:z,query_stats:e.Opt(ce),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),pe=e.Record({sns_tokens_per_icp:e.Opt(e.Float64),buyer_total_icp_e8s:e.Opt(e.Nat64),cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),j=e.Record({init:e.Opt(r)}),de=e.Record({decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),lifecycle:e.Opt(e.Int32),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64)}),ue=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(e.Vec(e.Nat8))}),te=e.Record({creation_time:e.Nat64,ticket_id:e.Nat64,account:e.Opt(ue),amount_icp_e8s:e.Nat64}),W=e.Record({ticket:e.Opt(te)}),le=e.Record({error_type:e.Opt(e.Int32)}),me=e.Variant({Ok:W,Err:le}),Ne=e.Record({result:e.Opt(me)}),se=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(s),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Oe=e.Record({params:e.Opt(se)}),Re=e.Record({id:e.Vec(e.Nat8)}),Q=e.Record({dissolve_delay_seconds:e.Nat64,memo:e.Nat64,followees:e.Vec(Re)}),oe=e.Record({principals:e.Vec(e.Principal)}),ge=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64}),ye=e.Record({buyer_principal:e.Text}),fe=e.Variant({CommunityFund:ge,Direct:ye}),h=e.Record({sns:e.Opt(k),claimed_status:e.Opt(e.Int32),neuron_attributes:e.Opt(Q),investor:e.Opt(fe)}),ne=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),x=e.Record({has_created_neuron_recipes:e.Opt(e.Bool),hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64,amount_icp_e8s:e.Nat64}),M=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,cf_neurons:e.Vec(x)}),J=e.Record({auto_finalize_swap_response:e.Opt(O),neuron_recipes:e.Vec(h),next_ticket_id:e.Opt(e.Nat64),decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),finalize_swap_in_progress:e.Opt(e.Bool),timers:e.Opt(ne),cf_participants:e.Vec(M),init:e.Opt(r),already_tried_to_auto_finalize:e.Opt(e.Bool),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),purge_old_tickets_last_completion_timestamp_nanoseconds:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),lifecycle:e.Int32,purge_old_tickets_next_principal:e.Opt(e.Vec(e.Nat8)),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64),buyers:e.Vec(e.Tuple(e.Text,E)),params:e.Opt(se),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),Y=e.Record({sns_tokens_per_icp:e.Float32,buyer_total_icp_e8s:e.Nat64,cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),ve=e.Record({swap:e.Opt(J),derived:e.Opt(Y)}),Se=e.Record({timers:e.Opt(ne)}),he=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),we=e.Record({cf_participants:e.Vec(M)}),H=e.Record({offset:e.Opt(e.Nat32),limit:e.Opt(e.Nat32)}),$=e.Record({participation:e.Opt(E),participant_id:e.Opt(e.Principal)}),Te=e.Record({participants:e.Vec($)}),X=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),K=e.Record({sns_neuron_recipes:e.Vec(h)}),Pe=e.Record({subaccount:e.Opt(e.Vec(e.Nat8)),amount_icp_e8s:e.Nat64}),Ve=e.Record({min_amount_icp_e8s_included:e.Nat64,max_amount_icp_e8s_included:e.Nat64}),xe=e.Record({invalid_user_amount:e.Opt(Ve),existing_ticket:e.Opt(te),error_type:e.Int32}),Z=e.Variant({Ok:W,Err:xe}),I=e.Record({result:e.Opt(Z)}),D=e.Record({confirmation_text:e.Opt(e.Text),buyer:e.Text}),L=e.Record({icp_accepted_participation_e8s:e.Nat64,icp_ledger_account_balance_e8s:e.Nat64});return e.Service({error_refund_icp:e.Func([i],[c],[]),finalize_swap:e.Func([e.Record({})],[O],[]),get_auto_finalization_status:e.Func([e.Record({})],[V],["query"]),get_buyer_state:e.Func([R],[re],["query"]),get_buyers_total:e.Func([e.Record({})],[ie],[]),get_canister_status:e.Func([e.Record({})],[_e],[]),get_derived_state:e.Func([e.Record({})],[pe],["query"]),get_init:e.Func([e.Record({})],[j],["query"]),get_lifecycle:e.Func([e.Record({})],[de],["query"]),get_open_ticket:e.Func([e.Record({})],[Ne],["query"]),get_sale_parameters:e.Func([e.Record({})],[Oe],["query"]),get_state:e.Func([e.Record({})],[ve],["query"]),get_timers:e.Func([e.Record({})],[Se],["query"]),list_community_fund_participants:e.Func([he],[we],["query"]),list_direct_participants:e.Func([H],[Te],["query"]),list_sns_neuron_recipes:e.Func([X],[K],["query"]),new_sale_ticket:e.Func([Pe],[I],[]),notify_payment_failure:e.Func([e.Record({})],[W],[]),refresh_buyer_tokens:e.Func([D],[L],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[])})};var Ks=({subaccount:e,amount_icp_e8s:s})=>({subaccount:e===void 0?[]:[e],amount_icp_e8s:s});var Zs=require("@dfinity/utils"),Is=e=>{if(typeof e=="object"&&(0,Zs.nonNullish)(e)&&"message"in e){let s=e.message;return s.includes("has no update method")||s.includes("has no query method")}return!1};var zt=class e extends ee.Canister{constructor(){super(...arguments);this.state=t=>this.caller(t).get_state({});this.notifyPaymentFailure=async()=>{let{ticket:t}=await this.caller({certified:!0}).notify_payment_failure({});return(0,ee.fromNullable)(t)};this.notifyParticipation=async t=>await this.caller({certified:!0}).refresh_buyer_tokens(t);this.getUserCommitment=async t=>{let{buyer_state:o}=await this.caller({certified:t.certified}).get_buyer_state({principal_id:t.principal_id});return(0,ee.fromNullable)(o)};this.getDerivedState=async({certified:t})=>this.caller({certified:t}).get_derived_state({});this.getSaleParameters=async({certified:t})=>this.caller({certified:t}).get_sale_parameters({});this.getOpenTicket=async t=>{var r;let{result:o}=await this.caller({certified:t.certified}).get_open_ticket({}),n=(0,ee.fromDefinedNullable)(o);if("Ok"in n)return(0,ee.fromNullable)(n.Ok.ticket);let a=(0,ee.fromDefinedNullable)((r=n==null?void 0:n.Err)==null?void 0:r.error_type);throw new Jt(a)};this.newSaleTicket=async t=>{let o=Ks(t),{result:n}=await this.caller({certified:!0}).new_sale_ticket(o),a=(0,ee.fromDefinedNullable)(n);if("Ok"in a)return(0,ee.fromDefinedNullable)(a.Ok.ticket);let r=a.Err;throw new Qt({errorType:r.error_type,invalidUserAmount:(0,ee.fromNullable)(r.invalid_user_amount??[]),existingTicket:(0,ee.fromNullable)(r.existing_ticket??[])})};this.getLifecycle=async t=>this.caller(t).get_lifecycle({});this.getFinalizationStatus=async t=>{try{return await this.caller(t).get_auto_finalization_status({})}catch(o){throw Is(o)?new Wt("getFinalizationStatus"):o}}}static create(t){let{service:o,certifiedService:n,canisterId:a}=(0,ee.createServices)({options:t,idlFactory:Xs,certifiedIdlFactory:$s});return new e(a,o,n)}};var vo=async({agent:e,rootOptions:s,certified:t=!0})=>{let o=Et.create({...s,agent:e}),{ledger:n,swap:a,governance:r,index:i}=await o.listSnsCanisters({certified:t}),_=(0,ke.fromNullable)(r),N=(0,ke.fromNullable)(n),l=(0,ke.fromNullable)(a),c=(0,ke.fromNullable)(i);return(0,ke.assertNonNullish)(_),(0,ke.assertNonNullish)(N),(0,ke.assertNonNullish)(l),(0,ke.assertNonNullish)(c),new Ht({root:o,governance:Ut.create({canisterId:_,agent:e}),ledger:Dt.IcrcLedgerCanister.create({canisterId:N,agent:e}),swap:zt.create({canisterId:l,agent:e}),index:Dt.IcrcIndexCanister.create({canisterId:c,agent:e}),certified:t})};0&&(module.exports={GetOpenTicketErrorType,NewSaleTicketResponseErrorType,SnsGovernanceCanister,SnsGovernanceError,SnsGovernanceTestCanister,SnsNeuronPermissionType,SnsProposalDecisionStatus,SnsProposalRewardStatus,SnsRootCanister,SnsSwapCanister,SnsSwapGetOpenTicketError,SnsSwapLifecycle,SnsSwapNewTicketError,SnsVote,SnsWrapper,UnsupportedMethodError,fromCandidAction,initSnsWrapper,neuronSubaccount});
1
+ "use strict";var rs=Object.defineProperty;var Ls=Object.getOwnPropertyDescriptor;var eo=Object.getOwnPropertyNames;var to=Object.prototype.hasOwnProperty;var so=(e,s)=>{for(var t in s)rs(e,t,{get:s[t],enumerable:!0})},oo=(e,s,t,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let a of eo(s))!to.call(e,a)&&a!==t&&rs(e,a,{get:()=>s[a],enumerable:!(o=Ls(s,a))||o.enumerable});return e};var no=e=>oo(rs({},"__esModule",{value:!0}),e);var ho={};so(ho,{GetOpenTicketErrorType:()=>qs,NewSaleTicketResponseErrorType:()=>Gs,SnsGovernanceCanister:()=>Et,SnsGovernanceError:()=>b,SnsGovernanceTestCanister:()=>Xt,SnsNeuronPermissionType:()=>Fs,SnsProposalDecisionStatus:()=>ks,SnsProposalRewardStatus:()=>Cs,SnsRootCanister:()=>Bt,SnsSwapCanister:()=>jt,SnsSwapGetOpenTicketError:()=>Yt,SnsSwapLifecycle:()=>As,SnsSwapNewTicketError:()=>Jt,SnsVote:()=>Ms,SnsWrapper:()=>$t,UnsupportedMethodError:()=>Qt,fromCandidAction:()=>bs,initSnsWrapper:()=>So,neuronSubaccount:()=>us});module.exports=no(ho);var d=require("@dfinity/utils");var Ut=({neuronId:{id:e},command:s})=>({subaccount:e,command:[s]}),Wt=({neuronId:e,operation:s})=>Ut({neuronId:e,command:{Configure:{operation:[s]}}}),ls=({owner:e,subaccount:s})=>({owner:(0,d.toNullable)(e),subaccount:s===void 0?[]:(0,d.toNullable)({subaccount:s})}),ms=({neuronId:e,permissions:s,principal:t})=>Ut({neuronId:e,command:{AddNeuronPermissions:{permissions_to_add:[{permissions:Int32Array.from(s)}],principal_id:[t]}}}),Ns=({neuronId:e,permissions:s,principal:t})=>Ut({neuronId:e,command:{RemoveNeuronPermissions:{permissions_to_remove:[{permissions:Int32Array.from(s)}],principal_id:[t]}}}),Os=({neuronId:e,memo:s,amount:t})=>Ut({neuronId:e,command:{Split:{memo:s,amount_e8s:t}}}),Rs=({neuronId:e,amount:s,toAccount:t})=>Ut({neuronId:e,command:{Disburse:{to_account:t===void 0?[]:(0,d.toNullable)(ls(t)),amount:s===void 0?[]:[{e8s:s}]}}}),gs=e=>Wt({neuronId:e,operation:{StartDissolving:{}}}),ys=e=>Wt({neuronId:e,operation:{StopDissolving:{}}}),fs=({neuronId:e,percentageToStake:s})=>Ut({neuronId:e,command:{StakeMaturity:{percentage_to_stake:(0,d.toNullable)(s)}}}),vs=({neuronId:e,percentageToDisburse:s,toAccount:t})=>Ut({neuronId:e,command:{DisburseMaturity:{to_account:t===void 0?[]:(0,d.toNullable)(ls(t)),percentage_to_disburse:s}}}),Ss=({neuronId:e,autoStake:s})=>Wt({neuronId:e,operation:{ChangeAutoStakeMaturity:{requested_setting_for_auto_stake_maturity:s}}}),hs=({neuronId:e,dissolveTimestampSeconds:s})=>Wt({neuronId:e,operation:{SetDissolveTimestamp:{dissolve_timestamp_seconds:s}}}),ws=({neuronId:e,additionalDissolveDelaySeconds:s})=>Wt({neuronId:e,operation:{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:s}}}),Ts=({neuronId:e,functionId:s,followees:t})=>({subaccount:e.id,command:[{Follow:{function_id:s,followees:t}}]}),Vs=({neuronId:e,topicFollowing:s})=>({subaccount:e.id,command:[{SetFollowing:{topic_following:s.map(({topic:t,followees:o})=>({topic:[t],followees:o.map(({neuronId:a,alias:n})=>({neuron_id:(0,d.toNullable)(a),alias:(0,d.toNullable)(n)}))}))}}]}),Ps=({neuronId:e,proposalId:s,vote:t})=>({subaccount:e.id,command:[{RegisterVote:{vote:t,proposal:[s]}}]}),is=({subaccount:e,memo:s,controller:t})=>({subaccount:e,command:[{ClaimOrRefresh:{by:[s===void 0?{NeuronId:{}}:{MemoAndController:{memo:s,controller:(0,d.toNullable)(t)}}]}}]}),xs=({excludeType:e,beforeProposal:s,includeRewardStatus:t,includeStatus:o,limit:a,includeTopics:n})=>({exclude_type:BigUint64Array.from(e??[]),before_proposal:(0,d.toNullable)(s),include_reward_status:Int32Array.from(t??[]),include_status:Int32Array.from(o??[]),limit:a??10,include_topics:(0,d.toNullable)((n==null?void 0:n.map(r=>({topic:(0,d.toNullable)(r)})))??[])}),bs=e=>{if("ManageNervousSystemParameters"in e)return{ManageNervousSystemParameters:No(e.ManageNervousSystemParameters)};if("AddGenericNervousSystemFunction"in e)return{AddGenericNervousSystemFunction:lo(e.AddGenericNervousSystemFunction)};if("SetTopicsForCustomProposals"in e)return{SetTopicsForCustomProposals:e.SetTopicsForCustomProposals};if("RemoveGenericNervousSystemFunction"in e)return{RemoveGenericNervousSystemFunction:e.RemoveGenericNervousSystemFunction};if("UpgradeSnsToNextVersion"in e)return{UpgradeSnsToNextVersion:e.UpgradeSnsToNextVersion};if("RegisterDappCanisters"in e)return{RegisterDappCanisters:e.RegisterDappCanisters};if("TransferSnsTreasuryFunds"in e)return{TransferSnsTreasuryFunds:_o(e.TransferSnsTreasuryFunds)};if("UpgradeSnsControlledCanister"in e)return{UpgradeSnsControlledCanister:co(e.UpgradeSnsControlledCanister)};if("DeregisterDappCanisters"in e)return{DeregisterDappCanisters:e.DeregisterDappCanisters};if("Unspecified"in e)return{Unspecified:e.Unspecified};if("ManageSnsMetadata"in e)return{ManageSnsMetadata:ro(e.ManageSnsMetadata)};if("ExecuteGenericNervousSystemFunction"in e)return{ExecuteGenericNervousSystemFunction:e.ExecuteGenericNervousSystemFunction};if("Motion"in e)return{Motion:e.Motion};throw new Error(`Unknown action type ${JSON.stringify(e)}`)},ro=e=>({url:(0,d.fromNullable)(e.url),logo:(0,d.fromNullable)(e.logo),name:(0,d.fromNullable)(e.name),description:(0,d.fromNullable)(e.description)}),io=e=>{if(e!==void 0)return{wasm_module_hash:e.wasm_module_hash,store_canister_id:(0,d.fromNullable)(e.store_canister_id),chunk_hashes_list:e.chunk_hashes_list}},co=e=>({new_canister_wasm:e.new_canister_wasm,chunked_canister_wasm:io((0,d.fromNullable)(e.chunked_canister_wasm)),canister_id:(0,d.fromNullable)(e.canister_id),canister_upgrade_arg:(0,d.fromNullable)(e.canister_upgrade_arg),mode:(0,d.fromNullable)(e.mode)}),_o=e=>({from_treasury:e.from_treasury,to_principal:(0,d.fromNullable)(e.to_principal),to_subaccount:(0,d.fromNullable)(e.to_subaccount),memo:(0,d.fromNullable)(e.memo),amount_e8s:e.amount_e8s}),po=e=>({validator_canister_id:(0,d.fromNullable)(e.validator_canister_id),target_canister_id:(0,d.fromNullable)(e.target_canister_id),validator_method_name:(0,d.fromNullable)(e.validator_method_name),target_method_name:(0,d.fromNullable)(e.target_method_name),topic:(0,d.fromNullable)(e.topic)}),uo=e=>{if(e!==void 0){if("NativeNervousSystemFunction"in e)return{NativeNervousSystemFunction:e.NativeNervousSystemFunction};if("GenericNervousSystemFunction"in e)return{GenericNervousSystemFunction:po(e.GenericNervousSystemFunction)};throw new Error(`Unknown FunctionType ${JSON.stringify(e)}`)}},lo=e=>({id:e.id,name:e.name,description:(0,d.fromNullable)(e.description),function_type:uo((0,d.fromNullable)(e.function_type))}),mo=e=>e&&{final_reward_rate_basis_points:(0,d.fromNullable)(e.final_reward_rate_basis_points),initial_reward_rate_basis_points:(0,d.fromNullable)(e.initial_reward_rate_basis_points),reward_rate_transition_duration_seconds:(0,d.fromNullable)(e.reward_rate_transition_duration_seconds),round_duration_seconds:(0,d.fromNullable)(e.round_duration_seconds)},No=e=>({default_followees:(0,d.fromNullable)(e.default_followees),max_dissolve_delay_seconds:(0,d.fromNullable)(e.max_dissolve_delay_seconds),max_dissolve_delay_bonus_percentage:(0,d.fromNullable)(e.max_dissolve_delay_bonus_percentage),max_followees_per_function:(0,d.fromNullable)(e.max_followees_per_function),neuron_claimer_permissions:(0,d.fromNullable)(e.neuron_claimer_permissions),neuron_minimum_stake_e8s:(0,d.fromNullable)(e.neuron_minimum_stake_e8s),max_neuron_age_for_age_bonus:(0,d.fromNullable)(e.max_neuron_age_for_age_bonus),initial_voting_period_seconds:(0,d.fromNullable)(e.initial_voting_period_seconds),neuron_minimum_dissolve_delay_to_vote_seconds:(0,d.fromNullable)(e.neuron_minimum_dissolve_delay_to_vote_seconds),reject_cost_e8s:(0,d.fromNullable)(e.reject_cost_e8s),max_proposals_to_keep_per_action:(0,d.fromNullable)(e.max_proposals_to_keep_per_action),wait_for_quiet_deadline_increase_seconds:(0,d.fromNullable)(e.wait_for_quiet_deadline_increase_seconds),max_number_of_neurons:(0,d.fromNullable)(e.max_number_of_neurons),transaction_fee_e8s:(0,d.fromNullable)(e.transaction_fee_e8s),max_number_of_proposals_with_ballots:(0,d.fromNullable)(e.max_number_of_proposals_with_ballots),max_age_bonus_percentage:(0,d.fromNullable)(e.max_age_bonus_percentage),neuron_grantable_permissions:(0,d.fromNullable)(e.neuron_grantable_permissions),voting_rewards_parameters:mo((0,d.fromNullable)(e.voting_rewards_parameters)),max_number_of_principals_per_neuron:(0,d.fromNullable)(e.max_number_of_principals_per_neuron),automatically_advance_target_version:(0,d.fromNullable)(e.automatically_advance_target_version)});var Fs=(c=>(c[c.NEURON_PERMISSION_TYPE_UNSPECIFIED=0]="NEURON_PERMISSION_TYPE_UNSPECIFIED",c[c.NEURON_PERMISSION_TYPE_CONFIGURE_DISSOLVE_STATE=1]="NEURON_PERMISSION_TYPE_CONFIGURE_DISSOLVE_STATE",c[c.NEURON_PERMISSION_TYPE_MANAGE_PRINCIPALS=2]="NEURON_PERMISSION_TYPE_MANAGE_PRINCIPALS",c[c.NEURON_PERMISSION_TYPE_SUBMIT_PROPOSAL=3]="NEURON_PERMISSION_TYPE_SUBMIT_PROPOSAL",c[c.NEURON_PERMISSION_TYPE_VOTE=4]="NEURON_PERMISSION_TYPE_VOTE",c[c.NEURON_PERMISSION_TYPE_DISBURSE=5]="NEURON_PERMISSION_TYPE_DISBURSE",c[c.NEURON_PERMISSION_TYPE_SPLIT=6]="NEURON_PERMISSION_TYPE_SPLIT",c[c.NEURON_PERMISSION_TYPE_MERGE_MATURITY=7]="NEURON_PERMISSION_TYPE_MERGE_MATURITY",c[c.NEURON_PERMISSION_TYPE_DISBURSE_MATURITY=8]="NEURON_PERMISSION_TYPE_DISBURSE_MATURITY",c[c.NEURON_PERMISSION_TYPE_STAKE_MATURITY=9]="NEURON_PERMISSION_TYPE_STAKE_MATURITY",c[c.NEURON_PERMISSION_TYPE_MANAGE_VOTING_PERMISSION=10]="NEURON_PERMISSION_TYPE_MANAGE_VOTING_PERMISSION",c))(Fs||{}),Cs=(a=>(a[a.PROPOSAL_REWARD_STATUS_UNSPECIFIED=0]="PROPOSAL_REWARD_STATUS_UNSPECIFIED",a[a.PROPOSAL_REWARD_STATUS_ACCEPT_VOTES=1]="PROPOSAL_REWARD_STATUS_ACCEPT_VOTES",a[a.PROPOSAL_REWARD_STATUS_READY_TO_SETTLE=2]="PROPOSAL_REWARD_STATUS_READY_TO_SETTLE",a[a.PROPOSAL_REWARD_STATUS_SETTLED=3]="PROPOSAL_REWARD_STATUS_SETTLED",a))(Cs||{}),ks=(r=>(r[r.PROPOSAL_DECISION_STATUS_UNSPECIFIED=0]="PROPOSAL_DECISION_STATUS_UNSPECIFIED",r[r.PROPOSAL_DECISION_STATUS_OPEN=1]="PROPOSAL_DECISION_STATUS_OPEN",r[r.PROPOSAL_DECISION_STATUS_REJECTED=2]="PROPOSAL_DECISION_STATUS_REJECTED",r[r.PROPOSAL_DECISION_STATUS_ADOPTED=3]="PROPOSAL_DECISION_STATUS_ADOPTED",r[r.PROPOSAL_DECISION_STATUS_EXECUTED=4]="PROPOSAL_DECISION_STATUS_EXECUTED",r[r.PROPOSAL_DECISION_STATUS_FAILED=5]="PROPOSAL_DECISION_STATUS_FAILED",r))(ks||{}),Ms=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Yes=1]="Yes",o[o.No=2]="No",o))(Ms||{});var As=(r=>(r[r.Unspecified=0]="Unspecified",r[r.Pending=1]="Pending",r[r.Open=2]="Open",r[r.Committed=3]="Committed",r[r.Aborted=4]="Aborted",r[r.Adopted=5]="Adopted",r))(As||{}),qs=(o=>(o[o.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",o[o.TYPE_SALE_NOT_OPEN=1]="TYPE_SALE_NOT_OPEN",o[o.TYPE_SALE_CLOSED=2]="TYPE_SALE_CLOSED",o))(qs||{}),Gs=(i=>(i[i.TYPE_UNSPECIFIED=0]="TYPE_UNSPECIFIED",i[i.TYPE_SALE_NOT_OPEN=1]="TYPE_SALE_NOT_OPEN",i[i.TYPE_SALE_CLOSED=2]="TYPE_SALE_CLOSED",i[i.TYPE_TICKET_EXISTS=3]="TYPE_TICKET_EXISTS",i[i.TYPE_INVALID_USER_AMOUNT=4]="TYPE_INVALID_USER_AMOUNT",i[i.TYPE_INVALID_SUBACCOUNT=5]="TYPE_INVALID_SUBACCOUNT",i[i.TYPE_INVALID_PRINCIPAL=6]="TYPE_INVALID_PRINCIPAL",i))(Gs||{});var Qt=class extends Error{constructor(t){super();this.methodName=t}};var b=class extends Error{};var Jt=class extends Error{constructor({errorType:s,invalidUserAmount:t,existingTicket:o}){super(),this.errorType=s,this.invalidUserAmount=t,this.existingTicket=o}},Yt=class extends Error{constructor(t){super();this.errorType=t}};var F=require("@dfinity/utils");var Us=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),a=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),n=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(n),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),V=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),P=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(P)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,n))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(n),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(n),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Ve=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Pe=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Pe,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Ve,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),es=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(a),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(V),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({principals:e.Vec(e.Principal)}),Je=e.Record({nns_neuron_hotkeys:e.Opt(Qe),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ye=e.Variant({NeuronsFund:Je,Direct:e.Record({})}),He=e.Record({neuron_ids:e.Vec(p)}),$e=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ye),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(He),neuron_id:e.Opt(p)}),Xe=e.Record({neuron_recipes:e.Vec($e)}),Ke=e.Record({neuron_recipes:e.Opt(Xe)}),Ze=e.Record({id:e.Opt(p),status:e.Int32}),Ie=e.Record({swap_neurons:e.Vec(Ze)}),De=e.Variant({Ok:Ie,Err:e.Int32}),Le=e.Record({claim_swap_neurons_result:e.Opt(De)}),et=e.Record({maturity_modulation:e.Opt(l)}),tt=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),st=e.Record({mode:e.Opt(e.Int32)}),ot=e.Record({neuron_id:e.Opt(p)}),nt=e.Variant({Error:O,Neuron:A}),at=e.Record({result:e.Opt(nt)}),Me=e.Record({proposal_id:e.Opt(u)}),rt=e.Variant({Error:O,Proposal:x}),it=e.Record({result:e.Opt(rt)}),ct=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),Ae=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),_t=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),pt=e.Record({status:ct,memory_size:e.Nat,cycles:e.Nat,settings:Ae,query_stats:e.Opt(_t),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),dt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),ut=e.Record({sns_initialization_parameters:e.Text}),lt=e.Record({timers:e.Opt(s)}),mt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),Nt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),Ot=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),Rt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),gt=e.Record({neurons:e.Vec(A)}),yt=e.Record({topic:e.Opt(n)}),ft=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_topics:e.Opt(e.Vec(yt)),include_status:e.Vec(e.Int32)}),vt=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x),include_topic_filtering:e.Opt(e.Bool)}),St=e.Record({}),ht=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(n),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),wt=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(ht))}),Tt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Vt=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:Tt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Pt=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(Vt)}),xt=e.Record({created_neuron_id:e.Opt(p)}),bt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),Ft=e.Record({refreshed_neuron_id:e.Opt(p)}),Ct=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),kt=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),Mt=e.Record({transfer_block_height:e.Nat64}),At=e.Variant({Error:O,Split:xt,Follow:e.Record({}),DisburseMaturity:bt,ClaimOrRefresh:Ft,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Me,RemoveNeuronPermission:e.Record({}),StakeMaturity:Ct,MergeMaturity:kt,Disburse:Mt,AddNeuronPermission:e.Record({})}),qt=e.Record({command:e.Opt(At)}),Gt=e.Record({mode:e.Int32});return e.Service({claim_swap_neurons:e.Func([Ke],[Le],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],[]),get_latest_reward_event:e.Func([],[V],[]),get_maturity_modulation:e.Func([e.Record({})],[et],[]),get_metadata:e.Func([e.Record({})],[tt],[]),get_mode:e.Func([e.Record({})],[st],[]),get_nervous_system_parameters:e.Func([e.Null],[f],[]),get_neuron:e.Func([ot],[at],[]),get_proposal:e.Func([Me],[it],[]),get_root_canister_status:e.Func([e.Null],[pt],[]),get_running_sns_version:e.Func([e.Record({})],[dt],[]),get_sns_initialization_parameters:e.Func([e.Record({})],[ut],[]),get_timers:e.Func([e.Record({})],[lt],[]),get_upgrade_journal:e.Func([mt],[Nt],[]),list_nervous_system_functions:e.Func([],[Ot],[]),list_neurons:e.Func([Rt],[gt],[]),list_proposals:e.Func([ft],[vt],[]),list_topics:e.Func([St],[wt],[]),manage_neuron:e.Func([Pt],[qt],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([Gt],[e.Record({})],[])})};var Es=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),a=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),n=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(n),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),V=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),P=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(P)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,n))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(n),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(n),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Ve=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Pe=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Pe,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Ve,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),es=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(a),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(V),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({principals:e.Vec(e.Principal)}),Je=e.Record({nns_neuron_hotkeys:e.Opt(Qe),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ye=e.Variant({NeuronsFund:Je,Direct:e.Record({})}),He=e.Record({neuron_ids:e.Vec(p)}),$e=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ye),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(He),neuron_id:e.Opt(p)}),Xe=e.Record({neuron_recipes:e.Vec($e)}),Ke=e.Record({neuron_recipes:e.Opt(Xe)}),Ze=e.Record({id:e.Opt(p),status:e.Int32}),Ie=e.Record({swap_neurons:e.Vec(Ze)}),De=e.Variant({Ok:Ie,Err:e.Int32}),Le=e.Record({claim_swap_neurons_result:e.Opt(De)}),et=e.Record({maturity_modulation:e.Opt(l)}),tt=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),st=e.Record({mode:e.Opt(e.Int32)}),ot=e.Record({neuron_id:e.Opt(p)}),nt=e.Variant({Error:O,Neuron:A}),at=e.Record({result:e.Opt(nt)}),Me=e.Record({proposal_id:e.Opt(u)}),rt=e.Variant({Error:O,Proposal:x}),it=e.Record({result:e.Opt(rt)}),ct=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),Ae=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),_t=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),pt=e.Record({status:ct,memory_size:e.Nat,cycles:e.Nat,settings:Ae,query_stats:e.Opt(_t),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),dt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),ut=e.Record({sns_initialization_parameters:e.Text}),lt=e.Record({timers:e.Opt(s)}),mt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),Nt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),Ot=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),Rt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),gt=e.Record({neurons:e.Vec(A)}),yt=e.Record({topic:e.Opt(n)}),ft=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_topics:e.Opt(e.Vec(yt)),include_status:e.Vec(e.Int32)}),vt=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x),include_topic_filtering:e.Opt(e.Bool)}),St=e.Record({}),ht=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(n),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),wt=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(ht))}),Tt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Vt=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:Tt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Pt=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(Vt)}),xt=e.Record({created_neuron_id:e.Opt(p)}),bt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),Ft=e.Record({refreshed_neuron_id:e.Opt(p)}),Ct=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),kt=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),Mt=e.Record({transfer_block_height:e.Nat64}),At=e.Variant({Error:O,Split:xt,Follow:e.Record({}),DisburseMaturity:bt,ClaimOrRefresh:Ft,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Me,RemoveNeuronPermission:e.Record({}),StakeMaturity:Ct,MergeMaturity:kt,Disburse:Mt,AddNeuronPermission:e.Record({})}),qt=e.Record({command:e.Opt(At)}),Gt=e.Record({mode:e.Int32});return e.Service({claim_swap_neurons:e.Func([Ke],[Le],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_latest_reward_event:e.Func([],[V],["query"]),get_maturity_modulation:e.Func([e.Record({})],[et],[]),get_metadata:e.Func([e.Record({})],[tt],["query"]),get_mode:e.Func([e.Record({})],[st],["query"]),get_nervous_system_parameters:e.Func([e.Null],[f],["query"]),get_neuron:e.Func([ot],[at],["query"]),get_proposal:e.Func([Me],[it],["query"]),get_root_canister_status:e.Func([e.Null],[pt],[]),get_running_sns_version:e.Func([e.Record({})],[dt],["query"]),get_sns_initialization_parameters:e.Func([e.Record({})],[ut],["query"]),get_timers:e.Func([e.Record({})],[lt],["query"]),get_upgrade_journal:e.Func([mt],[Nt],["query"]),list_nervous_system_functions:e.Func([],[Ot],["query"]),list_neurons:e.Func([Rt],[gt],["query"]),list_proposals:e.Func([ft],[vt],["query"]),list_topics:e.Func([St],[wt],["query"]),manage_neuron:e.Func([Pt],[qt],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([Gt],[e.Record({})],[])})};var Et=class e extends F.Canister{constructor(){super(...arguments);this.listNeurons=async t=>{let{principal:o,limit:a,beforeNeuronId:n}=t,{neurons:r}=await this.caller(t).list_neurons({of_principal:(0,F.toNullable)(o),limit:a??100,start_page_at:(0,F.toNullable)(n)});return r};this.listProposals=async t=>{let{certified:o}=t;return await this.caller({certified:o}).list_proposals(xs(t))};this.listTopics=async t=>{let{certified:o}=t;return await this.caller({certified:o}).list_topics({})};this.getProposal=async t=>{let{proposalId:o}=t,{result:a}=await this.caller(t).get_proposal({proposal_id:(0,F.toNullable)(o)}),n=(0,F.fromNullable)(a);if(n===void 0||"Error"in n)throw new b((n==null?void 0:n.Error.error_message)??"Response type not supported");return n.Proposal};this.listNervousSystemFunctions=async t=>this.caller(t).list_nervous_system_functions();this.metadata=t=>this.caller(t).get_metadata({});this.nervousSystemParameters=t=>this.caller(t).get_nervous_system_parameters(null);this.getNeuron=async t=>{let{neuronId:o}=t,{result:a}=await this.caller(t).get_neuron({neuron_id:(0,F.toNullable)(o)}),n=(0,F.fromNullable)(a);if(n===void 0||"Error"in n)throw new b((n==null?void 0:n.Error.error_message)??"Response type not supported");return n.Neuron};this.queryNeuron=async t=>{try{return await this.getNeuron(t)}catch(o){if(o instanceof Error&&o.message.includes("No neuron for given NeuronId"))return;throw o}};this.manageNeuron=async t=>{let o=await this.caller({certified:!0}).manage_neuron(t);return this.assertManageNeuronError(o),o};this.addNeuronPermissions=async t=>{let o=ms(t);await this.manageNeuron(o)};this.removeNeuronPermissions=async t=>{let o=Ns(t);await this.manageNeuron(o)};this.splitNeuron=async t=>{let o=Os(t),{command:a}=await this.manageNeuron(o),n=(0,F.fromNullable)(a),r=i=>`Split neuron failed (${i})`;if(n===void 0)throw new b(r("no response"));if("Split"in n){let i=n.Split,_=(0,F.fromNullable)(i.created_neuron_id);if(_!==void 0)return _;throw new b(r("no id"))}throw new b(r("unknown"))};this.disburse=async t=>{let o=Rs(t);await this.manageNeuron(o)};this.startDissolving=async t=>{let o=gs(t);await this.manageNeuron(o)};this.stopDissolving=async t=>{let o=ys(t);await this.manageNeuron(o)};this.stakeMaturity=async({neuronId:t,percentageToStake:o})=>{(0,F.assertPercentageNumber)(o??100);let a=fs({neuronId:t,percentageToStake:o});await this.manageNeuron(a)};this.disburseMaturity=async t=>{(0,F.assertPercentageNumber)(t.percentageToDisburse);let o=vs(t);await this.manageNeuron(o)};this.autoStakeMaturity=async t=>{let o=Ss(t);await this.manageNeuron(o)};this.setDissolveTimestamp=async t=>{let o=hs(t);await this.manageNeuron(o)};this.increaseDissolveDelay=async t=>{let o=ws(t);await this.manageNeuron(o)};this.setTopicFollowees=async t=>{let o=Ts(t);await this.manageNeuron(o)};this.setFollowing=async t=>{let o=Vs(t);await this.manageNeuron(o)};this.registerVote=async t=>{let o=Ps(t);await this.manageNeuron(o)};this.refreshNeuron=async t=>{let o=is({subaccount:t.id});await this.manageNeuron(o)};this.claimNeuron=async({memo:t,controller:o,subaccount:a})=>{let n=is({subaccount:a,memo:t,controller:o}),{command:r}=await this.manageNeuron(n),i=(0,F.fromNullable)(r);if(i===void 0)throw new b("Claim neuron failed");if("ClaimOrRefresh"in i){let _=(0,F.fromNullable)(i.ClaimOrRefresh.refreshed_neuron_id);if(_===void 0)throw new b("Claim neuron failed");return _}throw new b("Claim neuron failed")};this.assertManageNeuronError=({command:t})=>{let o=t[0];if(o!==void 0&&"Error"in o)throw new b(o.Error.error_message)}}static create(t){let{service:o,certifiedService:a,canisterId:n}=(0,F.createServices)({options:t,idlFactory:Es,certifiedIdlFactory:Us});return new e(n,o,a)}};var Fe=require("@dfinity/utils");var Bs=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),a=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),n=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(n),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),V=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),P=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(P)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,n))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(n),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(n),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Ve=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Pe=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Pe,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Ve,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),es=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(a),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(V),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({id:e.Opt(p),amount_e8s:e.Opt(e.Nat64)}),Je=e.Record({new_maturity_e8s:e.Opt(e.Nat64)}),Ye=e.Record({target_version:e.Opt(t)}),He=e.Record({}),$e=e.Record({principals:e.Vec(e.Principal)}),Xe=e.Record({nns_neuron_hotkeys:e.Opt($e),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ke=e.Variant({NeuronsFund:Xe,Direct:e.Record({})}),Ze=e.Record({neuron_ids:e.Vec(p)}),Ie=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ke),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(Ze),neuron_id:e.Opt(p)}),De=e.Record({neuron_recipes:e.Vec(Ie)}),Le=e.Record({neuron_recipes:e.Opt(De)}),et=e.Record({id:e.Opt(p),status:e.Int32}),tt=e.Record({swap_neurons:e.Vec(et)}),st=e.Variant({Ok:tt,Err:e.Int32}),ot=e.Record({claim_swap_neurons_result:e.Opt(st)}),nt=e.Record({maturity_modulation:e.Opt(l)}),at=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),Me=e.Record({mode:e.Opt(e.Int32)}),rt=e.Record({neuron_id:e.Opt(p)}),it=e.Variant({Error:O,Neuron:A}),ct=e.Record({result:e.Opt(it)}),Ae=e.Record({proposal_id:e.Opt(u)}),_t=e.Variant({Error:O,Proposal:x}),pt=e.Record({result:e.Opt(_t)}),dt=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),ut=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),lt=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),mt=e.Record({status:dt,memory_size:e.Nat,cycles:e.Nat,settings:ut,query_stats:e.Opt(lt),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),Nt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),Ot=e.Record({sns_initialization_parameters:e.Text}),Rt=e.Record({timers:e.Opt(s)}),gt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),yt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),ft=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),vt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),St=e.Record({neurons:e.Vec(A)}),ht=e.Record({topic:e.Opt(n)}),wt=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_topics:e.Opt(e.Vec(ht)),include_status:e.Vec(e.Int32)}),Tt=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x),include_topic_filtering:e.Opt(e.Bool)}),Vt=e.Record({}),Pt=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(n),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),xt=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(Pt))}),bt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Ft=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:bt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Ct=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(Ft)}),kt=e.Record({created_neuron_id:e.Opt(p)}),Mt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),At=e.Record({refreshed_neuron_id:e.Opt(p)}),qt=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),Gt=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),ts=e.Record({transfer_block_height:e.Nat64}),ss=e.Variant({Error:O,Split:kt,Follow:e.Record({}),DisburseMaturity:Mt,ClaimOrRefresh:At,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Ae,RemoveNeuronPermission:e.Record({}),StakeMaturity:qt,MergeMaturity:Gt,Disburse:ts,AddNeuronPermission:e.Record({})}),os=e.Record({command:e.Opt(ss)}),ns=e.Record({recipient:e.Opt(R),amount_e8s:e.Opt(e.Nat64)}),as=e.Record({mode:e.Int32});return e.Service({add_maturity:e.Func([Qe],[Je],[]),advance_target_version:e.Func([Ye],[He],[]),claim_swap_neurons:e.Func([Le],[ot],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],[]),get_latest_reward_event:e.Func([],[V],[]),get_maturity_modulation:e.Func([e.Record({})],[nt],[]),get_metadata:e.Func([e.Record({})],[at],[]),get_mode:e.Func([e.Record({})],[Me],[]),get_nervous_system_parameters:e.Func([e.Null],[f],[]),get_neuron:e.Func([rt],[ct],[]),get_proposal:e.Func([Ae],[pt],[]),get_root_canister_status:e.Func([e.Null],[mt],[]),get_running_sns_version:e.Func([e.Record({})],[Nt],[]),get_sns_initialization_parameters:e.Func([e.Record({})],[Ot],[]),get_timers:e.Func([e.Record({})],[Rt],[]),get_upgrade_journal:e.Func([gt],[yt],[]),list_nervous_system_functions:e.Func([],[ft],[]),list_neurons:e.Func([vt],[St],[]),list_proposals:e.Func([wt],[Tt],[]),list_topics:e.Func([Vt],[xt],[]),manage_neuron:e.Func([Ct],[os],[]),mint_tokens:e.Func([ns],[e.Record({})],[]),refresh_cached_upgrade_steps:e.Func([e.Record({})],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([as],[e.Record({})],[]),update_neuron:e.Func([A],[e.Opt(O)],[])})};var zs=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({archive_wasm_hash:e.Vec(e.Nat8),root_wasm_hash:e.Vec(e.Nat8),swap_wasm_hash:e.Vec(e.Nat8),ledger_wasm_hash:e.Vec(e.Nat8),governance_wasm_hash:e.Vec(e.Nat8),index_wasm_hash:e.Vec(e.Nat8)}),o=e.Record({versions:e.Vec(t)}),a=e.Record({upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),requested_timestamp_seconds:e.Opt(e.Nat64)}),n=e.Variant({DappCanisterManagement:e.Null,DaoCommunitySettings:e.Null,ApplicationBusinessLogic:e.Null,CriticalDappOperations:e.Null,TreasuryAssetManagement:e.Null,Governance:e.Null,SnsFrameworkManagement:e.Null}),r=e.Record({topic:e.Opt(n),validator_canister_id:e.Opt(e.Principal),target_canister_id:e.Opt(e.Principal),validator_method_name:e.Opt(e.Text),target_method_name:e.Opt(e.Text)}),i=e.Variant({NativeNervousSystemFunction:e.Record({}),GenericNervousSystemFunction:r}),_=e.Record({id:e.Nat64,name:e.Text,description:e.Opt(e.Text),function_type:e.Opt(i)}),N=e.Record({not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),garbage_collectable_neurons_count:e.Nat64,neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,total_staked_e8s:e.Nat64,total_supply_governance_tokens:e.Nat64,not_dissolving_neurons_count:e.Nat64,dissolved_neurons_e8s:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64}),l=e.Record({current_basis_points:e.Opt(e.Int32),updated_at_timestamp_seconds:e.Opt(e.Nat64)}),c=e.Record({old_target_version:e.Opt(t),new_target_version:e.Opt(t),is_advanced_automatically:e.Opt(e.Bool)}),g=e.Record({human_readable:e.Opt(e.Text),upgrade_steps:e.Opt(o)}),v=e.Record({status:e.Opt(e.Variant({Success:e.Record({}),Timeout:e.Record({}),ExternalFailure:e.Record({}),InvalidState:e.Record({version:e.Opt(t)})})),human_readable:e.Opt(e.Text)}),u=e.Record({id:e.Nat64}),m=e.Record({current_version:e.Opt(t),expected_version:e.Opt(t),reason:e.Opt(e.Variant({UpgradeSnsToNextVersionProposal:u,BehindTargetVersion:e.Record({})}))}),q=e.Record({upgrade_steps:e.Opt(o)}),S=e.Record({human_readable:e.Opt(e.Text),old_target_version:e.Opt(t),new_target_version:e.Opt(t)}),G=e.Record({event:e.Opt(e.Variant({TargetVersionSet:c,UpgradeStepsReset:g,UpgradeOutcome:v,UpgradeStarted:m,UpgradeStepsRefreshed:q,TargetVersionReset:S})),timestamp_seconds:e.Opt(e.Nat64)}),w=e.Record({entries:e.Vec(G)}),p=e.Record({id:e.Vec(e.Nat8)}),T=e.Record({followees:e.Vec(p)}),C=e.Record({followees:e.Vec(e.Tuple(e.Nat64,T))}),y=e.Record({permissions:e.Vec(e.Int32)}),U=e.Record({final_reward_rate_basis_points:e.Opt(e.Nat64),initial_reward_rate_basis_points:e.Opt(e.Nat64),reward_rate_transition_duration_seconds:e.Opt(e.Nat64),round_duration_seconds:e.Opt(e.Nat64)}),f=e.Record({default_followees:e.Opt(C),max_dissolve_delay_seconds:e.Opt(e.Nat64),max_dissolve_delay_bonus_percentage:e.Opt(e.Nat64),max_followees_per_function:e.Opt(e.Nat64),automatically_advance_target_version:e.Opt(e.Bool),neuron_claimer_permissions:e.Opt(y),neuron_minimum_stake_e8s:e.Opt(e.Nat64),max_neuron_age_for_age_bonus:e.Opt(e.Nat64),initial_voting_period_seconds:e.Opt(e.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:e.Opt(e.Nat64),reject_cost_e8s:e.Opt(e.Nat64),max_proposals_to_keep_per_action:e.Opt(e.Nat32),wait_for_quiet_deadline_increase_seconds:e.Opt(e.Nat64),max_number_of_neurons:e.Opt(e.Nat64),transaction_fee_e8s:e.Opt(e.Nat64),max_number_of_proposals_with_ballots:e.Opt(e.Nat64),max_age_bonus_percentage:e.Opt(e.Nat64),neuron_grantable_permissions:e.Opt(y),voting_rewards_parameters:e.Opt(U),maturity_modulation_disabled:e.Opt(e.Bool),max_number_of_principals_per_neuron:e.Opt(e.Nat64)}),V=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),actual_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Opt(e.Nat64),total_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,round:e.Nat64,settled_proposals:e.Vec(u)}),ae=e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Opt(e.Nat64),target_version:e.Opt(t)}),O=e.Record({error_message:e.Text,error_type:e.Int32}),P=e.Record({subaccount:e.Vec(e.Nat8)}),R=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(P)}),k=e.Record({human_readable:e.Opt(e.Text)}),E=e.Record({e8s:e.Opt(e.Nat64)}),re=e.Record({xdrs_per_icp:e.Opt(k),icps_per_token:e.Opt(k),tokens:e.Opt(E)}),ie=e.Record({token:e.Opt(e.Int32),account:e.Opt(R),valuation_factors:e.Opt(re),timestamp_seconds:e.Opt(e.Nat64)}),B=e.Record({valuation:e.Opt(ie)}),z=e.Record({archive_wasm_hash:e.Opt(e.Vec(e.Nat8)),root_wasm_hash:e.Opt(e.Vec(e.Nat8)),swap_wasm_hash:e.Opt(e.Vec(e.Nat8)),ledger_wasm_hash:e.Opt(e.Vec(e.Nat8)),governance_wasm_hash:e.Opt(e.Vec(e.Nat8)),index_wasm_hash:e.Opt(e.Vec(e.Nat8))}),ce=e.Record({target_version:e.Opt(z)}),_e=e.Variant({TransferSnsTreasuryFunds:B,MintSnsTokens:B,AdvanceSnsTargetVersion:ce}),pe=e.Record({vote:e.Int32,cast_timestamp_seconds:e.Nat64,voting_power:e.Nat64}),j=e.Record({basis_points:e.Opt(e.Nat64)}),de=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),ue=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),te=e.Record({custom_function_id_to_topic:e.Vec(e.Tuple(e.Nat64,n))}),W=e.Record({canister_ids:e.Vec(e.Principal)}),le=e.Record({from_treasury:e.Int32,to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Nat64}),me=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Opt(e.Principal)}),Ne=e.Record({new_canister_wasm:e.Vec(e.Nat8),mode:e.Opt(e.Int32),canister_id:e.Opt(e.Principal),chunked_canister_wasm:e.Opt(me),canister_upgrade_arg:e.Opt(e.Vec(e.Nat8))}),se=e.Record({canister_ids:e.Vec(e.Principal),new_controllers:e.Vec(e.Principal)}),Oe=e.Record({to_principal:e.Opt(e.Principal),to_subaccount:e.Opt(P),memo:e.Opt(e.Nat64),amount_e8s:e.Opt(e.Nat64)}),Re=e.Record({new_target:e.Opt(z)}),Q=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),oe=e.Record({function_id:e.Nat64,payload:e.Vec(e.Nat8)}),ge=e.Record({token_symbol:e.Opt(e.Text),transfer_fee:e.Opt(e.Nat64),token_logo:e.Opt(e.Text),token_name:e.Opt(e.Text)}),ye=e.Record({motion_text:e.Text}),fe=e.Variant({ManageNervousSystemParameters:f,AddGenericNervousSystemFunction:_,ManageDappCanisterSettings:ue,RemoveGenericNervousSystemFunction:e.Nat64,SetTopicsForCustomProposals:te,UpgradeSnsToNextVersion:e.Record({}),RegisterDappCanisters:W,TransferSnsTreasuryFunds:le,UpgradeSnsControlledCanister:Ne,DeregisterDappCanisters:se,MintSnsTokens:Oe,AdvanceSnsTargetVersion:Re,Unspecified:e.Record({}),ManageSnsMetadata:Q,ExecuteGenericNervousSystemFunction:oe,ManageLedgerParameters:ge,Motion:ye}),h=e.Record({url:e.Text,title:e.Text,action:e.Opt(fe),summary:e.Text}),ne=e.Record({current_deadline_timestamp_seconds:e.Nat64}),x=e.Record({id:e.Opt(u),payload_text_rendering:e.Opt(e.Text),topic:e.Opt(n),action:e.Nat64,failure_reason:e.Opt(O),action_auxiliary:e.Opt(_e),ballots:e.Vec(e.Tuple(e.Text,pe)),minimum_yes_proportion_of_total:e.Opt(j),reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,reward_event_end_timestamp_seconds:e.Opt(e.Nat64),proposal_creation_timestamp_seconds:e.Nat64,initial_voting_period_seconds:e.Nat64,reject_cost_e8s:e.Nat64,latest_tally:e.Opt(de),wait_for_quiet_deadline_increase_seconds:e.Nat64,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(h),proposer:e.Opt(p),wait_for_quiet_state:e.Opt(ne),minimum_yes_proportion_of_exercised:e.Opt(j),is_eligible_for_rewards:e.Bool,executed_timestamp_seconds:e.Nat64}),M=e.Record({memo:e.Nat64,amount_e8s:e.Nat64}),J=e.Record({function_id:e.Nat64,followees:e.Vec(p)}),Y=e.Record({to_account:e.Opt(R),percentage_to_disburse:e.Nat32}),ve=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),Se=e.Record({additional_dissolve_delay_seconds:e.Nat32}),he=e.Record({dissolve_timestamp_seconds:e.Nat64}),we=e.Variant({ChangeAutoStakeMaturity:ve,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:Se,SetDissolveTimestamp:he}),H=e.Record({operation:e.Opt(we)}),$=e.Record({vote:e.Int32,proposal:e.Opt(u)}),Te=e.Record({alias:e.Opt(e.Text),neuron_id:e.Opt(p)}),X=e.Record({topic:e.Opt(n),followees:e.Vec(Te)}),K=e.Record({topic_following:e.Vec(X)}),Ve=e.Record({amount_to_be_disbursed_e8s:e.Nat64,to_account:e.Opt(R)}),Pe=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),xe=e.Variant({MemoAndController:Pe,NeuronId:e.Record({})}),Z=e.Record({by:e.Opt(xe)}),I=e.Record({permissions_to_remove:e.Opt(y),principal_id:e.Opt(e.Principal)}),D=e.Record({permissions_to_add:e.Opt(y),principal_id:e.Opt(e.Principal)}),L=e.Record({percentage_to_merge:e.Nat32}),Ue=e.Record({e8s:e.Nat64}),be=e.Record({to_account:e.Opt(R),amount:e.Opt(Ue)}),Ee=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,Configure:H,RegisterVote:$,SetFollowing:K,SyncCommand:e.Record({}),MakeProposal:h,FinalizeDisburseMaturity:Ve,ClaimOrRefreshNeuron:Z,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Be=e.Record({command:e.Opt(Ee),timestamp:e.Nat64}),ze=e.Record({principal:e.Opt(e.Principal),permission_type:e.Vec(e.Int32)}),je=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),We=e.Record({timestamp_of_disbursement_seconds:e.Nat64,amount_e8s:e.Nat64,account_to_disburse_to:e.Opt(R),finalize_disbursement_timestamp_seconds:e.Opt(e.Nat64)}),A=e.Record({id:e.Opt(p),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),permissions:e.Vec(ze),maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,topic_followees:e.Opt(e.Record({topic_id_to_followees:e.Vec(e.Tuple(e.Int32,X))})),source_nns_neuron_id:e.Opt(e.Nat64),auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,dissolve_state:e.Opt(je),voting_power_percentage_multiplier:e.Nat64,vesting_period_seconds:e.Opt(e.Nat64),disburse_maturity_in_progress:e.Vec(We),followees:e.Vec(e.Tuple(e.Nat64,T)),neuron_fees_e8s:e.Nat64}),es=e.Record({root_canister_id:e.Opt(e.Principal),timers:e.Opt(s),cached_upgrade_steps:e.Opt(a),id_to_nervous_system_functions:e.Vec(e.Tuple(e.Nat64,_)),metrics:e.Opt(N),maturity_modulation:e.Opt(l),upgrade_journal:e.Opt(w),mode:e.Int32,parameters:e.Opt(f),is_finalizing_disburse_maturity:e.Opt(e.Bool),deployed_version:e.Opt(t),sns_initialization_parameters:e.Text,latest_reward_event:e.Opt(V),pending_version:e.Opt(ae),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal),proposals:e.Vec(e.Tuple(e.Nat64,x)),in_flight_commands:e.Vec(e.Tuple(e.Text,Be)),sns_metadata:e.Opt(Q),neurons:e.Vec(e.Tuple(e.Text,A)),target_version:e.Opt(t),genesis_timestamp_seconds:e.Nat64}),Qe=e.Record({id:e.Opt(p),amount_e8s:e.Opt(e.Nat64)}),Je=e.Record({new_maturity_e8s:e.Opt(e.Nat64)}),Ye=e.Record({target_version:e.Opt(t)}),He=e.Record({}),$e=e.Record({principals:e.Vec(e.Principal)}),Xe=e.Record({nns_neuron_hotkeys:e.Opt($e),nns_neuron_controller:e.Opt(e.Principal),nns_neuron_id:e.Opt(e.Nat64)}),Ke=e.Variant({NeuronsFund:Xe,Direct:e.Record({})}),Ze=e.Record({neuron_ids:e.Vec(p)}),Ie=e.Record({controller:e.Opt(e.Principal),dissolve_delay_seconds:e.Opt(e.Nat64),participant:e.Opt(Ke),stake_e8s:e.Opt(e.Nat64),followees:e.Opt(Ze),neuron_id:e.Opt(p)}),De=e.Record({neuron_recipes:e.Vec(Ie)}),Le=e.Record({neuron_recipes:e.Opt(De)}),et=e.Record({id:e.Opt(p),status:e.Int32}),tt=e.Record({swap_neurons:e.Vec(et)}),st=e.Variant({Ok:tt,Err:e.Int32}),ot=e.Record({claim_swap_neurons_result:e.Opt(st)}),nt=e.Record({maturity_modulation:e.Opt(l)}),at=e.Record({url:e.Opt(e.Text),logo:e.Opt(e.Text),name:e.Opt(e.Text),description:e.Opt(e.Text)}),Me=e.Record({mode:e.Opt(e.Int32)}),rt=e.Record({neuron_id:e.Opt(p)}),it=e.Variant({Error:O,Neuron:A}),ct=e.Record({result:e.Opt(it)}),Ae=e.Record({proposal_id:e.Opt(u)}),_t=e.Variant({Error:O,Proposal:x}),pt=e.Record({result:e.Opt(_t)}),dt=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),ut=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),lt=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),mt=e.Record({status:dt,memory_size:e.Nat,cycles:e.Nat,settings:ut,query_stats:e.Opt(lt),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),Nt=e.Record({deployed_version:e.Opt(t),pending_version:e.Opt(e.Record({mark_failed_at_seconds:e.Nat64,checking_upgrade_lock:e.Nat64,proposal_id:e.Nat64,target_version:e.Opt(t)}))}),Ot=e.Record({sns_initialization_parameters:e.Text}),Rt=e.Record({timers:e.Opt(s)}),gt=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat64)}),yt=e.Record({upgrade_journal:e.Opt(w),upgrade_steps:e.Opt(o),response_timestamp_seconds:e.Opt(e.Nat64),deployed_version:e.Opt(t),target_version:e.Opt(t),upgrade_journal_entry_count:e.Opt(e.Nat64)}),ft=e.Record({reserved_ids:e.Vec(e.Nat64),functions:e.Vec(_)}),vt=e.Record({of_principal:e.Opt(e.Principal),limit:e.Nat32,start_page_at:e.Opt(p)}),St=e.Record({neurons:e.Vec(A)}),ht=e.Record({topic:e.Opt(n)}),wt=e.Record({include_reward_status:e.Vec(e.Int32),before_proposal:e.Opt(u),limit:e.Nat32,exclude_type:e.Vec(e.Nat64),include_topics:e.Opt(e.Vec(ht)),include_status:e.Vec(e.Int32)}),Tt=e.Record({include_ballots_by_caller:e.Opt(e.Bool),proposals:e.Vec(x),include_topic_filtering:e.Opt(e.Bool)}),Vt=e.Record({}),Pt=e.Record({native_functions:e.Opt(e.Vec(_)),topic:e.Opt(n),is_critical:e.Opt(e.Bool),name:e.Opt(e.Text),description:e.Opt(e.Text),custom_functions:e.Opt(e.Vec(_))}),xt=e.Record({uncategorized_functions:e.Opt(e.Vec(_)),topics:e.Opt(e.Vec(Pt))}),bt=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Ft=e.Variant({Split:M,Follow:J,DisburseMaturity:Y,ClaimOrRefresh:Z,Configure:H,RegisterVote:$,SetFollowing:K,MakeProposal:h,StakeMaturity:bt,RemoveNeuronPermissions:I,AddNeuronPermissions:D,MergeMaturity:L,Disburse:be}),Ct=e.Record({subaccount:e.Vec(e.Nat8),command:e.Opt(Ft)}),kt=e.Record({created_neuron_id:e.Opt(p)}),Mt=e.Record({amount_disbursed_e8s:e.Nat64,amount_deducted_e8s:e.Opt(e.Nat64)}),At=e.Record({refreshed_neuron_id:e.Opt(p)}),qt=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),Gt=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),ts=e.Record({transfer_block_height:e.Nat64}),ss=e.Variant({Error:O,Split:kt,Follow:e.Record({}),DisburseMaturity:Mt,ClaimOrRefresh:At,Configure:e.Record({}),RegisterVote:e.Record({}),SetFollowing:e.Record({}),MakeProposal:Ae,RemoveNeuronPermission:e.Record({}),StakeMaturity:qt,MergeMaturity:Gt,Disburse:ts,AddNeuronPermission:e.Record({})}),os=e.Record({command:e.Opt(ss)}),ns=e.Record({recipient:e.Opt(R),amount_e8s:e.Opt(e.Nat64)}),as=e.Record({mode:e.Int32});return e.Service({add_maturity:e.Func([Qe],[Je],[]),advance_target_version:e.Func([Ye],[He],[]),claim_swap_neurons:e.Func([Le],[ot],[]),fail_stuck_upgrade_in_progress:e.Func([e.Record({})],[e.Record({})],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_latest_reward_event:e.Func([],[V],["query"]),get_maturity_modulation:e.Func([e.Record({})],[nt],[]),get_metadata:e.Func([e.Record({})],[at],["query"]),get_mode:e.Func([e.Record({})],[Me],["query"]),get_nervous_system_parameters:e.Func([e.Null],[f],["query"]),get_neuron:e.Func([rt],[ct],["query"]),get_proposal:e.Func([Ae],[pt],["query"]),get_root_canister_status:e.Func([e.Null],[mt],[]),get_running_sns_version:e.Func([e.Record({})],[Nt],["query"]),get_sns_initialization_parameters:e.Func([e.Record({})],[Ot],["query"]),get_timers:e.Func([e.Record({})],[Rt],["query"]),get_upgrade_journal:e.Func([gt],[yt],["query"]),list_nervous_system_functions:e.Func([],[ft],["query"]),list_neurons:e.Func([vt],[St],["query"]),list_proposals:e.Func([wt],[Tt],["query"]),list_topics:e.Func([Vt],[xt],["query"]),manage_neuron:e.Func([Ct],[os],[]),mint_tokens:e.Func([ns],[e.Record({})],[]),refresh_cached_upgrade_steps:e.Func([e.Record({})],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_mode:e.Func([as],[e.Record({})],[]),update_neuron:e.Func([A],[e.Opt(O)],[])})};var Xt=class e extends Fe.Canister{constructor(){super(...arguments);this.addMaturity=async t=>{let{id:o,amountE8s:a}=t,{new_maturity_e8s:n}=await this.caller(t).add_maturity({id:(0,Fe.toNullable)(o),amount_e8s:(0,Fe.toNullable)(a)}),r=(0,Fe.fromNullable)(n);if((0,Fe.isNullish)(r)||r<a)throw new b("No maturity added")}}static create(t){let{service:o,certifiedService:a,canisterId:n}=(0,Fe.createServices)({options:t,idlFactory:zs,certifiedIdlFactory:Bs});return new e(n,o,a)}};var Kt=require("@dfinity/utils");var js=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({dapp_canister_ids:e.Vec(e.Principal),timers:e.Opt(s),testflight:e.Bool,archive_canister_ids:e.Vec(e.Principal),governance_canister_id:e.Opt(e.Principal),index_canister_id:e.Opt(e.Principal),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal)}),o=e.Record({canister_id:e.Principal}),a=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),n=e.Variant({controllers:e.Null,public:e.Null,allowed_viewers:e.Vec(e.Principal)}),r=e.Record({freezing_threshold:e.Opt(e.Nat),wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(n),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),i=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_=e.Record({status:a,memory_size:e.Nat,cycles:e.Nat,settings:r,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Opt(e.Nat),module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Opt(e.Nat)}),N=e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),l=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Principal}),c=e.Record({arg:e.Vec(e.Nat8),wasm_module:e.Vec(e.Nat8),stop_before_installing:e.Bool,mode:N,canister_id:e.Principal,chunked_canister_wasm:e.Opt(l),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),g=e.Record({update_canister_list:e.Opt(e.Bool)}),v=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:a,memory_size:e.Nat,cycles:e.Nat,settings:v,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),m=e.Record({status:e.Opt(u),canister_id:e.Opt(e.Principal)}),q=e.Record({root:e.Opt(m),swap:e.Opt(m),ledger:e.Opt(m),index:e.Opt(m),governance:e.Opt(m),dapps:e.Vec(m),archives:e.Vec(m)}),S=e.Record({timers:e.Opt(s)}),G=e.Record({root:e.Opt(e.Principal),swap:e.Opt(e.Principal),ledger:e.Opt(e.Principal),index:e.Opt(e.Principal),governance:e.Opt(e.Principal),dapps:e.Vec(e.Principal),archives:e.Vec(e.Principal)}),w=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),p=e.Record({failure_reason:e.Opt(e.Text)}),T=e.Record({canister_id:e.Opt(e.Principal)}),C=e.Record({canister_ids:e.Vec(e.Principal)}),y=e.Record({canister_ids:e.Opt(C),controller_principal_ids:e.Vec(e.Principal)}),U=e.Record({code:e.Opt(e.Int32),description:e.Text}),f=e.Record({err:e.Opt(U),dapp_canister_id:e.Opt(e.Principal)}),V=e.Record({failed_updates:e.Vec(f)});return e.Service({canister_status:e.Func([o],[_],[]),change_canister:e.Func([c],[],[]),get_build_metadata:e.Func([],[e.Text],[]),get_sns_canisters_summary:e.Func([g],[q],[]),get_timers:e.Func([e.Record({})],[S],[]),list_sns_canisters:e.Func([e.Record({})],[G],[]),manage_dapp_canister_settings:e.Func([w],[p],[]),register_dapp_canister:e.Func([T],[e.Record({})],[]),register_dapp_canisters:e.Func([C],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_dapp_controllers:e.Func([y],[V],[])})};var Ws=({IDL:e})=>{let s=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),t=e.Record({dapp_canister_ids:e.Vec(e.Principal),timers:e.Opt(s),testflight:e.Bool,archive_canister_ids:e.Vec(e.Principal),governance_canister_id:e.Opt(e.Principal),index_canister_id:e.Opt(e.Principal),swap_canister_id:e.Opt(e.Principal),ledger_canister_id:e.Opt(e.Principal)}),o=e.Record({canister_id:e.Principal}),a=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),n=e.Variant({controllers:e.Null,public:e.Null,allowed_viewers:e.Vec(e.Principal)}),r=e.Record({freezing_threshold:e.Opt(e.Nat),wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat),log_visibility:e.Opt(n),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),i=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_=e.Record({status:a,memory_size:e.Nat,cycles:e.Nat,settings:r,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Opt(e.Nat),module_hash:e.Opt(e.Vec(e.Nat8)),reserved_cycles:e.Opt(e.Nat)}),N=e.Variant({reinstall:e.Null,upgrade:e.Null,install:e.Null}),l=e.Record({wasm_module_hash:e.Vec(e.Nat8),chunk_hashes_list:e.Vec(e.Vec(e.Nat8)),store_canister_id:e.Principal}),c=e.Record({arg:e.Vec(e.Nat8),wasm_module:e.Vec(e.Nat8),stop_before_installing:e.Bool,mode:N,canister_id:e.Principal,chunked_canister_wasm:e.Opt(l),memory_allocation:e.Opt(e.Nat),compute_allocation:e.Opt(e.Nat)}),g=e.Record({update_canister_list:e.Opt(e.Bool)}),v=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),u=e.Record({status:a,memory_size:e.Nat,cycles:e.Nat,settings:v,query_stats:e.Opt(i),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),m=e.Record({status:e.Opt(u),canister_id:e.Opt(e.Principal)}),q=e.Record({root:e.Opt(m),swap:e.Opt(m),ledger:e.Opt(m),index:e.Opt(m),governance:e.Opt(m),dapps:e.Vec(m),archives:e.Vec(m)}),S=e.Record({timers:e.Opt(s)}),G=e.Record({root:e.Opt(e.Principal),swap:e.Opt(e.Principal),ledger:e.Opt(e.Principal),index:e.Opt(e.Principal),governance:e.Opt(e.Principal),dapps:e.Vec(e.Principal),archives:e.Vec(e.Principal)}),w=e.Record({freezing_threshold:e.Opt(e.Nat64),wasm_memory_threshold:e.Opt(e.Nat64),canister_ids:e.Vec(e.Principal),reserved_cycles_limit:e.Opt(e.Nat64),log_visibility:e.Opt(e.Int32),wasm_memory_limit:e.Opt(e.Nat64),memory_allocation:e.Opt(e.Nat64),compute_allocation:e.Opt(e.Nat64)}),p=e.Record({failure_reason:e.Opt(e.Text)}),T=e.Record({canister_id:e.Opt(e.Principal)}),C=e.Record({canister_ids:e.Vec(e.Principal)}),y=e.Record({canister_ids:e.Opt(C),controller_principal_ids:e.Vec(e.Principal)}),U=e.Record({code:e.Opt(e.Int32),description:e.Text}),f=e.Record({err:e.Opt(U),dapp_canister_id:e.Opt(e.Principal)}),V=e.Record({failed_updates:e.Vec(f)});return e.Service({canister_status:e.Func([o],[_],[]),change_canister:e.Func([c],[],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_sns_canisters_summary:e.Func([g],[q],[]),get_timers:e.Func([e.Record({})],[S],["query"]),list_sns_canisters:e.Func([e.Record({})],[G],["query"]),manage_dapp_canister_settings:e.Func([w],[p],[]),register_dapp_canister:e.Func([T],[e.Record({})],[]),register_dapp_canisters:e.Func([C],[e.Record({})],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[]),set_dapp_controllers:e.Func([y],[V],[])})};var Bt=class e extends Kt.Canister{constructor(){super(...arguments);this.listSnsCanisters=async({certified:t=!0})=>this.caller({certified:t}).list_sns_canisters({})}static create(t){let{service:o,certifiedService:a,canisterId:n}=(0,Kt.createServices)({options:t,idlFactory:Ws,certifiedIdlFactory:js});return new e(n,o,a)}};var Lt=require("@dfinity/ledger-icrc"),ke=require("@dfinity/utils");var Ht=require("@dfinity/utils");var zt=require("@dfinity/utils");function Ro(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function cs(e,...s){if(!Ro(e))throw new Error("Uint8Array expected");if(s.length>0&&!s.includes(e.length))throw new Error(`Uint8Array expected of length ${s}, not of length=${e.length}`)}function _s(e,s=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(s&&e.finished)throw new Error("Hash#digest() has already been called")}function Qs(e,s){cs(e);let t=s.outputLen;if(e.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var It=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ce=(e,s)=>e<<32-s|e>>>s;var en=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function go(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function ps(e){return typeof e=="string"&&(e=go(e)),cs(e),e}var Zt=class{clone(){return this._cloneInto()}},tn={}.toString;function Js(e){let s=o=>e().update(ps(o)).digest(),t=e();return s.outputLen=t.outputLen,s.blockLen=t.blockLen,s.create=()=>e(),s}function yo(e,s,t,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(s,t,o);let a=BigInt(32),n=BigInt(4294967295),r=Number(t>>a&n),i=Number(t&n),_=o?4:0,N=o?0:4;e.setUint32(s+_,r,o),e.setUint32(s+N,i,o)}var Ys=(e,s,t)=>e&s^~e&t,Hs=(e,s,t)=>e&s^e&t^s&t,Dt=class extends Zt{constructor(s,t,o,a){super(),this.blockLen=s,this.outputLen=t,this.padOffset=o,this.isLE=a,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(s),this.view=It(this.buffer)}update(s){_s(this);let{view:t,buffer:o,blockLen:a}=this;s=ps(s);let n=s.length;for(let r=0;r<n;){let i=Math.min(a-this.pos,n-r);if(i===a){let _=It(s);for(;a<=n-r;r+=a)this.process(_,r);continue}o.set(s.subarray(r,r+i),this.pos),this.pos+=i,r+=i,this.pos===a&&(this.process(t,0),this.pos=0)}return this.length+=s.length,this.roundClean(),this}digestInto(s){_s(this),Qs(s,this),this.finished=!0;let{buffer:t,view:o,blockLen:a,isLE:n}=this,{pos:r}=this;t[r++]=128,this.buffer.subarray(r).fill(0),this.padOffset>a-r&&(this.process(o,0),r=0);for(let c=r;c<a;c++)t[c]=0;yo(o,a-8,BigInt(this.length*8),n),this.process(o,0);let i=It(s),_=this.outputLen;if(_%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let N=_/4,l=this.get();if(N>l.length)throw new Error("_sha2: outputLen bigger than state");for(let c=0;c<N;c++)i.setUint32(4*c,l[c],n)}digest(){let{buffer:s,outputLen:t}=this;this.digestInto(s);let o=s.slice(0,t);return this.destroy(),o}_cloneInto(s){s||(s=new this.constructor),s.set(...this.get());let{blockLen:t,buffer:o,length:a,finished:n,destroyed:r,pos:i}=this;return s.length=a,s.pos=i,s.finished=n,s.destroyed=r,a%t&&s.buffer.set(o),s}};var fo=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),qe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ge=new Uint32Array(64),ds=class extends Dt{constructor(){super(64,32,8,!1),this.A=qe[0]|0,this.B=qe[1]|0,this.C=qe[2]|0,this.D=qe[3]|0,this.E=qe[4]|0,this.F=qe[5]|0,this.G=qe[6]|0,this.H=qe[7]|0}get(){let{A:s,B:t,C:o,D:a,E:n,F:r,G:i,H:_}=this;return[s,t,o,a,n,r,i,_]}set(s,t,o,a,n,r,i,_){this.A=s|0,this.B=t|0,this.C=o|0,this.D=a|0,this.E=n|0,this.F=r|0,this.G=i|0,this.H=_|0}process(s,t){for(let c=0;c<16;c++,t+=4)Ge[c]=s.getUint32(t,!1);for(let c=16;c<64;c++){let g=Ge[c-15],v=Ge[c-2],u=Ce(g,7)^Ce(g,18)^g>>>3,m=Ce(v,17)^Ce(v,19)^v>>>10;Ge[c]=m+Ge[c-7]+u+Ge[c-16]|0}let{A:o,B:a,C:n,D:r,E:i,F:_,G:N,H:l}=this;for(let c=0;c<64;c++){let g=Ce(i,6)^Ce(i,11)^Ce(i,25),v=l+g+Ys(i,_,N)+fo[c]+Ge[c]|0,m=(Ce(o,2)^Ce(o,13)^Ce(o,22))+Hs(o,a,n)|0;l=N,N=_,_=i,i=r+v|0,r=n,n=a,a=o,o=v+m|0}o=o+this.A|0,a=a+this.B|0,n=n+this.C|0,r=r+this.D|0,i=i+this.E|0,_=_+this.F|0,N=N+this.G|0,l=l+this.H|0,this.set(o,a,n,r,i,_,N,l)}roundClean(){Ge.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var $s=Js(()=>new ds);var us=({index:e,controller:s})=>{let o=[12,...(0,zt.asciiStringToByteArray)("neuron-stake"),...s.toUint8Array(),...(0,zt.numberToUint8Array)(e)],a=$s.create();return a.update((0,zt.arrayOfNumberToUint8Array)(o)),a.digest()};var $t=class{constructor({root:s,governance:t,ledger:o,swap:a,index:n,certified:r}){this.listNeurons=s=>this.governance.listNeurons(this.mergeParams(s));this.listProposals=s=>this.governance.listProposals(this.mergeParams(s));this.getProposal=s=>this.governance.getProposal(this.mergeParams(s));this.listNervousSystemFunctions=s=>this.governance.listNervousSystemFunctions(this.mergeParams(s));this.metadata=s=>Promise.all([this.governance.metadata(this.mergeParams(s)),this.ledger.metadata(this.mergeParams(s))]);this.nervousSystemParameters=s=>this.governance.nervousSystemParameters(this.mergeParams(s));this.ledgerMetadata=s=>this.ledger.metadata(this.mergeParams(s));this.transactionFee=s=>this.ledger.transactionFee(this.mergeParams(s));this.totalTokensSupply=s=>this.ledger.totalTokensSupply(this.mergeParams(s));this.balance=s=>this.ledger.balance(this.mergeParams(s));this.transfer=s=>this.ledger.transfer(s);this.getNeuron=s=>this.governance.getNeuron(this.mergeParams(s));this.queryNeuron=s=>this.governance.queryNeuron(this.mergeParams(s));this.nextNeuronAccount=async s=>{for(let t=0;t<65536;t++){let o=us({index:t,controller:s}),a={id:o},n=await this.governance.queryNeuron({neuronId:a,certified:!1});if(n===void 0&&(n=await this.governance.queryNeuron({neuronId:a,certified:!0}),n===void 0))return{account:{...this.owner,subaccount:o},index:BigInt(t)}}throw new b("No more neuron accounts available")};this.stakeNeuron=async({stakeE8s:s,source:t,controller:o,createdAt:a,fee:n})=>{this.assertCertified("stakeNeuron");let{account:r,index:i}=await this.nextNeuronAccount(o);if(r.subaccount===void 0)throw new b("There was an error creating the neuron subaccount");return await this.ledger.transfer({amount:s,to:{owner:r.owner,subaccount:(0,Ht.toNullable)(r.subaccount)},from_subaccount:t.subaccount,memo:(0,Ht.bigIntToUint8Array)(i),created_at_time:a,fee:n}),this.governance.claimNeuron({memo:BigInt(i),controller:o,subaccount:r.subaccount})};this.increaseStakeNeuron=async({stakeE8s:s,source:t,neuronId:o})=>(this.assertCertified("stakeNeuron"),await this.ledger.transfer({amount:s,to:{...this.owner,subaccount:(0,Ht.toNullable)(Uint8Array.from(o.id))},from_subaccount:t.subaccount}),this.governance.refreshNeuron(o));this.getNeuronBalance=async s=>{let t={...this.owner,subaccount:Uint8Array.from(s.id)};return this.ledger.balance({...t,certified:this.certified})};this.addNeuronPermissions=s=>this.governance.addNeuronPermissions(s);this.refreshNeuron=s=>this.governance.refreshNeuron(s);this.claimNeuron=s=>this.governance.claimNeuron(s);this.removeNeuronPermissions=s=>this.governance.removeNeuronPermissions(s);this.splitNeuron=s=>this.governance.splitNeuron(s);this.disburse=s=>this.governance.disburse(s);this.startDissolving=s=>this.governance.startDissolving(s);this.stopDissolving=s=>this.governance.stopDissolving(s);this.setDissolveTimestamp=s=>this.governance.setDissolveTimestamp(s);this.increaseDissolveDelay=s=>this.governance.increaseDissolveDelay(s);this.setTopicFollowees=s=>this.governance.setTopicFollowees(s);this.setFollowing=s=>this.governance.setFollowing(s);this.registerVote=async s=>this.governance.registerVote(s);this.swapState=s=>this.swap.state(this.mergeParams(s));this.notifyPaymentFailure=()=>this.swap.notifyPaymentFailure();this.notifyParticipation=s=>this.swap.notifyParticipation(s);this.getUserCommitment=s=>this.swap.getUserCommitment(this.mergeParams(s));this.getOpenTicket=s=>this.swap.getOpenTicket(this.mergeParams(s));this.newSaleTicket=s=>this.swap.newSaleTicket(s);this.getLifecycle=s=>this.swap.getLifecycle(this.mergeParams(s));this.getFinalizationStatus=s=>this.swap.getFinalizationStatus(this.mergeParams(s));this.getSaleParameters=s=>this.swap.getSaleParameters(this.mergeParams(s));this.getDerivedState=s=>this.swap.getDerivedState(this.mergeParams(s));this.getTransactions=s=>this.index.getTransactions(s);this.stakeMaturity=s=>this.governance.stakeMaturity(s);this.disburseMaturity=s=>this.governance.disburseMaturity(s);this.autoStakeMaturity=s=>this.governance.autoStakeMaturity(s);this.assertCertified=s=>{if(!this.certified)throw new b(`Call to ${s} needs to be certified`)};this.root=s,this.governance=t,this.ledger=o,this.swap=a,this.index=n,this.certified=r}get canisterIds(){return{rootCanisterId:this.root.canisterId,ledgerCanisterId:this.ledger.canisterId,governanceCanisterId:this.governance.canisterId,swapCanisterId:this.swap.canisterId,indexCanisterId:this.index.canisterId}}mergeParams(s){return{...s,certified:this.certified}}get owner(){return{owner:this.canisterIds.governanceCanisterId}}};var ee=require("@dfinity/utils");var Xs=({IDL:e})=>{let s=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),t=e.Record({slope_numerator:e.Opt(e.Nat64),intercept_icp_e8s:e.Opt(e.Nat64),from_direct_participation_icp_e8s:e.Opt(e.Nat64),slope_denominator:e.Opt(e.Nat64),to_direct_participation_icp_e8s:e.Opt(e.Nat64)}),o=e.Record({serialized_representation:e.Opt(e.Text)}),a=e.Record({coefficient_intervals:e.Vec(t),max_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),min_direct_participation_threshold_icp_e8s:e.Opt(e.Nat64),ideal_matched_participation_function:e.Opt(o)}),n=e.Record({iso_codes:e.Vec(e.Text)}),r=e.Record({nns_proposal_id:e.Opt(e.Nat64),sns_root_canister_id:e.Text,neurons_fund_participation:e.Opt(e.Bool),min_participant_icp_e8s:e.Opt(e.Nat64),neuron_basket_construction_parameters:e.Opt(s),fallback_controller_principal_ids:e.Vec(e.Text),max_icp_e8s:e.Opt(e.Nat64),neuron_minimum_stake_e8s:e.Opt(e.Nat64),confirmation_text:e.Opt(e.Text),swap_start_timestamp_seconds:e.Opt(e.Nat64),swap_due_timestamp_seconds:e.Opt(e.Nat64),min_participants:e.Opt(e.Nat32),sns_token_e8s:e.Opt(e.Nat64),nns_governance_canister_id:e.Text,transaction_fee_e8s:e.Opt(e.Nat64),icp_ledger_canister_id:e.Text,sns_ledger_canister_id:e.Text,neurons_fund_participation_constraints:e.Opt(a),should_auto_finalize:e.Opt(e.Bool),max_participant_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Text,min_direct_participation_icp_e8s:e.Opt(e.Nat64),restricted_countries:e.Opt(n),min_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),i=e.Record({source_principal_id:e.Opt(e.Principal)}),_=e.Record({block_height:e.Opt(e.Nat64)}),N=e.Record({description:e.Opt(e.Text),error_type:e.Opt(e.Int32)}),l=e.Variant({Ok:_,Err:N}),c=e.Record({result:e.Opt(l)}),g=e.Record({code:e.Opt(e.Int32),description:e.Text}),v=e.Record({err:e.Opt(g),dapp_canister_id:e.Opt(e.Principal)}),u=e.Record({failed_updates:e.Vec(v)}),m=e.Variant({Ok:u,Err:g}),q=e.Record({possibility:e.Opt(m)}),S=e.Record({failure:e.Nat32,skipped:e.Nat32,invalid:e.Nat32,success:e.Nat32,global_failures:e.Nat32}),G=e.Record({error_message:e.Text,error_type:e.Int32}),w=e.Record({governance_error:e.Opt(G)}),p=e.Variant({Ok:w,Err:g}),T=e.Record({possibility:e.Opt(p)}),C=e.Record({neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_neurons_count:e.Opt(e.Nat64)}),y=e.Record({message:e.Opt(e.Text)}),U=e.Variant({Ok:C,Err:y}),f=e.Record({possibility:e.Opt(U)}),V=e.Variant({Ok:e.Record({}),Err:g}),ae=e.Record({possibility:e.Opt(V)}),O=e.Record({set_dapp_controllers_call_result:e.Opt(q),create_sns_neuron_recipes_result:e.Opt(S),settle_community_fund_participation_result:e.Opt(T),error_message:e.Opt(e.Text),settle_neurons_fund_participation_result:e.Opt(f),set_mode_call_result:e.Opt(ae),sweep_icp_result:e.Opt(S),claim_neuron_result:e.Opt(S),sweep_sns_result:e.Opt(S)}),P=e.Record({auto_finalize_swap_response:e.Opt(O),has_auto_finalize_been_attempted:e.Opt(e.Bool),is_auto_finalize_enabled:e.Opt(e.Bool)}),R=e.Record({principal_id:e.Opt(e.Principal)}),k=e.Record({transfer_fee_paid_e8s:e.Opt(e.Nat64),transfer_start_timestamp_seconds:e.Nat64,amount_e8s:e.Nat64,amount_transferred_e8s:e.Opt(e.Nat64),transfer_success_timestamp_seconds:e.Nat64}),E=e.Record({icp:e.Opt(k),has_created_neuron_recipes:e.Opt(e.Bool)}),re=e.Record({buyer_state:e.Opt(E)}),ie=e.Record({buyers_total:e.Nat64}),B=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),z=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),ce=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_e=e.Record({status:B,memory_size:e.Nat,cycles:e.Nat,settings:z,query_stats:e.Opt(ce),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),pe=e.Record({sns_tokens_per_icp:e.Opt(e.Float64),buyer_total_icp_e8s:e.Opt(e.Nat64),cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),j=e.Record({init:e.Opt(r)}),de=e.Record({decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),lifecycle:e.Opt(e.Int32),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64)}),ue=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(e.Vec(e.Nat8))}),te=e.Record({creation_time:e.Nat64,ticket_id:e.Nat64,account:e.Opt(ue),amount_icp_e8s:e.Nat64}),W=e.Record({ticket:e.Opt(te)}),le=e.Record({error_type:e.Opt(e.Int32)}),me=e.Variant({Ok:W,Err:le}),Ne=e.Record({result:e.Opt(me)}),se=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(s),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Oe=e.Record({params:e.Opt(se)}),Re=e.Record({id:e.Vec(e.Nat8)}),Q=e.Record({dissolve_delay_seconds:e.Nat64,memo:e.Nat64,followees:e.Vec(Re)}),oe=e.Record({principals:e.Vec(e.Principal)}),ge=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64}),ye=e.Record({buyer_principal:e.Text}),fe=e.Variant({CommunityFund:ge,Direct:ye}),h=e.Record({sns:e.Opt(k),claimed_status:e.Opt(e.Int32),neuron_attributes:e.Opt(Q),investor:e.Opt(fe)}),ne=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),x=e.Record({has_created_neuron_recipes:e.Opt(e.Bool),hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64,amount_icp_e8s:e.Nat64}),M=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,cf_neurons:e.Vec(x)}),J=e.Record({auto_finalize_swap_response:e.Opt(O),neuron_recipes:e.Vec(h),next_ticket_id:e.Opt(e.Nat64),decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),finalize_swap_in_progress:e.Opt(e.Bool),timers:e.Opt(ne),cf_participants:e.Vec(M),init:e.Opt(r),already_tried_to_auto_finalize:e.Opt(e.Bool),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),purge_old_tickets_last_completion_timestamp_nanoseconds:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),lifecycle:e.Int32,purge_old_tickets_next_principal:e.Opt(e.Vec(e.Nat8)),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64),buyers:e.Vec(e.Tuple(e.Text,E)),params:e.Opt(se),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),Y=e.Record({sns_tokens_per_icp:e.Float32,buyer_total_icp_e8s:e.Nat64,cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),ve=e.Record({swap:e.Opt(J),derived:e.Opt(Y)}),Se=e.Record({timers:e.Opt(ne)}),he=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),we=e.Record({cf_participants:e.Vec(M)}),H=e.Record({offset:e.Opt(e.Nat32),limit:e.Opt(e.Nat32)}),$=e.Record({participation:e.Opt(E),participant_id:e.Opt(e.Principal)}),Te=e.Record({participants:e.Vec($)}),X=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),K=e.Record({sns_neuron_recipes:e.Vec(h)}),Ve=e.Record({subaccount:e.Opt(e.Vec(e.Nat8)),amount_icp_e8s:e.Nat64}),Pe=e.Record({min_amount_icp_e8s_included:e.Nat64,max_amount_icp_e8s_included:e.Nat64}),xe=e.Record({invalid_user_amount:e.Opt(Pe),existing_ticket:e.Opt(te),error_type:e.Int32}),Z=e.Variant({Ok:W,Err:xe}),I=e.Record({result:e.Opt(Z)}),D=e.Record({confirmation_text:e.Opt(e.Text),buyer:e.Text}),L=e.Record({icp_accepted_participation_e8s:e.Nat64,icp_ledger_account_balance_e8s:e.Nat64});return e.Service({error_refund_icp:e.Func([i],[c],[]),finalize_swap:e.Func([e.Record({})],[O],[]),get_auto_finalization_status:e.Func([e.Record({})],[P],[]),get_buyer_state:e.Func([R],[re],[]),get_buyers_total:e.Func([e.Record({})],[ie],[]),get_canister_status:e.Func([e.Record({})],[_e],[]),get_derived_state:e.Func([e.Record({})],[pe],[]),get_init:e.Func([e.Record({})],[j],[]),get_lifecycle:e.Func([e.Record({})],[de],[]),get_open_ticket:e.Func([e.Record({})],[Ne],[]),get_sale_parameters:e.Func([e.Record({})],[Oe],[]),get_state:e.Func([e.Record({})],[ve],[]),get_timers:e.Func([e.Record({})],[Se],[]),list_community_fund_participants:e.Func([he],[we],[]),list_direct_participants:e.Func([H],[Te],[]),list_sns_neuron_recipes:e.Func([X],[K],[]),new_sale_ticket:e.Func([Ve],[I],[]),notify_payment_failure:e.Func([e.Record({})],[W],[]),refresh_buyer_tokens:e.Func([D],[L],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[])})};var Ks=({IDL:e})=>{let s=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),t=e.Record({slope_numerator:e.Opt(e.Nat64),intercept_icp_e8s:e.Opt(e.Nat64),from_direct_participation_icp_e8s:e.Opt(e.Nat64),slope_denominator:e.Opt(e.Nat64),to_direct_participation_icp_e8s:e.Opt(e.Nat64)}),o=e.Record({serialized_representation:e.Opt(e.Text)}),a=e.Record({coefficient_intervals:e.Vec(t),max_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),min_direct_participation_threshold_icp_e8s:e.Opt(e.Nat64),ideal_matched_participation_function:e.Opt(o)}),n=e.Record({iso_codes:e.Vec(e.Text)}),r=e.Record({nns_proposal_id:e.Opt(e.Nat64),sns_root_canister_id:e.Text,neurons_fund_participation:e.Opt(e.Bool),min_participant_icp_e8s:e.Opt(e.Nat64),neuron_basket_construction_parameters:e.Opt(s),fallback_controller_principal_ids:e.Vec(e.Text),max_icp_e8s:e.Opt(e.Nat64),neuron_minimum_stake_e8s:e.Opt(e.Nat64),confirmation_text:e.Opt(e.Text),swap_start_timestamp_seconds:e.Opt(e.Nat64),swap_due_timestamp_seconds:e.Opt(e.Nat64),min_participants:e.Opt(e.Nat32),sns_token_e8s:e.Opt(e.Nat64),nns_governance_canister_id:e.Text,transaction_fee_e8s:e.Opt(e.Nat64),icp_ledger_canister_id:e.Text,sns_ledger_canister_id:e.Text,neurons_fund_participation_constraints:e.Opt(a),should_auto_finalize:e.Opt(e.Bool),max_participant_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Text,min_direct_participation_icp_e8s:e.Opt(e.Nat64),restricted_countries:e.Opt(n),min_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),i=e.Record({source_principal_id:e.Opt(e.Principal)}),_=e.Record({block_height:e.Opt(e.Nat64)}),N=e.Record({description:e.Opt(e.Text),error_type:e.Opt(e.Int32)}),l=e.Variant({Ok:_,Err:N}),c=e.Record({result:e.Opt(l)}),g=e.Record({code:e.Opt(e.Int32),description:e.Text}),v=e.Record({err:e.Opt(g),dapp_canister_id:e.Opt(e.Principal)}),u=e.Record({failed_updates:e.Vec(v)}),m=e.Variant({Ok:u,Err:g}),q=e.Record({possibility:e.Opt(m)}),S=e.Record({failure:e.Nat32,skipped:e.Nat32,invalid:e.Nat32,success:e.Nat32,global_failures:e.Nat32}),G=e.Record({error_message:e.Text,error_type:e.Int32}),w=e.Record({governance_error:e.Opt(G)}),p=e.Variant({Ok:w,Err:g}),T=e.Record({possibility:e.Opt(p)}),C=e.Record({neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_neurons_count:e.Opt(e.Nat64)}),y=e.Record({message:e.Opt(e.Text)}),U=e.Variant({Ok:C,Err:y}),f=e.Record({possibility:e.Opt(U)}),V=e.Variant({Ok:e.Record({}),Err:g}),ae=e.Record({possibility:e.Opt(V)}),O=e.Record({set_dapp_controllers_call_result:e.Opt(q),create_sns_neuron_recipes_result:e.Opt(S),settle_community_fund_participation_result:e.Opt(T),error_message:e.Opt(e.Text),settle_neurons_fund_participation_result:e.Opt(f),set_mode_call_result:e.Opt(ae),sweep_icp_result:e.Opt(S),claim_neuron_result:e.Opt(S),sweep_sns_result:e.Opt(S)}),P=e.Record({auto_finalize_swap_response:e.Opt(O),has_auto_finalize_been_attempted:e.Opt(e.Bool),is_auto_finalize_enabled:e.Opt(e.Bool)}),R=e.Record({principal_id:e.Opt(e.Principal)}),k=e.Record({transfer_fee_paid_e8s:e.Opt(e.Nat64),transfer_start_timestamp_seconds:e.Nat64,amount_e8s:e.Nat64,amount_transferred_e8s:e.Opt(e.Nat64),transfer_success_timestamp_seconds:e.Nat64}),E=e.Record({icp:e.Opt(k),has_created_neuron_recipes:e.Opt(e.Bool)}),re=e.Record({buyer_state:e.Opt(E)}),ie=e.Record({buyers_total:e.Nat64}),B=e.Variant({stopped:e.Null,stopping:e.Null,running:e.Null}),z=e.Record({freezing_threshold:e.Nat,wasm_memory_threshold:e.Opt(e.Nat),controllers:e.Vec(e.Principal),wasm_memory_limit:e.Opt(e.Nat),memory_allocation:e.Nat,compute_allocation:e.Nat}),ce=e.Record({response_payload_bytes_total:e.Opt(e.Nat),num_instructions_total:e.Opt(e.Nat),num_calls_total:e.Opt(e.Nat),request_payload_bytes_total:e.Opt(e.Nat)}),_e=e.Record({status:B,memory_size:e.Nat,cycles:e.Nat,settings:z,query_stats:e.Opt(ce),idle_cycles_burned_per_day:e.Nat,module_hash:e.Opt(e.Vec(e.Nat8))}),pe=e.Record({sns_tokens_per_icp:e.Opt(e.Float64),buyer_total_icp_e8s:e.Opt(e.Nat64),cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),j=e.Record({init:e.Opt(r)}),de=e.Record({decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),lifecycle:e.Opt(e.Int32),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64)}),ue=e.Record({owner:e.Opt(e.Principal),subaccount:e.Opt(e.Vec(e.Nat8))}),te=e.Record({creation_time:e.Nat64,ticket_id:e.Nat64,account:e.Opt(ue),amount_icp_e8s:e.Nat64}),W=e.Record({ticket:e.Opt(te)}),le=e.Record({error_type:e.Opt(e.Int32)}),me=e.Variant({Ok:W,Err:le}),Ne=e.Record({result:e.Opt(me)}),se=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(s),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Oe=e.Record({params:e.Opt(se)}),Re=e.Record({id:e.Vec(e.Nat8)}),Q=e.Record({dissolve_delay_seconds:e.Nat64,memo:e.Nat64,followees:e.Vec(Re)}),oe=e.Record({principals:e.Vec(e.Principal)}),ge=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64}),ye=e.Record({buyer_principal:e.Text}),fe=e.Variant({CommunityFund:ge,Direct:ye}),h=e.Record({sns:e.Opt(k),claimed_status:e.Opt(e.Int32),neuron_attributes:e.Opt(Q),investor:e.Opt(fe)}),ne=e.Record({last_spawned_timestamp_seconds:e.Opt(e.Nat64),last_reset_timestamp_seconds:e.Opt(e.Nat64),requires_periodic_tasks:e.Opt(e.Bool)}),x=e.Record({has_created_neuron_recipes:e.Opt(e.Bool),hotkeys:e.Opt(oe),nns_neuron_id:e.Nat64,amount_icp_e8s:e.Nat64}),M=e.Record({controller:e.Opt(e.Principal),hotkey_principal:e.Text,cf_neurons:e.Vec(x)}),J=e.Record({auto_finalize_swap_response:e.Opt(O),neuron_recipes:e.Vec(h),next_ticket_id:e.Opt(e.Nat64),decentralization_sale_open_timestamp_seconds:e.Opt(e.Nat64),finalize_swap_in_progress:e.Opt(e.Bool),timers:e.Opt(ne),cf_participants:e.Vec(M),init:e.Opt(r),already_tried_to_auto_finalize:e.Opt(e.Bool),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),purge_old_tickets_last_completion_timestamp_nanoseconds:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),lifecycle:e.Int32,purge_old_tickets_next_principal:e.Opt(e.Vec(e.Nat8)),decentralization_swap_termination_timestamp_seconds:e.Opt(e.Nat64),buyers:e.Vec(e.Tuple(e.Text,E)),params:e.Opt(se),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),Y=e.Record({sns_tokens_per_icp:e.Float32,buyer_total_icp_e8s:e.Nat64,cf_participant_count:e.Opt(e.Nat64),neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),direct_participant_count:e.Opt(e.Nat64),cf_neuron_count:e.Opt(e.Nat64)}),ve=e.Record({swap:e.Opt(J),derived:e.Opt(Y)}),Se=e.Record({timers:e.Opt(ne)}),he=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),we=e.Record({cf_participants:e.Vec(M)}),H=e.Record({offset:e.Opt(e.Nat32),limit:e.Opt(e.Nat32)}),$=e.Record({participation:e.Opt(E),participant_id:e.Opt(e.Principal)}),Te=e.Record({participants:e.Vec($)}),X=e.Record({offset:e.Opt(e.Nat64),limit:e.Opt(e.Nat32)}),K=e.Record({sns_neuron_recipes:e.Vec(h)}),Ve=e.Record({subaccount:e.Opt(e.Vec(e.Nat8)),amount_icp_e8s:e.Nat64}),Pe=e.Record({min_amount_icp_e8s_included:e.Nat64,max_amount_icp_e8s_included:e.Nat64}),xe=e.Record({invalid_user_amount:e.Opt(Pe),existing_ticket:e.Opt(te),error_type:e.Int32}),Z=e.Variant({Ok:W,Err:xe}),I=e.Record({result:e.Opt(Z)}),D=e.Record({confirmation_text:e.Opt(e.Text),buyer:e.Text}),L=e.Record({icp_accepted_participation_e8s:e.Nat64,icp_ledger_account_balance_e8s:e.Nat64});return e.Service({error_refund_icp:e.Func([i],[c],[]),finalize_swap:e.Func([e.Record({})],[O],[]),get_auto_finalization_status:e.Func([e.Record({})],[P],["query"]),get_buyer_state:e.Func([R],[re],["query"]),get_buyers_total:e.Func([e.Record({})],[ie],[]),get_canister_status:e.Func([e.Record({})],[_e],[]),get_derived_state:e.Func([e.Record({})],[pe],["query"]),get_init:e.Func([e.Record({})],[j],["query"]),get_lifecycle:e.Func([e.Record({})],[de],["query"]),get_open_ticket:e.Func([e.Record({})],[Ne],["query"]),get_sale_parameters:e.Func([e.Record({})],[Oe],["query"]),get_state:e.Func([e.Record({})],[ve],["query"]),get_timers:e.Func([e.Record({})],[Se],["query"]),list_community_fund_participants:e.Func([he],[we],["query"]),list_direct_participants:e.Func([H],[Te],["query"]),list_sns_neuron_recipes:e.Func([X],[K],["query"]),new_sale_ticket:e.Func([Ve],[I],[]),notify_payment_failure:e.Func([e.Record({})],[W],[]),refresh_buyer_tokens:e.Func([D],[L],[]),reset_timers:e.Func([e.Record({})],[e.Record({})],[])})};var Zs=({subaccount:e,amount_icp_e8s:s})=>({subaccount:e===void 0?[]:[e],amount_icp_e8s:s});var Is=require("@dfinity/utils"),Ds=e=>{if(typeof e=="object"&&(0,Is.nonNullish)(e)&&"message"in e){let s=e.message;return s.includes("has no update method")||s.includes("has no query method")}return!1};var jt=class e extends ee.Canister{constructor(){super(...arguments);this.state=t=>this.caller(t).get_state({});this.notifyPaymentFailure=async()=>{let{ticket:t}=await this.caller({certified:!0}).notify_payment_failure({});return(0,ee.fromNullable)(t)};this.notifyParticipation=async t=>await this.caller({certified:!0}).refresh_buyer_tokens(t);this.getUserCommitment=async t=>{let{buyer_state:o}=await this.caller({certified:t.certified}).get_buyer_state({principal_id:t.principal_id});return(0,ee.fromNullable)(o)};this.getDerivedState=async({certified:t})=>this.caller({certified:t}).get_derived_state({});this.getSaleParameters=async({certified:t})=>this.caller({certified:t}).get_sale_parameters({});this.getOpenTicket=async t=>{var r;let{result:o}=await this.caller({certified:t.certified}).get_open_ticket({}),a=(0,ee.fromDefinedNullable)(o);if("Ok"in a)return(0,ee.fromNullable)(a.Ok.ticket);let n=(0,ee.fromDefinedNullable)((r=a==null?void 0:a.Err)==null?void 0:r.error_type);throw new Yt(n)};this.newSaleTicket=async t=>{let o=Zs(t),{result:a}=await this.caller({certified:!0}).new_sale_ticket(o),n=(0,ee.fromDefinedNullable)(a);if("Ok"in n)return(0,ee.fromDefinedNullable)(n.Ok.ticket);let r=n.Err;throw new Jt({errorType:r.error_type,invalidUserAmount:(0,ee.fromNullable)(r.invalid_user_amount??[]),existingTicket:(0,ee.fromNullable)(r.existing_ticket??[])})};this.getLifecycle=async t=>this.caller(t).get_lifecycle({});this.getFinalizationStatus=async t=>{try{return await this.caller(t).get_auto_finalization_status({})}catch(o){throw Ds(o)?new Qt("getFinalizationStatus"):o}}}static create(t){let{service:o,certifiedService:a,canisterId:n}=(0,ee.createServices)({options:t,idlFactory:Ks,certifiedIdlFactory:Xs});return new e(n,o,a)}};var So=async({agent:e,rootOptions:s,certified:t=!0})=>{let o=Bt.create({...s,agent:e}),{ledger:a,swap:n,governance:r,index:i}=await o.listSnsCanisters({certified:t}),_=(0,ke.fromNullable)(r),N=(0,ke.fromNullable)(a),l=(0,ke.fromNullable)(n),c=(0,ke.fromNullable)(i);return(0,ke.assertNonNullish)(_),(0,ke.assertNonNullish)(N),(0,ke.assertNonNullish)(l),(0,ke.assertNonNullish)(c),new $t({root:o,governance:Et.create({canisterId:_,agent:e}),ledger:Lt.IcrcLedgerCanister.create({canisterId:N,agent:e}),swap:jt.create({canisterId:l,agent:e}),index:Lt.IcrcIndexCanister.create({canisterId:c,agent:e}),certified:t})};0&&(module.exports={GetOpenTicketErrorType,NewSaleTicketResponseErrorType,SnsGovernanceCanister,SnsGovernanceError,SnsGovernanceTestCanister,SnsNeuronPermissionType,SnsProposalDecisionStatus,SnsProposalRewardStatus,SnsRootCanister,SnsSwapCanister,SnsSwapGetOpenTicketError,SnsSwapLifecycle,SnsSwapNewTicketError,SnsVote,SnsWrapper,UnsupportedMethodError,fromCandidAction,initSnsWrapper,neuronSubaccount});
2
2
  /*! Bundled license information:
3
3
 
4
4
  @noble/hashes/esm/utils.js: