@dfinity/nns 0.4.0-nightly-2022-04-22 → 0.4.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.
@@ -850,7 +850,7 @@ ${o(i)}
850
850
  account-id`),n=ua.sha224.create();n.update([...r,...t.toUint8Array(),...o??Array(32).fill(0)]);let i=new Uint8Array(n.array()),s=ii(i),p=new Uint8Array([...s,...i]);return ni(p)},ni=t=>t.reduce((o,r)=>o+r.toString(16).padStart(2,"0"),""),ii=t=>{let o=new ArrayBuffer(4);return new DataView(o).setUint32(0,Aa.crc32(rr.Buffer.from(t)),!1),rr.Buffer.from(o)};var Yt=class{constructor(o){this.bytes=o}static fromHex(o){return new Yt(Uint8Array.from(Buffer.from(o,"hex")))}static fromPrincipal({principal:o,subAccount:r=$t.ZERO}){let n=nr(`
851
851
  account-id`),i=Ea.sha224.create();i.update([...n,...o.toUint8Array(),...r.toUint8Array()]);let s=new Uint8Array(i.array()),p=ii(s),u=new Uint8Array([...p,...s]);return new Yt(u)}toProto(){let o=new ba.AccountIdentifier;return o.setHash(this.bytes),o}toHex(){return ni(this.bytes)}},ir=class{constructor(o){this.bytes=o}static fromBytes(o){return o.length!=32?Error("Subaccount length must be 32-bytes"):new ir(o)}static fromPrincipal(o){let r=new Uint8Array(32).fill(0),n=o.toUint8Array();r[0]=n.length;for(let i=0;i<n.length;i++)r[1+i]=n[i];return new ir(r)}toUint8Array(){return this.bytes}},$t=ir;$t.ZERO=new ir(new Uint8Array(32).fill(0));var sr=class extends Error{},ar=class extends sr{},gr=class extends sr{constructor(r){super();this.minimumAmount=r}},Co=class extends Error{},mt=class extends Error{constructor(r){super();this.detail=r}},De=class extends Error{constructor(o){super("Unsupported value: "+o)}};var _a=rt(or());var E0=BigInt(1095062083),b0=BigInt(1347768404),ya=BigInt(1e4),Gr=BigInt(1e8);var si=(r=>(r[r.FRACTIONAL_MORE_THAN_8_DECIMALS=0]="FRACTIONAL_MORE_THAN_8_DECIMALS",r[r.INVALID_FORMAT=1]="INVALID_FORMAT",r))(si||{});var at=class{constructor(o){this.e8s=o}static fromE8s(o){return new at(o)}static fromString(o){o=o.trim().replace(/[,']/g,"");let r=o.match(/\d*(\.\d*)?/);if(!r||r[0]!==o)return 1;let[n,i]=o.split("."),s=BigInt(0);if(n)try{s+=BigInt(n)*Gr}catch{return 1}if(i){if(i.length>8)return 0;try{s+=BigInt(i.padEnd(8,"0"))}catch{return 1}}return new at(s)}toE8s(){return this.e8s}toProto(){let o=new _a.ICPTs;return o.setE8s(this.e8s.toString()),o}};var eo=class extends Error{},Pr=class extends eo{},kr=class extends eo{constructor(r){super();this.balance=r}},Ur=class extends eo{constructor(r){super();this.allowed_window_secs=r}},jr=class extends eo{},Dr=class extends eo{constructor(r){super();this.duplicateOf=r}},ai=t=>{let{message:o}=t;if(o.includes("Reject code: 5")){if(o.match(/Sending from (.*) is not allowed/))return new Pr;{let r=o.match(/transaction.*duplicate.* in block (\d+)/);if(r&&r.length>1)return new Dr(BigInt(r[1]))}{let r=o.match(/debit account.*, current balance: (\d*(\.\d*)?)/);if(r&&r.length>1){let n=at.fromString(r[1]);if(n instanceof at)return new kr(n)}}if(o.includes("is in future"))return new jr;{let r=o.match(/older than (\d+)/);if(r&&r.length>1)return new Ur(Number.parseInt(r[1]))}}throw t};var Ms=rt(kn()),wA=rt(mo()),SA=rt(vp());var Qp=({IDL:t})=>{let o=t.Rec(),r=t.Record({id:t.Nat64}),n=t.Record({followees:t.Vec(r)}),i=t.Record({not_dissolving_neurons_e8s_buckets:t.Vec(t.Tuple(t.Nat64,t.Float64)),garbage_collectable_neurons_count:t.Nat64,neurons_with_invalid_stake_count:t.Nat64,not_dissolving_neurons_count_buckets:t.Vec(t.Tuple(t.Nat64,t.Nat64)),total_supply_icp:t.Nat64,neurons_with_less_than_6_months_dissolve_delay_count:t.Nat64,dissolved_neurons_count:t.Nat64,total_staked_e8s:t.Nat64,not_dissolving_neurons_count:t.Nat64,dissolved_neurons_e8s:t.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:t.Nat64,dissolving_neurons_count_buckets:t.Vec(t.Tuple(t.Nat64,t.Nat64)),dissolving_neurons_count:t.Nat64,dissolving_neurons_e8s_buckets:t.Vec(t.Tuple(t.Nat64,t.Float64)),community_fund_total_staked_e8s:t.Nat64,timestamp_seconds:t.Nat64}),s=t.Record({hash:t.Vec(t.Nat8)}),p=t.Record({id:t.Opt(t.Principal),reward_account:t.Opt(s)}),u=t.Record({neuron_minimum_stake_e8s:t.Nat64,max_proposals_to_keep_per_topic:t.Nat32,neuron_management_fee_per_proposal_e8s:t.Nat64,reject_cost_e8s:t.Nat64,transaction_fee_e8s:t.Nat64,neuron_spawn_dissolve_delay_seconds:t.Nat64,minimum_icp_xdr_rate:t.Nat64,maximum_node_provider_rewards_e8s:t.Nat64}),h=t.Record({day_after_genesis:t.Nat64,actual_timestamp_seconds:t.Nat64,distributed_e8s_equivalent:t.Nat64,settled_proposals:t.Vec(r)}),w=t.Record({to_subaccount:t.Vec(t.Nat8),neuron_stake_e8s:t.Nat64,from:t.Opt(t.Principal),memo:t.Nat64,from_subaccount:t.Vec(t.Nat8),transfer_timestamp:t.Nat64,block_height:t.Nat64}),O=t.Record({error_message:t.Text,error_type:t.Int32}),T=t.Record({vote:t.Int32,voting_power:t.Nat64}),V=t.Record({no:t.Nat64,yes:t.Nat64,total:t.Nat64,timestamp_seconds:t.Nat64}),P=t.Record({name:t.Text,description:t.Opt(t.Text)}),Z=t.Record({id:t.Opt(r),known_neuron_data:t.Opt(P)}),ee=t.Record({new_controller:t.Opt(t.Principal),nonce:t.Opt(t.Nat64)}),ce=t.Record({amount_e8s:t.Nat64}),te=t.Record({topic:t.Int32,followees:t.Vec(r)}),xe=t.Record({controller:t.Opt(t.Principal),memo:t.Nat64}),Ie=t.Variant({NeuronIdOrSubaccount:t.Record({}),MemoAndController:xe,Memo:t.Nat64}),we=t.Record({by:t.Opt(Ie)}),X=t.Record({hot_key_to_remove:t.Opt(t.Principal)}),L=t.Record({new_hot_key:t.Opt(t.Principal)}),pe=t.Record({additional_dissolve_delay_seconds:t.Nat32}),he=t.Record({dissolve_timestamp_seconds:t.Nat64}),H=t.Variant({RemoveHotKey:X,AddHotKey:L,StopDissolving:t.Record({}),StartDissolving:t.Record({}),IncreaseDissolveDelay:pe,JoinCommunityFund:t.Record({}),SetDissolveTimestamp:he}),Be=t.Record({operation:t.Opt(H)}),le=t.Record({vote:t.Int32,proposal:t.Opt(r)}),de=t.Record({source_neuron_id:t.Opt(r)}),Re=t.Record({dissolve_delay_seconds:t.Nat64,kyc_verified:t.Bool,amount_e8s:t.Nat64,new_controller:t.Opt(t.Principal),nonce:t.Nat64}),Ge=t.Record({percentage_to_merge:t.Nat32}),et=t.Record({e8s:t.Nat64}),je=t.Record({to_account:t.Opt(s),amount:t.Opt(et)}),st=t.Variant({Spawn:ee,Split:ce,Follow:te,ClaimOrRefresh:we,Configure:Be,RegisterVote:le,Merge:de,DisburseToNeuron:Re,MakeProposal:o,MergeMaturity:Ge,Disburse:je}),ve=t.Variant({Subaccount:t.Vec(t.Nat8),NeuronId:r}),tt=t.Record({id:t.Opt(r),command:t.Opt(st),neuron_id_or_subaccount:t.Opt(ve)}),Ht=t.Record({nns_function:t.Int32,payload:t.Vec(t.Nat8)}),ht=t.Record({dissolve_delay_seconds:t.Nat64}),qt=t.Record({to_account:t.Opt(s)}),U=t.Variant({RewardToNeuron:ht,RewardToAccount:qt}),I=t.Record({node_provider:t.Opt(p),reward_mode:t.Opt(U),amount_e8s:t.Nat64}),Qt=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n))}),ct=t.Record({rewards:t.Vec(I)}),Ve=t.Record({principals:t.Vec(t.Principal)}),$=t.Variant({ToRemove:p,ToAdd:p}),l=t.Record({change:t.Opt($)}),B=t.Record({motion_text:t.Text}),E=t.Variant({RegisterKnownNeuron:Z,ManageNeuron:tt,ExecuteNnsFunction:Ht,RewardNodeProvider:I,SetDefaultFollowees:Qt,RewardNodeProviders:ct,ManageNetworkEconomics:u,ApproveGenesisKyc:Ve,AddOrRemoveNodeProvider:l,Motion:B});o.fill(t.Record({url:t.Text,title:t.Opt(t.Text),action:t.Opt(E),summary:t.Text}));let v=t.Record({current_deadline_timestamp_seconds:t.Nat64}),C=t.Record({id:t.Opt(r),failure_reason:t.Opt(O),ballots:t.Vec(t.Tuple(t.Nat64,T)),proposal_timestamp_seconds:t.Nat64,reward_event_round:t.Nat64,failed_timestamp_seconds:t.Nat64,reject_cost_e8s:t.Nat64,latest_tally:t.Opt(V),decided_timestamp_seconds:t.Nat64,proposal:t.Opt(o),proposer:t.Opt(r),wait_for_quiet_state:t.Opt(v),executed_timestamp_seconds:t.Nat64}),S=t.Variant({Spawn:ee,Split:ce,Configure:Be,Merge:de,DisburseToNeuron:Re,ClaimOrRefreshNeuron:we,MergeMaturity:Ge,Disburse:je}),F=t.Record({command:t.Opt(S),timestamp:t.Nat64}),y=t.Record({vote:t.Int32,proposal_id:t.Opt(r)}),x=t.Variant({DissolveDelaySeconds:t.Nat64,WhenDissolvedTimestampSeconds:t.Nat64}),Q=t.Record({id:t.Opt(r),controller:t.Opt(t.Principal),recent_ballots:t.Vec(y),kyc_verified:t.Bool,not_for_profit:t.Bool,maturity_e8s_equivalent:t.Nat64,cached_neuron_stake_e8s:t.Nat64,created_timestamp_seconds:t.Nat64,aging_since_timestamp_seconds:t.Nat64,hot_keys:t.Vec(t.Principal),account:t.Vec(t.Nat8),joined_community_fund_timestamp_seconds:t.Opt(t.Nat64),dissolve_state:t.Opt(x),followees:t.Vec(t.Tuple(t.Int32,n)),neuron_fees_e8s:t.Nat64,transfer:t.Opt(w),known_neuron_data:t.Opt(P)}),R=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n)),wait_for_quiet_threshold_seconds:t.Nat64,metrics:t.Opt(i),node_providers:t.Vec(p),economics:t.Opt(u),latest_reward_event:t.Opt(h),to_claim_transfers:t.Vec(w),short_voting_period_seconds:t.Nat64,proposals:t.Vec(t.Tuple(t.Nat64,C)),in_flight_commands:t.Vec(t.Tuple(t.Nat64,F)),neurons:t.Vec(t.Tuple(t.Nat64,Q)),genesis_timestamp_seconds:t.Nat64}),G=t.Variant({Ok:t.Null,Err:O}),D=t.Variant({Error:O,NeuronId:r}),J=t.Record({result:t.Opt(D)}),re=t.Variant({Ok:Q,Err:O}),Ee=t.Variant({Ok:ct,Err:O}),me=t.Record({dissolve_delay_seconds:t.Nat64,recent_ballots:t.Vec(y),created_timestamp_seconds:t.Nat64,state:t.Int32,stake_e8s:t.Nat64,joined_community_fund_timestamp_seconds:t.Opt(t.Nat64),retrieved_at_timestamp_seconds:t.Nat64,known_neuron_data:t.Opt(P),voting_power:t.Nat64,age_seconds:t.Nat64}),oe=t.Variant({Ok:me,Err:O}),Y=t.Record({id:t.Opt(r),status:t.Int32,topic:t.Int32,failure_reason:t.Opt(O),ballots:t.Vec(t.Tuple(t.Nat64,T)),proposal_timestamp_seconds:t.Nat64,reward_event_round:t.Nat64,deadline_timestamp_seconds:t.Opt(t.Nat64),failed_timestamp_seconds:t.Nat64,reject_cost_e8s:t.Nat64,latest_tally:t.Opt(V),reward_status:t.Int32,decided_timestamp_seconds:t.Nat64,proposal:t.Opt(o),proposer:t.Opt(r),executed_timestamp_seconds:t.Nat64}),Fe=t.Record({known_neurons:t.Vec(Z)}),Ft=t.Record({neuron_ids:t.Vec(t.Nat64),include_neurons_readable_by_caller:t.Bool}),Wt=t.Record({neuron_infos:t.Vec(t.Tuple(t.Nat64,me)),full_neurons:t.Vec(Q)}),Vt=t.Record({include_reward_status:t.Vec(t.Int32),before_proposal:t.Opt(r),limit:t.Nat32,exclude_topic:t.Vec(t.Int32),include_status:t.Vec(t.Int32)}),ot=t.Record({proposal_info:t.Vec(Y)}),ne=t.Record({created_neuron_id:t.Opt(r)}),Ye=t.Record({refreshed_neuron_id:t.Opt(r)}),Pe=t.Record({proposal_id:t.Opt(r)}),be=t.Record({merged_maturity_e8s:t.Nat64,new_stake_e8s:t.Nat64}),Zo=t.Record({transfer_block_height:t.Nat64}),Xo=t.Variant({Error:O,Spawn:ne,Split:ne,Follow:t.Record({}),ClaimOrRefresh:Ye,Configure:t.Record({}),RegisterVote:t.Record({}),Merge:t.Record({}),DisburseToNeuron:ne,MakeProposal:Pe,MergeMaturity:be,Disburse:Zo}),ye=t.Record({command:t.Opt(Xo)}),$o=t.Record({reward_account:t.Opt(s)});return t.Service({claim_gtc_neurons:t.Func([t.Principal,t.Vec(r)],[G],[]),claim_or_refresh_neuron_from_account:t.Func([xe],[J],[]),get_build_metadata:t.Func([],[t.Text],[]),get_full_neuron:t.Func([t.Nat64],[re],[]),get_full_neuron_by_id_or_subaccount:t.Func([ve],[re],[]),get_monthly_node_provider_rewards:t.Func([],[Ee],[]),get_neuron_ids:t.Func([],[t.Vec(t.Nat64)],[]),get_neuron_info:t.Func([t.Nat64],[oe],[]),get_neuron_info_by_id_or_subaccount:t.Func([ve],[oe],[]),get_pending_proposals:t.Func([],[t.Vec(Y)],[]),get_proposal_info:t.Func([t.Nat64],[t.Opt(Y)],[]),list_known_neurons:t.Func([],[Fe],[]),list_neurons:t.Func([Ft],[Wt],[]),list_proposals:t.Func([Vt],[ot],[]),manage_neuron:t.Func([tt],[ye],[]),transfer_gtc_neuron:t.Func([r,r],[G],[]),update_node_provider:t.Func([$o],[G],[])})};var Fp=({IDL:t})=>{let o=t.Rec(),r=t.Record({id:t.Nat64}),n=t.Record({followees:t.Vec(r)}),i=t.Record({not_dissolving_neurons_e8s_buckets:t.Vec(t.Tuple(t.Nat64,t.Float64)),garbage_collectable_neurons_count:t.Nat64,neurons_with_invalid_stake_count:t.Nat64,not_dissolving_neurons_count_buckets:t.Vec(t.Tuple(t.Nat64,t.Nat64)),total_supply_icp:t.Nat64,neurons_with_less_than_6_months_dissolve_delay_count:t.Nat64,dissolved_neurons_count:t.Nat64,total_staked_e8s:t.Nat64,not_dissolving_neurons_count:t.Nat64,dissolved_neurons_e8s:t.Nat64,neurons_with_less_than_6_months_dissolve_delay_e8s:t.Nat64,dissolving_neurons_count_buckets:t.Vec(t.Tuple(t.Nat64,t.Nat64)),dissolving_neurons_count:t.Nat64,dissolving_neurons_e8s_buckets:t.Vec(t.Tuple(t.Nat64,t.Float64)),community_fund_total_staked_e8s:t.Nat64,timestamp_seconds:t.Nat64}),s=t.Record({hash:t.Vec(t.Nat8)}),p=t.Record({id:t.Opt(t.Principal),reward_account:t.Opt(s)}),u=t.Record({neuron_minimum_stake_e8s:t.Nat64,max_proposals_to_keep_per_topic:t.Nat32,neuron_management_fee_per_proposal_e8s:t.Nat64,reject_cost_e8s:t.Nat64,transaction_fee_e8s:t.Nat64,neuron_spawn_dissolve_delay_seconds:t.Nat64,minimum_icp_xdr_rate:t.Nat64,maximum_node_provider_rewards_e8s:t.Nat64}),h=t.Record({day_after_genesis:t.Nat64,actual_timestamp_seconds:t.Nat64,distributed_e8s_equivalent:t.Nat64,settled_proposals:t.Vec(r)}),w=t.Record({to_subaccount:t.Vec(t.Nat8),neuron_stake_e8s:t.Nat64,from:t.Opt(t.Principal),memo:t.Nat64,from_subaccount:t.Vec(t.Nat8),transfer_timestamp:t.Nat64,block_height:t.Nat64}),O=t.Record({error_message:t.Text,error_type:t.Int32}),T=t.Record({vote:t.Int32,voting_power:t.Nat64}),V=t.Record({no:t.Nat64,yes:t.Nat64,total:t.Nat64,timestamp_seconds:t.Nat64}),P=t.Record({name:t.Text,description:t.Opt(t.Text)}),Z=t.Record({id:t.Opt(r),known_neuron_data:t.Opt(P)}),ee=t.Record({new_controller:t.Opt(t.Principal),nonce:t.Opt(t.Nat64)}),ce=t.Record({amount_e8s:t.Nat64}),te=t.Record({topic:t.Int32,followees:t.Vec(r)}),xe=t.Record({controller:t.Opt(t.Principal),memo:t.Nat64}),Ie=t.Variant({NeuronIdOrSubaccount:t.Record({}),MemoAndController:xe,Memo:t.Nat64}),we=t.Record({by:t.Opt(Ie)}),X=t.Record({hot_key_to_remove:t.Opt(t.Principal)}),L=t.Record({new_hot_key:t.Opt(t.Principal)}),pe=t.Record({additional_dissolve_delay_seconds:t.Nat32}),he=t.Record({dissolve_timestamp_seconds:t.Nat64}),H=t.Variant({RemoveHotKey:X,AddHotKey:L,StopDissolving:t.Record({}),StartDissolving:t.Record({}),IncreaseDissolveDelay:pe,JoinCommunityFund:t.Record({}),SetDissolveTimestamp:he}),Be=t.Record({operation:t.Opt(H)}),le=t.Record({vote:t.Int32,proposal:t.Opt(r)}),de=t.Record({source_neuron_id:t.Opt(r)}),Re=t.Record({dissolve_delay_seconds:t.Nat64,kyc_verified:t.Bool,amount_e8s:t.Nat64,new_controller:t.Opt(t.Principal),nonce:t.Nat64}),Ge=t.Record({percentage_to_merge:t.Nat32}),et=t.Record({e8s:t.Nat64}),je=t.Record({to_account:t.Opt(s),amount:t.Opt(et)}),st=t.Variant({Spawn:ee,Split:ce,Follow:te,ClaimOrRefresh:we,Configure:Be,RegisterVote:le,Merge:de,DisburseToNeuron:Re,MakeProposal:o,MergeMaturity:Ge,Disburse:je}),ve=t.Variant({Subaccount:t.Vec(t.Nat8),NeuronId:r}),tt=t.Record({id:t.Opt(r),command:t.Opt(st),neuron_id_or_subaccount:t.Opt(ve)}),Ht=t.Record({nns_function:t.Int32,payload:t.Vec(t.Nat8)}),ht=t.Record({dissolve_delay_seconds:t.Nat64}),qt=t.Record({to_account:t.Opt(s)}),U=t.Variant({RewardToNeuron:ht,RewardToAccount:qt}),I=t.Record({node_provider:t.Opt(p),reward_mode:t.Opt(U),amount_e8s:t.Nat64}),Qt=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n))}),ct=t.Record({rewards:t.Vec(I)}),Ve=t.Record({principals:t.Vec(t.Principal)}),$=t.Variant({ToRemove:p,ToAdd:p}),l=t.Record({change:t.Opt($)}),B=t.Record({motion_text:t.Text}),E=t.Variant({RegisterKnownNeuron:Z,ManageNeuron:tt,ExecuteNnsFunction:Ht,RewardNodeProvider:I,SetDefaultFollowees:Qt,RewardNodeProviders:ct,ManageNetworkEconomics:u,ApproveGenesisKyc:Ve,AddOrRemoveNodeProvider:l,Motion:B});o.fill(t.Record({url:t.Text,title:t.Opt(t.Text),action:t.Opt(E),summary:t.Text}));let v=t.Record({current_deadline_timestamp_seconds:t.Nat64}),C=t.Record({id:t.Opt(r),failure_reason:t.Opt(O),ballots:t.Vec(t.Tuple(t.Nat64,T)),proposal_timestamp_seconds:t.Nat64,reward_event_round:t.Nat64,failed_timestamp_seconds:t.Nat64,reject_cost_e8s:t.Nat64,latest_tally:t.Opt(V),decided_timestamp_seconds:t.Nat64,proposal:t.Opt(o),proposer:t.Opt(r),wait_for_quiet_state:t.Opt(v),executed_timestamp_seconds:t.Nat64}),S=t.Variant({Spawn:ee,Split:ce,Configure:Be,Merge:de,DisburseToNeuron:Re,ClaimOrRefreshNeuron:we,MergeMaturity:Ge,Disburse:je}),F=t.Record({command:t.Opt(S),timestamp:t.Nat64}),y=t.Record({vote:t.Int32,proposal_id:t.Opt(r)}),x=t.Variant({DissolveDelaySeconds:t.Nat64,WhenDissolvedTimestampSeconds:t.Nat64}),Q=t.Record({id:t.Opt(r),controller:t.Opt(t.Principal),recent_ballots:t.Vec(y),kyc_verified:t.Bool,not_for_profit:t.Bool,maturity_e8s_equivalent:t.Nat64,cached_neuron_stake_e8s:t.Nat64,created_timestamp_seconds:t.Nat64,aging_since_timestamp_seconds:t.Nat64,hot_keys:t.Vec(t.Principal),account:t.Vec(t.Nat8),joined_community_fund_timestamp_seconds:t.Opt(t.Nat64),dissolve_state:t.Opt(x),followees:t.Vec(t.Tuple(t.Int32,n)),neuron_fees_e8s:t.Nat64,transfer:t.Opt(w),known_neuron_data:t.Opt(P)}),R=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n)),wait_for_quiet_threshold_seconds:t.Nat64,metrics:t.Opt(i),node_providers:t.Vec(p),economics:t.Opt(u),latest_reward_event:t.Opt(h),to_claim_transfers:t.Vec(w),short_voting_period_seconds:t.Nat64,proposals:t.Vec(t.Tuple(t.Nat64,C)),in_flight_commands:t.Vec(t.Tuple(t.Nat64,F)),neurons:t.Vec(t.Tuple(t.Nat64,Q)),genesis_timestamp_seconds:t.Nat64}),G=t.Variant({Ok:t.Null,Err:O}),D=t.Variant({Error:O,NeuronId:r}),J=t.Record({result:t.Opt(D)}),re=t.Variant({Ok:Q,Err:O}),Ee=t.Variant({Ok:ct,Err:O}),me=t.Record({dissolve_delay_seconds:t.Nat64,recent_ballots:t.Vec(y),created_timestamp_seconds:t.Nat64,state:t.Int32,stake_e8s:t.Nat64,joined_community_fund_timestamp_seconds:t.Opt(t.Nat64),retrieved_at_timestamp_seconds:t.Nat64,known_neuron_data:t.Opt(P),voting_power:t.Nat64,age_seconds:t.Nat64}),oe=t.Variant({Ok:me,Err:O}),Y=t.Record({id:t.Opt(r),status:t.Int32,topic:t.Int32,failure_reason:t.Opt(O),ballots:t.Vec(t.Tuple(t.Nat64,T)),proposal_timestamp_seconds:t.Nat64,reward_event_round:t.Nat64,deadline_timestamp_seconds:t.Opt(t.Nat64),failed_timestamp_seconds:t.Nat64,reject_cost_e8s:t.Nat64,latest_tally:t.Opt(V),reward_status:t.Int32,decided_timestamp_seconds:t.Nat64,proposal:t.Opt(o),proposer:t.Opt(r),executed_timestamp_seconds:t.Nat64}),Fe=t.Record({known_neurons:t.Vec(Z)}),Ft=t.Record({neuron_ids:t.Vec(t.Nat64),include_neurons_readable_by_caller:t.Bool}),Wt=t.Record({neuron_infos:t.Vec(t.Tuple(t.Nat64,me)),full_neurons:t.Vec(Q)}),Vt=t.Record({include_reward_status:t.Vec(t.Int32),before_proposal:t.Opt(r),limit:t.Nat32,exclude_topic:t.Vec(t.Int32),include_status:t.Vec(t.Int32)}),ot=t.Record({proposal_info:t.Vec(Y)}),ne=t.Record({created_neuron_id:t.Opt(r)}),Ye=t.Record({refreshed_neuron_id:t.Opt(r)}),Pe=t.Record({proposal_id:t.Opt(r)}),be=t.Record({merged_maturity_e8s:t.Nat64,new_stake_e8s:t.Nat64}),Zo=t.Record({transfer_block_height:t.Nat64}),Xo=t.Variant({Error:O,Spawn:ne,Split:ne,Follow:t.Record({}),ClaimOrRefresh:Ye,Configure:t.Record({}),RegisterVote:t.Record({}),Merge:t.Record({}),DisburseToNeuron:ne,MakeProposal:Pe,MergeMaturity:be,Disburse:Zo}),ye=t.Record({command:t.Opt(Xo)}),$o=t.Record({reward_account:t.Opt(s)});return t.Service({claim_gtc_neurons:t.Func([t.Principal,t.Vec(r)],[G],[]),claim_or_refresh_neuron_from_account:t.Func([xe],[J],[]),get_build_metadata:t.Func([],[t.Text],["query"]),get_full_neuron:t.Func([t.Nat64],[re],["query"]),get_full_neuron_by_id_or_subaccount:t.Func([ve],[re],["query"]),get_monthly_node_provider_rewards:t.Func([],[Ee],[]),get_neuron_ids:t.Func([],[t.Vec(t.Nat64)],["query"]),get_neuron_info:t.Func([t.Nat64],[oe],["query"]),get_neuron_info_by_id_or_subaccount:t.Func([ve],[oe],["query"]),get_pending_proposals:t.Func([],[t.Vec(Y)],["query"]),get_proposal_info:t.Func([t.Nat64],[t.Opt(Y)],["query"]),list_known_neurons:t.Func([],[Fe],["query"]),list_neurons:t.Func([Ft],[Wt],["query"]),list_proposals:t.Func([Vt],[ot],["query"]),manage_neuron:t.Func([tt],[ye],[]),transfer_gtc_neuron:t.Func([r,r],[G],[]),update_node_provider:t.Func([$o],[G],["query"])})};var _o=rt(Ct());var Mp=t=>({id:t}),Rs=t=>({id:t}),yf=t=>({followees:t.map(Rs)}),_f=t=>{if("NeuronId"in t)return{NeuronId:{id:t.NeuronId}};if("Subaccount"in t)return{Subaccount:t.Subaccount};throw new De(t)},Np=t=>{if("ExecuteNnsFunction"in t){let o=t.ExecuteNnsFunction;return{ExecuteNnsFunction:{nns_function:o.nnsFunctionId,payload:oi(o.payloadBytes)}}}if("ManageNeuron"in t){let o=t.ManageNeuron;return{ManageNeuron:Sf(o)}}if("ApproveGenesisKyc"in t)return{ApproveGenesisKyc:{principals:t.ApproveGenesisKyc.principals.map(_o.Principal.fromText)}};if("ManageNetworkEconomics"in t){let o=t.ManageNetworkEconomics;return{ManageNetworkEconomics:{neuron_minimum_stake_e8s:o.neuronMinimumStake,max_proposals_to_keep_per_topic:o.maxProposalsToKeepPerTopic,neuron_management_fee_per_proposal_e8s:o.neuronManagementFeePerProposal,reject_cost_e8s:o.rejectCost,transaction_fee_e8s:o.transactionFee,neuron_spawn_dissolve_delay_seconds:o.neuronSpawnDissolveDelaySeconds,minimum_icp_xdr_rate:o.minimumIcpXdrRate,maximum_node_provider_rewards_e8s:o.maximumNodeProviderRewards}}}if("RewardNodeProvider"in t){let o=t.RewardNodeProvider;return{RewardNodeProvider:{node_provider:o.nodeProvider?[Un(o.nodeProvider)]:[],amount_e8s:o.amountE8s,reward_mode:o.rewardMode!=null?[Tp(o.rewardMode)]:[]}}}if("RewardNodeProviders"in t)return{RewardNodeProviders:{rewards:t.RewardNodeProviders.rewards.map(r=>({node_provider:r.nodeProvider?[Un(r.nodeProvider)]:[],amount_e8s:r.amountE8s,reward_mode:r.rewardMode!=null?[Tp(r.rewardMode)]:[]}))}};if("AddOrRemoveNodeProvider"in t){let o=t.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:o.change?[Cf(o.change)]:[]}}}if("Motion"in t)return{Motion:{motion_text:t.Motion.motionText}};if("SetDefaultFollowees"in t)return{SetDefaultFollowees:{default_followees:t.SetDefaultFollowees.defaultFollowees.map(r=>[r.topic,yf(r.followees)])}};if("RegisterKnownNeuron"in t){let o=t.RegisterKnownNeuron;return{RegisterKnownNeuron:{id:[{id:o.id}],known_neuron_data:[{name:o.name,description:o.description!==void 0?[o.description]:[]}]}}}throw new De(t)},If=t=>{if("Split"in t)return{Split:{amount_e8s:t.Split.amount}};if("Follow"in t){let o=t.Follow;return{Follow:{topic:o.topic,followees:o.followees.map(Rs)}}}if("ClaimOrRefresh"in t){let o=t.ClaimOrRefresh;return{ClaimOrRefresh:{by:o.by?[wf(o.by)]:[]}}}if("Configure"in t){let o=t.Configure;return{Configure:{operation:o.operation?[mf(o.operation)]:[]}}}if("RegisterVote"in t){let o=t.RegisterVote;return{RegisterVote:{vote:o.vote,proposal:o.proposal?[Mp(o.proposal)]:[]}}}if("DisburseToNeuron"in t){let o=t.DisburseToNeuron;return{DisburseToNeuron:{dissolve_delay_seconds:o.dissolveDelaySeconds,kyc_verified:o.kycVerified,amount_e8s:o.amount,new_controller:o.newController?[_o.Principal.fromText(o.newController)]:[],nonce:o.nonce}}}if("MergeMaturity"in t)return{MergeMaturity:{percentage_to_merge:t.MergeMaturity.percentageToMerge}};if("MakeProposal"in t){let o=t.MakeProposal;return{MakeProposal:{url:o.url,title:[],action:o.action?[Np(o.action)]:[],summary:o.summary}}}if("Disburse"in t){let o=t.Disburse;return{Disburse:{to_account:o.toAccountId?[vs(o.toAccountId)]:[],amount:o.amount?[xf(o.amount)]:[]}}}if("Spawn"in t){let o=t.Spawn;return{Spawn:{new_controller:o.newController?[_o.Principal.fromText(o.newController)]:[],nonce:[]}}}if("Merge"in t){let o=t.Merge;return{Merge:{source_neuron_id:o.sourceNeuronId?[{id:o.sourceNeuronId}]:[]}}}throw new De(t)},mf=t=>{if("RemoveHotKey"in t){let o=t.RemoveHotKey;return{RemoveHotKey:{hot_key_to_remove:o.hotKeyToRemove!=null?[_o.Principal.fromText(o.hotKeyToRemove)]:[]}}}if("AddHotKey"in t){let o=t.AddHotKey;return{AddHotKey:{new_hot_key:o.newHotKey?[_o.Principal.fromText(o.newHotKey)]:[]}}}if("StopDissolving"in t)return{StopDissolving:{}};if("StartDissolving"in t)return{StartDissolving:{}};if("IncreaseDissolveDelay"in t)return{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:t.IncreaseDissolveDelay.additionalDissolveDelaySeconds}};if("JoinCommunityFund"in t)return t;if("SetDissolveTimestamp"in t)return{SetDissolveTimestamp:{dissolve_timestamp_seconds:t.SetDissolveTimestamp.dissolveTimestampSeconds}};throw new De(t)},Cf=t=>{if("ToRemove"in t)return{ToRemove:Un(t.ToRemove)};if("ToAdd"in t)return{ToAdd:Un(t.ToAdd)};throw new De(t)},Un=t=>({id:t.id!=null?[_o.Principal.fromText(t.id)]:[],reward_account:t.rewardAccount!=null?[vs(t.rewardAccount)]:[]}),xf=t=>({e8s:t}),vs=t=>{let o=fa(t);return{hash:oi(o)}},Tp=t=>{if("RewardToNeuron"in t)return{RewardToNeuron:{dissolve_delay_seconds:t.RewardToNeuron.dissolveDelaySeconds}};if("RewardToAccount"in t)return{RewardToAccount:{to_account:t.RewardToAccount.toAccount!=null?[vs(t.RewardToAccount.toAccount)]:[]}};throw new De(t)},wf=t=>{if("NeuronIdOrSubaccount"in t)return{NeuronIdOrSubaccount:{}};if("Memo"in t)return{Memo:t.Memo};if("MemoAndController"in t)return{MemoAndController:{memo:t.MemoAndController.memo,controller:t.MemoAndController.controller?[t.MemoAndController.controller]:[]}};throw new De(t)},Op=t=>({neuron_ids:t??[],include_neurons_readable_by_caller:!t}),Sf=({id:t,command:o,neuronIdOrSubaccount:r})=>({id:t?[Rs(t)]:[],command:o?[If(o)]:[],neuron_id_or_subaccount:r?[_f(r)]:[]});var Gp=({includeRewardStatus:t,beforeProposal:o,excludeTopic:r,includeStatus:n,limit:i})=>({include_reward_status:t,before_proposal:o?[Mp(o)]:[],limit:i,exclude_topic:r,include_status:n}),Pp=t=>({id:[],command:[{ClaimOrRefresh:{by:[{NeuronIdOrSubaccount:{}}]}}],neuron_id_or_subaccount:[{NeuronId:{id:t.neuronId}}]}),kp=({memo:t,controller:o})=>{let r={ClaimOrRefresh:{by:[{MemoAndController:{controller:o==null?[]:[o],memo:t}}]}};return{id:[],command:[r],neuron_id_or_subaccount:[]}},Up=({neuronId:t,amount:o})=>({id:[],command:[{Split:{amount_e8s:o}}],neuron_id_or_subaccount:[{NeuronId:{id:t}}]});var jp=({neuronId:t,vote:o,proposalId:r})=>jn({neuronId:t,command:{RegisterVote:{vote:o,proposal:[{id:r}]}}}),Dp=t=>{let o={MakeProposal:{url:t.url,title:t.title!=null?[t.title]:[],summary:t.summary,action:[Np(t.action)]}};return{id:[],command:[o],neuron_id_or_subaccount:[{NeuronId:{id:t.neuronId}}]}},Hp=({neuronId:t,topic:o,followees:r})=>jn({neuronId:t,command:{Follow:{topic:o,followees:r.map(n=>({id:n}))}}}),qp=({neuronId:t,principal:o})=>Jo({neuronId:t,operation:{AddHotKey:{new_hot_key:[o]}}}),Wp=({neuronId:t,principal:o})=>Jo({neuronId:t,operation:{RemoveHotKey:{hot_key_to_remove:[o]}}}),Vp=({neuronId:t,additionalDissolveDelaySeconds:o})=>Jo({neuronId:t,operation:{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:o}}}),Yp=t=>Jo({neuronId:t,operation:{JoinCommunityFund:{}}}),zp=({sourceNeuronId:t,targetNeuronId:o})=>jn({neuronId:o,command:{Merge:{source_neuron_id:[{id:t}]}}}),Jp=t=>Jo({neuronId:t,operation:{StartDissolving:{}}}),Lp=t=>Jo({neuronId:t,operation:{StopDissolving:{}}}),jn=({neuronId:t,command:o})=>({id:[{id:t}],command:[o],neuron_id_or_subaccount:[]}),Jo=({neuronId:t,operation:o})=>jn({neuronId:t,command:{Configure:{operation:[o]}}});var Dn=rt(Ct()),Kp=Dn.Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),Zp=Dn.Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),Xp=Dn.Principal.fromText("ryjl3-tyaaa-aaaaa-aaaba-cai");var Ze=rt(Po()),hA=rt(Ct()),BA=require("buffer");var m=rt(Po()),$p=m.IDL.Record({node_operator_principal_id:m.IDL.Opt(m.IDL.Principal),node_allowance:m.IDL.Nat64,node_provider_principal_id:m.IDL.Opt(m.IDL.Principal)}),eA=m.IDL.Record({subnet_id:m.IDL.Principal,node_ids:m.IDL.Vec(m.IDL.Principal)}),Rf=m.IDL.Record({latitude:m.IDL.Float32,longitude:m.IDL.Float32}),vf=m.IDL.Record({id:m.IDL.Text,gps:m.IDL.Opt(Rf),region:m.IDL.Text,owner:m.IDL.Text}),tA=m.IDL.Record({data_centers_to_add:m.IDL.Vec(vf),data_centers_to_remove:m.IDL.Vec(m.IDL.Text)}),oA=m.IDL.Record({node_manager_sha256_hex:m.IDL.Text,release_package_url:m.IDL.Text,sha256_hex:m.IDL.Text,replica_version_id:m.IDL.Text,release_package_sha256_hex:m.IDL.Text,node_manager_binary_url:m.IDL.Text,binary_url:m.IDL.Text}),rA=m.IDL.Record({ecdsa_signatures:m.IDL.Bool}),nA=m.IDL.Variant({application:m.IDL.Null,verified_application:m.IDL.Null,system:m.IDL.Null}),iA=m.IDL.Record({unit_delay_millis:m.IDL.Nat64,max_instructions_per_round:m.IDL.Nat64,features:rA,max_instructions_per_message:m.IDL.Nat64,gossip_registry_poll_period_ms:m.IDL.Nat32,max_ingress_bytes_per_message:m.IDL.Nat64,dkg_dealings_per_block:m.IDL.Nat64,max_block_payload_size:m.IDL.Nat64,max_instructions_per_install_code:m.IDL.Nat64,start_as_nns:m.IDL.Bool,is_halted:m.IDL.Bool,gossip_pfn_evaluation_period_ms:m.IDL.Nat32,max_ingress_messages_per_block:m.IDL.Nat64,gossip_max_artifact_streams_per_peer:m.IDL.Nat32,replica_version_id:m.IDL.Text,gossip_max_duplicity:m.IDL.Nat32,gossip_max_chunk_wait_ms:m.IDL.Nat32,dkg_interval_length:m.IDL.Nat64,subnet_id_override:m.IDL.Opt(m.IDL.Principal),ingress_bytes_per_block_soft_cap:m.IDL.Nat64,initial_notary_delay_millis:m.IDL.Nat64,gossip_max_chunk_size:m.IDL.Nat32,subnet_type:nA,gossip_retransmission_request_ms:m.IDL.Nat32,gossip_receive_check_cache_size:m.IDL.Nat32,node_ids:m.IDL.Vec(m.IDL.Principal)}),sA=m.IDL.Record({height:m.IDL.Nat64,replacement_nodes:m.IDL.Opt(m.IDL.Vec(m.IDL.Principal)),subnet_id:m.IDL.Principal,registry_store_uri:m.IDL.Opt(m.IDL.Tuple(m.IDL.Text,m.IDL.Text,m.IDL.Nat64)),state_hash:m.IDL.Vec(m.IDL.Nat8),time_ns:m.IDL.Nat64}),NB=m.IDL.Record({node_operators_to_remove:m.IDL.Vec(m.IDL.Vec(m.IDL.Nat8))}),Qs=m.IDL.Record({node_ids:m.IDL.Vec(m.IDL.Principal)}),OB=m.IDL.Record({range_end_inclusive:m.IDL.Principal,range_start_inclusive:m.IDL.Principal,destination_subnet:m.IDL.Principal}),aA=m.IDL.Record({who:m.IDL.Opt(m.IDL.Principal),subnets:m.IDL.Vec(m.IDL.Principal)}),gA=m.IDL.Record({ipv4_prefixes:m.IDL.Vec(m.IDL.Text),firewall_config:m.IDL.Text,ipv6_prefixes:m.IDL.Vec(m.IDL.Text)}),Qf=m.IDL.Variant({Start:m.IDL.Null,Stop:m.IDL.Null}),pA=m.IDL.Record({action:Qf,canister_id:m.IDL.Principal}),AA=m.IDL.Record({data_source:m.IDL.Text,xdr_permyriad_per_icp:m.IDL.Nat64,timestamp_seconds:m.IDL.Nat64}),uA=m.IDL.Record({node_operator_id:m.IDL.Opt(m.IDL.Principal),node_allowance:m.IDL.Opt(m.IDL.Nat64),rewardable_nodes:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,m.IDL.Nat32)),dc_id:m.IDL.Opt(m.IDL.Text)}),Ff=m.IDL.Record({xdr_permyriad_per_node_per_month:m.IDL.Nat64}),Tf=m.IDL.Record({rates:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,Ff))}),cA=m.IDL.Record({new_entries:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,Tf))}),lA=m.IDL.Record({unit_delay_millis:m.IDL.Opt(m.IDL.Nat64),max_duplicity:m.IDL.Opt(m.IDL.Nat32),max_instructions_per_round:m.IDL.Opt(m.IDL.Nat64),features:m.IDL.Opt(rA),set_gossip_config_to_default:m.IDL.Bool,max_instructions_per_message:m.IDL.Opt(m.IDL.Nat64),pfn_evaluation_period_ms:m.IDL.Opt(m.IDL.Nat32),subnet_id:m.IDL.Principal,max_ingress_bytes_per_message:m.IDL.Opt(m.IDL.Nat64),dkg_dealings_per_block:m.IDL.Opt(m.IDL.Nat64),max_block_payload_size:m.IDL.Opt(m.IDL.Nat64),max_instructions_per_install_code:m.IDL.Opt(m.IDL.Nat64),start_as_nns:m.IDL.Opt(m.IDL.Bool),is_halted:m.IDL.Opt(m.IDL.Bool),max_number_of_canisters:m.IDL.Opt(m.IDL.Nat64),advert_best_effort_percentage:m.IDL.Opt(m.IDL.Nat32),retransmission_request_ms:m.IDL.Opt(m.IDL.Nat32),dkg_interval_length:m.IDL.Opt(m.IDL.Nat64),registry_poll_period_ms:m.IDL.Opt(m.IDL.Nat32),max_chunk_wait_ms:m.IDL.Opt(m.IDL.Nat32),receive_check_cache_size:m.IDL.Opt(m.IDL.Nat32),ssh_backup_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text)),ingress_bytes_per_block_soft_cap:m.IDL.Opt(m.IDL.Nat64),max_chunk_size:m.IDL.Opt(m.IDL.Nat32),initial_notary_delay_millis:m.IDL.Opt(m.IDL.Nat64),max_artifact_streams_per_peer:m.IDL.Opt(m.IDL.Nat32),subnet_type:m.IDL.Opt(nA),ssh_readonly_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text))}),dA=m.IDL.Record({subnet_id:m.IDL.Principal,replica_version_id:m.IDL.Text}),fA=m.IDL.Record({replica_version:m.IDL.Opt(m.IDL.Text),ssh_readonly_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text))});hA.Principal.prototype.toJSON=function(){return this.toString()};var EA=t=>{switch(t){case 1:return"Create subnet";case 2:return"Add nodes to subnet";case 3:return"Install NNS canister";case 4:return"Upgrade NNS canister";case 5:return"Bless replica version";case 6:return"Recover subnet";case 7:return"Update subnet config";case 8:return"Assign node operator Id";case 9:return"Update NNS root canister";case 10:return"Update ICP/XDR conversion rate";case 11:return"Update subnet replica version";case 12:return"Clear provisional whitelist";case 13:return"Remove nodes from subnet";case 14:return"Set authorized subnetworks";case 15:return"Change firewall config";case 16:return"Update node operator config";case 17:return"Start or stop NNS canister";case 18:return"Remove nodes from registry";case 19:return"Uninstall code from canister";case 20:return"Update the node rewards table";case 21:return"Add or remove data centers";case 22:return"Update unassigned nodes config";default:return"--Unknown--"}},bA=(t,o)=>{let r=new BA.Buffer(o);try{switch(t){case 1:return Ze.IDL.decode([iA],r)[0];case 2:return Ze.IDL.decode([eA],r)[0];case 3:return{"Unable to display payload":"Payload too large"};case 4:return{"Unable to display payload":"Payload too large"};case 5:return Ze.IDL.decode([oA],r)[0];case 6:return Ze.IDL.decode([sA],r)[0];case 7:return Ze.IDL.decode([lA],r)[0];case 8:return Ze.IDL.decode([$p],r)[0];case 9:return{"Unable to display payload":"Payload too large"};case 10:return Ze.IDL.decode([AA],r)[0];case 11:return Ze.IDL.decode([dA],r)[0];case 12:return{};case 13:return Ze.IDL.decode([Qs],r)[0];case 14:return Ze.IDL.decode([aA],r)[0];case 15:return Ze.IDL.decode([gA],r)[0];case 16:return Ze.IDL.decode([uA],r)[0];case 17:return Ze.IDL.decode([pA],r)[0];case 18:return Ze.IDL.decode([Qs],r)[0];case 20:return Ze.IDL.decode([cA],r)[0];case 21:return Ze.IDL.decode([tA],r)[0];case 22:return Ze.IDL.decode([fA],r)[0];default:return}}catch(n){return console.log("Unable to deserialize payload. NNS function: "+t),console.log(n),{error:"Unable to deserialize payload"}}};var Mf=({neuronId:t,neuronInfo:o,rawNeuron:r})=>{let n=r?Nf(r):void 0;return{neuronId:t,dissolveDelaySeconds:o.dissolve_delay_seconds,recentBallots:o.recent_ballots.map(_A),createdTimestampSeconds:o.created_timestamp_seconds,state:o.state,joinedCommunityFundTimestampSeconds:o.joined_community_fund_timestamp_seconds.length?o.joined_community_fund_timestamp_seconds[0]:void 0,retrievedAtTimestampSeconds:o.retrieved_at_timestamp_seconds,votingPower:o.voting_power,ageSeconds:o.age_seconds,fullNeuron:n}},Nf=t=>({id:t.id.length?go(t.id[0]):void 0,controller:t.controller.length?t.controller[0].toString():void 0,recentBallots:t.recent_ballots.map(_A),kycVerified:t.kyc_verified,notForProfit:t.not_for_profit,cachedNeuronStake:t.cached_neuron_stake_e8s,createdTimestampSeconds:t.created_timestamp_seconds,maturityE8sEquivalent:t.maturity_e8s_equivalent,agingSinceTimestampSeconds:t.aging_since_timestamp_seconds,neuronFees:t.neuron_fees_e8s,hotKeys:t.hot_keys.map(o=>o.toString()),accountIdentifier:Ba(Kp,ri(t.account)),joinedCommunityFundTimestampSeconds:t.joined_community_fund_timestamp_seconds.length?t.joined_community_fund_timestamp_seconds[0]:void 0,dissolveState:t.dissolve_state.length?Of(t.dissolve_state[0]):void 0,followees:t.followees.map(([o,r])=>IA({topic:o,followees:r}))}),_A=({vote:t,proposal_id:o})=>({vote:t,proposalId:o.length?go(o[0]):void 0}),Of=t=>"DissolveDelaySeconds"in t?{DissolveDelaySeconds:t.DissolveDelaySeconds}:{WhenDissolvedTimestampSeconds:t.WhenDissolvedTimestampSeconds},IA=({topic:t,followees:o})=>({topic:t,followees:o.followees.map(go)}),go=({id:t})=>t,Gf=t=>{if("NeuronId"in t)return{NeuronId:t.NeuronId.id};if("Subaccount"in t)return{Subaccount:t.Subaccount};throw new De(t)},Pf=({neuronId:t,ballot:o})=>{let{vote:r,voting_power:n}=o;return{neuronId:t,vote:r,votingPower:n}},kf=({title:t,url:o,action:r,summary:n})=>({title:t.length?t[0]:void 0,url:o,action:r.length?mA(r[0]):void 0,summary:n}),mA=t=>{if("ExecuteNnsFunction"in t){let o=t.ExecuteNnsFunction,r=la(o.payload),n=r.byteLength?bA(o.nns_function,r):void 0;return{ExecuteNnsFunction:{nnsFunctionId:o.nns_function,nnsFunctionName:EA(o.nns_function),payload:n,payloadBytes:r}}}if("ManageNeuron"in t){let o=t.ManageNeuron;return{ManageNeuron:{id:o.id.length?go(o.id[0]):void 0,command:o.command.length?jf(o.command[0]):void 0,neuronIdOrSubaccount:o.neuron_id_or_subaccount.length?Gf(o.neuron_id_or_subaccount[0]):void 0}}}if("ApproveGenesisKyc"in t)return{ApproveGenesisKyc:{principals:t.ApproveGenesisKyc.principals.map(r=>r.toString())}};if("ManageNetworkEconomics"in t){let o=t.ManageNetworkEconomics;return{ManageNetworkEconomics:{neuronMinimumStake:o.neuron_minimum_stake_e8s,maxProposalsToKeepPerTopic:o.max_proposals_to_keep_per_topic,neuronManagementFeePerProposal:o.neuron_management_fee_per_proposal_e8s,rejectCost:o.reject_cost_e8s,transactionFee:o.transaction_fee_e8s,neuronSpawnDissolveDelaySeconds:o.neuron_spawn_dissolve_delay_seconds,minimumIcpXdrRate:o.minimum_icp_xdr_rate,maximumNodeProviderRewards:o.maximum_node_provider_rewards_e8s}}}if("RewardNodeProvider"in t){let o=t.RewardNodeProvider;return{RewardNodeProvider:{nodeProvider:o.node_provider.length?Hn(o.node_provider[0]):void 0,amountE8s:o.amount_e8s,rewardMode:o.reward_mode.length?yA(o.reward_mode[0]):void 0}}}if("RewardNodeProviders"in t)return{RewardNodeProviders:{rewards:t.RewardNodeProviders.rewards.map(r=>({nodeProvider:r.node_provider.length?Hn(r.node_provider[0]):void 0,amountE8s:r.amount_e8s,rewardMode:r.reward_mode.length?yA(r.reward_mode[0]):void 0}))}};if("AddOrRemoveNodeProvider"in t){let o=t.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:o.change.length?Hf(o.change[0]):void 0}}}if("Motion"in t)return{Motion:{motionText:t.Motion.motion_text}};if("SetDefaultFollowees"in t)return{SetDefaultFollowees:{defaultFollowees:t.SetDefaultFollowees.default_followees.map(([r,n])=>IA({topic:r,followees:n}))}};if("RegisterKnownNeuron"in t){let o=t.RegisterKnownNeuron;return{RegisterKnownNeuron:Vf(o)}}throw new De(t)},Uf=t=>({no:t.no,yes:t.yes,total:t.total,timestampSeconds:t.timestamp_seconds}),jf=t=>{if("Spawn"in t){let o=t.Spawn;return{Spawn:{newController:o.new_controller.length?o.new_controller[0].toString():void 0}}}if("Split"in t)return{Split:{amount:t.Split.amount_e8s}};if("Follow"in t){let o=t.Follow;return{Follow:{topic:o.topic,followees:o.followees.map(go)}}}if("ClaimOrRefresh"in t){let o=t.ClaimOrRefresh;return{ClaimOrRefresh:{by:o.by.length?Wf(o.by[0]):void 0}}}if("Configure"in t){let o=t.Configure;return{Configure:{operation:o.operation.length?Df(o.operation[0]):void 0}}}if("RegisterVote"in t){let o=t.RegisterVote;return{RegisterVote:{vote:o.vote,proposal:o.proposal.length?go(o.proposal[0]):void 0}}}if("DisburseToNeuron"in t){let o=t.DisburseToNeuron;return{DisburseToNeuron:{dissolveDelaySeconds:o.dissolve_delay_seconds,kycVerified:o.kyc_verified,amount:o.amount_e8s,newController:o.new_controller.length?o.new_controller[0].toString():void 0,nonce:o.nonce}}}if("MergeMaturity"in t)return{MergeMaturity:{percentageToMerge:t.MergeMaturity.percentage_to_merge}};if("MakeProposal"in t){let o=t.MakeProposal;return{MakeProposal:{title:o.title.length?o.title[0]:void 0,url:o.url,action:o.action.length?mA(o.action[0]):void 0,summary:o.summary}}}if("Disburse"in t){let o=t.Disburse;return{Disburse:{toAccountId:o.to_account.length?Fs(o.to_account[0]):void 0,amount:o.amount.length?qf(o.amount[0]):void 0}}}if("Merge"in t){let o=t.Merge;return{Merge:{sourceNeuronId:o.source_neuron_id.length?o.source_neuron_id[0].id:void 0}}}throw new De(t)},Df=t=>{if("RemoveHotKey"in t){let o=t.RemoveHotKey;return{RemoveHotKey:{hotKeyToRemove:o.hot_key_to_remove.length?o.hot_key_to_remove[0].toString():void 0}}}if("AddHotKey"in t){let o=t.AddHotKey;return{AddHotKey:{newHotKey:o.new_hot_key.length?o.new_hot_key[0].toString():void 0}}}if("StopDissolving"in t)return{StopDissolving:{}};if("StartDissolving"in t)return{StartDissolving:{}};if("IncreaseDissolveDelay"in t)return{IncreaseDissolveDelay:{additionalDissolveDelaySeconds:t.IncreaseDissolveDelay.additional_dissolve_delay_seconds}};if("JoinCommunityFund"in t)return t;if("SetDissolveTimestamp"in t)return{SetDissolveTimestamp:{dissolveTimestampSeconds:t.SetDissolveTimestamp.dissolve_timestamp_seconds}};throw new De(t)},Hf=t=>{if("ToRemove"in t)return{ToRemove:Hn(t.ToRemove)};if("ToAdd"in t)return{ToAdd:Hn(t.ToAdd)};throw new De(t)},Hn=t=>({id:t.id.length?t.id[0].toString():void 0,rewardAccount:t.reward_account.length?Fs(t.reward_account[0]):void 0}),qf=t=>t.e8s,Fs=t=>ha(new Uint8Array(t.hash)),yA=t=>{if("RewardToNeuron"in t)return{RewardToNeuron:{dissolveDelaySeconds:t.RewardToNeuron.dissolve_delay_seconds}};if("RewardToAccount"in t)return{RewardToAccount:{toAccount:t.RewardToAccount.to_account!=null&&t.RewardToAccount.to_account.length?Fs(t.RewardToAccount.to_account[0]):void 0}};throw new De(t)},Wf=t=>{if("NeuronIdOrSubaccount"in t)return{NeuronIdOrSubaccount:{}};if("Memo"in t)return{Memo:t.Memo};if("MemoAndController"in t)return{MemoAndController:{memo:t.MemoAndController.memo,controller:t.MemoAndController.controller.length?t.MemoAndController.controller[0]:void 0}};throw new De(t)},Ts=t=>({id:t.id.length?go(t.id[0]):void 0,ballots:t.ballots.map(o=>Pf({neuronId:o[0],ballot:o[1]})),rejectCost:t.reject_cost_e8s,proposalTimestampSeconds:t.proposal_timestamp_seconds,rewardEventRound:t.reward_event_round,failedTimestampSeconds:t.failed_timestamp_seconds,decidedTimestampSeconds:t.decided_timestamp_seconds,proposal:t.proposal.length?kf(t.proposal[0]):void 0,proposer:t.proposer.length?go(t.proposer[0]):void 0,latestTally:t.latest_tally.length?Uf(t.latest_tally[0]):void 0,executedTimestampSeconds:t.executed_timestamp_seconds,topic:t.topic,status:t.status,rewardStatus:t.reward_status}),CA=({neuron_infos:t,full_neurons:o})=>t.map(([r,n])=>Mf({neuronId:r,neuronInfo:n,rawNeuron:o.find(i=>i.id.length&&i.id[0].id===r)})),xA=({proposal_info:t})=>({proposals:t.map(Ts)}),Vf=({id:t,known_neuron_data:o})=>{var r,n,i;return{id:((r=t[0])==null?void 0:r.id)??BigInt(0),name:((n=o[0])==null?void 0:n.name)??"",description:((i=o[0])==null?void 0:i.description[0])??""}};var vt=async({request:t,service:o})=>{let{command:r}=await o.manage_neuron(t),n=r[0];if(!n)throw new mt({error_message:"Error updating neuron",error_type:0});if("Error"in n)throw new mt(n.Error)};var qn=rt(kn()),Wn=()=>new qn.HttpAgent({host:"https://ic0.app",identity:new qn.AnonymousIdentity});var Lo=class{constructor(o,r,n){this.canisterId=o;this.service=r;this.certifiedService=n;this.listNeurons=async({certified:o=!0,neuronIds:r})=>{let n=Op(r),i=await this.getGovernanceService(o).list_neurons(n);return CA(i)};this.listKnownNeurons=async(o=!0)=>(await this.getGovernanceService(o).list_known_neurons()).known_neurons.map(n=>{var i,s,p;return{id:((i=n.id[0])==null?void 0:i.id)??BigInt(0),name:((s=n.known_neuron_data[0])==null?void 0:s.name)??"",description:(p=n.known_neuron_data[0])==null?void 0:p.description[0]}});this.listProposals=async({request:o,certified:r=!0})=>{let n=Gp(o),i=await this.getGovernanceService(r).list_proposals(n);return xA(i)};this.stakeNeuron=async({stake:o,principal:r,fromSubAccountId:n,ledgerCanister:i})=>{if(o.toE8s()<Gr)throw new gr(at.fromString("1"));let s=new Uint8Array((0,SA.default)(8)),p=ca(s),u=this.buildNeuronStakeSubAccount(s,r),h=Yt.fromPrincipal({principal:this.canisterId,subAccount:u});await i.transfer({memo:p,amount:o,fromSubAccountId:n,to:h});let w=await this.claimOrRefreshNeuronFromAccount({controller:r,memo:p});if(w===void 0)throw new ar;return w};this.increaseDissolveDelay=async({neuronId:o,additionalDissolveDelaySeconds:r})=>{let n=Vp({neuronId:o,additionalDissolveDelaySeconds:r});return vt({request:n,service:this.certifiedService})};this.startDissolving=async o=>{let r=Jp(o);return vt({request:r,service:this.certifiedService})};this.stopDissolving=async o=>{let r=Lp(o);return vt({request:r,service:this.certifiedService})};this.joinCommunityFund=async o=>{let r=Yp(o);return vt({request:r,service:this.certifiedService})};this.mergeNeurons=async o=>{let r=zp(o);return vt({request:r,service:this.certifiedService})};this.splitNeuron=async({neuronId:o,amount:r})=>{let n=Up({neuronId:o,amount:r.toE8s()}),{command:i}=await this.certifiedService.manage_neuron(n),s=i[0];if(!s)throw new mt({error_message:"Error updating neuron",error_type:0});if("Error"in s)throw new mt(s.Error);if("Split"in s){let p=s.Split.created_neuron_id[0];if(p===void 0)throw new mt({error_message:"Unexpected error splitting neuron. No neuronId in Split response.",error_type:0});return p.id}throw new mt({error_message:"Unexpected error splitting neuron. Response type not expected.",error_type:0})};this.getProposal=async({proposalId:o,certified:r=!0})=>{let[n]=await this.getGovernanceService(r).get_proposal_info(o);return n?Ts(n):void 0};this.makeProposal=async o=>{let r=Dp(o);return vt({request:r,service:this.certifiedService})};this.registerVote=async({neuronId:o,vote:r,proposalId:n})=>{let i=jp({neuronId:o,vote:r,proposalId:n});return vt({request:i,service:this.certifiedService})};this.setFollowees=async o=>{let r=Hp(o);return vt({request:r,service:this.certifiedService})};this.addHotkey=async({neuronId:o,principal:r})=>{let n=qp({neuronId:o,principal:r});return vt({request:n,service:this.certifiedService})};this.removeHotkey=async({neuronId:o,principal:r})=>{let n=Wp({neuronId:o,principal:r});return vt({request:n,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async({memo:o,controller:r})=>{var p;let n=kp({memo:o,controller:r}),i=await this.certifiedService.manage_neuron(n),{command:s}=i;if(s.length&&"ClaimOrRefresh"in s[0])return(p=s[0].ClaimOrRefresh.refreshed_neuron_id[0])==null?void 0:p.id;throw new Co(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(i)}`)};this.claimOrRefreshNeuron=async o=>{var s;let r=Pp(o),n=await this.service.manage_neuron(r),{command:i}=n;if(i.length&&"ClaimOrRefresh"in i[0])return(s=i[0].ClaimOrRefresh.refreshed_neuron_id[0])==null?void 0:s.id;throw new Co(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(n)}`)};this.buildNeuronStakeSubAccount=(o,r)=>{let n=nr("neuron-stake"),i=wA.sha256.create();return i.update([12,...n,...r.toUint8Array(),...o]),$t.fromBytes(new Uint8Array(i.array()))};this.getNeuron=async({certified:o=!0,neuronId:r})=>{let[n]=await this.listNeurons({certified:o,neuronIds:[r]});return n};this.canisterId=o,this.service=r,this.certifiedService=n}static create(o={}){let r=o.agent??Wn(),n=o.canisterId??Zp,i=o.serviceOverride??Ms.Actor.createActor(Fp,{agent:r,canisterId:n}),s=o.certifiedServiceOverride??Ms.Actor.createActor(Qp,{agent:r,canisterId:n});return new Lo(n,i,s)}getGovernanceService(o){return o?this.certifiedService:this.service}};var It=rt(or());var Vn=rt(or());var RA=t=>{let o=da(t,32),r=new Vn.Subaccount;return r.setSubAccount(new Uint8Array(o)),r},vA=t=>{let o=new Vn.ICPTs;return o.setE8s(t.toString(10)),o};var Ns=rt(kn()),QA=async({agent:t,canisterId:o,methodName:r,arg:n})=>{let i=await t.call(o,{methodName:r,arg:n,effectiveCanisterId:o});if(!i.response.ok)throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${o}`,` Request ID: ${i.requestId}`,` HTTP status code: ${i.response.status}`,` HTTP status text: ${i.response.statusText}`].join(`
852
852
  `));let s=await Ns.polling.pollForResponse(t,o,i.requestId,Ns.polling.defaultStrategy());return new Uint8Array(s)},FA=async({agent:t,canisterId:o,methodName:r,arg:n})=>{let i=await t.query(o,{methodName:r,arg:n});if(i.status=="rejected")throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${o}`,` HTTP status code: ${i.reject_code}`,` HTTP status text: ${i.reject_message}`].join(`
853
- `));return new Uint8Array(i.reply.arg)};var Ko=class{constructor(o,r,n,i){this.agent=o;this.canisterId=r;this.updateFetcher=n;this.queryFetcher=i;this.accountBalance=async({accountIdentifier:o,certified:r=!0})=>{let n=r?this.updateFetcher:this.queryFetcher,i=new It.AccountBalanceRequest;i.setAccount(o.toProto());let s=await n({agent:this.agent,canisterId:this.canisterId,methodName:"account_balance_pb",arg:i.serializeBinary()});return at.fromE8s(BigInt(It.ICPTs.deserializeBinary(new Uint8Array(s)).getE8s()))};this.transfer=async({to:o,amount:r,memo:n,fee:i,fromSubAccountId:s})=>{let p=new It.SendRequest;p.setTo(o.toProto());let u=new It.Payment;u.setReceiverGets(r.toProto()),p.setPayment(u),p.setMaxFee(vA(i??ya));let h=new It.Memo;h.setMemo((n??BigInt(0)).toString()),p.setMemo(h),s!==void 0&&p.setFromSubaccount(RA(s));try{let w=await this.updateFetcher({agent:this.agent,canisterId:this.canisterId,methodName:"send_pb",arg:p.serializeBinary()});return BigInt(It.BlockHeight.deserializeBinary(w).getHeight())}catch(w){throw w instanceof Error?ai(w):w}}}static create(o={}){return new Ko(o.agent??Wn(),o.canisterId??Xp,o.updateCallOverride??QA,o.queryCallOverride??FA)}};var TA=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.LOCKED=1]="LOCKED",i[i.DISSOLVING=2]="DISSOLVING",i[i.DISSOLVED=3]="DISSOLVED",i))(TA||{}),MA=(s=>(s[s.PROPOSAL_REWARD_STATUS_UNKNOWN=0]="PROPOSAL_REWARD_STATUS_UNKNOWN",s[s.PROPOSAL_REWARD_STATUS_ACCEPT_VOTES=1]="PROPOSAL_REWARD_STATUS_ACCEPT_VOTES",s[s.PROPOSAL_REWARD_STATUS_READY_TO_SETTLE=2]="PROPOSAL_REWARD_STATUS_READY_TO_SETTLE",s[s.PROPOSAL_REWARD_STATUS_SETTLED=3]="PROPOSAL_REWARD_STATUS_SETTLED",s[s.PROPOSAL_REWARD_STATUS_INELIGIBLE=4]="PROPOSAL_REWARD_STATUS_INELIGIBLE",s))(MA||{}),NA=(p=>(p[p.PROPOSAL_STATUS_UNKNOWN=0]="PROPOSAL_STATUS_UNKNOWN",p[p.PROPOSAL_STATUS_OPEN=1]="PROPOSAL_STATUS_OPEN",p[p.PROPOSAL_STATUS_REJECTED=2]="PROPOSAL_STATUS_REJECTED",p[p.PROPOSAL_STATUS_ACCEPTED=3]="PROPOSAL_STATUS_ACCEPTED",p[p.PROPOSAL_STATUS_EXECUTED=4]="PROPOSAL_STATUS_EXECUTED",p[p.PROPOSAL_STATUS_FAILED=5]="PROPOSAL_STATUS_FAILED",p))(NA||{}),OA=(n=>(n[n.UNSPECIFIED=0]="UNSPECIFIED",n[n.YES=1]="YES",n[n.NO=2]="NO",n))(OA||{}),GA=(T=>(T[T.Unspecified=0]="Unspecified",T[T.ManageNeuron=1]="ManageNeuron",T[T.ExchangeRate=2]="ExchangeRate",T[T.NetworkEconomics=3]="NetworkEconomics",T[T.Governance=4]="Governance",T[T.NodeAdmin=5]="NodeAdmin",T[T.ParticipantManagement=6]="ParticipantManagement",T[T.SubnetManagement=7]="SubnetManagement",T[T.NetworkCanisterManagement=8]="NetworkCanisterManagement",T[T.Kyc=9]="Kyc",T[T.NodeProviderRewards=10]="NodeProviderRewards",T))(GA||{});var PA=({recentBallots:t,proposalId:o})=>{if(!o)return;let r=t.find(({proposalId:n})=>n===o);return r==null?void 0:r.vote},kA=({neurons:t,proposal:o})=>{let{ballots:r,proposalTimestampSeconds:n}=o;return t.filter(({createdTimestampSeconds:i,neuronId:s})=>{let p=i>n,u=r.find(({neuronId:h})=>h===s)===void 0;return p||u})},zf=({neurons:t,proposal:o})=>{let{id:r}=o;return t.filter(({recentBallots:n,neuronId:i})=>PA({recentBallots:n,proposalId:r})===void 0&&kA({neurons:t,proposal:o}).find(({neuronId:s})=>s===i)===void 0).filter(({votingPower:n})=>n>0n)},Jf=({neurons:t,proposal:o})=>{let{id:r}=o;return t.filter(({recentBallots:n})=>PA({recentBallots:n,proposalId:r})!==void 0)};0&&(module.exports={AccountIdentifier,CouldNotClaimNeuronError,FromICPStringError,GovernanceCanister,GovernanceError,ICP,InsufficientAmountError,InsufficientFundsError,InvalidSenderError,LedgerCanister,NeuronState,ProposalRewardStatus,ProposalStatus,StakeNeuronError,SubAccount,Topic,TransferError,TxCreatedInFutureError,TxDuplicateError,TxTooOldError,UnrecognizedTypeError,UnsupportedValueError,Vote,ineligibleNeurons,mapTransferError,votableNeurons,votedNeurons});
853
+ `));return new Uint8Array(i.reply.arg)};var Ko=class{constructor(o,r,n,i){this.agent=o;this.canisterId=r;this.updateFetcher=n;this.queryFetcher=i;this.accountBalance=async({accountIdentifier:o,certified:r=!0})=>{let n=r?this.updateFetcher:this.queryFetcher,i=new It.AccountBalanceRequest;i.setAccount(o.toProto());let s=await n({agent:this.agent,canisterId:this.canisterId,methodName:"account_balance_pb",arg:i.serializeBinary()});return at.fromE8s(BigInt(It.ICPTs.deserializeBinary(new Uint8Array(s)).getE8s()))};this.transfer=async({to:o,amount:r,memo:n,fee:i,fromSubAccountId:s})=>{let p=new It.SendRequest;p.setTo(o.toProto());let u=new It.Payment;u.setReceiverGets(r.toProto()),p.setPayment(u),p.setMaxFee(vA(i??ya));let h=new It.Memo;h.setMemo((n??BigInt(0)).toString()),p.setMemo(h),s!==void 0&&p.setFromSubaccount(RA(s));try{let w=await this.updateFetcher({agent:this.agent,canisterId:this.canisterId,methodName:"send_pb",arg:p.serializeBinary()});return BigInt(It.BlockHeight.deserializeBinary(w).getHeight())}catch(w){throw w instanceof Error?ai(w):w}}}static create(o={}){return new Ko(o.agent??Wn(),o.canisterId??Xp,o.updateCallOverride??QA,o.queryCallOverride??FA)}};var TA=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.LOCKED=1]="LOCKED",i[i.DISSOLVING=2]="DISSOLVING",i[i.DISSOLVED=3]="DISSOLVED",i))(TA||{}),MA=(s=>(s[s.PROPOSAL_REWARD_STATUS_UNKNOWN=0]="PROPOSAL_REWARD_STATUS_UNKNOWN",s[s.PROPOSAL_REWARD_STATUS_ACCEPT_VOTES=1]="PROPOSAL_REWARD_STATUS_ACCEPT_VOTES",s[s.PROPOSAL_REWARD_STATUS_READY_TO_SETTLE=2]="PROPOSAL_REWARD_STATUS_READY_TO_SETTLE",s[s.PROPOSAL_REWARD_STATUS_SETTLED=3]="PROPOSAL_REWARD_STATUS_SETTLED",s[s.PROPOSAL_REWARD_STATUS_INELIGIBLE=4]="PROPOSAL_REWARD_STATUS_INELIGIBLE",s))(MA||{}),NA=(p=>(p[p.PROPOSAL_STATUS_UNKNOWN=0]="PROPOSAL_STATUS_UNKNOWN",p[p.PROPOSAL_STATUS_OPEN=1]="PROPOSAL_STATUS_OPEN",p[p.PROPOSAL_STATUS_REJECTED=2]="PROPOSAL_STATUS_REJECTED",p[p.PROPOSAL_STATUS_ACCEPTED=3]="PROPOSAL_STATUS_ACCEPTED",p[p.PROPOSAL_STATUS_EXECUTED=4]="PROPOSAL_STATUS_EXECUTED",p[p.PROPOSAL_STATUS_FAILED=5]="PROPOSAL_STATUS_FAILED",p))(NA||{}),OA=(n=>(n[n.UNSPECIFIED=0]="UNSPECIFIED",n[n.YES=1]="YES",n[n.NO=2]="NO",n))(OA||{}),GA=(T=>(T[T.Unspecified=0]="Unspecified",T[T.ManageNeuron=1]="ManageNeuron",T[T.ExchangeRate=2]="ExchangeRate",T[T.NetworkEconomics=3]="NetworkEconomics",T[T.Governance=4]="Governance",T[T.NodeAdmin=5]="NodeAdmin",T[T.ParticipantManagement=6]="ParticipantManagement",T[T.SubnetManagement=7]="SubnetManagement",T[T.NetworkCanisterManagement=8]="NetworkCanisterManagement",T[T.Kyc=9]="Kyc",T[T.NodeProviderRewards=10]="NodeProviderRewards",T))(GA||{});var PA=({recentBallots:t,proposalId:o})=>{if(!o)return;let r=t.find(({proposalId:n})=>n===o);return r==null?void 0:r.vote},kA=({neurons:t,proposal:o})=>{let{ballots:r,proposalTimestampSeconds:n}=o;return t.filter(({createdTimestampSeconds:i,neuronId:s})=>{let p=i>n,u=r.find(({neuronId:h})=>h===s)===void 0;return p||u})},zf=({neurons:t,proposal:o})=>{let{id:r}=o;return t.filter(({recentBallots:n,neuronId:i})=>PA({recentBallots:n,proposalId:r})===void 0&&kA({neurons:t,proposal:o}).find(({neuronId:s})=>s===i)===void 0)},Jf=({neurons:t,proposal:o})=>{let{id:r}=o;return t.filter(({recentBallots:n})=>PA({recentBallots:n,proposalId:r})!==void 0)};0&&(module.exports={AccountIdentifier,CouldNotClaimNeuronError,FromICPStringError,GovernanceCanister,GovernanceError,ICP,InsufficientAmountError,InsufficientFundsError,InvalidSenderError,LedgerCanister,NeuronState,ProposalRewardStatus,ProposalStatus,StakeNeuronError,SubAccount,Topic,TransferError,TxCreatedInFutureError,TxDuplicateError,TxTooOldError,UnrecognizedTypeError,UnsupportedValueError,Vote,ineligibleNeurons,mapTransferError,votableNeurons,votedNeurons});
854
854
  /*!
855
855
  * The buffer module from node.js, for the browser.
856
856
  *