@dfinity/nns 4.0.2 → 5.0.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/README.md +32 -32
- package/dist/candid/genesis_token.d.ts +3 -0
- package/dist/candid/genesis_token.did +1 -1
- package/dist/candid/governance.certified.idl.js +41 -0
- package/dist/candid/governance.d.ts +26 -0
- package/dist/candid/governance.did +30 -12
- package/dist/candid/governance.idl.js +41 -0
- package/dist/candid/governance_test.certified.idl.js +41 -0
- package/dist/candid/governance_test.d.ts +26 -0
- package/dist/candid/governance_test.did +30 -12
- package/dist/candid/governance_test.idl.js +41 -0
- package/dist/candid/sns_wasm.d.ts +3 -0
- package/dist/candid/sns_wasm.did +12 -12
- package/dist/cjs/index.cjs.js +1 -2
- package/dist/cjs/index.cjs.js.map +4 -4
- package/dist/esm/chunk-T6KTQFXP.js +19 -0
- package/dist/esm/chunk-T6KTQFXP.js.map +7 -0
- package/dist/esm/governance.canister.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +4 -4
- package/dist/types/canisters/governance/request.converters.d.ts +7 -7
- package/dist/types/canisters/governance/response.converters.d.ts +1 -6
- package/dist/types/enums/governance.enums.d.ts +6 -1
- package/dist/types/errors/governance.errors.d.ts +0 -2
- package/dist/types/governance.canister.d.ts +16 -28
- package/dist/types/sns_wasm.canister.d.ts +1 -1
- package/dist/types/types/governance_converters.d.ts +15 -0
- package/package.json +6 -7
- package/dist/esm/chunk-LZ5FA3UO.js +0 -20
- package/dist/esm/chunk-LZ5FA3UO.js.map +0 -7
- package/dist/types/canisters/governance/request.proto.converters.d.ts +0 -16
- package/dist/types/canisters/governance/response.proto.converters.d.ts +0 -1
- package/dist/types/utils/proto.utils.d.ts +0 -25
|
@@ -10,7 +10,7 @@ export declare const fromListProposalsRequest: ({ includeRewardStatus, beforePro
|
|
|
10
10
|
export declare const fromClaimOrRefreshNeuronRequest: (request: ClaimOrRefreshNeuronRequest) => RawManageNeuron;
|
|
11
11
|
export declare const toClaimOrRefreshRequest: ({ memo, controller, }: {
|
|
12
12
|
memo: bigint;
|
|
13
|
-
controller?: Principal
|
|
13
|
+
controller?: Principal;
|
|
14
14
|
}) => RawManageNeuron;
|
|
15
15
|
export declare const toSplitRawRequest: ({ neuronId, amount, }: {
|
|
16
16
|
neuronId: NeuronId;
|
|
@@ -27,8 +27,8 @@ export declare const toMakeProposalRawRequest: (request: MakeProposalRequest) =>
|
|
|
27
27
|
export declare const toManageNeuronsFollowRequest: ({ neuronId, topic, followees, }: FollowRequest) => RawManageNeuron;
|
|
28
28
|
export declare const toDisburseNeuronRequest: ({ neuronId, toAccountIdentifier, amount, }: {
|
|
29
29
|
neuronId: NeuronId;
|
|
30
|
-
toAccountIdentifier?: AccountIdentifierClass
|
|
31
|
-
amount?:
|
|
30
|
+
toAccountIdentifier?: AccountIdentifierClass;
|
|
31
|
+
amount?: E8s;
|
|
32
32
|
}) => RawManageNeuron;
|
|
33
33
|
export declare const toMergeMaturityRequest: ({ neuronId, percentageToMerge, }: {
|
|
34
34
|
neuronId: NeuronId;
|
|
@@ -36,13 +36,13 @@ export declare const toMergeMaturityRequest: ({ neuronId, percentageToMerge, }:
|
|
|
36
36
|
}) => RawManageNeuron;
|
|
37
37
|
export declare const toStakeMaturityRequest: ({ neuronId, percentageToStake, }: {
|
|
38
38
|
neuronId: NeuronId;
|
|
39
|
-
percentageToStake?: number
|
|
39
|
+
percentageToStake?: number;
|
|
40
40
|
}) => RawManageNeuron;
|
|
41
41
|
export declare const toSpawnNeuronRequest: ({ neuronId, percentageToSpawn, newController, nonce, }: {
|
|
42
42
|
neuronId: NeuronId;
|
|
43
|
-
percentageToSpawn?: number
|
|
44
|
-
newController?: Principal
|
|
45
|
-
nonce?: bigint
|
|
43
|
+
percentageToSpawn?: number;
|
|
44
|
+
newController?: Principal;
|
|
45
|
+
nonce?: bigint;
|
|
46
46
|
}) => RawManageNeuron;
|
|
47
47
|
export declare const toAddHotkeyRequest: ({ neuronId, principal, }: {
|
|
48
48
|
neuronId: NeuronId;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type { ListNeuronsResponse, Neuron as PbNeuron } from "@dfinity/nns-proto";
|
|
2
1
|
import { Principal } from "@dfinity/principal";
|
|
3
2
|
import type { KnownNeuron as RawKnownNeuron, ListNeuronsResponse as RawListNeuronsResponse, ListProposalInfoResponse as RawListProposalInfoResponse, Neuron as RawNeuron, NeuronInfo as RawNeuronInfo, ProposalInfo as RawProposalInfo } from "../../../candid/governance";
|
|
4
3
|
import type { KnownNeuron, ListProposalsResponse, Neuron, NeuronInfo, ProposalInfo } from "../../types/governance_converters";
|
|
5
4
|
export declare const toNeuronInfo: ({ neuronId, neuronInfo, rawNeuron, canisterId, }: {
|
|
6
5
|
neuronId: bigint;
|
|
7
6
|
neuronInfo: RawNeuronInfo;
|
|
8
|
-
rawNeuron?: RawNeuron
|
|
7
|
+
rawNeuron?: RawNeuron;
|
|
9
8
|
canisterId: Principal;
|
|
10
9
|
}) => NeuronInfo;
|
|
11
10
|
export declare const toRawNeuron: (neuron: Neuron) => RawNeuron;
|
|
@@ -16,7 +15,3 @@ export declare const toArrayOfNeuronInfo: ({ response: { neuron_infos, full_neur
|
|
|
16
15
|
}) => Array<NeuronInfo>;
|
|
17
16
|
export declare const toListProposalsResponse: ({ proposal_info, }: RawListProposalInfoResponse) => ListProposalsResponse;
|
|
18
17
|
export declare const toKnownNeuron: ({ id, known_neuron_data, }: RawKnownNeuron) => KnownNeuron;
|
|
19
|
-
export declare const convertPbNeuronToNeuronInfo: ({ pbNeurons, canisterId, }: {
|
|
20
|
-
pbNeurons: PbNeuron[];
|
|
21
|
-
canisterId: Principal;
|
|
22
|
-
}) => (pbNeuronMapEntry: ListNeuronsResponse.NeuronMapEntry) => NeuronInfo;
|
|
@@ -91,7 +91,12 @@ export declare enum NnsFunction {
|
|
|
91
91
|
UpdateNodesHostosVersion = 41,
|
|
92
92
|
AddApiBoundaryNode = 43,
|
|
93
93
|
RemoveApiBoundaryNodes = 44,
|
|
94
|
-
UpdateApiBoundaryNodesVersion = 46
|
|
94
|
+
UpdateApiBoundaryNodesVersion = 46,
|
|
95
|
+
DeployGuestosToSomeApiBoundaryNodes = 47,
|
|
96
|
+
DeployGuestosToAllUnassignedNodes = 48,
|
|
97
|
+
UpdateSshReadOnlyAccessForAllUnassignedNodes = 49,
|
|
98
|
+
ReviseElectedHostosVersions = 50,
|
|
99
|
+
DeployHostosToSomeNodes = 51
|
|
95
100
|
}
|
|
96
101
|
export declare enum NeuronType {
|
|
97
102
|
Unspecified = 0,
|
|
@@ -10,7 +10,6 @@ export declare class GovernanceCanister {
|
|
|
10
10
|
private readonly service;
|
|
11
11
|
private readonly certifiedService;
|
|
12
12
|
private readonly agent;
|
|
13
|
-
private readonly hardwareWallet;
|
|
14
13
|
private constructor();
|
|
15
14
|
static create(options?: GovernanceCanisterOptions): GovernanceCanister;
|
|
16
15
|
/**
|
|
@@ -24,7 +23,7 @@ export declare class GovernanceCanister {
|
|
|
24
23
|
*/
|
|
25
24
|
listNeurons: ({ certified, neuronIds, }: {
|
|
26
25
|
certified: boolean;
|
|
27
|
-
neuronIds?:
|
|
26
|
+
neuronIds?: NeuronId[];
|
|
28
27
|
}) => Promise<NeuronInfo[]>;
|
|
29
28
|
/**
|
|
30
29
|
* Returns the list of neurons who have been approved by the community to
|
|
@@ -54,7 +53,7 @@ export declare class GovernanceCanister {
|
|
|
54
53
|
*/
|
|
55
54
|
listProposals: ({ request, certified, }: {
|
|
56
55
|
request: ListProposalsRequest;
|
|
57
|
-
certified?: boolean
|
|
56
|
+
certified?: boolean;
|
|
58
57
|
}) => Promise<ListProposalsResponse>;
|
|
59
58
|
/**
|
|
60
59
|
* @throws {@link InsufficientAmountError}
|
|
@@ -65,10 +64,10 @@ export declare class GovernanceCanister {
|
|
|
65
64
|
stakeNeuron: ({ stake, principal, fromSubAccount, ledgerCanister, createdAt, fee, }: {
|
|
66
65
|
stake: bigint;
|
|
67
66
|
principal: Principal;
|
|
68
|
-
fromSubAccount?: number[]
|
|
67
|
+
fromSubAccount?: number[];
|
|
69
68
|
ledgerCanister: LedgerCanister;
|
|
70
|
-
createdAt?: bigint
|
|
71
|
-
fee?:
|
|
69
|
+
createdAt?: bigint;
|
|
70
|
+
fee?: E8s;
|
|
72
71
|
}) => Promise<NeuronId>;
|
|
73
72
|
/**
|
|
74
73
|
* @throws {@link InsufficientAmountError}
|
|
@@ -79,10 +78,10 @@ export declare class GovernanceCanister {
|
|
|
79
78
|
stakeNeuronIcrc1: ({ stake, principal, fromSubAccount, ledgerCanister, createdAt, fee, }: {
|
|
80
79
|
stake: bigint;
|
|
81
80
|
principal: Principal;
|
|
82
|
-
fromSubAccount?: Uint8Array
|
|
81
|
+
fromSubAccount?: Uint8Array;
|
|
83
82
|
ledgerCanister: LedgerCanister;
|
|
84
|
-
createdAt?: bigint
|
|
85
|
-
fee?:
|
|
83
|
+
createdAt?: bigint;
|
|
84
|
+
fee?: E8s;
|
|
86
85
|
}) => Promise<NeuronId>;
|
|
87
86
|
/**
|
|
88
87
|
* Increases dissolve delay of a neuron
|
|
@@ -187,7 +186,7 @@ export declare class GovernanceCanister {
|
|
|
187
186
|
*/
|
|
188
187
|
getProposal: ({ proposalId, certified, }: {
|
|
189
188
|
proposalId: bigint;
|
|
190
|
-
certified?: boolean
|
|
189
|
+
certified?: boolean;
|
|
191
190
|
}) => Promise<ProposalInfo | undefined>;
|
|
192
191
|
/**
|
|
193
192
|
* Create new proposal
|
|
@@ -221,8 +220,8 @@ export declare class GovernanceCanister {
|
|
|
221
220
|
*/
|
|
222
221
|
disburse: ({ neuronId, toAccountId, amount, }: {
|
|
223
222
|
neuronId: NeuronId;
|
|
224
|
-
toAccountId?: string
|
|
225
|
-
amount?:
|
|
223
|
+
toAccountId?: string;
|
|
224
|
+
amount?: E8s;
|
|
226
225
|
}) => Promise<void>;
|
|
227
226
|
/**
|
|
228
227
|
* Merge Maturity of a neuron
|
|
@@ -248,7 +247,7 @@ export declare class GovernanceCanister {
|
|
|
248
247
|
*/
|
|
249
248
|
stakeMaturity: ({ neuronId, percentageToStake, }: {
|
|
250
249
|
neuronId: NeuronId;
|
|
251
|
-
percentageToStake?: number
|
|
250
|
+
percentageToStake?: number;
|
|
252
251
|
}) => Promise<void>;
|
|
253
252
|
/**
|
|
254
253
|
* Merge Maturity of a neuron
|
|
@@ -259,9 +258,9 @@ export declare class GovernanceCanister {
|
|
|
259
258
|
*/
|
|
260
259
|
spawnNeuron: ({ neuronId, percentageToSpawn, newController, nonce, }: {
|
|
261
260
|
neuronId: NeuronId;
|
|
262
|
-
percentageToSpawn?: number
|
|
263
|
-
newController?: Principal
|
|
264
|
-
nonce?: bigint
|
|
261
|
+
percentageToSpawn?: number;
|
|
262
|
+
newController?: Principal;
|
|
263
|
+
nonce?: bigint;
|
|
265
264
|
}) => Promise<bigint>;
|
|
266
265
|
/**
|
|
267
266
|
* Add hotkey to neuron
|
|
@@ -286,7 +285,7 @@ export declare class GovernanceCanister {
|
|
|
286
285
|
*/
|
|
287
286
|
claimOrRefreshNeuronFromAccount: ({ memo, controller, }: {
|
|
288
287
|
memo: bigint;
|
|
289
|
-
controller?: Principal
|
|
288
|
+
controller?: Principal;
|
|
290
289
|
}) => Promise<NeuronId | undefined>;
|
|
291
290
|
/**
|
|
292
291
|
* Refreshes neuron and returns neuronId when successful
|
|
@@ -305,15 +304,4 @@ export declare class GovernanceCanister {
|
|
|
305
304
|
certified: boolean;
|
|
306
305
|
neuronId: NeuronId;
|
|
307
306
|
}) => Promise<NeuronInfo | undefined>;
|
|
308
|
-
private listNeuronsHardwareWallet;
|
|
309
|
-
private manageNeuronUpdateCall;
|
|
310
|
-
private addHotkeyHardwareWallet;
|
|
311
|
-
private removeHotkeyHardwareWallet;
|
|
312
|
-
private increaseDissolveDelayHardwareWallet;
|
|
313
|
-
private startDissolvingHardwareWallet;
|
|
314
|
-
private stopDissolvingHardwareWallet;
|
|
315
|
-
private joinCommunityFundHardwareWallet;
|
|
316
|
-
private disburseHardwareWallet;
|
|
317
|
-
private mergeMaturityHardwareWallet;
|
|
318
|
-
private spawnHardwareWallet;
|
|
319
307
|
}
|
|
@@ -6,6 +6,6 @@ export declare class SnsWasmCanister {
|
|
|
6
6
|
private constructor();
|
|
7
7
|
static create(options?: CanisterOptions<SnsWasmService>): SnsWasmCanister;
|
|
8
8
|
listSnses: ({ certified, }: {
|
|
9
|
-
certified?: boolean
|
|
9
|
+
certified?: boolean;
|
|
10
10
|
}) => Promise<DeployedSns[]>;
|
|
11
11
|
}
|
|
@@ -246,6 +246,21 @@ export interface NetworkEconomics {
|
|
|
246
246
|
neuronSpawnDissolveDelaySeconds: bigint;
|
|
247
247
|
minimumIcpXdrRate: bigint;
|
|
248
248
|
maximumNodeProviderRewards: bigint;
|
|
249
|
+
neuronsFundEconomics: Option<NeuronsFundEconomics>;
|
|
250
|
+
}
|
|
251
|
+
export interface NeuronsFundEconomics {
|
|
252
|
+
maximumIcpXdrRate: Option<Percentage>;
|
|
253
|
+
neuronsFundMatchedFundingCurveCoefficients: Option<NeuronsFundMatchedFundingCurveCoefficients>;
|
|
254
|
+
maxTheoreticalNeuronsFundParticipationAmountXdr: Option<Decimal>;
|
|
255
|
+
minimumIcpXdrRate: Option<Percentage>;
|
|
256
|
+
}
|
|
257
|
+
export interface NeuronsFundMatchedFundingCurveCoefficients {
|
|
258
|
+
contributionThresholdXdr: Option<Decimal>;
|
|
259
|
+
oneThirdParticipationMilestoneXdr: Option<Decimal>;
|
|
260
|
+
fullParticipationMilestoneXdr: Option<Decimal>;
|
|
261
|
+
}
|
|
262
|
+
export interface Decimal {
|
|
263
|
+
humanReadable: Option<string>;
|
|
249
264
|
}
|
|
250
265
|
export interface Neuron {
|
|
251
266
|
id: Option<NeuronId>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dfinity/nns",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "A library for interfacing with the Internet Computer's Network Nervous System.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/cjs/index.cjs.js",
|
|
@@ -51,11 +51,10 @@
|
|
|
51
51
|
"network-nervous-system"
|
|
52
52
|
],
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"@dfinity/agent": "^1.
|
|
55
|
-
"@dfinity/candid": "^1.
|
|
56
|
-
"@dfinity/ledger-icp": "^2.2.
|
|
57
|
-
"@dfinity/
|
|
58
|
-
"@dfinity/
|
|
59
|
-
"@dfinity/utils": "^2.1.3"
|
|
54
|
+
"@dfinity/agent": "^1.2.1",
|
|
55
|
+
"@dfinity/candid": "^1.2.1",
|
|
56
|
+
"@dfinity/ledger-icp": "^2.2.3",
|
|
57
|
+
"@dfinity/principal": "^1.2.1",
|
|
58
|
+
"@dfinity/utils": "^2.2.0"
|
|
60
59
|
}
|
|
61
60
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import{a as Ke,b as Jr,c as lo}from"./chunk-KCY3PAEP.js";var yo=Ke(Xe=>{"use strict";Xe.byteLength=oi;Xe.toByteArray=ii;Xe.fromByteArray=ci;var q=[],P=[],ni=typeof Uint8Array<"u"?Uint8Array:Array,Hn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_e=0,No=Hn.length;_e<No;++_e)q[_e]=Hn[_e],P[Hn.charCodeAt(_e)]=_e;var _e,No;P[45]=62;P[95]=63;function go(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");n===-1&&(n=t);var o=n===t?0:4-n%4;return[n,o]}function oi(e){var t=go(e),n=t[0],o=t[1];return(n+o)*3/4-o}function ri(e,t,n){return(t+n)*3/4-n}function ii(e){var t,n=go(e),o=n[0],r=n[1],i=new ni(ri(e,o,r)),s=0,c=r>0?o-4:o,d;for(d=0;d<c;d+=4)t=P[e.charCodeAt(d)]<<18|P[e.charCodeAt(d+1)]<<12|P[e.charCodeAt(d+2)]<<6|P[e.charCodeAt(d+3)],i[s++]=t>>16&255,i[s++]=t>>8&255,i[s++]=t&255;return r===2&&(t=P[e.charCodeAt(d)]<<2|P[e.charCodeAt(d+1)]>>4,i[s++]=t&255),r===1&&(t=P[e.charCodeAt(d)]<<10|P[e.charCodeAt(d+1)]<<4|P[e.charCodeAt(d+2)]>>2,i[s++]=t>>8&255,i[s++]=t&255),i}function si(e){return q[e>>18&63]+q[e>>12&63]+q[e>>6&63]+q[e&63]}function ai(e,t,n){for(var o,r=[],i=t;i<n;i+=3)o=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(e[i+2]&255),r.push(si(o));return r.join("")}function ci(e){for(var t,n=e.length,o=n%3,r=[],i=16383,s=0,c=n-o;s<c;s+=i)r.push(ai(e,s,s+i>c?c:s+i));return o===1?(t=e[n-1],r.push(q[t>>2]+q[t<<4&63]+"==")):o===2&&(t=(e[n-2]<<8)+e[n-1],r.push(q[t>>10]+q[t>>4&63]+q[t<<2&63]+"=")),r.join("")}});var Ro=Ke(Gn=>{Gn.read=function(e,t,n,o,r){var i,s,c=r*8-o-1,d=(1<<c)-1,m=d>>1,l=-7,p=n?r-1:0,v=n?-1:1,g=e[t+p];for(p+=v,i=g&(1<<-l)-1,g>>=-l,l+=c;l>0;i=i*256+e[t+p],p+=v,l-=8);for(s=i&(1<<-l)-1,i>>=-l,l+=o;l>0;s=s*256+e[t+p],p+=v,l-=8);if(i===0)i=1-m;else{if(i===d)return s?NaN:(g?-1:1)*(1/0);s=s+Math.pow(2,o),i=i-m}return(g?-1:1)*s*Math.pow(2,i-o)};Gn.write=function(e,t,n,o,r,i){var s,c,d,m=i*8-r-1,l=(1<<m)-1,p=l>>1,v=r===23?Math.pow(2,-24)-Math.pow(2,-77):0,g=o?0:i-1,F=o?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(c=isNaN(t)?1:0,s=l):(s=Math.floor(Math.log(t)/Math.LN2),t*(d=Math.pow(2,-s))<1&&(s--,d*=2),s+p>=1?t+=v/d:t+=v*Math.pow(2,1-p),t*d>=2&&(s++,d/=2),s+p>=l?(c=0,s=l):s+p>=1?(c=(t*d-1)*Math.pow(2,r),s=s+p):(c=t*Math.pow(2,p-1)*Math.pow(2,r),s=0));r>=8;e[n+g]=c&255,g+=F,c/=256,r-=8);for(s=s<<r|c,m+=r;m>0;e[n+g]=s&255,g+=F,s/=256,m-=8);e[n+g-F]|=j*128}});var qo=Ke(Ne=>{"use strict";var Wn=yo(),fe=Ro(),ho=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ne.Buffer=a;Ne.SlowBuffer=mi;Ne.INSPECT_MAX_BYTES=50;var Ye=2147483647;Ne.kMaxLength=Ye;a.TYPED_ARRAY_SUPPORT=ui();!a.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ui(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}});Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function Q(e){if(e>Ye)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if(typeof e=="number"){if(typeof t=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Jn(e)}return bo(e,t,n)}a.poolSize=8192;function bo(e,t,n){if(typeof e=="string")return pi(e,t);if(ArrayBuffer.isView(e))return _i(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(U(e,ArrayBuffer)||e&&U(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(U(e,SharedArrayBuffer)||e&&U(e.buffer,SharedArrayBuffer)))return $n(e,t,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return a.from(o,t,n);let r=li(e);if(r)return r;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return a.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}a.from=function(e,t,n){return bo(e,t,n)};Object.setPrototypeOf(a.prototype,Uint8Array.prototype);Object.setPrototypeOf(a,Uint8Array);function So(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function di(e,t,n){return So(e),e<=0?Q(e):t!==void 0?typeof n=="string"?Q(e).fill(t,n):Q(e).fill(t):Q(e)}a.alloc=function(e,t,n){return di(e,t,n)};function Jn(e){return So(e),Q(e<0?0:Xn(e)|0)}a.allocUnsafe=function(e){return Jn(e)};a.allocUnsafeSlow=function(e){return Jn(e)};function pi(e,t){if((typeof t!="string"||t==="")&&(t="utf8"),!a.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let n=ko(e,t)|0,o=Q(n),r=o.write(e,t);return r!==n&&(o=o.slice(0,r)),o}function jn(e){let t=e.length<0?0:Xn(e.length)|0,n=Q(t);for(let o=0;o<t;o+=1)n[o]=e[o]&255;return n}function _i(e){if(U(e,Uint8Array)){let t=new Uint8Array(e);return $n(t.buffer,t.byteOffset,t.byteLength)}return jn(e)}function $n(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return t===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,t):o=new Uint8Array(e,t,n),Object.setPrototypeOf(o,a.prototype),o}function li(e){if(a.isBuffer(e)){let t=Xn(e.length)|0,n=Q(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!="number"||Qn(e.length)?Q(0):jn(e);if(e.type==="Buffer"&&Array.isArray(e.data))return jn(e.data)}function Xn(e){if(e>=Ye)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Ye.toString(16)+" bytes");return e|0}function mi(e){return+e!=e&&(e=0),a.alloc(+e)}a.isBuffer=function(t){return t!=null&&t._isBuffer===!0&&t!==a.prototype};a.compare=function(t,n){if(U(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),U(n,Uint8Array)&&(n=a.from(n,n.offset,n.byteLength)),!a.isBuffer(t)||!a.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===n)return 0;let o=t.length,r=n.length;for(let i=0,s=Math.min(o,r);i<s;++i)if(t[i]!==n[i]){o=t[i],r=n[i];break}return o<r?-1:r<o?1:0};a.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};a.concat=function(t,n){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(t.length===0)return a.alloc(0);let o;if(n===void 0)for(n=0,o=0;o<t.length;++o)n+=t[o].length;let r=a.allocUnsafe(n),i=0;for(o=0;o<t.length;++o){let s=t[o];if(U(s,Uint8Array))i+s.length>r.length?(a.isBuffer(s)||(s=a.from(s)),s.copy(r,i)):Uint8Array.prototype.set.call(r,s,i);else if(a.isBuffer(s))s.copy(r,i);else throw new TypeError('"list" argument must be an Array of Buffers');i+=s.length}return r};function ko(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||U(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let r=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return zn(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Fo(e).length;default:if(r)return o?-1:zn(e).length;t=(""+t).toLowerCase(),r=!0}}a.byteLength=ko;function fi(e,t,n){let o=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return bi(this,t,n);case"utf8":case"utf-8":return Po(this,t,n);case"ascii":return vi(this,t,n);case"latin1":case"binary":return xi(this,t,n);case"base64":return hi(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Si(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}a.prototype._isBuffer=!0;function le(e,t,n){let o=e[t];e[t]=e[n],e[n]=o}a.prototype.swap16=function(){let t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<t;n+=2)le(this,n,n+1);return this};a.prototype.swap32=function(){let t=this.length;if(t%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<t;n+=4)le(this,n,n+3),le(this,n+1,n+2);return this};a.prototype.swap64=function(){let t=this.length;if(t%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<t;n+=8)le(this,n,n+7),le(this,n+1,n+6),le(this,n+2,n+5),le(this,n+3,n+4);return this};a.prototype.toString=function(){let t=this.length;return t===0?"":arguments.length===0?Po(this,0,t):fi.apply(this,arguments)};a.prototype.toLocaleString=a.prototype.toString;a.prototype.equals=function(t){if(!a.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t?!0:a.compare(this,t)===0};a.prototype.inspect=function(){let t="",n=Ne.INSPECT_MAX_BYTES;return t=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(t+=" ... "),"<Buffer "+t+">"};ho&&(a.prototype[ho]=a.prototype.inspect);a.prototype.compare=function(t,n,o,r,i){if(U(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(n===void 0&&(n=0),o===void 0&&(o=t?t.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),n<0||o>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&n>=o)return 0;if(r>=i)return-1;if(n>=o)return 1;if(n>>>=0,o>>>=0,r>>>=0,i>>>=0,this===t)return 0;let s=i-r,c=o-n,d=Math.min(s,c),m=this.slice(r,i),l=t.slice(n,o);for(let p=0;p<d;++p)if(m[p]!==l[p]){s=m[p],c=l[p];break}return s<c?-1:c<s?1:0};function To(e,t,n,o,r){if(e.length===0)return-1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,Qn(n)&&(n=r?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(r)return-1;n=e.length-1}else if(n<0)if(r)n=0;else return-1;if(typeof t=="string"&&(t=a.from(t,o)),a.isBuffer(t))return t.length===0?-1:Oo(e,t,n,o,r);if(typeof t=="number")return t=t&255,typeof Uint8Array.prototype.indexOf=="function"?r?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):Oo(e,[t],n,o,r);throw new TypeError("val must be string, number or Buffer")}function Oo(e,t,n,o,r){let i=1,s=e.length,c=t.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||t.length<2)return-1;i=2,s/=2,c/=2,n/=2}function d(l,p){return i===1?l[p]:l.readUInt16BE(p*i)}let m;if(r){let l=-1;for(m=n;m<s;m++)if(d(e,m)===d(t,l===-1?0:m-l)){if(l===-1&&(l=m),m-l+1===c)return l*i}else l!==-1&&(m-=m-l),l=-1}else for(n+c>s&&(n=s-c),m=n;m>=0;m--){let l=!0;for(let p=0;p<c;p++)if(d(e,m+p)!==d(t,p)){l=!1;break}if(l)return m}return-1}a.prototype.includes=function(t,n,o){return this.indexOf(t,n,o)!==-1};a.prototype.indexOf=function(t,n,o){return To(this,t,n,o,!0)};a.prototype.lastIndexOf=function(t,n,o){return To(this,t,n,o,!1)};function wi(e,t,n,o){n=Number(n)||0;let r=e.length-n;o?(o=Number(o),o>r&&(o=r)):o=r;let i=t.length;o>i/2&&(o=i/2);let s;for(s=0;s<o;++s){let c=parseInt(t.substr(s*2,2),16);if(Qn(c))return s;e[n+s]=c}return s}function Ni(e,t,n,o){return Qe(zn(t,e.length-n),e,n,o)}function gi(e,t,n,o){return Qe(Ci(t),e,n,o)}function yi(e,t,n,o){return Qe(Fo(t),e,n,o)}function Ri(e,t,n,o){return Qe(Mi(t,e.length-n),e,n,o)}a.prototype.write=function(t,n,o,r){if(n===void 0)r="utf8",o=this.length,n=0;else if(o===void 0&&typeof n=="string")r=n,o=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(o)?(o=o>>>0,r===void 0&&(r="utf8")):(r=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let i=this.length-n;if((o===void 0||o>i)&&(o=i),t.length>0&&(o<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let s=!1;for(;;)switch(r){case"hex":return wi(this,t,n,o);case"utf8":case"utf-8":return Ni(this,t,n,o);case"ascii":case"latin1":case"binary":return gi(this,t,n,o);case"base64":return yi(this,t,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ri(this,t,n,o);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}};a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function hi(e,t,n){return t===0&&n===e.length?Wn.fromByteArray(e):Wn.fromByteArray(e.slice(t,n))}function Po(e,t,n){n=Math.min(e.length,n);let o=[],r=t;for(;r<n;){let i=e[r],s=null,c=i>239?4:i>223?3:i>191?2:1;if(r+c<=n){let d,m,l,p;switch(c){case 1:i<128&&(s=i);break;case 2:d=e[r+1],(d&192)===128&&(p=(i&31)<<6|d&63,p>127&&(s=p));break;case 3:d=e[r+1],m=e[r+2],(d&192)===128&&(m&192)===128&&(p=(i&15)<<12|(d&63)<<6|m&63,p>2047&&(p<55296||p>57343)&&(s=p));break;case 4:d=e[r+1],m=e[r+2],l=e[r+3],(d&192)===128&&(m&192)===128&&(l&192)===128&&(p=(i&15)<<18|(d&63)<<12|(m&63)<<6|l&63,p>65535&&p<1114112&&(s=p))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,o.push(s>>>10&1023|55296),s=56320|s&1023),o.push(s),r+=c}return Oi(o)}var vo=4096;function Oi(e){let t=e.length;if(t<=vo)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=vo));return n}function vi(e,t,n){let o="";n=Math.min(e.length,n);for(let r=t;r<n;++r)o+=String.fromCharCode(e[r]&127);return o}function xi(e,t,n){let o="";n=Math.min(e.length,n);for(let r=t;r<n;++r)o+=String.fromCharCode(e[r]);return o}function bi(e,t,n){let o=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>o)&&(n=o);let r="";for(let i=t;i<n;++i)r+=Ai[e[i]];return r}function Si(e,t,n){let o=e.slice(t,n),r="";for(let i=0;i<o.length-1;i+=2)r+=String.fromCharCode(o[i]+o[i+1]*256);return r}a.prototype.slice=function(t,n){let o=this.length;t=~~t,n=n===void 0?o:~~n,t<0?(t+=o,t<0&&(t=0)):t>o&&(t=o),n<0?(n+=o,n<0&&(n=0)):n>o&&(n=o),n<t&&(n=t);let r=this.subarray(t,n);return Object.setPrototypeOf(r,a.prototype),r};function R(e,t,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(t,n,o){t=t>>>0,n=n>>>0,o||R(t,n,this.length);let r=this[t],i=1,s=0;for(;++s<n&&(i*=256);)r+=this[t+s]*i;return r};a.prototype.readUintBE=a.prototype.readUIntBE=function(t,n,o){t=t>>>0,n=n>>>0,o||R(t,n,this.length);let r=this[t+--n],i=1;for(;n>0&&(i*=256);)r+=this[t+--n]*i;return r};a.prototype.readUint8=a.prototype.readUInt8=function(t,n){return t=t>>>0,n||R(t,1,this.length),this[t]};a.prototype.readUint16LE=a.prototype.readUInt16LE=function(t,n){return t=t>>>0,n||R(t,2,this.length),this[t]|this[t+1]<<8};a.prototype.readUint16BE=a.prototype.readUInt16BE=function(t,n){return t=t>>>0,n||R(t,2,this.length),this[t]<<8|this[t+1]};a.prototype.readUint32LE=a.prototype.readUInt32LE=function(t,n){return t=t>>>0,n||R(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216};a.prototype.readUint32BE=a.prototype.readUInt32BE=function(t,n){return t=t>>>0,n||R(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])};a.prototype.readBigUInt64LE=te(function(t){t=t>>>0,we(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&He(t,this.length-8);let r=n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24,i=this[++t]+this[++t]*2**8+this[++t]*2**16+o*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))});a.prototype.readBigUInt64BE=te(function(t){t=t>>>0,we(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&He(t,this.length-8);let r=n*2**24+this[++t]*2**16+this[++t]*2**8+this[++t],i=this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+o;return(BigInt(r)<<BigInt(32))+BigInt(i)});a.prototype.readIntLE=function(t,n,o){t=t>>>0,n=n>>>0,o||R(t,n,this.length);let r=this[t],i=1,s=0;for(;++s<n&&(i*=256);)r+=this[t+s]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*n)),r};a.prototype.readIntBE=function(t,n,o){t=t>>>0,n=n>>>0,o||R(t,n,this.length);let r=n,i=1,s=this[t+--r];for(;r>0&&(i*=256);)s+=this[t+--r]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*n)),s};a.prototype.readInt8=function(t,n){return t=t>>>0,n||R(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]};a.prototype.readInt16LE=function(t,n){t=t>>>0,n||R(t,2,this.length);let o=this[t]|this[t+1]<<8;return o&32768?o|4294901760:o};a.prototype.readInt16BE=function(t,n){t=t>>>0,n||R(t,2,this.length);let o=this[t+1]|this[t]<<8;return o&32768?o|4294901760:o};a.prototype.readInt32LE=function(t,n){return t=t>>>0,n||R(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24};a.prototype.readInt32BE=function(t,n){return t=t>>>0,n||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]};a.prototype.readBigInt64LE=te(function(t){t=t>>>0,we(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&He(t,this.length-8);let r=this[t+4]+this[t+5]*2**8+this[t+6]*2**16+(o<<24);return(BigInt(r)<<BigInt(32))+BigInt(n+this[++t]*2**8+this[++t]*2**16+this[++t]*2**24)});a.prototype.readBigInt64BE=te(function(t){t=t>>>0,we(t,"offset");let n=this[t],o=this[t+7];(n===void 0||o===void 0)&&He(t,this.length-8);let r=(n<<24)+this[++t]*2**16+this[++t]*2**8+this[++t];return(BigInt(r)<<BigInt(32))+BigInt(this[++t]*2**24+this[++t]*2**16+this[++t]*2**8+o)});a.prototype.readFloatLE=function(t,n){return t=t>>>0,n||R(t,4,this.length),fe.read(this,t,!0,23,4)};a.prototype.readFloatBE=function(t,n){return t=t>>>0,n||R(t,4,this.length),fe.read(this,t,!1,23,4)};a.prototype.readDoubleLE=function(t,n){return t=t>>>0,n||R(t,8,this.length),fe.read(this,t,!0,52,8)};a.prototype.readDoubleBE=function(t,n){return t=t>>>0,n||R(t,8,this.length),fe.read(this,t,!1,52,8)};function S(e,t,n,o,r,i){if(!a.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>r||t<i)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(t,n,o,r){if(t=+t,n=n>>>0,o=o>>>0,!r){let c=Math.pow(2,8*o)-1;S(this,t,n,o,c,0)}let i=1,s=0;for(this[n]=t&255;++s<o&&(i*=256);)this[n+s]=t/i&255;return n+o};a.prototype.writeUintBE=a.prototype.writeUIntBE=function(t,n,o,r){if(t=+t,n=n>>>0,o=o>>>0,!r){let c=Math.pow(2,8*o)-1;S(this,t,n,o,c,0)}let i=o-1,s=1;for(this[n+i]=t&255;--i>=0&&(s*=256);)this[n+i]=t/s&255;return n+o};a.prototype.writeUint8=a.prototype.writeUInt8=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,1,255,0),this[n]=t&255,n+1};a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,2,65535,0),this[n]=t&255,this[n+1]=t>>>8,n+2};a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,2,65535,0),this[n]=t>>>8,this[n+1]=t&255,n+2};a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,4,4294967295,0),this[n+3]=t>>>24,this[n+2]=t>>>16,this[n+1]=t>>>8,this[n]=t&255,n+4};a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,4,4294967295,0),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};function Co(e,t,n,o,r){Vo(t,o,r,e,n,7);let i=Number(t&BigInt(4294967295));e[n++]=i,i=i>>8,e[n++]=i,i=i>>8,e[n++]=i,i=i>>8,e[n++]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=s,s=s>>8,e[n++]=s,s=s>>8,e[n++]=s,s=s>>8,e[n++]=s,n}function Mo(e,t,n,o,r){Vo(t,o,r,e,n,7);let i=Number(t&BigInt(4294967295));e[n+7]=i,i=i>>8,e[n+6]=i,i=i>>8,e[n+5]=i,i=i>>8,e[n+4]=i;let s=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=s,s=s>>8,e[n+2]=s,s=s>>8,e[n+1]=s,s=s>>8,e[n]=s,n+8}a.prototype.writeBigUInt64LE=te(function(t,n=0){return Co(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeBigUInt64BE=te(function(t,n=0){return Mo(this,t,n,BigInt(0),BigInt("0xffffffffffffffff"))});a.prototype.writeIntLE=function(t,n,o,r){if(t=+t,n=n>>>0,!r){let d=Math.pow(2,8*o-1);S(this,t,n,o,d-1,-d)}let i=0,s=1,c=0;for(this[n]=t&255;++i<o&&(s*=256);)t<0&&c===0&&this[n+i-1]!==0&&(c=1),this[n+i]=(t/s>>0)-c&255;return n+o};a.prototype.writeIntBE=function(t,n,o,r){if(t=+t,n=n>>>0,!r){let d=Math.pow(2,8*o-1);S(this,t,n,o,d-1,-d)}let i=o-1,s=1,c=0;for(this[n+i]=t&255;--i>=0&&(s*=256);)t<0&&c===0&&this[n+i+1]!==0&&(c=1),this[n+i]=(t/s>>0)-c&255;return n+o};a.prototype.writeInt8=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,1,127,-128),t<0&&(t=255+t+1),this[n]=t&255,n+1};a.prototype.writeInt16LE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,2,32767,-32768),this[n]=t&255,this[n+1]=t>>>8,n+2};a.prototype.writeInt16BE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,2,32767,-32768),this[n]=t>>>8,this[n+1]=t&255,n+2};a.prototype.writeInt32LE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,4,2147483647,-2147483648),this[n]=t&255,this[n+1]=t>>>8,this[n+2]=t>>>16,this[n+3]=t>>>24,n+4};a.prototype.writeInt32BE=function(t,n,o){return t=+t,n=n>>>0,o||S(this,t,n,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[n]=t>>>24,this[n+1]=t>>>16,this[n+2]=t>>>8,this[n+3]=t&255,n+4};a.prototype.writeBigInt64LE=te(function(t,n=0){return Co(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});a.prototype.writeBigInt64BE=te(function(t,n=0){return Mo(this,t,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ao(e,t,n,o,r,i){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Bo(e,t,n,o,r){return t=+t,n=n>>>0,r||Ao(e,t,n,4,34028234663852886e22,-34028234663852886e22),fe.write(e,t,n,o,23,4),n+4}a.prototype.writeFloatLE=function(t,n,o){return Bo(this,t,n,!0,o)};a.prototype.writeFloatBE=function(t,n,o){return Bo(this,t,n,!1,o)};function Eo(e,t,n,o,r){return t=+t,n=n>>>0,r||Ao(e,t,n,8,17976931348623157e292,-17976931348623157e292),fe.write(e,t,n,o,52,8),n+8}a.prototype.writeDoubleLE=function(t,n,o){return Eo(this,t,n,!0,o)};a.prototype.writeDoubleBE=function(t,n,o){return Eo(this,t,n,!1,o)};a.prototype.copy=function(t,n,o,r){if(!a.isBuffer(t))throw new TypeError("argument should be a Buffer");if(o||(o=0),!r&&r!==0&&(r=this.length),n>=t.length&&(n=t.length),n||(n=0),r>0&&r<o&&(r=o),r===o||t.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-n<r-o&&(r=t.length-n+o);let i=r-o;return this===t&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,o,r):Uint8Array.prototype.set.call(t,this.subarray(o,r),n),i};a.prototype.fill=function(t,n,o,r){if(typeof t=="string"){if(typeof n=="string"?(r=n,n=0,o=this.length):typeof o=="string"&&(r=o,o=this.length),r!==void 0&&typeof r!="string")throw new TypeError("encoding must be a string");if(typeof r=="string"&&!a.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(t.length===1){let s=t.charCodeAt(0);(r==="utf8"&&s<128||r==="latin1")&&(t=s)}}else typeof t=="number"?t=t&255:typeof t=="boolean"&&(t=Number(t));if(n<0||this.length<n||this.length<o)throw new RangeError("Out of range index");if(o<=n)return this;n=n>>>0,o=o===void 0?this.length:o>>>0,t||(t=0);let i;if(typeof t=="number")for(i=n;i<o;++i)this[i]=t;else{let s=a.isBuffer(t)?t:a.from(t,r),c=s.length;if(c===0)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<o-n;++i)this[i+n]=s[i%c]}return this};var me={};function Yn(e,t,n){me[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(r){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:r,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}Yn("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Yn("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError);Yn("ERR_OUT_OF_RANGE",function(e,t,n){let o=`The value of "${e}" is out of range.`,r=n;return Number.isInteger(n)&&Math.abs(n)>2**32?r=xo(String(n)):typeof n=="bigint"&&(r=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(r=xo(r)),r+="n"),o+=` It must be ${t}. Received ${r}`,o},RangeError);function xo(e){let t="",n=e.length,o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function ki(e,t,n){we(t,"offset"),(e[t]===void 0||e[t+n]===void 0)&&He(t,e.length-(n+1))}function Vo(e,t,n,o,r,i){if(e>n||e<t){let s=typeof t=="bigint"?"n":"",c;throw i>3?t===0||t===BigInt(0)?c=`>= 0${s} and < 2${s} ** ${(i+1)*8}${s}`:c=`>= -(2${s} ** ${(i+1)*8-1}${s}) and < 2 ** ${(i+1)*8-1}${s}`:c=`>= ${t}${s} and <= ${n}${s}`,new me.ERR_OUT_OF_RANGE("value",c,e)}ki(o,r,i)}function we(e,t){if(typeof e!="number")throw new me.ERR_INVALID_ARG_TYPE(t,"number",e)}function He(e,t,n){throw Math.floor(e)!==e?(we(e,n),new me.ERR_OUT_OF_RANGE(n||"offset","an integer",e)):t<0?new me.ERR_BUFFER_OUT_OF_BOUNDS:new me.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}var Ti=/[^+/0-9A-Za-z-_]/g;function Pi(e){if(e=e.split("=")[0],e=e.trim().replace(Ti,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function zn(e,t){t=t||1/0;let n,o=e.length,r=null,i=[];for(let s=0;s<o;++s){if(n=e.charCodeAt(s),n>55295&&n<57344){if(!r){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}else if(s+1===o){(t-=3)>-1&&i.push(239,191,189);continue}r=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),r=n;continue}n=(r-55296<<10|n-56320)+65536}else r&&(t-=3)>-1&&i.push(239,191,189);if(r=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return i}function Ci(e){let t=[];for(let n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function Mi(e,t){let n,o,r,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=e.charCodeAt(s),o=n>>8,r=n%256,i.push(r),i.push(o);return i}function Fo(e){return Wn.toByteArray(Pi(e))}function Qe(e,t,n,o){let r;for(r=0;r<o&&!(r+n>=t.length||r>=e.length);++r)t[r+n]=e[r];return r}function U(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function Qn(e){return e!==e}var Ai=function(){let e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){let o=n*16;for(let r=0;r<16;++r)t[o+r]=e[n]+e[r]}return t}();function te(e){return typeof BigInt>"u"?Bi:e}function Bi(){throw new Error("BigInt not supported")}});var Ho=Ke((Zn,Ko)=>{var Ze=qo(),Z=Ze.Buffer;function Uo(e,t){for(var n in e)t[n]=e[n]}Z.from&&Z.alloc&&Z.allocUnsafe&&Z.allocUnsafeSlow?Ko.exports=Ze:(Uo(Ze,Zn),Zn.Buffer=ge);function ge(e,t,n){return Z(e,t,n)}Uo(Z,ge);ge.from=function(e,t,n){if(typeof e=="number")throw new TypeError("Argument must not be a number");return Z(e,t,n)};ge.alloc=function(e,t,n){if(typeof e!="number")throw new TypeError("Argument must be a number");var o=Z(e);return t!==void 0?typeof n=="string"?o.fill(t,n):o.fill(t):o.fill(0),o};ge.allocUnsafe=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Z(e)};ge.allocUnsafeSlow=function(e){if(typeof e!="number")throw new TypeError("Argument must be a number");return Ze.SlowBuffer(e)}});var Go=Ke((ia,Dn)=>{"use strict";var In=65536,Ei=4294967295;function Vi(){throw new Error(`Secure random number generation is not supported by this browser.
|
|
2
|
-
Use Chrome, Firefox or Internet Explorer 11`)}var Fi=Ho().Buffer,Ie=window.crypto||window.msCrypto;Ie&&Ie.getRandomValues?Dn.exports=qi:Dn.exports=Vi;function qi(e,t){if(e>Ei)throw new RangeError("requested too many random bytes");var n=Fi.allocUnsafe(e);if(e>0)if(e>In)for(var o=0;o<e;o+=In)Ie.getRandomValues(n.slice(o,o+In));else Ie.getRandomValues(n);return typeof t=="function"?process.nextTick(function(){t(null,n)}):n}});import{AccountIdentifier as co,SubAccount as Ws,checkAccountId as Wr}from"@dfinity/ledger-icp";import{arrayOfNumberToUint8Array as js,asciiStringToByteArray as $s,assertPercentageNumber as uo,createServices as zs,fromNullable as k,isNullish as po,nonNullish as V,uint8ArrayToBigInt as jr}from"@dfinity/utils";function Xr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Yr(e,...t){if(!Xr(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function qn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function mo(e,t){Yr(e);let n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}function Qr(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}var ze=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),B=(e,t)=>e<<32-t|e>>>t,Zr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Zr)throw new Error("Non little-endian hardware is not supported");function Ir(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Un(e){if(typeof e=="string"&&(e=Ir(e)),!Qr(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var $e=class{clone(){return this._cloneInto()}},Xs={}.toString;function fo(e){let t=o=>e().update(Un(o)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Dr(e,t,n,o){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,o);let r=BigInt(32),i=BigInt(4294967295),s=Number(n>>r&i),c=Number(n&i),d=o?4:0,m=o?0:4;e.setUint32(t+d,s,o),e.setUint32(t+m,c,o)}var Je=class extends $e{constructor(t,n,o,r){super(),this.blockLen=t,this.outputLen=n,this.padOffset=o,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ze(this.buffer)}update(t){qn(this);let{view:n,buffer:o,blockLen:r}=this;t=Un(t);let i=t.length;for(let s=0;s<i;){let c=Math.min(r-this.pos,i-s);if(c===r){let d=ze(t);for(;r<=i-s;s+=r)this.process(d,s);continue}o.set(t.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===r&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){qn(this),mo(t,this),this.finished=!0;let{buffer:n,view:o,blockLen:r,isLE:i}=this,{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>r-s&&(this.process(o,0),s=0);for(let p=s;p<r;p++)n[p]=0;Dr(o,r-8,BigInt(this.length*8),i),this.process(o,0);let c=ze(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let m=d/4,l=this.get();if(m>l.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<m;p++)c.setUint32(4*p,l[p],i)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let o=t.slice(0,n);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:n,buffer:o,length:r,finished:i,destroyed:s,pos:c}=this;return t.length=r,t.pos=c,t.finished=i,t.destroyed=s,r%n&&t.buffer.set(o),t}};var Lr=(e,t,n)=>e&t^~e&n,ei=(e,t,n)=>e&t^e&n^t&n,ti=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),L=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ee=new Uint32Array(64),Kn=class extends Je{constructor(){super(64,32,8,!1),this.A=L[0]|0,this.B=L[1]|0,this.C=L[2]|0,this.D=L[3]|0,this.E=L[4]|0,this.F=L[5]|0,this.G=L[6]|0,this.H=L[7]|0}get(){let{A:t,B:n,C:o,D:r,E:i,F:s,G:c,H:d}=this;return[t,n,o,r,i,s,c,d]}set(t,n,o,r,i,s,c,d){this.A=t|0,this.B=n|0,this.C=o|0,this.D=r|0,this.E=i|0,this.F=s|0,this.G=c|0,this.H=d|0}process(t,n){for(let p=0;p<16;p++,n+=4)ee[p]=t.getUint32(n,!1);for(let p=16;p<64;p++){let v=ee[p-15],g=ee[p-2],F=B(v,7)^B(v,18)^v>>>3,j=B(g,17)^B(g,19)^g>>>10;ee[p]=j+ee[p-7]+F+ee[p-16]|0}let{A:o,B:r,C:i,D:s,E:c,F:d,G:m,H:l}=this;for(let p=0;p<64;p++){let v=B(c,6)^B(c,11)^B(c,25),g=l+v+Lr(c,d,m)+ti[p]+ee[p]|0,j=(B(o,2)^B(o,13)^B(o,22))+ei(o,r,i)|0;l=m,m=d,d=c,c=s+g|0,s=i,i=r,r=o,o=g+j|0}o=o+this.A|0,r=r+this.B|0,i=i+this.C|0,s=s+this.D|0,c=c+this.E|0,d=d+this.F|0,m=m+this.G|0,l=l+this.H|0,this.set(o,r,i,s,c,d,m,l)}roundClean(){ee.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var wo=fo(()=>new Kn);var _o=Jr(Go());var Wo=({IDL:e})=>{let t=e.Rec(),n=e.Record({id:e.Nat64}),o=e.Record({followees:e.Vec(n)}),r=e.Record({name:e.Text,description:e.Opt(e.Text)}),i=e.Record({id:e.Opt(n),known_neuron_data:e.Opt(r)}),s=e.Record({percentage_to_spawn:e.Opt(e.Nat32),new_controller:e.Opt(e.Principal),nonce:e.Opt(e.Nat64)}),c=e.Record({amount_e8s:e.Nat64}),d=e.Record({topic:e.Int32,followees:e.Vec(n)}),m=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),l=e.Variant({NeuronIdOrSubaccount:e.Record({}),MemoAndController:m,Memo:e.Nat64}),p=e.Record({by:e.Opt(l)}),v=e.Record({hot_key_to_remove:e.Opt(e.Principal)}),g=e.Record({new_hot_key:e.Opt(e.Principal)}),F=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),j=e.Record({additional_dissolve_delay_seconds:e.Nat32}),f=e.Record({dissolve_timestamp_seconds:e.Nat64}),st=e.Variant({RemoveHotKey:v,AddHotKey:g,ChangeAutoStakeMaturity:F,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:j,JoinCommunityFund:e.Record({}),LeaveCommunityFund:e.Record({}),SetDissolveTimestamp:f}),ye=e.Record({operation:e.Opt(st)}),at=e.Record({vote:e.Int32,proposal:e.Opt(n)}),Re=e.Record({source_neuron_id:e.Opt(n)}),he=e.Record({dissolve_delay_seconds:e.Nat64,kyc_verified:e.Bool,amount_e8s:e.Nat64,new_controller:e.Opt(e.Principal),nonce:e.Nat64}),ct=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Oe=e.Record({percentage_to_merge:e.Nat32}),$=e.Record({hash:e.Vec(e.Nat8)}),ut=e.Record({e8s:e.Nat64}),ve=e.Record({to_account:e.Opt($),amount:e.Opt(ut)}),dt=e.Variant({Spawn:s,Split:c,Follow:d,ClaimOrRefresh:p,Configure:ye,RegisterVote:at,Merge:Re,DisburseToNeuron:he,MakeProposal:t,StakeMaturity:ct,MergeMaturity:Oe,Disburse:ve}),ie=e.Variant({Subaccount:e.Vec(e.Nat8),NeuronId:n}),se=e.Record({id:e.Opt(n),command:e.Opt(dt),neuron_id_or_subaccount:e.Opt(ie)}),z=e.Record({basis_points:e.Opt(e.Nat64)}),y=e.Record({seconds:e.Opt(e.Nat64)}),w=e.Record({e8s:e.Opt(e.Nat64)}),pt=e.Record({reward_rate_transition_duration:e.Opt(y),initial_reward_rate:e.Opt(z),final_reward_rate:e.Opt(z)}),_t=e.Record({neuron_maximum_dissolve_delay_bonus:e.Opt(z),neuron_maximum_age_for_age_bonus:e.Opt(y),neuron_maximum_dissolve_delay:e.Opt(y),neuron_minimum_dissolve_delay_to_vote:e.Opt(y),neuron_maximum_age_bonus:e.Opt(z),neuron_minimum_stake:e.Opt(w),proposal_wait_for_quiet_deadline_increase:e.Opt(y),proposal_initial_voting_period:e.Opt(y),proposal_rejection_fee:e.Opt(w),voting_reward_parameters:e.Opt(pt)}),xe=e.Record({base64_encoding:e.Opt(e.Text)}),lt=e.Record({transaction_fee:e.Opt(w),token_symbol:e.Opt(e.Text),token_logo:e.Opt(xe),token_name:e.Opt(e.Text)}),mt=e.Record({id:e.Opt(e.Principal)}),ft=e.Record({dissolve_delay_interval:e.Opt(y),count:e.Opt(e.Nat64)}),wt=e.Record({seconds_after_utc_midnight:e.Opt(e.Nat64)}),Nt=e.Record({iso_codes:e.Vec(e.Text)}),gt=e.Record({minimum_participants:e.Opt(e.Nat64),neurons_fund_participation:e.Opt(e.Bool),duration:e.Opt(y),neuron_basket_construction_parameters:e.Opt(ft),confirmation_text:e.Opt(e.Text),maximum_participant_icp:e.Opt(w),minimum_icp:e.Opt(w),minimum_direct_participation_icp:e.Opt(w),minimum_participant_icp:e.Opt(w),start_time:e.Opt(wt),maximum_direct_participation_icp:e.Opt(w),maximum_icp:e.Opt(w),neurons_fund_investment_icp:e.Opt(w),restricted_countries:e.Opt(Nt)}),be=e.Record({total:e.Opt(w)}),yt=e.Record({controller:e.Opt(e.Principal),dissolve_delay:e.Opt(y),memo:e.Opt(e.Nat64),vesting_period:e.Opt(y),stake:e.Opt(w)}),Rt=e.Record({developer_neurons:e.Vec(yt)}),u=e.Record({treasury_distribution:e.Opt(be),developer_distribution:e.Opt(Rt),swap_distribution:e.Opt(be)}),ht=e.Record({url:e.Opt(e.Text),governance_parameters:e.Opt(_t),fallback_controller_principal_ids:e.Vec(e.Principal),logo:e.Opt(xe),name:e.Opt(e.Text),ledger_parameters:e.Opt(lt),description:e.Opt(e.Text),dapp_canisters:e.Vec(mt),swap_parameters:e.Opt(gt),initial_token_distribution:e.Opt(u)}),Ot=e.Record({nns_function:e.Int32,payload:e.Vec(e.Nat8)}),T=e.Record({id:e.Opt(e.Principal),reward_account:e.Opt($)}),vt=e.Record({dissolve_delay_seconds:e.Nat64}),xt=e.Record({to_account:e.Opt($)}),bt=e.Variant({RewardToNeuron:vt,RewardToAccount:xt}),ae=e.Record({node_provider:e.Opt(T),reward_mode:e.Opt(bt),amount_e8s:e.Nat64}),St=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),kt=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(St),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Tt=e.Record({community_fund_investment_e8s:e.Opt(e.Nat64),target_swap_canister_id:e.Opt(e.Principal),params:e.Opt(kt)}),Pt=e.Record({start_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Nat64}),Ct=e.Record({open_time_window:e.Opt(Pt)}),Mt=e.Record({request:e.Opt(Ct),swap_canister_id:e.Opt(e.Principal)}),At=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,o))}),Se=e.Record({use_registry_derived_rewards:e.Opt(e.Bool),rewards:e.Vec(ae)}),ce=e.Record({neuron_minimum_stake_e8s:e.Nat64,max_proposals_to_keep_per_topic:e.Nat32,neuron_management_fee_per_proposal_e8s:e.Nat64,reject_cost_e8s:e.Nat64,transaction_fee_e8s:e.Nat64,neuron_spawn_dissolve_delay_seconds:e.Nat64,minimum_icp_xdr_rate:e.Nat64,maximum_node_provider_rewards_e8s:e.Nat64}),Bt=e.Record({principals:e.Vec(e.Principal)}),Et=e.Variant({ToRemove:T,ToAdd:T}),Vt=e.Record({change:e.Opt(Et)}),Ft=e.Record({motion_text:e.Text}),qt=e.Variant({RegisterKnownNeuron:i,ManageNeuron:se,CreateServiceNervousSystem:ht,ExecuteNnsFunction:Ot,RewardNodeProvider:ae,OpenSnsTokenSwap:Tt,SetSnsTokenSwapOpenTimeWindow:Mt,SetDefaultFollowees:At,RewardNodeProviders:Se,ManageNetworkEconomics:ce,ApproveGenesisKyc:Bt,AddOrRemoveNodeProvider:Vt,Motion:Ft});t.fill(e.Record({url:e.Text,title:e.Opt(e.Text),action:e.Opt(qt),summary:e.Text}));let Ut=e.Record({proposal:e.Opt(t),caller:e.Opt(e.Principal),proposer_id:e.Opt(n)}),ke=e.Record({timestamp:e.Nat64,rewards:e.Vec(ae)}),Te=e.Record({total_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,garbage_collectable_neurons_count:e.Nat64,dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),ect_neuron_count:e.Nat64,total_supply_icp:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,community_fund_total_maturity_e8s_equivalent:e.Nat64,total_staked_e8s_seed:e.Nat64,total_staked_maturity_e8s_equivalent_ect:e.Nat64,total_staked_e8s:e.Nat64,not_dissolving_neurons_count:e.Nat64,total_locked_e8s:e.Nat64,neurons_fund_total_active_neurons:e.Nat64,total_staked_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),total_staked_e8s_ect:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,dissolved_neurons_e8s:e.Nat64,dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),total_staked_maturity_e8s_equivalent_seed:e.Nat64,community_fund_total_staked_e8s:e.Nat64,not_dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64,seed_neuron_count:e.Nat64}),Pe=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),day_after_genesis:e.Nat64,actual_timestamp_seconds:e.Nat64,total_available_e8s_equivalent:e.Nat64,latest_round_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,settled_proposals:e.Vec(n)}),Ce=e.Record({to_subaccount:e.Vec(e.Nat8),neuron_stake_e8s:e.Nat64,from:e.Opt(e.Principal),memo:e.Nat64,from_subaccount:e.Vec(e.Nat8),transfer_timestamp:e.Nat64,block_height:e.Nat64}),Kt=e.Record({followers:e.Vec(n)}),Ht=e.Record({followers_map:e.Vec(e.Tuple(e.Nat64,Kt))}),Gt=e.Variant({LastNeuronId:n}),Me=e.Record({status:e.Opt(e.Int32),failure_reason:e.Opt(e.Text),progress:e.Opt(Gt)}),Wt=e.Record({neuron_indexes_migration:e.Opt(Me),copy_inactive_neurons_to_stable_memory_migration:e.Opt(Me)}),N=e.Record({error_message:e.Text,error_type:e.Int32}),jt=e.Record({has_created_neuron_recipes:e.Opt(e.Bool),nns_neuron_id:e.Nat64,amount_icp_e8s:e.Nat64}),$t=e.Record({hotkey_principal:e.Text,cf_neurons:e.Vec(jt)}),Ae=e.Record({vote:e.Int32,voting_power:e.Nat64}),zt=e.Record({min_participant_icp_e8s:e.Opt(e.Nat64),max_participant_icp_e8s:e.Opt(e.Nat64),min_direct_participation_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Jt=e.Record({hotkey_principal:e.Opt(e.Principal),is_capped:e.Opt(e.Bool),maturity_equivalent_icp_e8s:e.Opt(e.Nat64),nns_neuron_id:e.Opt(n),amount_icp_e8s:e.Opt(e.Nat64)}),ue=e.Record({neurons_fund_neuron_portions:e.Vec(Jt)}),Xt=e.Record({serialized_representation:e.Opt(e.Text)}),J=e.Record({total_maturity_equivalent_icp_e8s:e.Opt(e.Nat64),intended_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),swap_participation_limits:e.Opt(zt),max_neurons_fund_swap_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_reserves:e.Opt(ue),ideal_matched_participation_function:e.Opt(Xt),allocated_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64)}),Yt=e.Record({final_neurons_fund_participation:e.Opt(J),initial_neurons_fund_participation:e.Opt(J),neurons_fund_refunds:e.Opt(ue)}),Qt=e.Record({status:e.Opt(e.Int32),freezing_threshold:e.Opt(e.Nat64),controllers:e.Vec(e.Principal),memory_size:e.Opt(e.Nat64),cycles:e.Opt(e.Nat64),idle_cycles_burned_per_day:e.Opt(e.Nat64),module_hash:e.Vec(e.Nat8)}),x=e.Record({status:e.Opt(Qt),canister_id:e.Opt(e.Principal)}),Zt=e.Record({ledger_index_canister_summary:e.Opt(x),fallback_controller_principal_ids:e.Vec(e.Principal),ledger_archive_canister_summaries:e.Vec(x),ledger_canister_summary:e.Opt(x),swap_canister_summary:e.Opt(x),governance_canister_summary:e.Opt(x),root_canister_summary:e.Opt(x),dapp_canister_summaries:e.Vec(x)}),Be=e.Record({swap_background_information:e.Opt(Zt)}),Ee=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),It=e.Record({current_deadline_timestamp_seconds:e.Nat64}),Dt=e.Record({id:e.Opt(n),failure_reason:e.Opt(N),cf_participants:e.Vec($t),ballots:e.Vec(e.Tuple(e.Nat64,Ae)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,neurons_fund_data:e.Opt(Yt),reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Be),latest_tally:e.Opt(Ee),sns_token_swap_lifecycle:e.Opt(e.Int32),decided_timestamp_seconds:e.Nat64,proposal:e.Opt(t),proposer:e.Opt(n),wait_for_quiet_state:e.Opt(It),executed_timestamp_seconds:e.Nat64,original_total_community_fund_maturity_e8s_equivalent:e.Opt(e.Nat64)}),Lt=e.Variant({Spawn:n,Split:c,Configure:ye,Merge:Re,DisburseToNeuron:he,SyncCommand:e.Record({}),ClaimOrRefreshNeuron:p,MergeMaturity:Oe,Disburse:ve}),en=e.Record({command:e.Opt(Lt),timestamp:e.Nat64}),Ve=e.Record({vote:e.Int32,proposal_id:e.Opt(n)}),tn=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),A=e.Record({id:e.Opt(n),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),controller:e.Opt(e.Principal),recent_ballots:e.Vec(Ve),kyc_verified:e.Bool,neuron_type:e.Opt(e.Int32),not_for_profit:e.Bool,maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,hot_keys:e.Vec(e.Principal),account:e.Vec(e.Nat8),joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),dissolve_state:e.Opt(tn),followees:e.Vec(e.Tuple(e.Int32,o)),neuron_fees_e8s:e.Nat64,transfer:e.Opt(Ce),known_neuron_data:e.Opt(r),spawn_at_timestamp_seconds:e.Opt(e.Nat64)}),zr=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,o)),making_sns_proposal:e.Opt(Ut),most_recent_monthly_node_provider_rewards:e.Opt(ke),maturity_modulation_last_updated_at_timestamp_seconds:e.Opt(e.Nat64),wait_for_quiet_threshold_seconds:e.Nat64,metrics:e.Opt(Te),neuron_management_voting_period_seconds:e.Opt(e.Nat64),node_providers:e.Vec(T),cached_daily_maturity_modulation_basis_points:e.Opt(e.Int32),economics:e.Opt(ce),spawning_neurons:e.Opt(e.Bool),latest_reward_event:e.Opt(Pe),to_claim_transfers:e.Vec(Ce),short_voting_period_seconds:e.Nat64,topic_followee_index:e.Vec(e.Tuple(e.Int32,Ht)),migrations:e.Opt(Wt),proposals:e.Vec(e.Tuple(e.Nat64,Dt)),in_flight_commands:e.Vec(e.Tuple(e.Nat64,en)),neurons:e.Vec(e.Tuple(e.Nat64,A)),genesis_timestamp_seconds:e.Nat64}),X=e.Variant({Ok:e.Null,Err:N}),nn=e.Variant({Error:N,NeuronId:n}),on=e.Record({result:e.Opt(nn)}),Fe=e.Variant({Ok:A,Err:N}),rn=e.Variant({Ok:Te,Err:N}),sn=e.Variant({Ok:Se,Err:N}),Y=e.Record({dissolve_delay_seconds:e.Nat64,recent_ballots:e.Vec(Ve),neuron_type:e.Opt(e.Int32),created_timestamp_seconds:e.Nat64,state:e.Int32,stake_e8s:e.Nat64,joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),retrieved_at_timestamp_seconds:e.Nat64,known_neuron_data:e.Opt(r),voting_power:e.Nat64,age_seconds:e.Nat64}),qe=e.Variant({Ok:Y,Err:N}),an=e.Record({nns_proposal_id:e.Opt(n)}),cn=e.Record({final_neurons_fund_participation:e.Opt(J),initial_neurons_fund_participation:e.Opt(J),neurons_fund_refunds:e.Opt(ue)}),un=e.Record({neurons_fund_audit_info:e.Opt(cn)}),dn=e.Variant({Ok:un,Err:N}),pn=e.Record({result:e.Opt(dn)}),_n=e.Variant({Ok:T,Err:N}),de=e.Record({id:e.Opt(n),status:e.Int32,topic:e.Int32,failure_reason:e.Opt(N),ballots:e.Vec(e.Tuple(e.Nat64,Ae)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,deadline_timestamp_seconds:e.Opt(e.Nat64),failed_timestamp_seconds:e.Nat64,reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Be),latest_tally:e.Opt(Ee),reward_status:e.Int32,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(t),proposer:e.Opt(n),executed_timestamp_seconds:e.Nat64}),ln=e.Record({known_neurons:e.Vec(i)}),mn=e.Record({neuron_ids:e.Vec(e.Nat64),include_neurons_readable_by_caller:e.Bool}),fn=e.Record({neuron_infos:e.Vec(e.Tuple(e.Nat64,Y)),full_neurons:e.Vec(A)}),wn=e.Record({node_providers:e.Vec(T)}),Nn=e.Record({include_reward_status:e.Vec(e.Int32),omit_large_fields:e.Opt(e.Bool),before_proposal:e.Opt(n),limit:e.Nat32,exclude_topic:e.Vec(e.Int32),include_all_manage_neuron_proposals:e.Opt(e.Bool),include_status:e.Vec(e.Int32)}),gn=e.Record({proposal_info:e.Vec(de)}),pe=e.Record({created_neuron_id:e.Opt(n)}),yn=e.Record({refreshed_neuron_id:e.Opt(n)}),Rn=e.Record({target_neuron:e.Opt(A),source_neuron:e.Opt(A),target_neuron_info:e.Opt(Y),source_neuron_info:e.Opt(Y)}),hn=e.Record({proposal_id:e.Opt(n)}),On=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),vn=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),xn=e.Record({transfer_block_height:e.Nat64}),bn=e.Variant({Error:N,Spawn:pe,Split:pe,Follow:e.Record({}),ClaimOrRefresh:yn,Configure:e.Record({}),RegisterVote:e.Record({}),Merge:Rn,DisburseToNeuron:pe,MakeProposal:hn,StakeMaturity:On,MergeMaturity:vn,Disburse:xn}),Ue=e.Record({command:e.Opt(bn)}),Sn=e.Record({total_direct_contribution_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_contribution_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),kn=e.Variant({Committed:Sn,Aborted:e.Record({})}),Tn=e.Record({result:e.Opt(kn),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),Pn=e.Record({total_direct_participation_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),Cn=e.Variant({Committed:Pn,Aborted:e.Record({})}),Mn=e.Record({result:e.Opt(Cn),nns_proposal_id:e.Opt(e.Nat64)}),An=e.Record({hotkey_principal:e.Opt(e.Text),is_capped:e.Opt(e.Bool),nns_neuron_id:e.Opt(e.Nat64),amount_icp_e8s:e.Opt(e.Nat64)}),Bn=e.Record({neurons_fund_neuron_portions:e.Vec(An)}),En=e.Variant({Ok:Bn,Err:N}),Vn=e.Record({result:e.Opt(En)}),Fn=e.Record({reward_account:e.Opt($)});return e.Service({claim_gtc_neurons:e.Func([e.Principal,e.Vec(n)],[X],[]),claim_or_refresh_neuron_from_account:e.Func([m],[on],[]),get_build_metadata:e.Func([],[e.Text],[]),get_full_neuron:e.Func([e.Nat64],[Fe],[]),get_full_neuron_by_id_or_subaccount:e.Func([ie],[Fe],[]),get_latest_reward_event:e.Func([],[Pe],[]),get_metrics:e.Func([],[rn],[]),get_monthly_node_provider_rewards:e.Func([],[sn],[]),get_most_recent_monthly_node_provider_rewards:e.Func([],[e.Opt(ke)],[]),get_network_economics_parameters:e.Func([],[ce],[]),get_neuron_ids:e.Func([],[e.Vec(e.Nat64)],[]),get_neuron_info:e.Func([e.Nat64],[qe],[]),get_neuron_info_by_id_or_subaccount:e.Func([ie],[qe],[]),get_neurons_fund_audit_info:e.Func([an],[pn],[]),get_node_provider_by_caller:e.Func([e.Null],[_n],[]),get_pending_proposals:e.Func([],[e.Vec(de)],[]),get_proposal_info:e.Func([e.Nat64],[e.Opt(de)],[]),list_known_neurons:e.Func([],[ln],[]),list_neurons:e.Func([mn],[fn],[]),list_node_providers:e.Func([],[wn],[]),list_proposals:e.Func([Nn],[gn],[]),manage_neuron:e.Func([se],[Ue],[]),settle_community_fund_participation:e.Func([Tn],[X],[]),settle_neurons_fund_participation:e.Func([Mn],[Vn],[]),simulate_manage_neuron:e.Func([se],[Ue],[]),transfer_gtc_neuron:e.Func([n,n],[X],[]),update_node_provider:e.Func([Fn],[X],[])})};var jo=({IDL:e})=>{let t=e.Rec(),n=e.Record({id:e.Nat64}),o=e.Record({followees:e.Vec(n)}),r=e.Record({name:e.Text,description:e.Opt(e.Text)}),i=e.Record({id:e.Opt(n),known_neuron_data:e.Opt(r)}),s=e.Record({percentage_to_spawn:e.Opt(e.Nat32),new_controller:e.Opt(e.Principal),nonce:e.Opt(e.Nat64)}),c=e.Record({amount_e8s:e.Nat64}),d=e.Record({topic:e.Int32,followees:e.Vec(n)}),m=e.Record({controller:e.Opt(e.Principal),memo:e.Nat64}),l=e.Variant({NeuronIdOrSubaccount:e.Record({}),MemoAndController:m,Memo:e.Nat64}),p=e.Record({by:e.Opt(l)}),v=e.Record({hot_key_to_remove:e.Opt(e.Principal)}),g=e.Record({new_hot_key:e.Opt(e.Principal)}),F=e.Record({requested_setting_for_auto_stake_maturity:e.Bool}),j=e.Record({additional_dissolve_delay_seconds:e.Nat32}),f=e.Record({dissolve_timestamp_seconds:e.Nat64}),st=e.Variant({RemoveHotKey:v,AddHotKey:g,ChangeAutoStakeMaturity:F,StopDissolving:e.Record({}),StartDissolving:e.Record({}),IncreaseDissolveDelay:j,JoinCommunityFund:e.Record({}),LeaveCommunityFund:e.Record({}),SetDissolveTimestamp:f}),ye=e.Record({operation:e.Opt(st)}),at=e.Record({vote:e.Int32,proposal:e.Opt(n)}),Re=e.Record({source_neuron_id:e.Opt(n)}),he=e.Record({dissolve_delay_seconds:e.Nat64,kyc_verified:e.Bool,amount_e8s:e.Nat64,new_controller:e.Opt(e.Principal),nonce:e.Nat64}),ct=e.Record({percentage_to_stake:e.Opt(e.Nat32)}),Oe=e.Record({percentage_to_merge:e.Nat32}),$=e.Record({hash:e.Vec(e.Nat8)}),ut=e.Record({e8s:e.Nat64}),ve=e.Record({to_account:e.Opt($),amount:e.Opt(ut)}),dt=e.Variant({Spawn:s,Split:c,Follow:d,ClaimOrRefresh:p,Configure:ye,RegisterVote:at,Merge:Re,DisburseToNeuron:he,MakeProposal:t,StakeMaturity:ct,MergeMaturity:Oe,Disburse:ve}),ie=e.Variant({Subaccount:e.Vec(e.Nat8),NeuronId:n}),se=e.Record({id:e.Opt(n),command:e.Opt(dt),neuron_id_or_subaccount:e.Opt(ie)}),z=e.Record({basis_points:e.Opt(e.Nat64)}),y=e.Record({seconds:e.Opt(e.Nat64)}),w=e.Record({e8s:e.Opt(e.Nat64)}),pt=e.Record({reward_rate_transition_duration:e.Opt(y),initial_reward_rate:e.Opt(z),final_reward_rate:e.Opt(z)}),_t=e.Record({neuron_maximum_dissolve_delay_bonus:e.Opt(z),neuron_maximum_age_for_age_bonus:e.Opt(y),neuron_maximum_dissolve_delay:e.Opt(y),neuron_minimum_dissolve_delay_to_vote:e.Opt(y),neuron_maximum_age_bonus:e.Opt(z),neuron_minimum_stake:e.Opt(w),proposal_wait_for_quiet_deadline_increase:e.Opt(y),proposal_initial_voting_period:e.Opt(y),proposal_rejection_fee:e.Opt(w),voting_reward_parameters:e.Opt(pt)}),xe=e.Record({base64_encoding:e.Opt(e.Text)}),lt=e.Record({transaction_fee:e.Opt(w),token_symbol:e.Opt(e.Text),token_logo:e.Opt(xe),token_name:e.Opt(e.Text)}),mt=e.Record({id:e.Opt(e.Principal)}),ft=e.Record({dissolve_delay_interval:e.Opt(y),count:e.Opt(e.Nat64)}),wt=e.Record({seconds_after_utc_midnight:e.Opt(e.Nat64)}),Nt=e.Record({iso_codes:e.Vec(e.Text)}),gt=e.Record({minimum_participants:e.Opt(e.Nat64),neurons_fund_participation:e.Opt(e.Bool),duration:e.Opt(y),neuron_basket_construction_parameters:e.Opt(ft),confirmation_text:e.Opt(e.Text),maximum_participant_icp:e.Opt(w),minimum_icp:e.Opt(w),minimum_direct_participation_icp:e.Opt(w),minimum_participant_icp:e.Opt(w),start_time:e.Opt(wt),maximum_direct_participation_icp:e.Opt(w),maximum_icp:e.Opt(w),neurons_fund_investment_icp:e.Opt(w),restricted_countries:e.Opt(Nt)}),be=e.Record({total:e.Opt(w)}),yt=e.Record({controller:e.Opt(e.Principal),dissolve_delay:e.Opt(y),memo:e.Opt(e.Nat64),vesting_period:e.Opt(y),stake:e.Opt(w)}),Rt=e.Record({developer_neurons:e.Vec(yt)}),u=e.Record({treasury_distribution:e.Opt(be),developer_distribution:e.Opt(Rt),swap_distribution:e.Opt(be)}),ht=e.Record({url:e.Opt(e.Text),governance_parameters:e.Opt(_t),fallback_controller_principal_ids:e.Vec(e.Principal),logo:e.Opt(xe),name:e.Opt(e.Text),ledger_parameters:e.Opt(lt),description:e.Opt(e.Text),dapp_canisters:e.Vec(mt),swap_parameters:e.Opt(gt),initial_token_distribution:e.Opt(u)}),Ot=e.Record({nns_function:e.Int32,payload:e.Vec(e.Nat8)}),T=e.Record({id:e.Opt(e.Principal),reward_account:e.Opt($)}),vt=e.Record({dissolve_delay_seconds:e.Nat64}),xt=e.Record({to_account:e.Opt($)}),bt=e.Variant({RewardToNeuron:vt,RewardToAccount:xt}),ae=e.Record({node_provider:e.Opt(T),reward_mode:e.Opt(bt),amount_e8s:e.Nat64}),St=e.Record({dissolve_delay_interval_seconds:e.Nat64,count:e.Nat64}),kt=e.Record({min_participant_icp_e8s:e.Nat64,neuron_basket_construction_parameters:e.Opt(St),max_icp_e8s:e.Nat64,swap_due_timestamp_seconds:e.Nat64,min_participants:e.Nat32,sns_token_e8s:e.Nat64,sale_delay_seconds:e.Opt(e.Nat64),max_participant_icp_e8s:e.Nat64,min_direct_participation_icp_e8s:e.Opt(e.Nat64),min_icp_e8s:e.Nat64,max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Tt=e.Record({community_fund_investment_e8s:e.Opt(e.Nat64),target_swap_canister_id:e.Opt(e.Principal),params:e.Opt(kt)}),Pt=e.Record({start_timestamp_seconds:e.Nat64,end_timestamp_seconds:e.Nat64}),Ct=e.Record({open_time_window:e.Opt(Pt)}),Mt=e.Record({request:e.Opt(Ct),swap_canister_id:e.Opt(e.Principal)}),At=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,o))}),Se=e.Record({use_registry_derived_rewards:e.Opt(e.Bool),rewards:e.Vec(ae)}),ce=e.Record({neuron_minimum_stake_e8s:e.Nat64,max_proposals_to_keep_per_topic:e.Nat32,neuron_management_fee_per_proposal_e8s:e.Nat64,reject_cost_e8s:e.Nat64,transaction_fee_e8s:e.Nat64,neuron_spawn_dissolve_delay_seconds:e.Nat64,minimum_icp_xdr_rate:e.Nat64,maximum_node_provider_rewards_e8s:e.Nat64}),Bt=e.Record({principals:e.Vec(e.Principal)}),Et=e.Variant({ToRemove:T,ToAdd:T}),Vt=e.Record({change:e.Opt(Et)}),Ft=e.Record({motion_text:e.Text}),qt=e.Variant({RegisterKnownNeuron:i,ManageNeuron:se,CreateServiceNervousSystem:ht,ExecuteNnsFunction:Ot,RewardNodeProvider:ae,OpenSnsTokenSwap:Tt,SetSnsTokenSwapOpenTimeWindow:Mt,SetDefaultFollowees:At,RewardNodeProviders:Se,ManageNetworkEconomics:ce,ApproveGenesisKyc:Bt,AddOrRemoveNodeProvider:Vt,Motion:Ft});t.fill(e.Record({url:e.Text,title:e.Opt(e.Text),action:e.Opt(qt),summary:e.Text}));let Ut=e.Record({proposal:e.Opt(t),caller:e.Opt(e.Principal),proposer_id:e.Opt(n)}),ke=e.Record({timestamp:e.Nat64,rewards:e.Vec(ae)}),Te=e.Record({total_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,garbage_collectable_neurons_count:e.Nat64,dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_invalid_stake_count:e.Nat64,not_dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),ect_neuron_count:e.Nat64,total_supply_icp:e.Nat64,neurons_with_less_than_6_months_dissolve_delay_count:e.Nat64,dissolved_neurons_count:e.Nat64,community_fund_total_maturity_e8s_equivalent:e.Nat64,total_staked_e8s_seed:e.Nat64,total_staked_maturity_e8s_equivalent_ect:e.Nat64,total_staked_e8s:e.Nat64,not_dissolving_neurons_count:e.Nat64,total_locked_e8s:e.Nat64,neurons_fund_total_active_neurons:e.Nat64,total_staked_maturity_e8s_equivalent:e.Nat64,not_dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),total_staked_e8s_ect:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_sum:e.Nat64,dissolved_neurons_e8s:e.Nat64,dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),neurons_with_less_than_6_months_dissolve_delay_e8s:e.Nat64,not_dissolving_neurons_staked_maturity_e8s_equivalent_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_count_buckets:e.Vec(e.Tuple(e.Nat64,e.Nat64)),dissolving_neurons_e8s_buckets_ect:e.Vec(e.Tuple(e.Nat64,e.Float64)),dissolving_neurons_count:e.Nat64,dissolving_neurons_e8s_buckets:e.Vec(e.Tuple(e.Nat64,e.Float64)),total_staked_maturity_e8s_equivalent_seed:e.Nat64,community_fund_total_staked_e8s:e.Nat64,not_dissolving_neurons_e8s_buckets_seed:e.Vec(e.Tuple(e.Nat64,e.Float64)),timestamp_seconds:e.Nat64,seed_neuron_count:e.Nat64}),Pe=e.Record({rounds_since_last_distribution:e.Opt(e.Nat64),day_after_genesis:e.Nat64,actual_timestamp_seconds:e.Nat64,total_available_e8s_equivalent:e.Nat64,latest_round_available_e8s_equivalent:e.Opt(e.Nat64),distributed_e8s_equivalent:e.Nat64,settled_proposals:e.Vec(n)}),Ce=e.Record({to_subaccount:e.Vec(e.Nat8),neuron_stake_e8s:e.Nat64,from:e.Opt(e.Principal),memo:e.Nat64,from_subaccount:e.Vec(e.Nat8),transfer_timestamp:e.Nat64,block_height:e.Nat64}),Kt=e.Record({followers:e.Vec(n)}),Ht=e.Record({followers_map:e.Vec(e.Tuple(e.Nat64,Kt))}),Gt=e.Variant({LastNeuronId:n}),Me=e.Record({status:e.Opt(e.Int32),failure_reason:e.Opt(e.Text),progress:e.Opt(Gt)}),Wt=e.Record({neuron_indexes_migration:e.Opt(Me),copy_inactive_neurons_to_stable_memory_migration:e.Opt(Me)}),N=e.Record({error_message:e.Text,error_type:e.Int32}),jt=e.Record({has_created_neuron_recipes:e.Opt(e.Bool),nns_neuron_id:e.Nat64,amount_icp_e8s:e.Nat64}),$t=e.Record({hotkey_principal:e.Text,cf_neurons:e.Vec(jt)}),Ae=e.Record({vote:e.Int32,voting_power:e.Nat64}),zt=e.Record({min_participant_icp_e8s:e.Opt(e.Nat64),max_participant_icp_e8s:e.Opt(e.Nat64),min_direct_participation_icp_e8s:e.Opt(e.Nat64),max_direct_participation_icp_e8s:e.Opt(e.Nat64)}),Jt=e.Record({hotkey_principal:e.Opt(e.Principal),is_capped:e.Opt(e.Bool),maturity_equivalent_icp_e8s:e.Opt(e.Nat64),nns_neuron_id:e.Opt(n),amount_icp_e8s:e.Opt(e.Nat64)}),ue=e.Record({neurons_fund_neuron_portions:e.Vec(Jt)}),Xt=e.Record({serialized_representation:e.Opt(e.Text)}),J=e.Record({total_maturity_equivalent_icp_e8s:e.Opt(e.Nat64),intended_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),direct_participation_icp_e8s:e.Opt(e.Nat64),swap_participation_limits:e.Opt(zt),max_neurons_fund_swap_participation_icp_e8s:e.Opt(e.Nat64),neurons_fund_reserves:e.Opt(ue),ideal_matched_participation_function:e.Opt(Xt),allocated_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64)}),Yt=e.Record({final_neurons_fund_participation:e.Opt(J),initial_neurons_fund_participation:e.Opt(J),neurons_fund_refunds:e.Opt(ue)}),Qt=e.Record({status:e.Opt(e.Int32),freezing_threshold:e.Opt(e.Nat64),controllers:e.Vec(e.Principal),memory_size:e.Opt(e.Nat64),cycles:e.Opt(e.Nat64),idle_cycles_burned_per_day:e.Opt(e.Nat64),module_hash:e.Vec(e.Nat8)}),x=e.Record({status:e.Opt(Qt),canister_id:e.Opt(e.Principal)}),Zt=e.Record({ledger_index_canister_summary:e.Opt(x),fallback_controller_principal_ids:e.Vec(e.Principal),ledger_archive_canister_summaries:e.Vec(x),ledger_canister_summary:e.Opt(x),swap_canister_summary:e.Opt(x),governance_canister_summary:e.Opt(x),root_canister_summary:e.Opt(x),dapp_canister_summaries:e.Vec(x)}),Be=e.Record({swap_background_information:e.Opt(Zt)}),Ee=e.Record({no:e.Nat64,yes:e.Nat64,total:e.Nat64,timestamp_seconds:e.Nat64}),It=e.Record({current_deadline_timestamp_seconds:e.Nat64}),Dt=e.Record({id:e.Opt(n),failure_reason:e.Opt(N),cf_participants:e.Vec($t),ballots:e.Vec(e.Tuple(e.Nat64,Ae)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,failed_timestamp_seconds:e.Nat64,neurons_fund_data:e.Opt(Yt),reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Be),latest_tally:e.Opt(Ee),sns_token_swap_lifecycle:e.Opt(e.Int32),decided_timestamp_seconds:e.Nat64,proposal:e.Opt(t),proposer:e.Opt(n),wait_for_quiet_state:e.Opt(It),executed_timestamp_seconds:e.Nat64,original_total_community_fund_maturity_e8s_equivalent:e.Opt(e.Nat64)}),Lt=e.Variant({Spawn:n,Split:c,Configure:ye,Merge:Re,DisburseToNeuron:he,SyncCommand:e.Record({}),ClaimOrRefreshNeuron:p,MergeMaturity:Oe,Disburse:ve}),en=e.Record({command:e.Opt(Lt),timestamp:e.Nat64}),Ve=e.Record({vote:e.Int32,proposal_id:e.Opt(n)}),tn=e.Variant({DissolveDelaySeconds:e.Nat64,WhenDissolvedTimestampSeconds:e.Nat64}),A=e.Record({id:e.Opt(n),staked_maturity_e8s_equivalent:e.Opt(e.Nat64),controller:e.Opt(e.Principal),recent_ballots:e.Vec(Ve),kyc_verified:e.Bool,neuron_type:e.Opt(e.Int32),not_for_profit:e.Bool,maturity_e8s_equivalent:e.Nat64,cached_neuron_stake_e8s:e.Nat64,created_timestamp_seconds:e.Nat64,auto_stake_maturity:e.Opt(e.Bool),aging_since_timestamp_seconds:e.Nat64,hot_keys:e.Vec(e.Principal),account:e.Vec(e.Nat8),joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),dissolve_state:e.Opt(tn),followees:e.Vec(e.Tuple(e.Int32,o)),neuron_fees_e8s:e.Nat64,transfer:e.Opt(Ce),known_neuron_data:e.Opt(r),spawn_at_timestamp_seconds:e.Opt(e.Nat64)}),zr=e.Record({default_followees:e.Vec(e.Tuple(e.Int32,o)),making_sns_proposal:e.Opt(Ut),most_recent_monthly_node_provider_rewards:e.Opt(ke),maturity_modulation_last_updated_at_timestamp_seconds:e.Opt(e.Nat64),wait_for_quiet_threshold_seconds:e.Nat64,metrics:e.Opt(Te),neuron_management_voting_period_seconds:e.Opt(e.Nat64),node_providers:e.Vec(T),cached_daily_maturity_modulation_basis_points:e.Opt(e.Int32),economics:e.Opt(ce),spawning_neurons:e.Opt(e.Bool),latest_reward_event:e.Opt(Pe),to_claim_transfers:e.Vec(Ce),short_voting_period_seconds:e.Nat64,topic_followee_index:e.Vec(e.Tuple(e.Int32,Ht)),migrations:e.Opt(Wt),proposals:e.Vec(e.Tuple(e.Nat64,Dt)),in_flight_commands:e.Vec(e.Tuple(e.Nat64,en)),neurons:e.Vec(e.Tuple(e.Nat64,A)),genesis_timestamp_seconds:e.Nat64}),X=e.Variant({Ok:e.Null,Err:N}),nn=e.Variant({Error:N,NeuronId:n}),on=e.Record({result:e.Opt(nn)}),Fe=e.Variant({Ok:A,Err:N}),rn=e.Variant({Ok:Te,Err:N}),sn=e.Variant({Ok:Se,Err:N}),Y=e.Record({dissolve_delay_seconds:e.Nat64,recent_ballots:e.Vec(Ve),neuron_type:e.Opt(e.Int32),created_timestamp_seconds:e.Nat64,state:e.Int32,stake_e8s:e.Nat64,joined_community_fund_timestamp_seconds:e.Opt(e.Nat64),retrieved_at_timestamp_seconds:e.Nat64,known_neuron_data:e.Opt(r),voting_power:e.Nat64,age_seconds:e.Nat64}),qe=e.Variant({Ok:Y,Err:N}),an=e.Record({nns_proposal_id:e.Opt(n)}),cn=e.Record({final_neurons_fund_participation:e.Opt(J),initial_neurons_fund_participation:e.Opt(J),neurons_fund_refunds:e.Opt(ue)}),un=e.Record({neurons_fund_audit_info:e.Opt(cn)}),dn=e.Variant({Ok:un,Err:N}),pn=e.Record({result:e.Opt(dn)}),_n=e.Variant({Ok:T,Err:N}),de=e.Record({id:e.Opt(n),status:e.Int32,topic:e.Int32,failure_reason:e.Opt(N),ballots:e.Vec(e.Tuple(e.Nat64,Ae)),proposal_timestamp_seconds:e.Nat64,reward_event_round:e.Nat64,deadline_timestamp_seconds:e.Opt(e.Nat64),failed_timestamp_seconds:e.Nat64,reject_cost_e8s:e.Nat64,derived_proposal_information:e.Opt(Be),latest_tally:e.Opt(Ee),reward_status:e.Int32,decided_timestamp_seconds:e.Nat64,proposal:e.Opt(t),proposer:e.Opt(n),executed_timestamp_seconds:e.Nat64}),ln=e.Record({known_neurons:e.Vec(i)}),mn=e.Record({neuron_ids:e.Vec(e.Nat64),include_neurons_readable_by_caller:e.Bool}),fn=e.Record({neuron_infos:e.Vec(e.Tuple(e.Nat64,Y)),full_neurons:e.Vec(A)}),wn=e.Record({node_providers:e.Vec(T)}),Nn=e.Record({include_reward_status:e.Vec(e.Int32),omit_large_fields:e.Opt(e.Bool),before_proposal:e.Opt(n),limit:e.Nat32,exclude_topic:e.Vec(e.Int32),include_all_manage_neuron_proposals:e.Opt(e.Bool),include_status:e.Vec(e.Int32)}),gn=e.Record({proposal_info:e.Vec(de)}),pe=e.Record({created_neuron_id:e.Opt(n)}),yn=e.Record({refreshed_neuron_id:e.Opt(n)}),Rn=e.Record({target_neuron:e.Opt(A),source_neuron:e.Opt(A),target_neuron_info:e.Opt(Y),source_neuron_info:e.Opt(Y)}),hn=e.Record({proposal_id:e.Opt(n)}),On=e.Record({maturity_e8s:e.Nat64,staked_maturity_e8s:e.Nat64}),vn=e.Record({merged_maturity_e8s:e.Nat64,new_stake_e8s:e.Nat64}),xn=e.Record({transfer_block_height:e.Nat64}),bn=e.Variant({Error:N,Spawn:pe,Split:pe,Follow:e.Record({}),ClaimOrRefresh:yn,Configure:e.Record({}),RegisterVote:e.Record({}),Merge:Rn,DisburseToNeuron:pe,MakeProposal:hn,StakeMaturity:On,MergeMaturity:vn,Disburse:xn}),Ue=e.Record({command:e.Opt(bn)}),Sn=e.Record({total_direct_contribution_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_contribution_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),kn=e.Variant({Committed:Sn,Aborted:e.Record({})}),Tn=e.Record({result:e.Opt(kn),open_sns_token_swap_proposal_id:e.Opt(e.Nat64)}),Pn=e.Record({total_direct_participation_icp_e8s:e.Opt(e.Nat64),total_neurons_fund_participation_icp_e8s:e.Opt(e.Nat64),sns_governance_canister_id:e.Opt(e.Principal)}),Cn=e.Variant({Committed:Pn,Aborted:e.Record({})}),Mn=e.Record({result:e.Opt(Cn),nns_proposal_id:e.Opt(e.Nat64)}),An=e.Record({hotkey_principal:e.Opt(e.Text),is_capped:e.Opt(e.Bool),nns_neuron_id:e.Opt(e.Nat64),amount_icp_e8s:e.Opt(e.Nat64)}),Bn=e.Record({neurons_fund_neuron_portions:e.Vec(An)}),En=e.Variant({Ok:Bn,Err:N}),Vn=e.Record({result:e.Opt(En)}),Fn=e.Record({reward_account:e.Opt($)});return e.Service({claim_gtc_neurons:e.Func([e.Principal,e.Vec(n)],[X],[]),claim_or_refresh_neuron_from_account:e.Func([m],[on],[]),get_build_metadata:e.Func([],[e.Text],["query"]),get_full_neuron:e.Func([e.Nat64],[Fe],["query"]),get_full_neuron_by_id_or_subaccount:e.Func([ie],[Fe],["query"]),get_latest_reward_event:e.Func([],[Pe],["query"]),get_metrics:e.Func([],[rn],["query"]),get_monthly_node_provider_rewards:e.Func([],[sn],[]),get_most_recent_monthly_node_provider_rewards:e.Func([],[e.Opt(ke)],["query"]),get_network_economics_parameters:e.Func([],[ce],["query"]),get_neuron_ids:e.Func([],[e.Vec(e.Nat64)],["query"]),get_neuron_info:e.Func([e.Nat64],[qe],["query"]),get_neuron_info_by_id_or_subaccount:e.Func([ie],[qe],["query"]),get_neurons_fund_audit_info:e.Func([an],[pn],["query"]),get_node_provider_by_caller:e.Func([e.Null],[_n],["query"]),get_pending_proposals:e.Func([],[e.Vec(de)],["query"]),get_proposal_info:e.Func([e.Nat64],[e.Opt(de)],["query"]),list_known_neurons:e.Func([],[ln],["query"]),list_neurons:e.Func([mn],[fn],["query"]),list_node_providers:e.Func([],[wn],["query"]),list_proposals:e.Func([Nn],[gn],["query"]),manage_neuron:e.Func([se],[Ue],[]),settle_community_fund_participation:e.Func([Tn],[X],[]),settle_neurons_fund_participation:e.Func([Mn],[Vn],[]),simulate_manage_neuron:e.Func([se],[Ue],[]),transfer_gtc_neuron:e.Func([n,n],[X],[]),update_node_provider:e.Func([Fn],[X],[])})};import{accountIdentifierToBytes as Ui}from"@dfinity/ledger-icp";import{Principal as G}from"@dfinity/principal";import{arrayBufferToUint8Array as Ki,toNullable as K}from"@dfinity/utils";var De=class extends Error{},Ge=class extends De{},We=class extends De{constructor(n){super();this.minimumAmount=n}},I=class extends Error{},E=class extends Error{constructor(n){super();this.detail=n}},h=class extends Error{constructor(t){super("Unsupported value: "+t)}},Le=class extends Error{};var Jo=e=>({id:e}),Ln=e=>({id:e}),Hi=e=>({followees:e.map(Ln)}),Gi=e=>{if("NeuronId"in e)return{NeuronId:{id:e.NeuronId}};if("Subaccount"in e)return{Subaccount:Uint8Array.from(e.Subaccount)};throw new h(e)},et=e=>e.basisPoints!==void 0?{basis_points:[e.basisPoints]}:{basis_points:[]},H=e=>e.seconds!==void 0?{seconds:[e.seconds]}:{seconds:[]},Wi=e=>e.secondsAfterUtcMidnight!==void 0?{seconds_after_utc_midnight:[e.secondsAfterUtcMidnight]}:{seconds_after_utc_midnight:[]},ji=e=>({iso_codes:e.isoCodes}),C=e=>e.e8s!==void 0?{e8s:[e.e8s]}:{e8s:[]},Xo=e=>e.base64Encoding!==void 0?{base64_encoding:[e.base64Encoding]}:{base64_encoding:[]},$i=e=>({reward_rate_transition_duration:e.rewardRateTransitionDuration!==void 0?[H(e.rewardRateTransitionDuration)]:[],initial_reward_rate:e.initialRewardRate!==void 0?[et(e.initialRewardRate)]:[],final_reward_rate:e.finalRewardRate!==void 0?[et(e.finalRewardRate)]:[]}),zi=e=>({transaction_fee:e.transactionFee!==void 0?[C(e.transactionFee)]:[],token_symbol:e.tokenSymbol!==void 0?[e.tokenSymbol]:[],token_logo:e.tokenLogo!==void 0?[Xo(e.tokenLogo)]:[],token_name:e.tokenName!==void 0?[e.tokenName]:[]}),Ji=e=>({minimum_participants:e.minimumParticipants!==void 0?[e.minimumParticipants]:[],duration:e.duration!==void 0?[H(e.duration)]:[],neuron_basket_construction_parameters:e.neuronBasketConstructionParameters!==void 0?[Xi(e.neuronBasketConstructionParameters)]:[],confirmation_text:e.confirmationText!==void 0?[e.confirmationText]:[],maximum_participant_icp:e.maximumParticipantIcp!==void 0?[C(e.maximumParticipantIcp)]:[],neurons_fund_investment_icp:e.neuronsFundInvestmentIcp!==void 0?[C(e.neuronsFundInvestmentIcp)]:[],minimum_icp:e.minimumIcp!==void 0?[C(e.minimumIcp)]:[],minimum_participant_icp:e.minimumParticipantIcp!==void 0?[C(e.minimumParticipantIcp)]:[],start_time:e.startTime!==void 0?[Wi(e.startTime)]:[],maximum_icp:e.maximumIcp!==void 0?[C(e.maximumIcp)]:[],restricted_countries:e.restrictedCountries!==void 0?[ji(e.restrictedCountries)]:[],maximum_direct_participation_icp:e.maxDirectParticipationIcp!==void 0?[C(e.maxDirectParticipationIcp)]:[],minimum_direct_participation_icp:e.minDirectParticipationIcp!==void 0?[C(e.minDirectParticipationIcp)]:[],neurons_fund_participation:K(e.neuronsFundParticipation)}),Xi=e=>({dissolve_delay_interval:e.dissolveDelayInterval!==void 0?[H(e.dissolveDelayInterval)]:[],count:e.count!==void 0?[e.count]:[]}),Yi=e=>({neuron_maximum_dissolve_delay_bonus:e.neuronMaximumDissolveDelayBonus!==void 0?[et(e.neuronMaximumDissolveDelayBonus)]:[],neuron_maximum_age_for_age_bonus:e.neuronMaximumAgeForAgeBonus!==void 0?[H(e.neuronMaximumAgeForAgeBonus)]:[],neuron_maximum_dissolve_delay:e.neuronMaximumDissolveDelay!==void 0?[H(e.neuronMaximumDissolveDelay)]:[],neuron_minimum_dissolve_delay_to_vote:e.neuronMinimumDissolveDelayToVote!==void 0?[H(e.neuronMinimumDissolveDelayToVote)]:[],neuron_maximum_age_bonus:e.neuronMaximumAgeBonus!==void 0?[et(e.neuronMaximumAgeBonus)]:[],neuron_minimum_stake:e.neuronMinimumStake!==void 0?[C(e.neuronMinimumStake)]:[],proposal_wait_for_quiet_deadline_increase:e.proposalWaitForQuietDeadlineIncrease!==void 0?[H(e.proposalWaitForQuietDeadlineIncrease)]:[],proposal_initial_voting_period:e.proposalInitialVotingPeriod!==void 0?[H(e.proposalInitialVotingPeriod)]:[],proposal_rejection_fee:e.proposalRejectionFee!==void 0?[C(e.proposalRejectionFee)]:[],voting_reward_parameters:e.votingRewardParameters!==void 0?[$i(e.votingRewardParameters)]:[]}),$o=e=>({total:e.total!==void 0?[C(e.total)]:[]}),Qi=e=>({treasury_distribution:e.treasuryDistribution!==void 0?[$o(e.treasuryDistribution)]:[],developer_distribution:e.developerDistribution!==void 0?[Ii(e.developerDistribution)]:[],swap_distribution:e.swapDistribution!==void 0?[$o(e.swapDistribution)]:[]}),Zi=e=>({controller:e.controller!==void 0?[G.fromText(e.controller)]:[],dissolve_delay:e.dissolveDelay!==void 0?[H(e.dissolveDelay)]:[],memo:e.memo!==void 0?[e.memo]:[],vesting_period:e.vestingPeriod!==void 0?[H(e.vestingPeriod)]:[],stake:e.stake!==void 0?[C(e.stake)]:[]}),Ii=e=>({developer_neurons:e.developerNeurons.map(Zi)}),Di=e=>({url:e.url!==void 0?[e.url]:[],governance_parameters:e.governanceParameters!==void 0?[Yi(e.governanceParameters)]:[],fallback_controller_principal_ids:e.fallbackControllerPrincipalIds.map(G.fromText),logo:e.logo!==void 0?[Xo(e.logo)]:[],name:e.name!==void 0?[e.name]:[],ledger_parameters:e.ledgerParameters!==void 0?[zi(e.ledgerParameters)]:[],description:e.description!==void 0?[e.description]:[],dapp_canisters:e.dappCanisters.map(t=>({id:[G.fromText(t)]})),swap_parameters:e.swapParameters!==void 0?[Ji(e.swapParameters)]:[],initial_token_distribution:e.initialTokenDistribution!==void 0?[Qi(e.initialTokenDistribution)]:[]}),Yo=e=>{if("ExecuteNnsFunction"in e){let t=e.ExecuteNnsFunction;if(t.payloadBytes===void 0)throw new Error("payloadBytes not found");return{ExecuteNnsFunction:{nns_function:t.nnsFunctionId,payload:Ki(t.payloadBytes)}}}if("ManageNeuron"in e){let t=e.ManageNeuron;return{ManageNeuron:os(t)}}if("ApproveGenesisKyc"in e)return{ApproveGenesisKyc:{principals:e.ApproveGenesisKyc.principals.map(G.fromText)}};if("ManageNetworkEconomics"in e){let t=e.ManageNetworkEconomics;return{ManageNetworkEconomics:{neuron_minimum_stake_e8s:t.neuronMinimumStake,max_proposals_to_keep_per_topic:t.maxProposalsToKeepPerTopic,neuron_management_fee_per_proposal_e8s:t.neuronManagementFeePerProposal,reject_cost_e8s:t.rejectCost,transaction_fee_e8s:t.transactionFee,neuron_spawn_dissolve_delay_seconds:t.neuronSpawnDissolveDelaySeconds,minimum_icp_xdr_rate:t.minimumIcpXdrRate,maximum_node_provider_rewards_e8s:t.maximumNodeProviderRewards}}}if("RewardNodeProvider"in e){let t=e.RewardNodeProvider;return{RewardNodeProvider:{node_provider:t.nodeProvider?[tt(t.nodeProvider)]:[],amount_e8s:t.amountE8s,reward_mode:t.rewardMode!=null?[zo(t.rewardMode)]:[]}}}if("RewardNodeProviders"in e){let t=e.RewardNodeProviders;return{RewardNodeProviders:{use_registry_derived_rewards:t.useRegistryDerivedRewards===void 0?[]:[t.useRegistryDerivedRewards],rewards:t.rewards.map(n=>({node_provider:n.nodeProvider?[tt(n.nodeProvider)]:[],amount_e8s:n.amountE8s,reward_mode:n.rewardMode!=null?[zo(n.rewardMode)]:[]}))}}}if("AddOrRemoveNodeProvider"in e){let t=e.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:t.change?[ts(t.change)]:[]}}}if("Motion"in e)return{Motion:{motion_text:e.Motion.motionText}};if("SetDefaultFollowees"in e)return{SetDefaultFollowees:{default_followees:e.SetDefaultFollowees.defaultFollowees.map(n=>[n.topic,Hi(n.followees)])}};if("RegisterKnownNeuron"in e){let t=e.RegisterKnownNeuron;return{RegisterKnownNeuron:{id:[{id:t.id}],known_neuron_data:[{name:t.name,description:t.description!==void 0?[t.description]:[]}]}}}if("SetSnsTokenSwapOpenTimeWindow"in e){let{request:t,swapCanisterId:n}=e.SetSnsTokenSwapOpenTimeWindow;return{SetSnsTokenSwapOpenTimeWindow:{request:t===void 0?[]:[{open_time_window:t.openTimeWindow===void 0?[]:[{start_timestamp_seconds:t.openTimeWindow.startTimestampSeconds,end_timestamp_seconds:t.openTimeWindow.endTimestampSeconds}]}],swap_canister_id:n===void 0?[]:[G.fromText(n)]}}}if("OpenSnsTokenSwap"in e){let{communityFundInvestmentE8s:t,targetSwapCanisterId:n,params:o}=e.OpenSnsTokenSwap;return{OpenSnsTokenSwap:{community_fund_investment_e8s:K(t),target_swap_canister_id:K(n),params:o===void 0?[]:[{min_participant_icp_e8s:o.minParticipantIcpE8s,max_icp_e8s:o.maxIcpE8s,swap_due_timestamp_seconds:o.swapDueTimestampSeconds,min_participants:o.minParticipants,sns_token_e8s:o.snsTokenE8s,max_participant_icp_e8s:o.maxParticipantIcpE8s,min_icp_e8s:o.minIcpE8s,sale_delay_seconds:K(o.saleDelaySeconds),neuron_basket_construction_parameters:K(o.neuronBasketConstructionParameters),max_direct_participation_icp_e8s:K(o.maxDirectParticipationIcpE8s),min_direct_participation_icp_e8s:K(o.minDirectParticipationIcpE8s)}]}}}if("CreateServiceNervousSystem"in e)return{CreateServiceNervousSystem:Di(e.CreateServiceNervousSystem)};throw new h(e)},Li=e=>{if("Split"in e)return{Split:{amount_e8s:e.Split.amount}};if("Follow"in e){let t=e.Follow;return{Follow:{topic:t.topic,followees:t.followees.map(Ln)}}}if("ClaimOrRefresh"in e){let t=e.ClaimOrRefresh;return{ClaimOrRefresh:{by:t.by?[ns(t.by)]:[]}}}if("Configure"in e){let t=e.Configure;return{Configure:{operation:t.operation?[es(t.operation)]:[]}}}if("RegisterVote"in e){let t=e.RegisterVote;return{RegisterVote:{vote:t.vote,proposal:t.proposal?[Jo(t.proposal)]:[]}}}if("DisburseToNeuron"in e){let t=e.DisburseToNeuron;return{DisburseToNeuron:{dissolve_delay_seconds:t.dissolveDelaySeconds,kyc_verified:t.kycVerified,amount_e8s:t.amount,new_controller:t.newController?[G.fromText(t.newController)]:[],nonce:t.nonce}}}if("MergeMaturity"in e)return{MergeMaturity:{percentage_to_merge:e.MergeMaturity.percentageToMerge}};if("StakeMaturity"in e){let{percentageToStake:t}=e.StakeMaturity;return{StakeMaturity:{percentage_to_stake:K(t)}}}if("MakeProposal"in e){let t=e.MakeProposal;return{MakeProposal:{url:t.url,title:[],action:t.action?[Yo(t.action)]:[],summary:t.summary}}}if("Disburse"in e){let t=e.Disburse;return{Disburse:{to_account:t.toAccountId?[eo(t.toAccountId)]:[],amount:t.amount?[Qo(t.amount)]:[]}}}if("Spawn"in e){let t=e.Spawn;return{Spawn:{percentage_to_spawn:t.percentageToSpawn===void 0?[]:[t.percentageToSpawn],new_controller:t.newController?[G.fromText(t.newController)]:[],nonce:[]}}}if("Merge"in e){let t=e.Merge;return{Merge:{source_neuron_id:t.sourceNeuronId?[{id:t.sourceNeuronId}]:[]}}}throw new h(e)},es=e=>{if("RemoveHotKey"in e){let t=e.RemoveHotKey;return{RemoveHotKey:{hot_key_to_remove:t.hotKeyToRemove!=null?[G.fromText(t.hotKeyToRemove)]:[]}}}if("AddHotKey"in e){let t=e.AddHotKey;return{AddHotKey:{new_hot_key:t.newHotKey?[G.fromText(t.newHotKey)]:[]}}}if("StopDissolving"in e)return{StopDissolving:{}};if("StartDissolving"in e)return{StartDissolving:{}};if("IncreaseDissolveDelay"in e)return{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:e.IncreaseDissolveDelay.additionalDissolveDelaySeconds}};if("JoinCommunityFund"in e||"LeaveCommunityFund"in e)return e;if("SetDissolveTimestamp"in e)return{SetDissolveTimestamp:{dissolve_timestamp_seconds:e.SetDissolveTimestamp.dissolveTimestampSeconds}};if("ChangeAutoStakeMaturity"in e){let{requestedSettingForAutoStakeMaturity:t}=e.ChangeAutoStakeMaturity;return{ChangeAutoStakeMaturity:{requested_setting_for_auto_stake_maturity:t}}}throw new h(e)},ts=e=>{if("ToRemove"in e)return{ToRemove:tt(e.ToRemove)};if("ToAdd"in e)return{ToAdd:tt(e.ToAdd)};throw new h(e)},tt=e=>({id:e.id!=null?[G.fromText(e.id)]:[],reward_account:e.rewardAccount!=null?[eo(e.rewardAccount)]:[]}),Qo=e=>({e8s:e}),eo=e=>({hash:Ui(e)}),zo=e=>{if("RewardToNeuron"in e)return{RewardToNeuron:{dissolve_delay_seconds:e.RewardToNeuron.dissolveDelaySeconds}};if("RewardToAccount"in e)return{RewardToAccount:{to_account:e.RewardToAccount.toAccount!=null?[eo(e.RewardToAccount.toAccount)]:[]}};throw new h(e)},ns=e=>{if("NeuronIdOrSubaccount"in e)return{NeuronIdOrSubaccount:{}};if("Memo"in e)return{Memo:e.Memo};if("MemoAndController"in e)return{MemoAndController:{memo:e.MemoAndController.memo,controller:e.MemoAndController.controller?[e.MemoAndController.controller]:[]}};throw new h(e)},Zo=e=>({neuron_ids:BigUint64Array.from(e??[]),include_neurons_readable_by_caller:!e}),os=({id:e,command:t,neuronIdOrSubaccount:n})=>({id:e?[Ln(e)]:[],command:t?[Li(t)]:[],neuron_id_or_subaccount:n?[Gi(n)]:[]}),Io=({includeRewardStatus:e,beforeProposal:t,excludeTopic:n,includeStatus:o,limit:r,includeAllManageNeuronProposals:i,omitLargeFields:s})=>({include_reward_status:Int32Array.from(e),before_proposal:t?[Jo(t)]:[],limit:r,exclude_topic:Int32Array.from(n),include_all_manage_neuron_proposals:i!==void 0?[i]:[],include_status:Int32Array.from(o),omit_large_fields:K(s)}),Do=e=>({id:[],command:[{ClaimOrRefresh:{by:[{NeuronIdOrSubaccount:{}}]}}],neuron_id_or_subaccount:[{NeuronId:{id:e.neuronId}}]}),Lo=({memo:e,controller:t})=>{let n={ClaimOrRefresh:{by:[{MemoAndController:{controller:t==null?[]:[t],memo:e}}]}};return{id:[],command:[n],neuron_id_or_subaccount:[]}},er=({neuronId:e,amount:t})=>({id:[],command:[{Split:{amount_e8s:t}}],neuron_id_or_subaccount:[{NeuronId:{id:e}}]});var tr=({neuronId:e,vote:t,proposalId:n})=>ne({neuronId:e,command:{RegisterVote:{vote:t,proposal:[{id:n}]}}}),nr=e=>{let t={MakeProposal:{url:e.url,title:e.title!=null?[e.title]:[],summary:e.summary,action:[Yo(e.action)]}};return{id:[],command:[t],neuron_id_or_subaccount:[{NeuronId:{id:e.neuronId}}]}},or=({neuronId:e,topic:t,followees:n})=>ne({neuronId:e,command:{Follow:{topic:t,followees:n.map(o=>({id:o}))}}}),rr=({neuronId:e,toAccountIdentifier:t,amount:n})=>ne({neuronId:e,command:{Disburse:{to_account:t!==void 0?[t.toAccountIdentifierHash()]:[],amount:n!==void 0?[Qo(n)]:[]}}}),ir=({neuronId:e,percentageToMerge:t})=>ne({neuronId:e,command:{MergeMaturity:{percentage_to_merge:t}}}),sr=({neuronId:e,percentageToStake:t})=>ne({neuronId:e,command:{StakeMaturity:{percentage_to_stake:K(t)}}}),ar=({neuronId:e,percentageToSpawn:t,newController:n,nonce:o})=>ne({neuronId:e,command:{Spawn:{percentage_to_spawn:t===void 0?[]:[t],new_controller:n===void 0?[]:[n],nonce:o===void 0?[]:[o]}}}),cr=({neuronId:e,principal:t})=>D({neuronId:e,operation:{AddHotKey:{new_hot_key:[t]}}}),ur=({neuronId:e,principal:t})=>D({neuronId:e,operation:{RemoveHotKey:{hot_key_to_remove:[t]}}}),dr=({neuronId:e,additionalDissolveDelaySeconds:t})=>D({neuronId:e,operation:{IncreaseDissolveDelay:{additional_dissolve_delay_seconds:t}}}),pr=({neuronId:e,dissolveDelaySeconds:t})=>D({neuronId:e,operation:{SetDissolveTimestamp:{dissolve_timestamp_seconds:BigInt(t)}}}),_r=e=>D({neuronId:e,operation:{JoinCommunityFund:{}}}),lr=({neuronId:e,autoStake:t})=>D({neuronId:e,operation:{ChangeAutoStakeMaturity:{requested_setting_for_auto_stake_maturity:t}}}),mr=e=>D({neuronId:e,operation:{LeaveCommunityFund:{}}}),to=({sourceNeuronId:e,targetNeuronId:t})=>ne({neuronId:t,command:{Merge:{source_neuron_id:[{id:e}]}}}),fr=e=>D({neuronId:e,operation:{StartDissolving:{}}}),wr=e=>D({neuronId:e,operation:{StopDissolving:{}}}),ne=({neuronId:e,command:t})=>({id:[{id:e}],command:[t],neuron_id_or_subaccount:[]}),D=({neuronId:e,operation:t})=>ne({neuronId:e,command:{Configure:{operation:[t]}}});import{Principal as no}from"@dfinity/principal";import{polling as Nr}from"@dfinity/agent";var b=()=>import("@dfinity/nns-proto"),nt=async({agent:e,canisterId:t,methodName:n,arg:o})=>{let r=await e.call(t,{methodName:n,arg:o,effectiveCanisterId:t});if(!r.response.ok)throw new Error(["Call failed:",` Method: ${n}`,` Canister ID: ${t}`,` Request ID: ${r.requestId}`,` HTTP status code: ${r.response.status}`,` HTTP status text: ${r.response.statusText}`].join(`
|
|
3
|
-
`));let i=await Nr.pollForResponse(e,t,r.requestId,Nr.defaultStrategy());return new Uint8Array(i)};var gr=async e=>{let{PrincipalId:t,ManageNeuron:n,NeuronId:o}=await b(),r=new t;r.setSerializedId(no.fromText(e.principal).toUint8Array());let i=new n.AddHotKey;i.setNewHotKey(r);let s=new n.Configure;s.setAddHotKey(i);let c=new n;c.setConfigure(s);let d=new o;return d.setId(e.neuronId.toString()),c.setNeuronId(d),c},yr=async e=>{let{PrincipalId:t,ManageNeuron:n,NeuronId:o}=await b(),r=new t;r.setSerializedId(no.fromText(e.principal).toUint8Array());let i=new n.RemoveHotKey;i.setHotKeyToRemove(r);let s=new n.Configure;s.setRemoveHotKey(i);let c=new n;c.setConfigure(s);let d=new o;return d.setId(e.neuronId.toString()),c.setNeuronId(d),c},Rr=async({neuronId:e,additionalDissolveDelaySeconds:t})=>{let{ManageNeuron:n,NeuronId:o}=await b(),r=new n.IncreaseDissolveDelay;r.setAdditionalDissolveDelaySeconds(t);let i=new n.Configure;i.setIncreaseDissolveDelay(r);let s=new n;s.setConfigure(i);let c=new o;return c.setId(e.toString()),s.setNeuronId(c),s},hr=async e=>{let{ManageNeuron:t,NeuronId:n}=await b(),o=new t.Configure;o.setStartDissolving(new t.StartDissolving);let r=new t;r.setConfigure(o);let i=new n;return i.setId(e.toString()),r.setNeuronId(i),r},Or=async e=>{let{ManageNeuron:t,NeuronId:n}=await b(),o=new t.Configure;o.setStopDissolving(new t.StopDissolving);let r=new t;r.setConfigure(o);let i=new n;return i.setId(e.toString()),r.setNeuronId(i),r},vr=async e=>{let{ManageNeuron:t,NeuronId:n}=await b(),o=new t.Configure;o.setJoinCommunityFund(new t.JoinCommunityFund);let r=new t;r.setConfigure(o);let i=new n;return i.setId(e.toString()),r.setNeuronId(i),r},xr=async e=>{let{ManageNeuron:t,NeuronId:n,AccountIdentifier:o}=await b(),r=new t.Disburse;if(e.toAccountId){let c=new o;c.setHash(Uint8Array.from(Buffer.from(e.toAccountId,"hex"))),r.setToAccount(c)}if(e.amount!=null){let c=new t.Disburse.Amount;c.setE8s(e.amount.toString()),r.setAmount(c)}let i=new t;i.setDisburse(r);let s=new n;return s.setId(e.neuronId.toString()),i.setNeuronId(s),i},br=async e=>{let{ManageNeuron:t,NeuronId:n}=await b(),o=new t.MergeMaturity;o.setPercentageToMerge(e.percentageToMerge);let r=new t,i=new n;return i.setId(e.neuronId.toString()),r.setNeuronId(i),r.setMergeMaturity(o),r},Sr=async e=>{let{ManageNeuron:t,NeuronId:n,PrincipalId:o}=await b(),r=new t.Spawn;if(e.newController){let c=new o;c.setSerializedId(no.fromText(e.newController).toUint8Array().slice(4)),r.setNewController(c)}e.percentageToSpawn!==void 0&&r.setPercentageToSpawn(e.percentageToSpawn);let i=new t;i.setSpawn(r);let s=new n;return s.setId(e.neuronId.toString()),i.setNeuronId(s),i};import{AccountIdentifier as Mr,accountIdentifierFromBytes as ds,principalToAccountIdentifier as ps,SubAccount as _s}from"@dfinity/ledger-icp";import{Principal as oo}from"@dfinity/principal";import{fromDefinedNullable as ls,fromNullable as _,nonNullish as ot,toNullable as oe,uint8ArrayToArrayOfNumber as ms}from"@dfinity/utils";var kr=(i=>(i[i.Unspecified=0]="Unspecified",i[i.Locked=1]="Locked",i[i.Dissolving=2]="Dissolving",i[i.Dissolved=3]="Dissolved",i[i.Spawning=4]="Spawning",i))(kr||{}),rs=(f=>(f[f.Unspecified=0]="Unspecified",f[f.ManageNeuron=1]="ManageNeuron",f[f.ExchangeRate=2]="ExchangeRate",f[f.NetworkEconomics=3]="NetworkEconomics",f[f.Governance=4]="Governance",f[f.NodeAdmin=5]="NodeAdmin",f[f.ParticipantManagement=6]="ParticipantManagement",f[f.SubnetManagement=7]="SubnetManagement",f[f.NetworkCanisterManagement=8]="NetworkCanisterManagement",f[f.Kyc=9]="Kyc",f[f.NodeProviderRewards=10]="NodeProviderRewards",f[f.SnsDecentralizationSale=11]="SnsDecentralizationSale",f[f.SubnetReplicaVersionManagement=12]="SubnetReplicaVersionManagement",f[f.ReplicaVersionManagement=13]="ReplicaVersionManagement",f[f.SnsAndCommunityFund=14]="SnsAndCommunityFund",f[f.ApiBoundaryNodeManagement=15]="ApiBoundaryNodeManagement",f))(rs||{}),is=(i=>(i[i.Unknown=0]="Unknown",i[i.AcceptVotes=1]="AcceptVotes",i[i.ReadyToSettle=2]="ReadyToSettle",i[i.Settled=3]="Settled",i[i.Ineligible=4]="Ineligible",i))(is||{}),ss=(s=>(s[s.Unknown=0]="Unknown",s[s.Open=1]="Open",s[s.Rejected=2]="Rejected",s[s.Accepted=3]="Accepted",s[s.Executed=4]="Executed",s[s.Failed=5]="Failed",s))(ss||{}),as=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Yes=1]="Yes",o[o.No=2]="No",o))(as||{}),cs=(u=>(u[u.Unspecified=0]="Unspecified",u[u.CreateSubnet=1]="CreateSubnet",u[u.AddNodeToSubnet=2]="AddNodeToSubnet",u[u.NnsCanisterInstall=3]="NnsCanisterInstall",u[u.NnsCanisterUpgrade=4]="NnsCanisterUpgrade",u[u.BlessReplicaVersion=5]="BlessReplicaVersion",u[u.RecoverSubnet=6]="RecoverSubnet",u[u.UpdateConfigOfSubnet=7]="UpdateConfigOfSubnet",u[u.AssignNoid=8]="AssignNoid",u[u.NnsRootUpgrade=9]="NnsRootUpgrade",u[u.IcpXdrConversionRate=10]="IcpXdrConversionRate",u[u.UpdateSubnetReplicaVersion=11]="UpdateSubnetReplicaVersion",u[u.ClearProvisionalWhitelist=12]="ClearProvisionalWhitelist",u[u.RemoveNodesFromSubnet=13]="RemoveNodesFromSubnet",u[u.SetAuthorizedSubnetworks=14]="SetAuthorizedSubnetworks",u[u.SetFirewallConfig=15]="SetFirewallConfig",u[u.UpdateNodeOperatorConfig=16]="UpdateNodeOperatorConfig",u[u.StopOrStartNnsCanister=17]="StopOrStartNnsCanister",u[u.RemoveNodes=18]="RemoveNodes",u[u.UninstallCode=19]="UninstallCode",u[u.UpdateNodeRewardsTable=20]="UpdateNodeRewardsTable",u[u.AddOrRemoveDataCenters=21]="AddOrRemoveDataCenters",u[u.UpdateUnassignedNodesConfig=22]="UpdateUnassignedNodesConfig",u[u.RemoveNodeOperators=23]="RemoveNodeOperators",u[u.RerouteCanisterRanges=24]="RerouteCanisterRanges",u[u.AddFirewallRules=25]="AddFirewallRules",u[u.RemoveFirewallRules=26]="RemoveFirewallRules",u[u.UpdateFirewallRules=27]="UpdateFirewallRules",u[u.PrepareCanisterMigration=28]="PrepareCanisterMigration",u[u.CompleteCanisterMigration=29]="CompleteCanisterMigration",u[u.AddSnsWasm=30]="AddSnsWasm",u[u.ChangeSubnetMembership=31]="ChangeSubnetMembership",u[u.UpdateSubnetType=32]="UpdateSubnetType",u[u.ChangeSubnetTypeAssignment=33]="ChangeSubnetTypeAssignment",u[u.UpdateSnsWasmSnsSubnetIds=34]="UpdateSnsWasmSnsSubnetIds",u[u.UpdateAllowedPrincipals=35]="UpdateAllowedPrincipals",u[u.RetireReplicaVersion=36]="RetireReplicaVersion",u[u.InsertSnsWasmUpgradePathEntries=37]="InsertSnsWasmUpgradePathEntries",u[u.UpdateElectedReplicaVersions=38]="UpdateElectedReplicaVersions",u[u.BitcoinSetConfig=39]="BitcoinSetConfig",u[u.UpdateElectedHostosVersions=40]="UpdateElectedHostosVersions",u[u.UpdateNodesHostosVersion=41]="UpdateNodesHostosVersion",u[u.AddApiBoundaryNode=43]="AddApiBoundaryNode",u[u.RemoveApiBoundaryNodes=44]="RemoveApiBoundaryNodes",u[u.UpdateApiBoundaryNodesVersion=46]="UpdateApiBoundaryNodesVersion",u))(cs||{}),us=(o=>(o[o.Unspecified=0]="Unspecified",o[o.Seed=1]="Seed",o[o.Ect=2]="Ect",o))(us||{});var ro=({neuronId:e,neuronInfo:t,rawNeuron:n,canisterId:o})=>{let r=n?fs({neuron:n,canisterId:o}):void 0;return{neuronId:e,dissolveDelaySeconds:t.dissolve_delay_seconds,recentBallots:t.recent_ballots.map(Ar),neuronType:_(t.neuron_type),createdTimestampSeconds:t.created_timestamp_seconds,state:t.state,joinedCommunityFundTimestampSeconds:t.joined_community_fund_timestamp_seconds.length?t.joined_community_fund_timestamp_seconds[0]:void 0,retrievedAtTimestampSeconds:t.retrieved_at_timestamp_seconds,votingPower:t.voting_power,ageSeconds:t.age_seconds,fullNeuron:r}},fs=({neuron:e,canisterId:t})=>({id:e.id.length?re(e.id[0]):void 0,stakedMaturityE8sEquivalent:_(e.staked_maturity_e8s_equivalent),controller:e.controller.length?e.controller[0].toString():void 0,recentBallots:e.recent_ballots.map(Ar),neuronType:_(e.neuron_type),kycVerified:e.kyc_verified,notForProfit:e.not_for_profit,cachedNeuronStake:e.cached_neuron_stake_e8s,createdTimestampSeconds:e.created_timestamp_seconds,autoStakeMaturity:_(e.auto_stake_maturity),maturityE8sEquivalent:e.maturity_e8s_equivalent,agingSinceTimestampSeconds:e.aging_since_timestamp_seconds,neuronFees:e.neuron_fees_e8s,hotKeys:e.hot_keys.map(n=>n.toString()),accountIdentifier:ps(t,Uint8Array.from(e.account)),joinedCommunityFundTimestampSeconds:e.joined_community_fund_timestamp_seconds.length?e.joined_community_fund_timestamp_seconds[0]:void 0,dissolveState:e.dissolve_state.length?ws(e.dissolve_state[0]):void 0,spawnAtTimesSeconds:e.spawn_at_timestamp_seconds[0],followees:e.followees.map(([n,o])=>Br({topic:n,followees:o}))}),ba=e=>({id:ot(e.id)?oe({id:e.id}):[],staked_maturity_e8s_equivalent:oe(e.stakedMaturityE8sEquivalent),controller:ot(e.controller)?oe(oo.from(e.controller)):[],recent_ballots:e.recentBallots.map(t=>({vote:t.vote,proposal_id:ot(t.proposalId)?oe({id:t.proposalId}):[]})),kyc_verified:e.kycVerified,neuron_type:oe(e.neuronType),not_for_profit:e.notForProfit,cached_neuron_stake_e8s:e.cachedNeuronStake,created_timestamp_seconds:e.createdTimestampSeconds,auto_stake_maturity:oe(e.autoStakeMaturity),maturity_e8s_equivalent:e.maturityE8sEquivalent,aging_since_timestamp_seconds:e.agingSinceTimestampSeconds,neuron_fees_e8s:e.neuronFees,hot_keys:e.hotKeys.map(t=>oo.from(t)),account:Mr.fromHex(e.accountIdentifier).toUint8Array(),joined_community_fund_timestamp_seconds:oe(e.joinedCommunityFundTimestampSeconds),dissolve_state:ot(e.dissolveState)?[e.dissolveState]:[],spawn_at_timestamp_seconds:oe(e.spawnAtTimesSeconds),followees:e.followees.map(t=>[t.topic,{followees:t.followees.map(n=>({id:n}))}]),transfer:[],known_neuron_data:[]}),Ar=({vote:e,proposal_id:t})=>({vote:e,proposalId:t.length?re(t[0]):void 0}),ws=e=>"DissolveDelaySeconds"in e?{DissolveDelaySeconds:e.DissolveDelaySeconds}:{WhenDissolvedTimestampSeconds:e.WhenDissolvedTimestampSeconds},Br=({topic:e,followees:t})=>({topic:e,followees:t.followees.map(re)}),re=({id:e})=>e,Ns=e=>{if("NeuronId"in e)return{NeuronId:e.NeuronId.id};if("Subaccount"in e)return{Subaccount:ms(Uint8Array.from(e.Subaccount))};throw new h(e)},gs=({neuronId:e,ballot:t})=>{let{vote:n,voting_power:o}=t;return{neuronId:e,vote:n,votingPower:o}},ys=({title:e,url:t,action:n,summary:o})=>({title:e.length?e[0]:void 0,url:t,action:n.length?Er(n[0]):void 0,summary:o}),Er=e=>{if("ExecuteNnsFunction"in e)return{ExecuteNnsFunction:{nnsFunctionId:e.ExecuteNnsFunction.nns_function}};if("ManageNeuron"in e){let t=e.ManageNeuron;return{ManageNeuron:{id:t.id.length?re(t.id[0]):void 0,command:t.command.length?hs(t.command[0]):void 0,neuronIdOrSubaccount:t.neuron_id_or_subaccount.length?Ns(t.neuron_id_or_subaccount[0]):void 0}}}if("ApproveGenesisKyc"in e)return{ApproveGenesisKyc:{principals:e.ApproveGenesisKyc.principals.map(n=>n.toString())}};if("ManageNetworkEconomics"in e){let t=e.ManageNetworkEconomics;return{ManageNetworkEconomics:{neuronMinimumStake:t.neuron_minimum_stake_e8s,maxProposalsToKeepPerTopic:t.max_proposals_to_keep_per_topic,neuronManagementFeePerProposal:t.neuron_management_fee_per_proposal_e8s,rejectCost:t.reject_cost_e8s,transactionFee:t.transaction_fee_e8s,neuronSpawnDissolveDelaySeconds:t.neuron_spawn_dissolve_delay_seconds,minimumIcpXdrRate:t.minimum_icp_xdr_rate,maximumNodeProviderRewards:t.maximum_node_provider_rewards_e8s}}}if("RewardNodeProvider"in e){let t=e.RewardNodeProvider;return{RewardNodeProvider:{nodeProvider:t.node_provider.length?rt(t.node_provider[0]):void 0,amountE8s:t.amount_e8s,rewardMode:t.reward_mode.length?Tr(t.reward_mode[0]):void 0}}}if("RewardNodeProviders"in e){let t=e.RewardNodeProviders;return{RewardNodeProviders:{useRegistryDerivedRewards:t.use_registry_derived_rewards.length?t.use_registry_derived_rewards[0]:void 0,rewards:t.rewards.map(n=>({nodeProvider:n.node_provider.length?rt(n.node_provider[0]):void 0,amountE8s:n.amount_e8s,rewardMode:n.reward_mode.length?Tr(n.reward_mode[0]):void 0}))}}}if("AddOrRemoveNodeProvider"in e){let t=e.AddOrRemoveNodeProvider;return{AddOrRemoveNodeProvider:{change:t.change.length?vs(t.change[0]):void 0}}}if("Motion"in e)return{Motion:{motionText:e.Motion.motion_text}};if("SetDefaultFollowees"in e)return{SetDefaultFollowees:{defaultFollowees:e.SetDefaultFollowees.default_followees.map(([n,o])=>Br({topic:n,followees:o}))}};if("RegisterKnownNeuron"in e){let t=e.RegisterKnownNeuron;return{RegisterKnownNeuron:Ss(t)}}if("SetSnsTokenSwapOpenTimeWindow"in e){let t=e.SetSnsTokenSwapOpenTimeWindow,n=t.request?.length?{openTimeWindow:t.request[0].open_time_window.length?{startTimestampSeconds:t.request[0].open_time_window[0].start_timestamp_seconds,endTimestampSeconds:t.request[0].open_time_window[0].end_timestamp_seconds}:void 0}:void 0,o=t?.swap_canister_id.length?t.swap_canister_id[0].toString():void 0;return{SetSnsTokenSwapOpenTimeWindow:{request:n,swapCanisterId:o}}}if("OpenSnsTokenSwap"in e){let t=e.OpenSnsTokenSwap,n=_(t.params);return{OpenSnsTokenSwap:{communityFundInvestmentE8s:_(t.community_fund_investment_e8s),targetSwapCanisterId:_(t.target_swap_canister_id),params:n&&{minParticipantIcpE8s:n.min_participant_icp_e8s,maxIcpE8s:n.max_icp_e8s,swapDueTimestampSeconds:n.swap_due_timestamp_seconds,minParticipants:n.min_participants,snsTokenE8s:n.sns_token_e8s,maxParticipantIcpE8s:n.max_participant_icp_e8s,minIcpE8s:n.min_icp_e8s,saleDelaySeconds:_(n.sale_delay_seconds),neuronBasketConstructionParameters:_(n.neuron_basket_construction_parameters),maxDirectParticipationIcpE8s:_(n.max_direct_participation_icp_e8s),minDirectParticipationIcpE8s:_(n.min_direct_participation_icp_e8s)}}}}if("CreateServiceNervousSystem"in e){let t=e.CreateServiceNervousSystem;return{CreateServiceNervousSystem:{url:_(t.url),governanceParameters:Fs(_(t.governance_parameters)),fallbackControllerPrincipalIds:t.fallback_controller_principal_ids.map(n=>n.toString()),logo:Kr(_(t.logo)),name:_(t.name),ledgerParameters:Es(_(t.ledger_parameters)),description:_(t.description),dappCanisters:t.dapp_canisters.map(Bs)??[],swapParameters:Us(_(t.swap_parameters)),initialTokenDistribution:Gs(_(t.initial_token_distribution))}}}throw new h(e)},Rs=e=>({no:e.no,yes:e.yes,total:e.total,timestampSeconds:e.timestamp_seconds}),hs=e=>{if("Spawn"in e){let t=e.Spawn;return{Spawn:{newController:t.new_controller.length?t.new_controller[0].toString():void 0,percentageToSpawn:t.percentage_to_spawn.length?t.percentage_to_spawn[0]:0}}}if("Split"in e)return{Split:{amount:e.Split.amount_e8s}};if("Follow"in e){let t=e.Follow;return{Follow:{topic:t.topic,followees:t.followees.map(re)}}}if("ClaimOrRefresh"in e){let t=e.ClaimOrRefresh;return{ClaimOrRefresh:{by:t.by.length?bs(t.by[0]):void 0}}}if("Configure"in e){let t=e.Configure;return{Configure:{operation:t.operation.length?Os(t.operation[0]):void 0}}}if("RegisterVote"in e){let t=e.RegisterVote;return{RegisterVote:{vote:t.vote,proposal:t.proposal.length?re(t.proposal[0]):void 0}}}if("DisburseToNeuron"in e){let t=e.DisburseToNeuron;return{DisburseToNeuron:{dissolveDelaySeconds:t.dissolve_delay_seconds,kycVerified:t.kyc_verified,amount:t.amount_e8s,newController:t.new_controller.length?t.new_controller[0].toString():void 0,nonce:t.nonce}}}if("MergeMaturity"in e)return{MergeMaturity:{percentageToMerge:e.MergeMaturity.percentage_to_merge}};if("StakeMaturity"in e){let{percentage_to_stake:t}=e.StakeMaturity;return{StakeMaturity:{percentageToStake:_(t)}}}if("MakeProposal"in e){let t=e.MakeProposal;return{MakeProposal:{title:t.title.length?t.title[0]:void 0,url:t.url,action:t.action.length?Er(t.action[0]):void 0,summary:t.summary}}}if("Disburse"in e){let t=e.Disburse;return{Disburse:{toAccountId:t.to_account.length?io(t.to_account[0]):void 0,amount:t.amount.length?xs(t.amount[0]):void 0}}}if("Merge"in e){let t=e.Merge;return{Merge:{sourceNeuronId:t.source_neuron_id.length?t.source_neuron_id[0].id:void 0}}}throw new h(e)},Os=e=>{if("RemoveHotKey"in e){let t=e.RemoveHotKey;return{RemoveHotKey:{hotKeyToRemove:t.hot_key_to_remove.length?t.hot_key_to_remove[0].toString():void 0}}}if("AddHotKey"in e){let t=e.AddHotKey;return{AddHotKey:{newHotKey:t.new_hot_key.length?t.new_hot_key[0].toString():void 0}}}if("StopDissolving"in e)return{StopDissolving:{}};if("StartDissolving"in e)return{StartDissolving:{}};if("IncreaseDissolveDelay"in e)return{IncreaseDissolveDelay:{additionalDissolveDelaySeconds:e.IncreaseDissolveDelay.additional_dissolve_delay_seconds}};if("JoinCommunityFund"in e||"LeaveCommunityFund"in e)return e;if("SetDissolveTimestamp"in e)return{SetDissolveTimestamp:{dissolveTimestampSeconds:e.SetDissolveTimestamp.dissolve_timestamp_seconds}};if("ChangeAutoStakeMaturity"in e){let{requested_setting_for_auto_stake_maturity:t}=e.ChangeAutoStakeMaturity;return{ChangeAutoStakeMaturity:{requestedSettingForAutoStakeMaturity:t}}}throw new h(e)},vs=e=>{if("ToRemove"in e)return{ToRemove:rt(e.ToRemove)};if("ToAdd"in e)return{ToAdd:rt(e.ToAdd)};throw new h(e)},rt=e=>({id:e.id.length?e.id[0].toString():void 0,rewardAccount:e.reward_account.length?io(e.reward_account[0]):void 0}),xs=e=>e.e8s,io=e=>ds(new Uint8Array(e.hash)),Tr=e=>{if("RewardToNeuron"in e)return{RewardToNeuron:{dissolveDelaySeconds:e.RewardToNeuron.dissolve_delay_seconds}};if("RewardToAccount"in e)return{RewardToAccount:{toAccount:e.RewardToAccount.to_account!=null&&e.RewardToAccount.to_account.length?io(e.RewardToAccount.to_account[0]):void 0}};throw new h(e)},bs=e=>{if("NeuronIdOrSubaccount"in e)return{NeuronIdOrSubaccount:{}};if("Memo"in e)return{Memo:e.Memo};if("MemoAndController"in e)return{MemoAndController:{memo:e.MemoAndController.memo,controller:e.MemoAndController.controller.length?e.MemoAndController.controller[0]:void 0}};throw new h(e)},so=e=>({id:e.id.length?re(e.id[0]):void 0,ballots:e.ballots.map(t=>gs({neuronId:t[0],ballot:t[1]})),rejectCost:e.reject_cost_e8s,proposalTimestampSeconds:e.proposal_timestamp_seconds,rewardEventRound:e.reward_event_round,failedTimestampSeconds:e.failed_timestamp_seconds,deadlineTimestampSeconds:_(e.deadline_timestamp_seconds),decidedTimestampSeconds:e.decided_timestamp_seconds,proposal:e.proposal.length?ys(e.proposal[0]):void 0,proposer:e.proposer.length?re(e.proposer[0]):void 0,latestTally:e.latest_tally.length?Rs(e.latest_tally[0]):void 0,executedTimestampSeconds:e.executed_timestamp_seconds,topic:e.topic,status:e.status,rewardStatus:e.reward_status}),Vr=({response:{neuron_infos:e,full_neurons:t},canisterId:n})=>e.map(([o,r])=>ro({neuronId:o,neuronInfo:r,rawNeuron:t.find(i=>i.id.length&&i.id[0].id===o),canisterId:n})),Fr=({proposal_info:e})=>({proposals:e.map(so)}),Ss=({id:e,known_neuron_data:t})=>({id:e[0]?.id??BigInt(0),name:t[0]?.name??"",description:t[0]?.description[0]??""}),qr=e=>{let t=e.getProposalId();return{vote:e.getVote(),proposalId:t!==void 0?BigInt(t.getId()):void 0}},ks=e=>e?.hasWhenDissolvedTimestampSeconds()?2:e?.hasDissolveDelaySeconds()?e.getDissolveDelaySeconds()==="0"?3:1:0,Ts=e=>e.toArray().map(([t,n])=>({topic:Number(t),followees:n.getFolloweesList?.().map(o=>BigInt(o.getId()))??[]})),Pr=e=>oo.fromUint8Array(e.getSerializedId_asU8()).toText(),Ps=({neuron:e,canisterId:t})=>{let n=_s.fromBytes(e.getAccount_asU8());return Mr.fromPrincipal({principal:t,subAccount:n})},Cs=({pbNeuron:e,pbNeuronInfo:t,canisterId:n})=>{let o=e.getId(),r=e.getController(),i=r===void 0?r:Pr(r),s;return e.hasWhenDissolvedTimestampSeconds()?s={WhenDissolvedTimestampSeconds:BigInt(e.getWhenDissolvedTimestampSeconds())}:e.hasDissolveDelaySeconds()&&(s={DissolveDelaySeconds:BigInt(e.getDissolveDelaySeconds())}),{id:o===void 0?void 0:BigInt(o.getId()),stakedMaturityE8sEquivalent:void 0,controller:i,recentBallots:t.getRecentBallotsList().map(qr),neuronType:void 0,kycVerified:e.getKycVerified(),notForProfit:e.getNotForProfit(),cachedNeuronStake:BigInt(e.getCachedNeuronStakeE8s()),createdTimestampSeconds:BigInt(e.getCreatedTimestampSeconds()),autoStakeMaturity:void 0,maturityE8sEquivalent:BigInt(e.getMaturityE8sEquivalent()),agingSinceTimestampSeconds:BigInt(e.getAgingSinceTimestampSeconds()),spawnAtTimesSeconds:e.hasSpawnAtTimestampSeconds()?BigInt(e.getSpawnAtTimestampSeconds()):void 0,neuronFees:BigInt(e.getNeuronFeesE8s()),hotKeys:e.getHotKeysList().map(Pr),accountIdentifier:Ps({neuron:e,canisterId:n}).toHex(),joinedCommunityFundTimestampSeconds:void 0,dissolveState:s,followees:Ts(e.getFolloweesMap())}},Ur=({pbNeurons:e,canisterId:t})=>n=>{let o=e.find(i=>i.getId()?.getId()===n.getKey()),r=n.getValue();if(r===void 0)throw new Error(`NeuronInfo not present for neuron ${n.getKey()}`);return{neuronId:BigInt(n.getKey()),dissolveDelaySeconds:BigInt(r.getDissolveDelaySeconds()),recentBallots:r.getRecentBallotsList().map(qr),neuronType:void 0,createdTimestampSeconds:BigInt(r.getCreatedTimestampSeconds()),state:ks(o),joinedCommunityFundTimestampSeconds:void 0,retrievedAtTimestampSeconds:BigInt(r.getRetrievedAtTimestampSeconds()),votingPower:BigInt(r.getVotingPower()),ageSeconds:BigInt(r.getAgeSeconds()),fullNeuron:o===void 0?void 0:Cs({pbNeuron:o,pbNeuronInfo:r,canisterId:t})}},it=e=>e===void 0?void 0:{basisPoints:_(e.basis_points)},W=e=>e===void 0?void 0:{seconds:_(e.seconds)},Ms=e=>e===void 0?void 0:{secondsAfterUtcMidnight:_(e.seconds_after_utc_midnight)},As=e=>e===void 0?void 0:{isoCodes:e.iso_codes},M=e=>e===void 0?void 0:{e8s:_(e.e8s)},Bs=e=>e===void 0||e.id.length===0?void 0:ls(e.id).toString(),Kr=e=>e===void 0?void 0:{base64Encoding:_(e.base64_encoding)},Es=e=>e===void 0?void 0:{transactionFee:M(_(e.transaction_fee)),tokenSymbol:_(e.token_symbol),tokenLogo:Kr(_(e.token_logo)),tokenName:_(e.token_name)},Vs=e=>e===void 0?void 0:{rewardRateTransitionDuration:W(_(e.reward_rate_transition_duration)),initialRewardRate:it(_(e.initial_reward_rate)),finalRewardRate:it(_(e.final_reward_rate))},Fs=e=>e===void 0?void 0:{neuronMaximumDissolveDelayBonus:it(_(e.neuron_maximum_dissolve_delay_bonus)),neuronMaximumAgeForAgeBonus:W(_(e.neuron_maximum_age_for_age_bonus)),neuronMaximumDissolveDelay:W(_(e.neuron_maximum_dissolve_delay)),neuronMinimumDissolveDelayToVote:W(_(e.neuron_minimum_dissolve_delay_to_vote)),neuronMaximumAgeBonus:it(_(e.neuron_maximum_age_bonus)),neuronMinimumStake:M(_(e.neuron_minimum_stake)),proposalWaitForQuietDeadlineIncrease:W(_(e.proposal_wait_for_quiet_deadline_increase)),proposalInitialVotingPeriod:W(_(e.proposal_initial_voting_period)),proposalRejectionFee:M(_(e.proposal_rejection_fee)),votingRewardParameters:Vs(_(e.voting_reward_parameters))},qs=e=>e===void 0?void 0:{dissolveDelayInterval:W(_(e.dissolve_delay_interval)),count:_(e.count)},Us=e=>e===void 0?void 0:{minimumParticipants:_(e.minimum_participants),duration:W(_(e.duration)),neuronBasketConstructionParameters:qs(_(e.neuron_basket_construction_parameters)),confirmationText:_(e.confirmation_text),maximumParticipantIcp:M(_(e.maximum_participant_icp)),neuronsFundInvestmentIcp:M(_(e.neurons_fund_investment_icp)),minimumIcp:M(_(e.minimum_icp)),minimumParticipantIcp:M(_(e.minimum_participant_icp)),startTime:Ms(_(e.start_time)),maximumIcp:M(_(e.maximum_icp)),restrictedCountries:As(_(e.restricted_countries)),maxDirectParticipationIcp:M(_(e.maximum_direct_participation_icp)),minDirectParticipationIcp:M(_(e.minimum_direct_participation_icp)),neuronsFundParticipation:_(e.neurons_fund_participation)},Cr=e=>e===void 0?void 0:{total:M(_(e.total))},Ks=e=>e===void 0?void 0:{controller:e.controller.length===0?void 0:e.controller[0].toString(),dissolveDelay:W(_(e.dissolve_delay)),memo:_(e.memo),vestingPeriod:W(_(e.vesting_period)),stake:M(_(e.stake))},Hs=e=>e===void 0?void 0:{developerNeurons:e.developer_neurons.map(Ks)},Gs=e=>e===void 0?void 0:{treasuryDistribution:Cr(_(e.treasury_distribution)),developerDistribution:Hs(_(e.developer_distribution)),swapDistribution:Cr(_(e.swap_distribution))};var Hr=async e=>{let{ManageNeuronResponse:t}=await b(),o=t.deserializeBinary(e).getError();if(o)throw new E({error_message:o.getErrorMessage(),error_type:o.getErrorType()})};var je=e=>{let{command:t}=e,n=t[0];if(!n)throw new E({error_message:"Error updating neuron",error_type:0});if("Error"in n)throw new E(n.Error);return n},O=async({request:e,service:t})=>{let n=await t.manage_neuron(e);return je(n)},Gr=async({request:e,service:t})=>{let n=await t.simulate_manage_neuron(e);return je(n)};var ao=BigInt(1e8);var $r=class e{constructor(t,n,o,r,i=!1){this.canisterId=t;this.service=n;this.certifiedService=o;this.agent=r;this.hardwareWallet=i;this.listNeurons=async({certified:t=!0,neuronIds:n})=>{if(this.hardwareWallet&&!t)throw new Le;if(this.hardwareWallet)return this.listNeuronsHardwareWallet();let o=Zo(n),r=await this.getGovernanceService(t).list_neurons(o);return Vr({response:r,canisterId:this.canisterId})};this.listKnownNeurons=async(t=!0)=>(await this.getGovernanceService(t).list_known_neurons()).known_neurons.map(o=>({id:k(o.id)?.id??BigInt(0),name:k(o.known_neuron_data)?.name??"",description:k(k(o.known_neuron_data)?.description??[])}));this.getLastestRewardEvent=async(t=!0)=>this.getGovernanceService(t).get_latest_reward_event();this.listProposals=async({request:t,certified:n=!0})=>{let o=Io(t),r=await this.getGovernanceService(n).list_proposals(o);return Fr(r)};this.stakeNeuron=async({stake:t,principal:n,fromSubAccount:o,ledgerCanister:r,createdAt:i,fee:s})=>{if(t<ao)throw new We(t);let c=new Uint8Array((0,_o.default)(8)),d=jr(c),m=this.buildNeuronStakeSubAccount(c,n),l=co.fromPrincipal({principal:this.canisterId,subAccount:m});await r.transfer({memo:d,amount:t,fromSubAccount:o,to:l,createdAt:i,fee:s});let p=await this.claimOrRefreshNeuronFromAccount({controller:n,memo:d});if(po(p))throw new Ge;return p};this.stakeNeuronIcrc1=async({stake:t,principal:n,fromSubAccount:o,ledgerCanister:r,createdAt:i,fee:s})=>{if(t<ao)throw new We(t);let c=new Uint8Array((0,_o.default)(8)),d=jr(c),m=this.getNeuronStakeSubAccountBytes(c,n);await r.icrc1Transfer({icrc1Memo:c,amount:t,fromSubAccount:o,to:{owner:this.canisterId,subaccount:[m]},createdAt:i,fee:s});let l=await this.claimOrRefreshNeuronFromAccount({controller:n,memo:d});if(po(l))throw new Ge;return l};this.increaseDissolveDelay=async({neuronId:t,additionalDissolveDelaySeconds:n})=>{if(this.hardwareWallet)return this.increaseDissolveDelayHardwareWallet({neuronId:t,additionalDissolveDelaySeconds:n});let o=dr({neuronId:t,additionalDissolveDelaySeconds:n});await O({request:o,service:this.certifiedService})};this.setDissolveDelay=async({neuronId:t,dissolveDelaySeconds:n})=>{let o=pr({neuronId:t,dissolveDelaySeconds:n});await O({request:o,service:this.certifiedService})};this.startDissolving=async t=>{if(this.hardwareWallet)return this.startDissolvingHardwareWallet(t);let n=fr(t);await O({request:n,service:this.certifiedService})};this.stopDissolving=async t=>{if(this.hardwareWallet)return this.stopDissolvingHardwareWallet(t);let n=wr(t);await O({request:n,service:this.certifiedService})};this.joinCommunityFund=async t=>{if(this.hardwareWallet)return this.joinCommunityFundHardwareWallet(t);let n=_r(t);await O({request:n,service:this.certifiedService})};this.autoStakeMaturity=async t=>{await O({request:lr(t),service:this.certifiedService})};this.leaveCommunityFund=async t=>{let n=mr(t);await O({request:n,service:this.certifiedService})};this.setNodeProviderAccount=async t=>{Wr(t);let n=co.fromHex(t),o=await this.certifiedService.update_node_provider({reward_account:[n.toAccountIdentifierHash()]});if("Err"in o)throw new E(o.Err)};this.mergeNeurons=async t=>{let n=to(t);await O({request:n,service:this.certifiedService})};this.simulateMergeNeurons=async t=>{let n=to(t),o=await Gr({request:n,service:this.certifiedService}),r,i,s,c;if("Merge"in o&&V(r=o.Merge)&&V(i=k(r.target_neuron_info))&&V(s=k(r.target_neuron))&&V(c=k(s.id)?.id))return ro({neuronId:c,neuronInfo:i,rawNeuron:s,canisterId:this.canisterId});throw new I(`simulateMergeNeurons: Unrecognized Merge error in ${JSON.stringify(o)}`)};this.splitNeuron=async({neuronId:t,amount:n})=>{let o=er({neuronId:t,amount:n}),r=await this.certifiedService.manage_neuron(o),i=je(r);if("Split"in i){let s=k(i.Split.created_neuron_id);if(po(s))throw new E({error_message:"Unexpected error splitting neuron. No neuronId in Split response.",error_type:0});return s.id}throw new I(`Unrecognized Split error in ${JSON.stringify(r)}`)};this.getProposal=async({proposalId:t,certified:n=!0})=>{let[o]=await this.getGovernanceService(n).get_proposal_info(t);return o?so(o):void 0};this.makeProposal=async t=>{let n=nr(t),o=await O({request:n,service:this.certifiedService});return"MakeProposal"in o?k(o.MakeProposal.proposal_id)?.id:void 0};this.registerVote=async({neuronId:t,vote:n,proposalId:o})=>{let r=tr({neuronId:t,vote:n,proposalId:o});await O({request:r,service:this.certifiedService})};this.setFollowees=async t=>{let n=or(t);await O({request:n,service:this.certifiedService})};this.disburse=async({neuronId:t,toAccountId:n,amount:o})=>{if(V(n)&&Wr(n),this.hardwareWallet)return this.disburseHardwareWallet({neuronId:t,toAccountId:n,amount:o});let r=V(n)?co.fromHex(n):void 0,i=rr({neuronId:t,toAccountIdentifier:r,amount:o});await O({request:i,service:this.certifiedService})};this.mergeMaturity=async({neuronId:t,percentageToMerge:n})=>{if(uo(n),this.hardwareWallet)return this.mergeMaturityHardwareWallet({neuronId:t,percentageToMerge:n});let o=ir({neuronId:t,percentageToMerge:n});await O({request:o,service:this.certifiedService})};this.stakeMaturity=async({neuronId:t,percentageToStake:n})=>{uo(n??100),await O({request:sr({neuronId:t,percentageToStake:n}),service:this.certifiedService})};this.spawnNeuron=async({neuronId:t,percentageToSpawn:n,newController:o,nonce:r})=>{if(V(n)&&uo(n),this.hardwareWallet)return this.spawnHardwareWallet({neuronId:t,percentageToSpawn:n,newController:o?.toText()});let i=ar({neuronId:t,percentageToSpawn:n,newController:o,nonce:r}),s=await this.certifiedService.manage_neuron(i),c=je(s),d;if("Spawn"in c&&V(d=k(c.Spawn.created_neuron_id)?.id))return d;throw new I(`Unrecognized Spawn error in ${JSON.stringify(s)}`)};this.addHotkey=async({neuronId:t,principal:n})=>{if(this.hardwareWallet)return this.addHotkeyHardwareWallet({neuronId:t,principal:n});let o=cr({neuronId:t,principal:n});await O({request:o,service:this.certifiedService})};this.removeHotkey=async({neuronId:t,principal:n})=>{if(this.hardwareWallet)return this.removeHotkeyHardwareWallet({neuronId:t,principal:n});let o=ur({neuronId:t,principal:n});await O({request:o,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async({memo:t,controller:n})=>{let o=Lo({memo:t,controller:n}),r=await this.certifiedService.manage_neuron(o),i;if(V(i=k(r.command))&&"ClaimOrRefresh"in i)return k(i.ClaimOrRefresh.refreshed_neuron_id)?.id;throw new I(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(r)}`)};this.claimOrRefreshNeuron=async t=>{let n=Do(t),o=await this.service.manage_neuron(n),r;if(V(r=k(o.command))&&"ClaimOrRefresh"in r)return k(r.ClaimOrRefresh.refreshed_neuron_id)?.id;throw new I(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(o)}`)};this.buildNeuronStakeSubAccount=(t,n)=>Ws.fromBytes(this.getNeuronStakeSubAccountBytes(t,n));this.getNeuronStakeSubAccountBytes=(t,n)=>{let o=$s("neuron-stake"),r=wo.create();return r.update(js([12,...o,...n.toUint8Array(),...t])),r.digest()};this.getNeuron=async({certified:t=!0,neuronId:n})=>{let[o]=await this.listNeurons({certified:t,neuronIds:[n]});return o};this.listNeuronsHardwareWallet=async()=>{let{ListNeurons:t,ListNeuronsResponse:n}=await b(),o=new t;o.setIncludeNeuronsReadableByCaller(!0);let r=await nt({agent:this.agent,canisterId:this.canisterId,methodName:"list_neurons_pb",arg:o.serializeBinary()}),i=n.deserializeBinary(r),s=i.getFullNeuronsList();return i.getNeuronIdsList().map(Ur({pbNeurons:s,canisterId:this.canisterId}))};this.manageNeuronUpdateCall=async t=>{let n=await nt({agent:this.agent,canisterId:this.canisterId,methodName:"manage_neuron_pb",arg:t.serializeBinary()});await Hr(n)};this.addHotkeyHardwareWallet=async({neuronId:t,principal:n})=>{let o=await gr({neuronId:t,principal:n.toText()});await this.manageNeuronUpdateCall(o)};this.removeHotkeyHardwareWallet=async({neuronId:t,principal:n})=>{let o=await yr({neuronId:t,principal:n.toText()});await this.manageNeuronUpdateCall(o)};this.increaseDissolveDelayHardwareWallet=async({neuronId:t,additionalDissolveDelaySeconds:n})=>{let o=await Rr({neuronId:t,additionalDissolveDelaySeconds:n});await this.manageNeuronUpdateCall(o)};this.startDissolvingHardwareWallet=async t=>{let n=await hr(t);await this.manageNeuronUpdateCall(n)};this.stopDissolvingHardwareWallet=async t=>{let n=await Or(t);await this.manageNeuronUpdateCall(n)};this.joinCommunityFundHardwareWallet=async t=>{let n=await vr(t);await this.manageNeuronUpdateCall(n)};this.disburseHardwareWallet=async t=>{let n=await xr(t);await this.manageNeuronUpdateCall(n)};this.mergeMaturityHardwareWallet=async t=>{let n=await br(t);await this.manageNeuronUpdateCall(n)};this.spawnHardwareWallet=async t=>{let n=await Sr(t),o=await nt({agent:this.agent,canisterId:this.canisterId,methodName:"manage_neuron_pb",arg:n.serializeBinary()}),{ManageNeuronResponse:r}=await b(),i=r.deserializeBinary(o),s=i.getError();if(s)throw new E({error_message:s.getErrorMessage(),error_type:s.getErrorType()});let c=i.getSpawn()?.getCreatedNeuronId();if(V(c))return BigInt(c.getId());throw new I(`Unrecognized Spawn error in ${JSON.stringify(i)}`)};this.canisterId=t,this.service=n,this.certifiedService=o,this.agent=r,this.hardwareWallet=i}static create(t={}){let n=t.canisterId??lo,{service:o,certifiedService:r,agent:i}=zs({options:{...t,canisterId:n},idlFactory:jo,certifiedIdlFactory:Wo});return new e(n,o,r,i,t.hardwareWallet)}getGovernanceService(t){return t?this.certifiedService:this.service}};export{jo as a,De as b,Ge as c,We as d,I as e,E as f,h as g,Le as h,kr as i,rs as j,is as k,ss as l,as as m,cs as n,us as o,ba as p,$r as q};
|
|
4
|
-
/*! Bundled license information:
|
|
5
|
-
|
|
6
|
-
ieee754/index.js:
|
|
7
|
-
(*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> *)
|
|
8
|
-
|
|
9
|
-
buffer/index.js:
|
|
10
|
-
(*!
|
|
11
|
-
* The buffer module from node.js, for the browser.
|
|
12
|
-
*
|
|
13
|
-
* @author Feross Aboukhadijeh <https://feross.org>
|
|
14
|
-
* @license MIT
|
|
15
|
-
*)
|
|
16
|
-
|
|
17
|
-
@noble/hashes/esm/utils.js:
|
|
18
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
19
|
-
*/
|
|
20
|
-
//# sourceMappingURL=chunk-LZ5FA3UO.js.map
|