@dfinity/nns 0.2.3-nightly-2022-04-07.0 → 0.3.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.
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +2 -2
- package/dist/esm/{chunk-SRRQDWWT.js → chunk-LSSEKDUC.js} +3 -3
- package/dist/esm/chunk-LSSEKDUC.js.map +7 -0
- package/dist/esm/governance.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +2 -2
- package/dist/types/canisters/governance/response.converters.d.ts +1 -2
- package/dist/types/governance.d.ts +2 -4
- package/dist/types/types/governance_converters.d.ts +0 -1
- package/package.json +1 -1
- package/dist/esm/chunk-SRRQDWWT.js.map +0 -7
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -848,7 +848,7 @@ ${o(i)}
|
|
|
848
848
|
`)}throw new Error("unreachable")}It.pollForResponse=jp});var en=D(ft=>{"use strict";Object.defineProperty(ft,"__esModule",{value:!0});ft.Actor=ft.CanisterInstallMode=ft.UpdateCallRejectedError=ft.QueryCallRejectedError=ft.ActorCallError=void 0;var Sh=Ha(),is=gr(),Dp=Li(),wh=Fr(),sn=vo(),Hp=ns(),Oo=Mt(),vh=Yt(),an=class extends wh.AgentError{constructor(o,r,n,i){super(["Call failed:",` Canister: ${o.toText()}`,` Method: ${r} (${n})`,...Object.getOwnPropertyNames(i).map(s=>` "${s}": ${JSON.stringify(i[s])}`)].join(`
|
|
849
849
|
`));this.canisterId=o,this.methodName=r,this.type=n,this.props=i}};ft.ActorCallError=an;var ss=class extends an{constructor(o,r,n){var i;super(o,r,"query",{Status:n.status,Code:(i=is.ReplicaRejectCode[n.reject_code])!==null&&i!==void 0?i:`Unknown Code "${n.reject_code}"`,Message:n.reject_message});this.result=n}};ft.QueryCallRejectedError=ss;var as=class extends an{constructor(o,r,n,i){super(o,r,"update",{"Request ID":vh.toHex(n),"HTTP status code":i.status.toString(),"HTTP status text":i.statusText});this.requestId=n,this.response=i}};ft.UpdateCallRejectedError=as;var qp;(function(t){t.Install="install",t.Reinstall="reinstall",t.Upgrade="upgrade"})(qp=ft.CanisterInstallMode||(ft.CanisterInstallMode={}));var mt=Symbol.for("ic-agent-metadata"),gn=class{constructor(o){this[mt]=Object.freeze(o)}static agentOf(o){return o[mt].config.agent}static interfaceOf(o){return o[mt].service}static canisterIdOf(o){return Oo.Principal.from(o[mt].config.canisterId)}static async install(o,r){let n=o.mode===void 0?qp.Install:o.mode,i=o.arg?[...new Uint8Array(o.arg)]:[],s=[...new Uint8Array(o.module)],p=typeof r.canisterId=="string"?Oo.Principal.fromText(r.canisterId):r.canisterId;await Dp.getManagementCanister(r).install_code({mode:{[n]:null},arg:i,wasm_module:s,canister_id:p})}static async createCanister(o){let{canister_id:r}=await Dp.getManagementCanister(o||{}).provisional_create_canister_with_cycles({amount:[],settings:[]});return r}static async createAndInstallCanister(o,r,n){let i=await this.createCanister(n);return await this.install(Object.assign({},r),Object.assign(Object.assign({},n),{canisterId:i})),this.createActor(o,Object.assign(Object.assign({},n),{canisterId:i}))}static createActorClass(o){let r=o({IDL:sn.IDL});class n extends gn{constructor(s){let p=typeof s.canisterId=="string"?Oo.Principal.fromText(s.canisterId):s.canisterId;super({config:Object.assign(Object.assign(Object.assign({},Vp),s),{canisterId:p}),service:r});for(let[u,h]of r._fields)this[u]=Rh(this,u,h)}}return n}static createActor(o,r){return new(this.createActorClass(o))(r)}};ft.Actor=gn;function Wp(t,o){let r=sn.IDL.decode(t,Sh.Buffer.from(o));switch(r.length){case 0:return;case 1:return r[0];default:return r}}var Vp={pollingStrategyFactory:Hp.strategy.defaultStrategy};function Rh(t,o,r){let n;r.annotations.includes("query")?n=async(s,...p)=>{var u,h;s=Object.assign(Object.assign({},s),(h=(u=t[mt].config).queryTransform)===null||h===void 0?void 0:h.call(u,o,p,Object.assign(Object.assign({},t[mt].config),s)));let w=s.agent||t[mt].config.agent||is.getDefaultAgent(),G=Oo.Principal.from(s.canisterId||t[mt].config.canisterId),T=sn.IDL.encode(r.argTypes,p),V=await w.query(G,{methodName:o,arg:T});switch(V.status){case"rejected":throw new ss(G,o,V);case"replied":return Wp(r.retTypes,V.reply.arg)}}:n=async(s,...p)=>{var u,h;s=Object.assign(Object.assign({},s),(h=(u=t[mt].config).callTransform)===null||h===void 0?void 0:h.call(u,o,p,Object.assign(Object.assign({},t[mt].config),s)));let w=s.agent||t[mt].config.agent||is.getDefaultAgent(),{canisterId:G,effectiveCanisterId:T,pollingStrategyFactory:V}=Object.assign(Object.assign(Object.assign({},Vp),t[mt].config),s),P=Oo.Principal.from(G),L=T!==void 0?Oo.Principal.from(T):P,ee=sn.IDL.encode(r.argTypes,p),{requestId:ce,response:te}=await w.call(P,{methodName:o,arg:ee,effectiveCanisterId:L});if(!te.ok)throw new as(P,o,ce,te);let xe=V(),Ie=await Hp.pollForResponse(w,L,ce,xe);if(Ie!==void 0)return Wp(r.retTypes,Ie);if(r.retTypes.length===0)return;throw new Error(`Call was returned undefined, but type [${r.retTypes.join(",")}].`)};let i=(...s)=>n({},...s);return i.withOptions=s=>(...p)=>n(s,...p),i}});var Yp=D(gs=>{"use strict";Object.defineProperty(gs,"__esModule",{value:!0});gs.default=({IDL:t})=>t.Service({retrieve:t.Func([t.Text],[t.Vec(t.Nat8)],["query"]),store:t.Func([t.Text,t.Vec(t.Nat8)],[],[])})});var zp=D(No=>{"use strict";var Qh=No&&No.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(No,"__esModule",{value:!0});No.createAssetCanisterActor=void 0;var Fh=en(),Th=Qh(Yp());function Mh(t){return Fh.Actor.createActor(Th.default,t)}No.createAssetCanisterActor=Mh});var pn=D(Oe=>{"use strict";var Lp=Oe&&Oe.__createBinding||(Object.create?function(t,o,r,n){n===void 0&&(n=r),Object.defineProperty(t,n,{enumerable:!0,get:function(){return o[r]}})}:function(t,o,r,n){n===void 0&&(n=r),t[n]=o[r]}),Oh=Oe&&Oe.__setModuleDefault||(Object.create?function(t,o){Object.defineProperty(t,"default",{enumerable:!0,value:o})}:function(t,o){t.default=o}),Ut=Oe&&Oe.__exportStar||function(t,o){for(var r in t)r!=="default"&&!o.hasOwnProperty(r)&&Lp(o,t,r)},Jp=Oe&&Oe.__importStar||function(t){if(t&&t.__esModule)return t;var o={};if(t!=null)for(var r in t)r!=="default"&&Object.hasOwnProperty.call(t,r)&&Lp(o,t,r);return Oh(o,t),o};Object.defineProperty(Oe,"__esModule",{value:!0});Ut(en(),Oe);Ut(gr(),Oe);Ut(Oi(),Oe);Ut(os(),Oe);Ut(Zr(),Oe);Ut(ar(),Oe);Ut(zp(),Oe);Ut(Li(),Oe);Ut(ir(),Oe);Ut(Xi(),Oe);Oe.polling=Jp(ns());Oe.Cbor=Jp(Kr())});var Zp=D((sE,Kp)=>{Kp.exports=require("crypto").randomBytes});var p0={};Iu(p0,{AccountIdentifier:()=>Kt,CouldNotClaimNeuronError:()=>br,FromICPStringError:()=>Dn,GovernanceCanister:()=>cr,GovernanceError:()=>Wo,ICP:()=>ut,InsufficientAmountError:()=>yr,InsufficientFundsError:()=>qn,InvalidSenderError:()=>Hn,LedgerCanister:()=>lr,NeuronState:()=>YA,ProposalRewardStatus:()=>zA,ProposalStatus:()=>LA,StakeNeuronError:()=>Er,SubAccount:()=>oo,Topic:()=>KA,TransferError:()=>ro,TxCreatedInFutureError:()=>Vn,TxDuplicateError:()=>Yn,TxTooOldError:()=>Wn,UnrecognizedTypeError:()=>_r,UnsupportedValueError:()=>Ve,Vote:()=>JA,ineligibleNeurons:()=>XA,mapTransferError:()=>zn,notVotedNeurons:()=>a0,votedNeurons:()=>g0});var ma=rt(Eo()),Ca=rt(Br());var Do=require("buffer"),fa=rt(da()),ha=rt(Eo()),Ba=t=>{let o=new DataView(t.buffer,t.byteOffset,t.byteLength);if(typeof o.getBigUint64=="function")return o.getBigUint64(0);{let r=BigInt(o.getUint32(0)),n=BigInt(o.getUint32(4));return(r<<BigInt(32))+n}},Pn=t=>{let o=new Uint8Array(t);return Array.from(o)},kn=t=>new Uint8Array(t),Ea=t=>kn(t).buffer,ba=(t,o)=>{let r=new ArrayBuffer(o);return new DataView(r).setUint32(o-4,t),r},Ho=t=>Array.from(t).map(o=>o.charCodeAt(0)),ya=t=>Uint8Array.from(Do.Buffer.from(t,"hex")).subarray(4),_a=t=>Do.Buffer.from(t).toString("hex"),Ia=(t,o)=>{let r=Ho(`
|
|
850
850
|
account-id`),n=ha.sha224.create();n.update([...r,...t.toUint8Array(),...o??Array(32).fill(0)]);let i=new Uint8Array(n.array()),s=jn(i),p=new Uint8Array([...s,...i]);return Un(p)},Un=t=>t.reduce((o,r)=>o+r.toString(16).padStart(2,"0"),""),jn=t=>{let o=new ArrayBuffer(4);return new DataView(o).setUint32(0,fa.default.crc32(Do.Buffer.from(t)),!1),Do.Buffer.from(o)};var Kt=class{constructor(o){this.bytes=o}static fromHex(o){return new Kt(Uint8Array.from(Buffer.from(o,"hex")))}static fromPrincipal({principal:o,subAccount:r=oo.ZERO}){let n=Ho(`
|
|
851
|
-
account-id`),i=ma.sha224.create();i.update([...n,...o.toUint8Array(),...r.toUint8Array()]);let s=new Uint8Array(i.array()),p=jn(s),u=new Uint8Array([...p,...s]);return new Kt(u)}toProto(){let o=new Ca.AccountIdentifier;return o.setHash(this.bytes),o}toHex(){return Un(this.bytes)}},qo=class{constructor(o){this.bytes=o}static fromBytes(o){return o.length!=32?Error("Subaccount length must be 32-bytes"):new qo(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 qo(r)}toUint8Array(){return this.bytes}},oo=qo;oo.ZERO=new qo(new Uint8Array(32).fill(0));var Er=class extends Error{},br=class extends Er{},yr=class extends Er{constructor(o){super();this.minimumAmount=o}},_r=class extends Error{},Wo=class extends Error{constructor(o){super();this.detail=o}},Ve=class extends Error{constructor(o){super("Unsupported value: "+o)}};var Sa=rt(Br());var xa=32,Z0=BigInt(1095062083),X0=BigInt(1347768404),$0=BigInt(1e4),Ir=BigInt(1e8);var Dn=(r=>(r[r.FRACTIONAL_MORE_THAN_8_DECIMALS=0]="FRACTIONAL_MORE_THAN_8_DECIMALS",r[r.INVALID_FORMAT=1]="INVALID_FORMAT",r))(Dn||{});var ut=class{constructor(o){this.e8s=o}static fromE8s(o){return new ut(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)*Ir}catch{return 1}if(i){if(i.length>8)return 0;try{s+=BigInt(i.padEnd(8,"0"))}catch{return 1}}return new ut(s)}toE8s(){return this.e8s}toProto(){let o=new Sa.ICPTs;return o.setE8s(this.e8s.toString()),o}};var ro=class extends Error{},Hn=class extends ro{},qn=class extends ro{constructor(o){super();this.balance=o}},Wn=class extends ro{constructor(o){super();this.allowed_window_secs=o}},Vn=class extends ro{},Yn=class extends ro{constructor(o){super();this.duplicateOf=o}},zn=t=>{let{message:o}=t;if(o.includes("Reject code: 5")){if(o.match(/Sending from (.*) is not allowed/))return new Hn;{let r=o.match(/transaction.*duplicate.* in block (\d+)/);if(r&&r.length>1)return new Yn(BigInt(r[1]))}{let r=o.match(/debit account.*, current balance: (\d*(\.\d*)?)/);if(r&&r.length>1){let n=ut.fromString(r[1]);if(n instanceof ut)return new qn(n)}}if(o.includes("is in future"))return new Vn;{let r=o.match(/older than (\d+)/);if(r&&r.length>1)return new Wn(Number.parseInt(r[1]))}}throw t};var ds=rt(pn()),HA=rt(Eo()),qA=rt(Zp());var Xp=({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}),G=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)}),L=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}),Se=t.Record({by:t.Opt(Ie)}),X=t.Record({hot_key_to_remove:t.Opt(t.Principal)}),Z=t.Record({new_hot_key:t.Opt(t.Principal)}),Ae=t.Record({additional_dissolve_delay_seconds:t.Nat32}),he=t.Record({dissolve_timestamp_seconds:t.Nat64}),q=t.Variant({RemoveHotKey:X,AddHotKey:Z,StopDissolving:t.Record({}),StartDissolving:t.Record({}),IncreaseDissolveDelay:Ae,JoinCommunityFund:t.Record({}),SetDissolveTimestamp:he}),Be=t.Record({operation:t.Opt(q)}),le=t.Record({vote:t.Int32,proposal:t.Opt(r)}),de=t.Record({source_neuron_id:t.Opt(r)}),ve=t.Record({dissolve_delay_seconds:t.Nat64,kyc_verified:t.Bool,amount_e8s:t.Nat64,new_controller:t.Opt(t.Principal),nonce:t.Nat64}),Ne=t.Record({percentage_to_merge:t.Nat32}),$e=t.Record({e8s:t.Nat64}),Ue=t.Record({to_account:t.Opt(s),amount:t.Opt($e)}),it=t.Variant({Spawn:ee,Split:ce,Follow:te,ClaimOrRefresh:Se,Configure:Be,RegisterVote:le,Merge:de,DisburseToNeuron:ve,MakeProposal:o,MergeMaturity:Ne,Disburse:Ue}),Re=t.Variant({Subaccount:t.Vec(t.Nat8),NeuronId:r}),et=t.Record({id:t.Opt(r),command:t.Opt(it),neuron_id_or_subaccount:t.Opt(Re)}),jt=t.Record({nns_function:t.Int32,payload:t.Vec(t.Nat8)}),ht=t.Record({dissolve_delay_seconds:t.Nat64}),Dt=t.Record({to_account:t.Opt(s)}),U=t.Variant({RewardToNeuron:ht,RewardToAccount:Dt}),I=t.Record({node_provider:t.Opt(p),reward_mode:t.Opt(U),amount_e8s:t.Nat64}),vt=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n))}),At=t.Record({rewards:t.Vec(I)}),He=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:L,ManageNeuron:et,ExecuteNnsFunction:jt,RewardNodeProvider:I,SetDefaultFollowees:vt,RewardNodeProviders:At,ManageNetworkEconomics:u,ApproveGenesisKyc:He,AddOrRemoveNodeProvider:l,Motion:B});o.fill(t.Record({url:t.Text,title:t.Opt(t.Text),action:t.Opt(E),summary:t.Text}));let R=t.Record({current_deadline_timestamp_seconds:t.Nat64}),C=t.Record({id:t.Opt(r),failure_reason:t.Opt(G),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(R),executed_timestamp_seconds:t.Nat64}),S=t.Variant({Spawn:ee,Split:ce,Configure:Be,Merge:de,DisburseToNeuron:ve,ClaimOrRefreshNeuron:Se,MergeMaturity:Ne,Disburse:Ue}),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)}),v=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}),N=t.Variant({Ok:t.Null,Err:G}),H=t.Variant({Error:G,NeuronId:r}),J=t.Record({result:t.Opt(H)}),re=t.Variant({Ok:Q,Err:G}),Ee=t.Variant({Ok:At,Err:G}),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:G}),z=t.Record({id:t.Opt(r),status:t.Int32,topic:t.Int32,failure_reason:t.Opt(G),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}),Qe=t.Record({known_neurons:t.Vec(L)}),Rt=t.Record({neuron_ids:t.Vec(t.Nat64),include_neurons_readable_by_caller:t.Bool}),Ht=t.Record({neuron_infos:t.Vec(t.Tuple(t.Nat64,me)),full_neurons:t.Vec(Q)}),qt=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)}),tt=t.Record({proposal_info:t.Vec(z)}),ne=t.Record({created_neuron_id:t.Opt(r)}),qe=t.Record({refreshed_neuron_id:t.Opt(r)}),Ge=t.Record({proposal_id:t.Opt(r)}),be=t.Record({merged_maturity_e8s:t.Nat64,new_stake_e8s:t.Nat64}),Go=t.Record({transfer_block_height:t.Nat64}),Po=t.Variant({Error:G,Spawn:ne,Split:ne,Follow:t.Record({}),ClaimOrRefresh:qe,Configure:t.Record({}),RegisterVote:t.Record({}),Merge:t.Record({}),DisburseToNeuron:ne,MakeProposal:Ge,MergeMaturity:be,Disburse:Go}),ye=t.Record({command:t.Opt(Po)}),ko=t.Record({reward_account:t.Opt(s)});return t.Service({claim_gtc_neurons:t.Func([t.Principal,t.Vec(r)],[N],[]),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([Re],[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([Re],[oe],[]),get_pending_proposals:t.Func([],[t.Vec(z)],[]),get_proposal_info:t.Func([t.Nat64],[t.Opt(z)],[]),list_known_neurons:t.Func([],[Qe],[]),list_neurons:t.Func([Rt],[Ht],[]),list_proposals:t.Func([qt],[tt],[]),manage_neuron:t.Func([et],[ye],[]),transfer_gtc_neuron:t.Func([r,r],[N],[]),update_node_provider:t.Func([ko],[N],[])})};var $p=({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}),G=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)}),L=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}),Se=t.Record({by:t.Opt(Ie)}),X=t.Record({hot_key_to_remove:t.Opt(t.Principal)}),Z=t.Record({new_hot_key:t.Opt(t.Principal)}),Ae=t.Record({additional_dissolve_delay_seconds:t.Nat32}),he=t.Record({dissolve_timestamp_seconds:t.Nat64}),q=t.Variant({RemoveHotKey:X,AddHotKey:Z,StopDissolving:t.Record({}),StartDissolving:t.Record({}),IncreaseDissolveDelay:Ae,JoinCommunityFund:t.Record({}),SetDissolveTimestamp:he}),Be=t.Record({operation:t.Opt(q)}),le=t.Record({vote:t.Int32,proposal:t.Opt(r)}),de=t.Record({source_neuron_id:t.Opt(r)}),ve=t.Record({dissolve_delay_seconds:t.Nat64,kyc_verified:t.Bool,amount_e8s:t.Nat64,new_controller:t.Opt(t.Principal),nonce:t.Nat64}),Ne=t.Record({percentage_to_merge:t.Nat32}),$e=t.Record({e8s:t.Nat64}),Ue=t.Record({to_account:t.Opt(s),amount:t.Opt($e)}),it=t.Variant({Spawn:ee,Split:ce,Follow:te,ClaimOrRefresh:Se,Configure:Be,RegisterVote:le,Merge:de,DisburseToNeuron:ve,MakeProposal:o,MergeMaturity:Ne,Disburse:Ue}),Re=t.Variant({Subaccount:t.Vec(t.Nat8),NeuronId:r}),et=t.Record({id:t.Opt(r),command:t.Opt(it),neuron_id_or_subaccount:t.Opt(Re)}),jt=t.Record({nns_function:t.Int32,payload:t.Vec(t.Nat8)}),ht=t.Record({dissolve_delay_seconds:t.Nat64}),Dt=t.Record({to_account:t.Opt(s)}),U=t.Variant({RewardToNeuron:ht,RewardToAccount:Dt}),I=t.Record({node_provider:t.Opt(p),reward_mode:t.Opt(U),amount_e8s:t.Nat64}),vt=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n))}),At=t.Record({rewards:t.Vec(I)}),He=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:L,ManageNeuron:et,ExecuteNnsFunction:jt,RewardNodeProvider:I,SetDefaultFollowees:vt,RewardNodeProviders:At,ManageNetworkEconomics:u,ApproveGenesisKyc:He,AddOrRemoveNodeProvider:l,Motion:B});o.fill(t.Record({url:t.Text,title:t.Opt(t.Text),action:t.Opt(E),summary:t.Text}));let R=t.Record({current_deadline_timestamp_seconds:t.Nat64}),C=t.Record({id:t.Opt(r),failure_reason:t.Opt(G),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(R),executed_timestamp_seconds:t.Nat64}),S=t.Variant({Spawn:ee,Split:ce,Configure:Be,Merge:de,DisburseToNeuron:ve,ClaimOrRefreshNeuron:Se,MergeMaturity:Ne,Disburse:Ue}),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)}),v=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}),N=t.Variant({Ok:t.Null,Err:G}),H=t.Variant({Error:G,NeuronId:r}),J=t.Record({result:t.Opt(H)}),re=t.Variant({Ok:Q,Err:G}),Ee=t.Variant({Ok:At,Err:G}),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:G}),z=t.Record({id:t.Opt(r),status:t.Int32,topic:t.Int32,failure_reason:t.Opt(G),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}),Qe=t.Record({known_neurons:t.Vec(L)}),Rt=t.Record({neuron_ids:t.Vec(t.Nat64),include_neurons_readable_by_caller:t.Bool}),Ht=t.Record({neuron_infos:t.Vec(t.Tuple(t.Nat64,me)),full_neurons:t.Vec(Q)}),qt=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)}),tt=t.Record({proposal_info:t.Vec(z)}),ne=t.Record({created_neuron_id:t.Opt(r)}),qe=t.Record({refreshed_neuron_id:t.Opt(r)}),Ge=t.Record({proposal_id:t.Opt(r)}),be=t.Record({merged_maturity_e8s:t.Nat64,new_stake_e8s:t.Nat64}),Go=t.Record({transfer_block_height:t.Nat64}),Po=t.Variant({Error:G,Spawn:ne,Split:ne,Follow:t.Record({}),ClaimOrRefresh:qe,Configure:t.Record({}),RegisterVote:t.Record({}),Merge:t.Record({}),DisburseToNeuron:ne,MakeProposal:Ge,MergeMaturity:be,Disburse:Go}),ye=t.Record({command:t.Opt(Po)}),ko=t.Record({reward_account:t.Opt(s)});return t.Service({claim_gtc_neurons:t.Func([t.Principal,t.Vec(r)],[N],[]),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([Re],[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([Re],[oe],["query"]),get_pending_proposals:t.Func([],[t.Vec(z)],["query"]),get_proposal_info:t.Func([t.Nat64],[t.Opt(z)],["query"]),list_known_neurons:t.Func([],[Qe],["query"]),list_neurons:t.Func([Rt],[Ht],["query"]),list_proposals:t.Func([qt],[tt],["query"]),manage_neuron:t.Func([et],[ye],[]),transfer_gtc_neuron:t.Func([r,r],[N],[]),update_node_provider:t.Func([ko],[N],["query"])})};var ho=rt(Mt());var eA=t=>({id:t}),ps=t=>({id:t}),Nh=t=>({followees:t.map(ps)}),Gh=t=>{if("NeuronId"in t)return{NeuronId:{id:t.NeuronId}};if("Subaccount"in t)return{Subaccount:t.Subaccount};throw new Ve(t)},tA=t=>{if("ExecuteNnsFunction"in t){let o=t.ExecuteNnsFunction;return{ExecuteNnsFunction:{nns_function:o.nnsFunctionId,payload:Pn(o.payloadBytes)}}}if("ManageNeuron"in t){let o=t.ManageNeuron;return{ManageNeuron:Hh(o)}}if("ApproveGenesisKyc"in t)return{ApproveGenesisKyc:{principals:t.ApproveGenesisKyc.principals.map(ho.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?[An(o.nodeProvider)]:[],amount_e8s:o.amountE8s,reward_mode:o.rewardMode!=null?[oA(o.rewardMode)]:[]}}}if("RewardNodeProviders"in t)return{RewardNodeProviders:{rewards:t.RewardNodeProviders.rewards.map(r=>({node_provider:r.nodeProvider?[An(r.nodeProvider)]:[],amount_e8s:r.amountE8s,reward_mode:r.rewardMode!=null?[oA(r.rewardMode)]:[]}))}};if("AddOrRemoveNodeProvider"in t){let o=t.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:o.change?[Uh(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,Nh(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 Ve(t)},Ph=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(ps)}}}if("ClaimOrRefresh"in t){let o=t.ClaimOrRefresh;return{ClaimOrRefresh:{by:o.by?[Dh(o.by)]:[]}}}if("Configure"in t){let o=t.Configure;return{Configure:{operation:o.operation?[kh(o.operation)]:[]}}}if("RegisterVote"in t){let o=t.RegisterVote;return{RegisterVote:{vote:o.vote,proposal:o.proposal?[eA(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?[ho.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?[tA(o.action)]:[],summary:o.summary}}}if("Disburse"in t){let o=t.Disburse;return{Disburse:{to_account:o.toAccountId?[As(o.toAccountId)]:[],amount:o.amount?[jh(o.amount)]:[]}}}if("Spawn"in t){let o=t.Spawn;return{Spawn:{new_controller:o.newController?[ho.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 Ve(t)},kh=t=>{if("RemoveHotKey"in t){let o=t.RemoveHotKey;return{RemoveHotKey:{hot_key_to_remove:o.hotKeyToRemove!=null?[ho.Principal.fromText(o.hotKeyToRemove)]:[]}}}if("AddHotKey"in t){let o=t.AddHotKey;return{AddHotKey:{new_hot_key:o.newHotKey?[ho.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 Ve(t)},Uh=t=>{if("ToRemove"in t)return{ToRemove:An(t.ToRemove)};if("ToAdd"in t)return{ToAdd:An(t.ToAdd)};throw new Ve(t)},An=t=>({id:t.id!=null?[ho.Principal.fromText(t.id)]:[],reward_account:t.rewardAccount!=null?[As(t.rewardAccount)]:[]}),jh=t=>({e8s:t}),As=t=>{let o=ya(t);return{hash:Pn(o)}},oA=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?[As(t.RewardToAccount.toAccount)]:[]}};throw new Ve(t)},Dh=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 Ve(t)},rA=t=>({neuron_ids:t??[],include_neurons_readable_by_caller:!t}),Hh=({id:t,command:o,neuronIdOrSubaccount:r})=>({id:t?[ps(t)]:[],command:o?[Ph(o)]:[],neuron_id_or_subaccount:r?[Gh(r)]:[]});var nA=({includeRewardStatus:t,beforeProposal:o,excludeTopic:r,includeStatus:n,limit:i})=>({include_reward_status:t,before_proposal:o?[eA(o)]:[],limit:i,exclude_topic:r,include_status:n}),iA=t=>({id:[],command:[{ClaimOrRefresh:{by:[{NeuronIdOrSubaccount:{}}]}}],neuron_id_or_subaccount:[{NeuronId:{id:t.neuronId}}]});var sA=({neuronId:t,vote:o,proposalId:r})=>({id:[{id:t}],command:[{RegisterVote:{vote:o,proposal:[{id:r}]}}],neuron_id_or_subaccount:[]}),aA=t=>{let o={MakeProposal:{url:t.url,title:t.title!=null?[t.title]:[],summary:t.summary,action:[tA(t.action)]}};return{id:[],command:[o],neuron_id_or_subaccount:[{NeuronId:{id:t.neuronId}}]}},gA=({neuronId:t,topic:o,followees:r})=>({id:[{id:t}],command:[{Follow:{topic:o,followees:r.map(n=>({id:n}))}}],neuron_id_or_subaccount:[]}),pA=({neuronId:t,additionalDissolveDelaySeconds:o})=>({id:[{id:t}],command:[{Configure:{operation:[{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:o}}]}}],neuron_id_or_subaccount:[]}),AA=t=>({id:[{id:t}],command:[{Configure:{operation:[{JoinCommunityFund:{}}]}}],neuron_id_or_subaccount:[]}),uA=t=>({id:[{id:t}],command:[{Configure:{operation:[{StartDissolving:{}}]}}],neuron_id_or_subaccount:[]}),cA=t=>({id:[{id:t}],command:[{Configure:{operation:[{StopDissolving:{}}]}}],neuron_id_or_subaccount:[]});var un=rt(Mt()),lA=un.Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),dA=un.Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),fA=un.Principal.fromText("ryjl3-tyaaa-aaaaa-aaaba-cai");var Je=rt(vo()),MA=require("buffer");var m=rt(vo()),hA=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)}),BA=m.IDL.Record({subnet_id:m.IDL.Principal,node_ids:m.IDL.Vec(m.IDL.Principal)}),qh=m.IDL.Record({latitude:m.IDL.Float32,longitude:m.IDL.Float32}),Wh=m.IDL.Record({id:m.IDL.Text,gps:m.IDL.Opt(qh),region:m.IDL.Text,owner:m.IDL.Text}),EA=m.IDL.Record({data_centers_to_add:m.IDL.Vec(Wh),data_centers_to_remove:m.IDL.Vec(m.IDL.Text)}),bA=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}),yA=m.IDL.Record({ecdsa_signatures:m.IDL.Bool}),_A=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:yA,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:_A,gossip_retransmission_request_ms:m.IDL.Nat32,gossip_receive_check_cache_size:m.IDL.Nat32,node_ids:m.IDL.Vec(m.IDL.Principal)}),mA=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}),lE=m.IDL.Record({node_operators_to_remove:m.IDL.Vec(m.IDL.Vec(m.IDL.Nat8))}),us=m.IDL.Record({node_ids:m.IDL.Vec(m.IDL.Principal)}),dE=m.IDL.Record({range_end_inclusive:m.IDL.Principal,range_start_inclusive:m.IDL.Principal,destination_subnet:m.IDL.Principal}),CA=m.IDL.Record({who:m.IDL.Opt(m.IDL.Principal),subnets:m.IDL.Vec(m.IDL.Principal)}),xA=m.IDL.Record({ipv4_prefixes:m.IDL.Vec(m.IDL.Text),firewall_config:m.IDL.Text,ipv6_prefixes:m.IDL.Vec(m.IDL.Text)}),Vh=m.IDL.Variant({Start:m.IDL.Null,Stop:m.IDL.Null}),SA=m.IDL.Record({action:Vh,canister_id:m.IDL.Principal}),wA=m.IDL.Record({data_source:m.IDL.Text,xdr_permyriad_per_icp:m.IDL.Nat64,timestamp_seconds:m.IDL.Nat64}),vA=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)}),Yh=m.IDL.Record({xdr_permyriad_per_node_per_month:m.IDL.Nat64}),zh=m.IDL.Record({rates:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,Yh))}),RA=m.IDL.Record({new_entries:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,zh))}),QA=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(yA),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(_A),ssh_readonly_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text))}),FA=m.IDL.Record({subnet_id:m.IDL.Principal,replica_version_id:m.IDL.Text}),TA=m.IDL.Record({replica_version:m.IDL.Opt(m.IDL.Text),ssh_readonly_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text))});var OA=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--"}},NA=(t,o)=>{let r=new MA.Buffer(o);try{switch(t){case 1:return Je.IDL.decode([IA],r)[0];case 2:return Je.IDL.decode([BA],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 Je.IDL.decode([bA],r)[0];case 6:return Je.IDL.decode([mA],r)[0];case 7:return Je.IDL.decode([QA],r)[0];case 8:return Je.IDL.decode([hA],r)[0];case 9:return{"Unable to display payload":"Payload too large"};case 10:return Je.IDL.decode([wA],r)[0];case 11:return Je.IDL.decode([FA],r)[0];case 12:return{};case 13:return Je.IDL.decode([us],r)[0];case 14:return Je.IDL.decode([CA],r)[0];case 15:return Je.IDL.decode([xA],r)[0];case 16:return Je.IDL.decode([vA],r)[0];case 17:return Je.IDL.decode([SA],r)[0];case 18:return Je.IDL.decode([us],r)[0];case 20:return Je.IDL.decode([RA],r)[0];case 21:return Je.IDL.decode([EA],r)[0];case 22:return Je.IDL.decode([TA],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 Lh=({neuronId:t,principalString:o,neuronInfo:r,rawNeuron:n})=>{let i=n?Jh({neuron:n,principalString:o}):void 0;return{neuronId:t,dissolveDelaySeconds:r.dissolve_delay_seconds,recentBallots:r.recent_ballots.map(GA),createdTimestampSeconds:r.created_timestamp_seconds,state:r.state,joinedCommunityFundTimestampSeconds:r.joined_community_fund_timestamp_seconds.length?r.joined_community_fund_timestamp_seconds[0]:void 0,retrievedAtTimestampSeconds:r.retrieved_at_timestamp_seconds,votingPower:r.voting_power,ageSeconds:r.age_seconds,fullNeuron:i}},Jh=({neuron:t,principalString:o})=>({id:t.id.length?eo(t.id[0]):void 0,isCurrentUserController:t.controller.length?t.controller[0].toString()===o:void 0,controller:t.controller.length?t.controller[0].toString():void 0,recentBallots:t.recent_ballots.map(GA),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(r=>r.toString()),accountIdentifier:Ia(lA,kn(t.account)),joinedCommunityFundTimestampSeconds:t.joined_community_fund_timestamp_seconds.length?t.joined_community_fund_timestamp_seconds[0]:void 0,dissolveState:t.dissolve_state.length?Kh(t.dissolve_state[0]):void 0,followees:t.followees.map(([r,n])=>PA({topic:r,followees:n}))}),GA=({vote:t,proposal_id:o})=>({vote:t,proposalId:o.length?eo(o[0]):void 0}),Kh=t=>"DissolveDelaySeconds"in t?{DissolveDelaySeconds:t.DissolveDelaySeconds}:{WhenDissolvedTimestampSeconds:t.WhenDissolvedTimestampSeconds},PA=({topic:t,followees:o})=>({topic:t,followees:o.followees.map(eo)}),eo=({id:t})=>t,Zh=t=>{if("NeuronId"in t)return{NeuronId:t.NeuronId.id};if("Subaccount"in t)return{Subaccount:t.Subaccount};throw new Ve(t)},Xh=({neuronId:t,ballot:o})=>{let{vote:r,voting_power:n}=o;return{neuronId:t,vote:r,votingPower:n}},$h=({title:t,url:o,action:r,summary:n})=>({title:t.length?t[0]:void 0,url:o,action:r.length?kA(r[0]):void 0,summary:n}),kA=t=>{if("ExecuteNnsFunction"in t){let o=t.ExecuteNnsFunction,r=Ea(o.payload),n=r.byteLength?NA(o.nns_function,r):void 0;return{ExecuteNnsFunction:{nnsFunctionId:o.nns_function,nnsFunctionName:OA(o.nns_function),payload:n,payloadBytes:r}}}if("ManageNeuron"in t){let o=t.ManageNeuron;return{ManageNeuron:{id:o.id.length?eo(o.id[0]):void 0,command:o.command.length?t0(o.command[0]):void 0,neuronIdOrSubaccount:o.neuron_id_or_subaccount.length?Zh(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?cn(o.node_provider[0]):void 0,amountE8s:o.amount_e8s,rewardMode:o.reward_mode.length?UA(o.reward_mode[0]):void 0}}}if("RewardNodeProviders"in t)return{RewardNodeProviders:{rewards:t.RewardNodeProviders.rewards.map(r=>({nodeProvider:r.node_provider.length?cn(r.node_provider[0]):void 0,amountE8s:r.amount_e8s,rewardMode:r.reward_mode.length?UA(r.reward_mode[0]):void 0}))}};if("AddOrRemoveNodeProvider"in t){let o=t.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:o.change.length?r0(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])=>PA({topic:r,followees:n}))}};if("RegisterKnownNeuron"in t){let o=t.RegisterKnownNeuron;return{RegisterKnownNeuron:s0(o)}}throw new Ve(t)},e0=t=>({no:t.no,yes:t.yes,total:t.total,timestampSeconds:t.timestamp_seconds}),t0=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(eo)}}}if("ClaimOrRefresh"in t){let o=t.ClaimOrRefresh;return{ClaimOrRefresh:{by:o.by.length?i0(o.by[0]):void 0}}}if("Configure"in t){let o=t.Configure;return{Configure:{operation:o.operation.length?o0(o.operation[0]):void 0}}}if("RegisterVote"in t){let o=t.RegisterVote;return{RegisterVote:{vote:o.vote,proposal:o.proposal.length?eo(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?kA(o.action[0]):void 0,summary:o.summary}}}if("Disburse"in t){let o=t.Disburse;return{Disburse:{toAccountId:o.to_account.length?cs(o.to_account[0]):void 0,amount:o.amount.length?n0(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 Ve(t)},o0=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 Ve(t)},r0=t=>{if("ToRemove"in t)return{ToRemove:cn(t.ToRemove)};if("ToAdd"in t)return{ToAdd:cn(t.ToAdd)};throw new Ve(t)},cn=t=>({id:t.id.length?t.id[0].toString():void 0,rewardAccount:t.reward_account.length?cs(t.reward_account[0]):void 0}),n0=t=>t.e8s,cs=t=>_a(new Uint8Array(t.hash)),UA=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?cs(t.RewardToAccount.to_account[0]):void 0}};throw new Ve(t)},i0=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 Ve(t)},ls=t=>({id:t.id.length?eo(t.id[0]):void 0,ballots:t.ballots.map(o=>Xh({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?$h(t.proposal[0]):void 0,proposer:t.proposer.length?eo(t.proposer[0]):void 0,latestTally:t.latest_tally.length?e0(t.latest_tally[0]):void 0,executedTimestampSeconds:t.executed_timestamp_seconds,topic:t.topic,status:t.status,rewardStatus:t.reward_status}),jA=({neuron_infos:t,full_neurons:o},r)=>t.map(([n,i])=>Lh({neuronId:n,principalString:r.toString(),neuronInfo:i,rawNeuron:o.find(s=>s.id.length&&s.id[0].id===n)})),DA=({proposal_info:t})=>({proposals:t.map(ls)}),s0=({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 to=async({request:t,service:o})=>{let{command:r}=await o.manage_neuron(t),n=r[0];if(!n)throw new Wo({error_message:"Error updating neuron",error_type:0});if("Error"in n)throw new Wo(n.Error)};var ln=rt(pn()),dn=()=>new ln.HttpAgent({host:"https://ic0.app",identity:new ln.AnonymousIdentity});var cr=class{constructor(o,r,n){this.canisterId=o;this.service=r;this.certifiedService=n;this.listNeurons=async({certified:o=!0,principal:r,neuronIds:n})=>{let i=rA(n),s=await this.getGovernanceService(o).list_neurons(i);return jA(s,r)};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=nA(o),i=await this.getGovernanceService(r).list_proposals(n);return DA(i)};this.stakeNeuron=async({stake:o,principal:r,fromSubAccountId:n,ledgerCanister:i})=>{if(o.toE8s()<Ir)throw new yr(ut.fromString("1"));let s=new Uint8Array((0,qA.default)(8)),p=Ba(s),u=this.buildNeuronStakeSubAccount(s,r),h=Kt.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 br;return w};this.increaseDissolveDelay=async({neuronId:o,additionalDissolveDelaySeconds:r})=>{let n=pA({neuronId:o,additionalDissolveDelaySeconds:r});return to({request:n,service:this.certifiedService})};this.startDissolving=async o=>{let r=uA(o);return to({request:r,service:this.certifiedService})};this.stopDissolving=async o=>{let r=cA(o);return to({request:r,service:this.certifiedService})};this.joinCommunityFund=async o=>{let r=AA(o);return to({request:r,service:this.certifiedService})};this.getProposal=async({proposalId:o,certified:r=!0})=>{let[n]=await this.getGovernanceService(r).get_proposal_info(o);return n?ls(n):void 0};this.makeProposal=async o=>{let r=aA(o);return to({request:r,service:this.certifiedService})};this.registerVote=async({neuronId:o,vote:r,proposalId:n})=>{let i=sA({neuronId:o,vote:r,proposalId:n});return to({request:i,service:this.certifiedService})};this.setFollowees=async o=>{let r=gA(o);return to({request:r,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async o=>{let r=await this.certifiedService.claim_or_refresh_neuron_from_account({controller:o.controller?[o.controller]:[],memo:o.memo}),{result:n}=r;if(n.length&&"NeuronId"in n[0])return n[0].NeuronId.id};this.claimOrRefreshNeuron=async o=>{var s;let r=iA(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 _r(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(n)}`)};this.buildNeuronStakeSubAccount=(o,r)=>{let n=Ho("neuron-stake"),i=HA.sha256.create();return i.update([12,...n,...r.toUint8Array(),...o]),oo.fromBytes(new Uint8Array(i.array()))};this.getNeuron=async({certified:o=!0,principal:r,neuronId:n})=>{let[i]=await this.listNeurons({certified:o,principal:r,neuronIds:[n]});return i};this.canisterId=o,this.service=r,this.certifiedService=n}static create(o={}){let r=o.agent??dn(),n=o.canisterId??dA,i=o.serviceOverride??ds.Actor.createActor($p,{agent:r,canisterId:n}),s=o.certifiedServiceOverride??ds.Actor.createActor(Xp,{agent:r,canisterId:n});return new cr(n,i,s)}getGovernanceService(o){return o?this.certifiedService:this.service}};var pt=rt(Br());var fs=rt(pn()),WA=async(t,o,r,n)=>{let i=await t.call(o,{methodName:r,arg:n,effectiveCanisterId:o});if(!i.response.ok)return 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(`
|
|
851
|
+
account-id`),i=ma.sha224.create();i.update([...n,...o.toUint8Array(),...r.toUint8Array()]);let s=new Uint8Array(i.array()),p=jn(s),u=new Uint8Array([...p,...s]);return new Kt(u)}toProto(){let o=new Ca.AccountIdentifier;return o.setHash(this.bytes),o}toHex(){return Un(this.bytes)}},qo=class{constructor(o){this.bytes=o}static fromBytes(o){return o.length!=32?Error("Subaccount length must be 32-bytes"):new qo(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 qo(r)}toUint8Array(){return this.bytes}},oo=qo;oo.ZERO=new qo(new Uint8Array(32).fill(0));var Er=class extends Error{},br=class extends Er{},yr=class extends Er{constructor(o){super();this.minimumAmount=o}},_r=class extends Error{},Wo=class extends Error{constructor(o){super();this.detail=o}},Ve=class extends Error{constructor(o){super("Unsupported value: "+o)}};var Sa=rt(Br());var xa=32,Z0=BigInt(1095062083),X0=BigInt(1347768404),$0=BigInt(1e4),Ir=BigInt(1e8);var Dn=(r=>(r[r.FRACTIONAL_MORE_THAN_8_DECIMALS=0]="FRACTIONAL_MORE_THAN_8_DECIMALS",r[r.INVALID_FORMAT=1]="INVALID_FORMAT",r))(Dn||{});var ut=class{constructor(o){this.e8s=o}static fromE8s(o){return new ut(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)*Ir}catch{return 1}if(i){if(i.length>8)return 0;try{s+=BigInt(i.padEnd(8,"0"))}catch{return 1}}return new ut(s)}toE8s(){return this.e8s}toProto(){let o=new Sa.ICPTs;return o.setE8s(this.e8s.toString()),o}};var ro=class extends Error{},Hn=class extends ro{},qn=class extends ro{constructor(o){super();this.balance=o}},Wn=class extends ro{constructor(o){super();this.allowed_window_secs=o}},Vn=class extends ro{},Yn=class extends ro{constructor(o){super();this.duplicateOf=o}},zn=t=>{let{message:o}=t;if(o.includes("Reject code: 5")){if(o.match(/Sending from (.*) is not allowed/))return new Hn;{let r=o.match(/transaction.*duplicate.* in block (\d+)/);if(r&&r.length>1)return new Yn(BigInt(r[1]))}{let r=o.match(/debit account.*, current balance: (\d*(\.\d*)?)/);if(r&&r.length>1){let n=ut.fromString(r[1]);if(n instanceof ut)return new qn(n)}}if(o.includes("is in future"))return new Vn;{let r=o.match(/older than (\d+)/);if(r&&r.length>1)return new Wn(Number.parseInt(r[1]))}}throw t};var ds=rt(pn()),HA=rt(Eo()),qA=rt(Zp());var Xp=({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}),G=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)}),L=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}),Se=t.Record({by:t.Opt(Ie)}),X=t.Record({hot_key_to_remove:t.Opt(t.Principal)}),Z=t.Record({new_hot_key:t.Opt(t.Principal)}),Ae=t.Record({additional_dissolve_delay_seconds:t.Nat32}),he=t.Record({dissolve_timestamp_seconds:t.Nat64}),q=t.Variant({RemoveHotKey:X,AddHotKey:Z,StopDissolving:t.Record({}),StartDissolving:t.Record({}),IncreaseDissolveDelay:Ae,JoinCommunityFund:t.Record({}),SetDissolveTimestamp:he}),Be=t.Record({operation:t.Opt(q)}),le=t.Record({vote:t.Int32,proposal:t.Opt(r)}),de=t.Record({source_neuron_id:t.Opt(r)}),ve=t.Record({dissolve_delay_seconds:t.Nat64,kyc_verified:t.Bool,amount_e8s:t.Nat64,new_controller:t.Opt(t.Principal),nonce:t.Nat64}),Ne=t.Record({percentage_to_merge:t.Nat32}),$e=t.Record({e8s:t.Nat64}),Ue=t.Record({to_account:t.Opt(s),amount:t.Opt($e)}),it=t.Variant({Spawn:ee,Split:ce,Follow:te,ClaimOrRefresh:Se,Configure:Be,RegisterVote:le,Merge:de,DisburseToNeuron:ve,MakeProposal:o,MergeMaturity:Ne,Disburse:Ue}),Re=t.Variant({Subaccount:t.Vec(t.Nat8),NeuronId:r}),et=t.Record({id:t.Opt(r),command:t.Opt(it),neuron_id_or_subaccount:t.Opt(Re)}),jt=t.Record({nns_function:t.Int32,payload:t.Vec(t.Nat8)}),ht=t.Record({dissolve_delay_seconds:t.Nat64}),Dt=t.Record({to_account:t.Opt(s)}),U=t.Variant({RewardToNeuron:ht,RewardToAccount:Dt}),I=t.Record({node_provider:t.Opt(p),reward_mode:t.Opt(U),amount_e8s:t.Nat64}),vt=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n))}),At=t.Record({rewards:t.Vec(I)}),He=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:L,ManageNeuron:et,ExecuteNnsFunction:jt,RewardNodeProvider:I,SetDefaultFollowees:vt,RewardNodeProviders:At,ManageNetworkEconomics:u,ApproveGenesisKyc:He,AddOrRemoveNodeProvider:l,Motion:B});o.fill(t.Record({url:t.Text,title:t.Opt(t.Text),action:t.Opt(E),summary:t.Text}));let R=t.Record({current_deadline_timestamp_seconds:t.Nat64}),C=t.Record({id:t.Opt(r),failure_reason:t.Opt(G),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(R),executed_timestamp_seconds:t.Nat64}),S=t.Variant({Spawn:ee,Split:ce,Configure:Be,Merge:de,DisburseToNeuron:ve,ClaimOrRefreshNeuron:Se,MergeMaturity:Ne,Disburse:Ue}),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)}),v=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}),N=t.Variant({Ok:t.Null,Err:G}),H=t.Variant({Error:G,NeuronId:r}),J=t.Record({result:t.Opt(H)}),re=t.Variant({Ok:Q,Err:G}),Ee=t.Variant({Ok:At,Err:G}),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:G}),z=t.Record({id:t.Opt(r),status:t.Int32,topic:t.Int32,failure_reason:t.Opt(G),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}),Qe=t.Record({known_neurons:t.Vec(L)}),Rt=t.Record({neuron_ids:t.Vec(t.Nat64),include_neurons_readable_by_caller:t.Bool}),Ht=t.Record({neuron_infos:t.Vec(t.Tuple(t.Nat64,me)),full_neurons:t.Vec(Q)}),qt=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)}),tt=t.Record({proposal_info:t.Vec(z)}),ne=t.Record({created_neuron_id:t.Opt(r)}),qe=t.Record({refreshed_neuron_id:t.Opt(r)}),Ge=t.Record({proposal_id:t.Opt(r)}),be=t.Record({merged_maturity_e8s:t.Nat64,new_stake_e8s:t.Nat64}),Go=t.Record({transfer_block_height:t.Nat64}),Po=t.Variant({Error:G,Spawn:ne,Split:ne,Follow:t.Record({}),ClaimOrRefresh:qe,Configure:t.Record({}),RegisterVote:t.Record({}),Merge:t.Record({}),DisburseToNeuron:ne,MakeProposal:Ge,MergeMaturity:be,Disburse:Go}),ye=t.Record({command:t.Opt(Po)}),ko=t.Record({reward_account:t.Opt(s)});return t.Service({claim_gtc_neurons:t.Func([t.Principal,t.Vec(r)],[N],[]),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([Re],[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([Re],[oe],[]),get_pending_proposals:t.Func([],[t.Vec(z)],[]),get_proposal_info:t.Func([t.Nat64],[t.Opt(z)],[]),list_known_neurons:t.Func([],[Qe],[]),list_neurons:t.Func([Rt],[Ht],[]),list_proposals:t.Func([qt],[tt],[]),manage_neuron:t.Func([et],[ye],[]),transfer_gtc_neuron:t.Func([r,r],[N],[]),update_node_provider:t.Func([ko],[N],[])})};var $p=({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}),G=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)}),L=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}),Se=t.Record({by:t.Opt(Ie)}),X=t.Record({hot_key_to_remove:t.Opt(t.Principal)}),Z=t.Record({new_hot_key:t.Opt(t.Principal)}),Ae=t.Record({additional_dissolve_delay_seconds:t.Nat32}),he=t.Record({dissolve_timestamp_seconds:t.Nat64}),q=t.Variant({RemoveHotKey:X,AddHotKey:Z,StopDissolving:t.Record({}),StartDissolving:t.Record({}),IncreaseDissolveDelay:Ae,JoinCommunityFund:t.Record({}),SetDissolveTimestamp:he}),Be=t.Record({operation:t.Opt(q)}),le=t.Record({vote:t.Int32,proposal:t.Opt(r)}),de=t.Record({source_neuron_id:t.Opt(r)}),ve=t.Record({dissolve_delay_seconds:t.Nat64,kyc_verified:t.Bool,amount_e8s:t.Nat64,new_controller:t.Opt(t.Principal),nonce:t.Nat64}),Ne=t.Record({percentage_to_merge:t.Nat32}),$e=t.Record({e8s:t.Nat64}),Ue=t.Record({to_account:t.Opt(s),amount:t.Opt($e)}),it=t.Variant({Spawn:ee,Split:ce,Follow:te,ClaimOrRefresh:Se,Configure:Be,RegisterVote:le,Merge:de,DisburseToNeuron:ve,MakeProposal:o,MergeMaturity:Ne,Disburse:Ue}),Re=t.Variant({Subaccount:t.Vec(t.Nat8),NeuronId:r}),et=t.Record({id:t.Opt(r),command:t.Opt(it),neuron_id_or_subaccount:t.Opt(Re)}),jt=t.Record({nns_function:t.Int32,payload:t.Vec(t.Nat8)}),ht=t.Record({dissolve_delay_seconds:t.Nat64}),Dt=t.Record({to_account:t.Opt(s)}),U=t.Variant({RewardToNeuron:ht,RewardToAccount:Dt}),I=t.Record({node_provider:t.Opt(p),reward_mode:t.Opt(U),amount_e8s:t.Nat64}),vt=t.Record({default_followees:t.Vec(t.Tuple(t.Int32,n))}),At=t.Record({rewards:t.Vec(I)}),He=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:L,ManageNeuron:et,ExecuteNnsFunction:jt,RewardNodeProvider:I,SetDefaultFollowees:vt,RewardNodeProviders:At,ManageNetworkEconomics:u,ApproveGenesisKyc:He,AddOrRemoveNodeProvider:l,Motion:B});o.fill(t.Record({url:t.Text,title:t.Opt(t.Text),action:t.Opt(E),summary:t.Text}));let R=t.Record({current_deadline_timestamp_seconds:t.Nat64}),C=t.Record({id:t.Opt(r),failure_reason:t.Opt(G),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(R),executed_timestamp_seconds:t.Nat64}),S=t.Variant({Spawn:ee,Split:ce,Configure:Be,Merge:de,DisburseToNeuron:ve,ClaimOrRefreshNeuron:Se,MergeMaturity:Ne,Disburse:Ue}),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)}),v=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}),N=t.Variant({Ok:t.Null,Err:G}),H=t.Variant({Error:G,NeuronId:r}),J=t.Record({result:t.Opt(H)}),re=t.Variant({Ok:Q,Err:G}),Ee=t.Variant({Ok:At,Err:G}),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:G}),z=t.Record({id:t.Opt(r),status:t.Int32,topic:t.Int32,failure_reason:t.Opt(G),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}),Qe=t.Record({known_neurons:t.Vec(L)}),Rt=t.Record({neuron_ids:t.Vec(t.Nat64),include_neurons_readable_by_caller:t.Bool}),Ht=t.Record({neuron_infos:t.Vec(t.Tuple(t.Nat64,me)),full_neurons:t.Vec(Q)}),qt=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)}),tt=t.Record({proposal_info:t.Vec(z)}),ne=t.Record({created_neuron_id:t.Opt(r)}),qe=t.Record({refreshed_neuron_id:t.Opt(r)}),Ge=t.Record({proposal_id:t.Opt(r)}),be=t.Record({merged_maturity_e8s:t.Nat64,new_stake_e8s:t.Nat64}),Go=t.Record({transfer_block_height:t.Nat64}),Po=t.Variant({Error:G,Spawn:ne,Split:ne,Follow:t.Record({}),ClaimOrRefresh:qe,Configure:t.Record({}),RegisterVote:t.Record({}),Merge:t.Record({}),DisburseToNeuron:ne,MakeProposal:Ge,MergeMaturity:be,Disburse:Go}),ye=t.Record({command:t.Opt(Po)}),ko=t.Record({reward_account:t.Opt(s)});return t.Service({claim_gtc_neurons:t.Func([t.Principal,t.Vec(r)],[N],[]),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([Re],[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([Re],[oe],["query"]),get_pending_proposals:t.Func([],[t.Vec(z)],["query"]),get_proposal_info:t.Func([t.Nat64],[t.Opt(z)],["query"]),list_known_neurons:t.Func([],[Qe],["query"]),list_neurons:t.Func([Rt],[Ht],["query"]),list_proposals:t.Func([qt],[tt],["query"]),manage_neuron:t.Func([et],[ye],[]),transfer_gtc_neuron:t.Func([r,r],[N],[]),update_node_provider:t.Func([ko],[N],["query"])})};var ho=rt(Mt());var eA=t=>({id:t}),ps=t=>({id:t}),Nh=t=>({followees:t.map(ps)}),Gh=t=>{if("NeuronId"in t)return{NeuronId:{id:t.NeuronId}};if("Subaccount"in t)return{Subaccount:t.Subaccount};throw new Ve(t)},tA=t=>{if("ExecuteNnsFunction"in t){let o=t.ExecuteNnsFunction;return{ExecuteNnsFunction:{nns_function:o.nnsFunctionId,payload:Pn(o.payloadBytes)}}}if("ManageNeuron"in t){let o=t.ManageNeuron;return{ManageNeuron:Hh(o)}}if("ApproveGenesisKyc"in t)return{ApproveGenesisKyc:{principals:t.ApproveGenesisKyc.principals.map(ho.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?[An(o.nodeProvider)]:[],amount_e8s:o.amountE8s,reward_mode:o.rewardMode!=null?[oA(o.rewardMode)]:[]}}}if("RewardNodeProviders"in t)return{RewardNodeProviders:{rewards:t.RewardNodeProviders.rewards.map(r=>({node_provider:r.nodeProvider?[An(r.nodeProvider)]:[],amount_e8s:r.amountE8s,reward_mode:r.rewardMode!=null?[oA(r.rewardMode)]:[]}))}};if("AddOrRemoveNodeProvider"in t){let o=t.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:o.change?[Uh(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,Nh(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 Ve(t)},Ph=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(ps)}}}if("ClaimOrRefresh"in t){let o=t.ClaimOrRefresh;return{ClaimOrRefresh:{by:o.by?[Dh(o.by)]:[]}}}if("Configure"in t){let o=t.Configure;return{Configure:{operation:o.operation?[kh(o.operation)]:[]}}}if("RegisterVote"in t){let o=t.RegisterVote;return{RegisterVote:{vote:o.vote,proposal:o.proposal?[eA(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?[ho.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?[tA(o.action)]:[],summary:o.summary}}}if("Disburse"in t){let o=t.Disburse;return{Disburse:{to_account:o.toAccountId?[As(o.toAccountId)]:[],amount:o.amount?[jh(o.amount)]:[]}}}if("Spawn"in t){let o=t.Spawn;return{Spawn:{new_controller:o.newController?[ho.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 Ve(t)},kh=t=>{if("RemoveHotKey"in t){let o=t.RemoveHotKey;return{RemoveHotKey:{hot_key_to_remove:o.hotKeyToRemove!=null?[ho.Principal.fromText(o.hotKeyToRemove)]:[]}}}if("AddHotKey"in t){let o=t.AddHotKey;return{AddHotKey:{new_hot_key:o.newHotKey?[ho.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 Ve(t)},Uh=t=>{if("ToRemove"in t)return{ToRemove:An(t.ToRemove)};if("ToAdd"in t)return{ToAdd:An(t.ToAdd)};throw new Ve(t)},An=t=>({id:t.id!=null?[ho.Principal.fromText(t.id)]:[],reward_account:t.rewardAccount!=null?[As(t.rewardAccount)]:[]}),jh=t=>({e8s:t}),As=t=>{let o=ya(t);return{hash:Pn(o)}},oA=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?[As(t.RewardToAccount.toAccount)]:[]}};throw new Ve(t)},Dh=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 Ve(t)},rA=t=>({neuron_ids:t??[],include_neurons_readable_by_caller:!t}),Hh=({id:t,command:o,neuronIdOrSubaccount:r})=>({id:t?[ps(t)]:[],command:o?[Ph(o)]:[],neuron_id_or_subaccount:r?[Gh(r)]:[]});var nA=({includeRewardStatus:t,beforeProposal:o,excludeTopic:r,includeStatus:n,limit:i})=>({include_reward_status:t,before_proposal:o?[eA(o)]:[],limit:i,exclude_topic:r,include_status:n}),iA=t=>({id:[],command:[{ClaimOrRefresh:{by:[{NeuronIdOrSubaccount:{}}]}}],neuron_id_or_subaccount:[{NeuronId:{id:t.neuronId}}]});var sA=({neuronId:t,vote:o,proposalId:r})=>({id:[{id:t}],command:[{RegisterVote:{vote:o,proposal:[{id:r}]}}],neuron_id_or_subaccount:[]}),aA=t=>{let o={MakeProposal:{url:t.url,title:t.title!=null?[t.title]:[],summary:t.summary,action:[tA(t.action)]}};return{id:[],command:[o],neuron_id_or_subaccount:[{NeuronId:{id:t.neuronId}}]}},gA=({neuronId:t,topic:o,followees:r})=>({id:[{id:t}],command:[{Follow:{topic:o,followees:r.map(n=>({id:n}))}}],neuron_id_or_subaccount:[]}),pA=({neuronId:t,additionalDissolveDelaySeconds:o})=>({id:[{id:t}],command:[{Configure:{operation:[{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:o}}]}}],neuron_id_or_subaccount:[]}),AA=t=>({id:[{id:t}],command:[{Configure:{operation:[{JoinCommunityFund:{}}]}}],neuron_id_or_subaccount:[]}),uA=t=>({id:[{id:t}],command:[{Configure:{operation:[{StartDissolving:{}}]}}],neuron_id_or_subaccount:[]}),cA=t=>({id:[{id:t}],command:[{Configure:{operation:[{StopDissolving:{}}]}}],neuron_id_or_subaccount:[]});var un=rt(Mt()),lA=un.Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),dA=un.Principal.fromText("rrkah-fqaaa-aaaaa-aaaaq-cai"),fA=un.Principal.fromText("ryjl3-tyaaa-aaaaa-aaaba-cai");var Je=rt(vo()),MA=require("buffer");var m=rt(vo()),hA=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)}),BA=m.IDL.Record({subnet_id:m.IDL.Principal,node_ids:m.IDL.Vec(m.IDL.Principal)}),qh=m.IDL.Record({latitude:m.IDL.Float32,longitude:m.IDL.Float32}),Wh=m.IDL.Record({id:m.IDL.Text,gps:m.IDL.Opt(qh),region:m.IDL.Text,owner:m.IDL.Text}),EA=m.IDL.Record({data_centers_to_add:m.IDL.Vec(Wh),data_centers_to_remove:m.IDL.Vec(m.IDL.Text)}),bA=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}),yA=m.IDL.Record({ecdsa_signatures:m.IDL.Bool}),_A=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:yA,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:_A,gossip_retransmission_request_ms:m.IDL.Nat32,gossip_receive_check_cache_size:m.IDL.Nat32,node_ids:m.IDL.Vec(m.IDL.Principal)}),mA=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}),lE=m.IDL.Record({node_operators_to_remove:m.IDL.Vec(m.IDL.Vec(m.IDL.Nat8))}),us=m.IDL.Record({node_ids:m.IDL.Vec(m.IDL.Principal)}),dE=m.IDL.Record({range_end_inclusive:m.IDL.Principal,range_start_inclusive:m.IDL.Principal,destination_subnet:m.IDL.Principal}),CA=m.IDL.Record({who:m.IDL.Opt(m.IDL.Principal),subnets:m.IDL.Vec(m.IDL.Principal)}),xA=m.IDL.Record({ipv4_prefixes:m.IDL.Vec(m.IDL.Text),firewall_config:m.IDL.Text,ipv6_prefixes:m.IDL.Vec(m.IDL.Text)}),Vh=m.IDL.Variant({Start:m.IDL.Null,Stop:m.IDL.Null}),SA=m.IDL.Record({action:Vh,canister_id:m.IDL.Principal}),wA=m.IDL.Record({data_source:m.IDL.Text,xdr_permyriad_per_icp:m.IDL.Nat64,timestamp_seconds:m.IDL.Nat64}),vA=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)}),Yh=m.IDL.Record({xdr_permyriad_per_node_per_month:m.IDL.Nat64}),zh=m.IDL.Record({rates:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,Yh))}),RA=m.IDL.Record({new_entries:m.IDL.Vec(m.IDL.Tuple(m.IDL.Text,zh))}),QA=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(yA),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(_A),ssh_readonly_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text))}),FA=m.IDL.Record({subnet_id:m.IDL.Principal,replica_version_id:m.IDL.Text}),TA=m.IDL.Record({replica_version:m.IDL.Opt(m.IDL.Text),ssh_readonly_access:m.IDL.Opt(m.IDL.Vec(m.IDL.Text))});var OA=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--"}},NA=(t,o)=>{let r=new MA.Buffer(o);try{switch(t){case 1:return Je.IDL.decode([IA],r)[0];case 2:return Je.IDL.decode([BA],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 Je.IDL.decode([bA],r)[0];case 6:return Je.IDL.decode([mA],r)[0];case 7:return Je.IDL.decode([QA],r)[0];case 8:return Je.IDL.decode([hA],r)[0];case 9:return{"Unable to display payload":"Payload too large"};case 10:return Je.IDL.decode([wA],r)[0];case 11:return Je.IDL.decode([FA],r)[0];case 12:return{};case 13:return Je.IDL.decode([us],r)[0];case 14:return Je.IDL.decode([CA],r)[0];case 15:return Je.IDL.decode([xA],r)[0];case 16:return Je.IDL.decode([vA],r)[0];case 17:return Je.IDL.decode([SA],r)[0];case 18:return Je.IDL.decode([us],r)[0];case 20:return Je.IDL.decode([RA],r)[0];case 21:return Je.IDL.decode([EA],r)[0];case 22:return Je.IDL.decode([TA],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 Lh=({neuronId:t,neuronInfo:o,rawNeuron:r})=>{let n=r?Jh(r):void 0;return{neuronId:t,dissolveDelaySeconds:o.dissolve_delay_seconds,recentBallots:o.recent_ballots.map(GA),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}},Jh=t=>({id:t.id.length?eo(t.id[0]):void 0,controller:t.controller.length?t.controller[0].toString():void 0,recentBallots:t.recent_ballots.map(GA),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:Ia(lA,kn(t.account)),joinedCommunityFundTimestampSeconds:t.joined_community_fund_timestamp_seconds.length?t.joined_community_fund_timestamp_seconds[0]:void 0,dissolveState:t.dissolve_state.length?Kh(t.dissolve_state[0]):void 0,followees:t.followees.map(([o,r])=>PA({topic:o,followees:r}))}),GA=({vote:t,proposal_id:o})=>({vote:t,proposalId:o.length?eo(o[0]):void 0}),Kh=t=>"DissolveDelaySeconds"in t?{DissolveDelaySeconds:t.DissolveDelaySeconds}:{WhenDissolvedTimestampSeconds:t.WhenDissolvedTimestampSeconds},PA=({topic:t,followees:o})=>({topic:t,followees:o.followees.map(eo)}),eo=({id:t})=>t,Zh=t=>{if("NeuronId"in t)return{NeuronId:t.NeuronId.id};if("Subaccount"in t)return{Subaccount:t.Subaccount};throw new Ve(t)},Xh=({neuronId:t,ballot:o})=>{let{vote:r,voting_power:n}=o;return{neuronId:t,vote:r,votingPower:n}},$h=({title:t,url:o,action:r,summary:n})=>({title:t.length?t[0]:void 0,url:o,action:r.length?kA(r[0]):void 0,summary:n}),kA=t=>{if("ExecuteNnsFunction"in t){let o=t.ExecuteNnsFunction,r=Ea(o.payload),n=r.byteLength?NA(o.nns_function,r):void 0;return{ExecuteNnsFunction:{nnsFunctionId:o.nns_function,nnsFunctionName:OA(o.nns_function),payload:n,payloadBytes:r}}}if("ManageNeuron"in t){let o=t.ManageNeuron;return{ManageNeuron:{id:o.id.length?eo(o.id[0]):void 0,command:o.command.length?t0(o.command[0]):void 0,neuronIdOrSubaccount:o.neuron_id_or_subaccount.length?Zh(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?cn(o.node_provider[0]):void 0,amountE8s:o.amount_e8s,rewardMode:o.reward_mode.length?UA(o.reward_mode[0]):void 0}}}if("RewardNodeProviders"in t)return{RewardNodeProviders:{rewards:t.RewardNodeProviders.rewards.map(r=>({nodeProvider:r.node_provider.length?cn(r.node_provider[0]):void 0,amountE8s:r.amount_e8s,rewardMode:r.reward_mode.length?UA(r.reward_mode[0]):void 0}))}};if("AddOrRemoveNodeProvider"in t){let o=t.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:o.change.length?r0(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])=>PA({topic:r,followees:n}))}};if("RegisterKnownNeuron"in t){let o=t.RegisterKnownNeuron;return{RegisterKnownNeuron:s0(o)}}throw new Ve(t)},e0=t=>({no:t.no,yes:t.yes,total:t.total,timestampSeconds:t.timestamp_seconds}),t0=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(eo)}}}if("ClaimOrRefresh"in t){let o=t.ClaimOrRefresh;return{ClaimOrRefresh:{by:o.by.length?i0(o.by[0]):void 0}}}if("Configure"in t){let o=t.Configure;return{Configure:{operation:o.operation.length?o0(o.operation[0]):void 0}}}if("RegisterVote"in t){let o=t.RegisterVote;return{RegisterVote:{vote:o.vote,proposal:o.proposal.length?eo(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?kA(o.action[0]):void 0,summary:o.summary}}}if("Disburse"in t){let o=t.Disburse;return{Disburse:{toAccountId:o.to_account.length?cs(o.to_account[0]):void 0,amount:o.amount.length?n0(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 Ve(t)},o0=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 Ve(t)},r0=t=>{if("ToRemove"in t)return{ToRemove:cn(t.ToRemove)};if("ToAdd"in t)return{ToAdd:cn(t.ToAdd)};throw new Ve(t)},cn=t=>({id:t.id.length?t.id[0].toString():void 0,rewardAccount:t.reward_account.length?cs(t.reward_account[0]):void 0}),n0=t=>t.e8s,cs=t=>_a(new Uint8Array(t.hash)),UA=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?cs(t.RewardToAccount.to_account[0]):void 0}};throw new Ve(t)},i0=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 Ve(t)},ls=t=>({id:t.id.length?eo(t.id[0]):void 0,ballots:t.ballots.map(o=>Xh({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?$h(t.proposal[0]):void 0,proposer:t.proposer.length?eo(t.proposer[0]):void 0,latestTally:t.latest_tally.length?e0(t.latest_tally[0]):void 0,executedTimestampSeconds:t.executed_timestamp_seconds,topic:t.topic,status:t.status,rewardStatus:t.reward_status}),jA=({neuron_infos:t,full_neurons:o})=>t.map(([r,n])=>Lh({neuronId:r,neuronInfo:n,rawNeuron:o.find(i=>i.id.length&&i.id[0].id===r)})),DA=({proposal_info:t})=>({proposals:t.map(ls)}),s0=({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 to=async({request:t,service:o})=>{let{command:r}=await o.manage_neuron(t),n=r[0];if(!n)throw new Wo({error_message:"Error updating neuron",error_type:0});if("Error"in n)throw new Wo(n.Error)};var ln=rt(pn()),dn=()=>new ln.HttpAgent({host:"https://ic0.app",identity:new ln.AnonymousIdentity});var cr=class{constructor(o,r,n){this.canisterId=o;this.service=r;this.certifiedService=n;this.listNeurons=async({certified:o=!0,neuronIds:r})=>{let n=rA(r),i=await this.getGovernanceService(o).list_neurons(n);return jA(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=nA(o),i=await this.getGovernanceService(r).list_proposals(n);return DA(i)};this.stakeNeuron=async({stake:o,principal:r,fromSubAccountId:n,ledgerCanister:i})=>{if(o.toE8s()<Ir)throw new yr(ut.fromString("1"));let s=new Uint8Array((0,qA.default)(8)),p=Ba(s),u=this.buildNeuronStakeSubAccount(s,r),h=Kt.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 br;return w};this.increaseDissolveDelay=async({neuronId:o,additionalDissolveDelaySeconds:r})=>{let n=pA({neuronId:o,additionalDissolveDelaySeconds:r});return to({request:n,service:this.certifiedService})};this.startDissolving=async o=>{let r=uA(o);return to({request:r,service:this.certifiedService})};this.stopDissolving=async o=>{let r=cA(o);return to({request:r,service:this.certifiedService})};this.joinCommunityFund=async o=>{let r=AA(o);return to({request:r,service:this.certifiedService})};this.getProposal=async({proposalId:o,certified:r=!0})=>{let[n]=await this.getGovernanceService(r).get_proposal_info(o);return n?ls(n):void 0};this.makeProposal=async o=>{let r=aA(o);return to({request:r,service:this.certifiedService})};this.registerVote=async({neuronId:o,vote:r,proposalId:n})=>{let i=sA({neuronId:o,vote:r,proposalId:n});return to({request:i,service:this.certifiedService})};this.setFollowees=async o=>{let r=gA(o);return to({request:r,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async o=>{let r=await this.certifiedService.claim_or_refresh_neuron_from_account({controller:o.controller?[o.controller]:[],memo:o.memo}),{result:n}=r;if(n.length&&"NeuronId"in n[0])return n[0].NeuronId.id};this.claimOrRefreshNeuron=async o=>{var s;let r=iA(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 _r(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(n)}`)};this.buildNeuronStakeSubAccount=(o,r)=>{let n=Ho("neuron-stake"),i=HA.sha256.create();return i.update([12,...n,...r.toUint8Array(),...o]),oo.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??dn(),n=o.canisterId??dA,i=o.serviceOverride??ds.Actor.createActor($p,{agent:r,canisterId:n}),s=o.certifiedServiceOverride??ds.Actor.createActor(Xp,{agent:r,canisterId:n});return new cr(n,i,s)}getGovernanceService(o){return o?this.certifiedService:this.service}};var pt=rt(Br());var fs=rt(pn()),WA=async(t,o,r,n)=>{let i=await t.call(o,{methodName:r,arg:n,effectiveCanisterId:o});if(!i.response.ok)return 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
|
`));try{let s=await fs.polling.pollForResponse(t,o,i.requestId,fs.polling.defaultStrategy());return new Uint8Array(s)}catch(s){if(s instanceof Error)return s;throw s}},VA=async(t,o,r,n)=>{let i=await t.query(o,{methodName:r,arg:n});return i.status=="rejected"?new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${o}`,` HTTP status code: ${i.reject_code}`,` HTTP status text: ${i.reject_message}`].join(`
|
|
853
853
|
`)):new Uint8Array(i.reply.arg)};var lr=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 pt.AccountBalanceRequest;i.setAccount(o.toProto());let s=await n(this.agent,this.canisterId,"account_balance_pb",i.serializeBinary());if(s instanceof Error)throw Error;return ut.fromE8s(BigInt(pt.ICPTs.deserializeBinary(new Uint8Array(s)).getE8s()))};this.transfer=async({to:o,amount:r,memo:n,fromSubAccountId:i})=>{let s=new pt.SendRequest;s.setTo(o.toProto());let p=new pt.Payment;if(p.setReceiverGets(r.toProto()),s.setPayment(p),n){let h=new pt.Memo;h.setMemo(h.toString()),s.setMemo(h)}i!==void 0&&s.setFromSubaccount(this.subAccountIdToSubaccount(i));let u=await this.updateFetcher(this.agent,this.canisterId,"send_pb",s.serializeBinary());if(u instanceof Error)throw zn(u);return BigInt(pt.BlockHeight.deserializeBinary(u).getHeight())};this.subAccountIdToSubaccount=o=>{let r=ba(o,xa),n=new pt.Subaccount;return n.setSubAccount(new Uint8Array(r)),n}}static create(o={}){return new lr(o.agent??dn(),o.canisterId??fA,o.updateCallOverride??WA,o.queryCallOverride??VA)}};var YA=(i=>(i[i.UNSPECIFIED=0]="UNSPECIFIED",i[i.LOCKED=1]="LOCKED",i[i.DISSOLVING=2]="DISSOLVING",i[i.DISSOLVED=3]="DISSOLVED",i))(YA||{}),zA=(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))(zA||{}),LA=(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))(LA||{}),JA=(n=>(n[n.UNSPECIFIED=0]="UNSPECIFIED",n[n.YES=1]="YES",n[n.NO=2]="NO",n))(JA||{}),KA=(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))(KA||{});var ZA=({recentBallots:t,proposalId:o})=>{if(!o)return;let r=t.find(({proposalId:n})=>n===o);return r==null?void 0:r.vote},XA=({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})},a0=({neurons:t,proposal:o})=>{let{id:r}=o;return t.filter(({recentBallots:n,neuronId:i})=>ZA({recentBallots:n,proposalId:r})===void 0&&XA({neurons:t,proposal:o}).find(({neuronId:s})=>s===i)===void 0)},g0=({neurons:t,proposal:o})=>{let{id:r}=o;return t.filter(({recentBallots:n})=>ZA({recentBallots:n,proposalId:r})!==void 0)};module.exports=mu(p0);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,notVotedNeurons,votedNeurons});
|
|
854
854
|
/*!
|