@dfinity/nns 0.9.0-next-2022-10-31 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/candid/genesis_token.did +1 -1
- package/dist/candid/governance.did +1 -1
- package/dist/candid/ledger.did +1 -1
- package/dist/candid/sns_wasm.certified.idl.js +13 -0
- package/dist/candid/sns_wasm.d.ts +13 -0
- package/dist/candid/sns_wasm.did +17 -2
- package/dist/candid/sns_wasm.idl.js +13 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/index.cjs.js.map +2 -2
- package/dist/esm/chunk-7W7SDNAO.js +2 -0
- package/dist/esm/chunk-7W7SDNAO.js.map +7 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/sns_wasm.canister.js +1 -1
- package/package.json +3 -3
- package/dist/esm/chunk-FE7GM5G4.js +0 -2
- package/dist/esm/chunk-FE7GM5G4.js.map +0 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 1fc0208b9aeed0554b1be2711605e5b54ace9d6a 'rs/nns/gtc/canister/gtc.did' by import-candid
|
|
2
2
|
type AccountState = record {
|
|
3
3
|
authenticated_principal_id : opt principal;
|
|
4
4
|
successfully_transferred_neurons : vec TransferredNeuron;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 1fc0208b9aeed0554b1be2711605e5b54ace9d6a 'rs/nns/governance/canister/governance.did' by import-candid
|
|
2
2
|
type AccountIdentifier = record { hash : vec nat8 };
|
|
3
3
|
type Action = variant {
|
|
4
4
|
RegisterKnownNeuron : KnownNeuron;
|
package/dist/candid/ledger.did
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 1fc0208b9aeed0554b1be2711605e5b54ace9d6a 'rs/rosetta-api/icp_ledger/ledger.did' by import-candid
|
|
2
2
|
// This is the official Ledger interface that is guaranteed to be backward compatible.
|
|
3
3
|
|
|
4
4
|
// Amount of tokens, measured in 10^-8 of a token.
|
|
@@ -47,16 +47,25 @@ export const idlFactory = ({ IDL }) => {
|
|
|
47
47
|
});
|
|
48
48
|
const SnsInitPayload = IDL.Record({
|
|
49
49
|
'url' : IDL.Opt(IDL.Text),
|
|
50
|
+
'max_dissolve_delay_seconds' : IDL.Opt(IDL.Nat64),
|
|
51
|
+
'max_dissolve_delay_bonus_percentage' : IDL.Opt(IDL.Nat64),
|
|
50
52
|
'fallback_controller_principal_ids' : IDL.Vec(IDL.Text),
|
|
51
53
|
'token_symbol' : IDL.Opt(IDL.Text),
|
|
54
|
+
'final_reward_rate_basis_points' : IDL.Opt(IDL.Nat64),
|
|
52
55
|
'neuron_minimum_stake_e8s' : IDL.Opt(IDL.Nat64),
|
|
53
56
|
'logo' : IDL.Opt(IDL.Text),
|
|
54
57
|
'name' : IDL.Opt(IDL.Text),
|
|
58
|
+
'initial_voting_period_seconds' : IDL.Opt(IDL.Nat64),
|
|
55
59
|
'neuron_minimum_dissolve_delay_to_vote_seconds' : IDL.Opt(IDL.Nat64),
|
|
56
60
|
'description' : IDL.Opt(IDL.Text),
|
|
61
|
+
'max_neuron_age_seconds_for_age_bonus' : IDL.Opt(IDL.Nat64),
|
|
62
|
+
'initial_reward_rate_basis_points' : IDL.Opt(IDL.Nat64),
|
|
63
|
+
'wait_for_quiet_deadline_increase_seconds' : IDL.Opt(IDL.Nat64),
|
|
57
64
|
'transaction_fee_e8s' : IDL.Opt(IDL.Nat64),
|
|
58
65
|
'sns_initialization_parameters' : IDL.Opt(IDL.Text),
|
|
66
|
+
'max_age_bonus_percentage' : IDL.Opt(IDL.Nat64),
|
|
59
67
|
'initial_token_distribution' : IDL.Opt(InitialTokenDistribution),
|
|
68
|
+
'reward_rate_transition_duration_seconds' : IDL.Opt(IDL.Nat64),
|
|
60
69
|
'token_name' : IDL.Opt(IDL.Text),
|
|
61
70
|
'proposal_reject_cost_e8s' : IDL.Opt(IDL.Nat64),
|
|
62
71
|
});
|
|
@@ -99,6 +108,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
99
108
|
const GetWasmResponse = IDL.Record({ 'wasm' : IDL.Opt(SnsWasm) });
|
|
100
109
|
const DeployedSns = IDL.Record({
|
|
101
110
|
'root_canister_id' : IDL.Opt(IDL.Principal),
|
|
111
|
+
'governance_canister_id' : IDL.Opt(IDL.Principal),
|
|
112
|
+
'index_canister_id' : IDL.Opt(IDL.Principal),
|
|
113
|
+
'swap_canister_id' : IDL.Opt(IDL.Principal),
|
|
114
|
+
'ledger_canister_id' : IDL.Opt(IDL.Principal),
|
|
102
115
|
});
|
|
103
116
|
const ListDeployedSnsesResponse = IDL.Record({
|
|
104
117
|
'instances' : IDL.Vec(DeployedSns),
|
|
@@ -21,6 +21,10 @@ export interface DeployNewSnsResponse {
|
|
|
21
21
|
}
|
|
22
22
|
export interface DeployedSns {
|
|
23
23
|
root_canister_id: [] | [Principal];
|
|
24
|
+
governance_canister_id: [] | [Principal];
|
|
25
|
+
index_canister_id: [] | [Principal];
|
|
26
|
+
swap_canister_id: [] | [Principal];
|
|
27
|
+
ledger_canister_id: [] | [Principal];
|
|
24
28
|
}
|
|
25
29
|
export interface DeveloperDistribution {
|
|
26
30
|
developer_neurons: Array<NeuronDistribution>;
|
|
@@ -71,16 +75,25 @@ export interface SnsCanisterIds {
|
|
|
71
75
|
}
|
|
72
76
|
export interface SnsInitPayload {
|
|
73
77
|
url: [] | [string];
|
|
78
|
+
max_dissolve_delay_seconds: [] | [bigint];
|
|
79
|
+
max_dissolve_delay_bonus_percentage: [] | [bigint];
|
|
74
80
|
fallback_controller_principal_ids: Array<string>;
|
|
75
81
|
token_symbol: [] | [string];
|
|
82
|
+
final_reward_rate_basis_points: [] | [bigint];
|
|
76
83
|
neuron_minimum_stake_e8s: [] | [bigint];
|
|
77
84
|
logo: [] | [string];
|
|
78
85
|
name: [] | [string];
|
|
86
|
+
initial_voting_period_seconds: [] | [bigint];
|
|
79
87
|
neuron_minimum_dissolve_delay_to_vote_seconds: [] | [bigint];
|
|
80
88
|
description: [] | [string];
|
|
89
|
+
max_neuron_age_seconds_for_age_bonus: [] | [bigint];
|
|
90
|
+
initial_reward_rate_basis_points: [] | [bigint];
|
|
91
|
+
wait_for_quiet_deadline_increase_seconds: [] | [bigint];
|
|
81
92
|
transaction_fee_e8s: [] | [bigint];
|
|
82
93
|
sns_initialization_parameters: [] | [string];
|
|
94
|
+
max_age_bonus_percentage: [] | [bigint];
|
|
83
95
|
initial_token_distribution: [] | [InitialTokenDistribution];
|
|
96
|
+
reward_rate_transition_duration_seconds: [] | [bigint];
|
|
84
97
|
token_name: [] | [string];
|
|
85
98
|
proposal_reject_cost_e8s: [] | [bigint];
|
|
86
99
|
}
|
package/dist/candid/sns_wasm.did
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated from IC repo commit
|
|
1
|
+
// Generated from IC repo commit 1fc0208b9aeed0554b1be2711605e5b54ace9d6a 'rs/nns/sns-wasm/canister/sns-wasm.did' by import-candid
|
|
2
2
|
type AddWasmRequest = record { hash : vec nat8; wasm : opt SnsWasm };
|
|
3
3
|
type AddWasmResponse = record { result : opt Result };
|
|
4
4
|
type AirdropDistribution = record { airdrop_neurons : vec NeuronDistribution };
|
|
@@ -8,7 +8,13 @@ type DeployNewSnsResponse = record {
|
|
|
8
8
|
error : opt SnsWasmError;
|
|
9
9
|
canisters : opt SnsCanisterIds;
|
|
10
10
|
};
|
|
11
|
-
type DeployedSns = record {
|
|
11
|
+
type DeployedSns = record {
|
|
12
|
+
root_canister_id : opt principal;
|
|
13
|
+
governance_canister_id : opt principal;
|
|
14
|
+
index_canister_id : opt principal;
|
|
15
|
+
swap_canister_id : opt principal;
|
|
16
|
+
ledger_canister_id : opt principal;
|
|
17
|
+
};
|
|
12
18
|
type DeveloperDistribution = record {
|
|
13
19
|
developer_neurons : vec NeuronDistribution;
|
|
14
20
|
};
|
|
@@ -46,16 +52,25 @@ type SnsCanisterIds = record {
|
|
|
46
52
|
};
|
|
47
53
|
type SnsInitPayload = record {
|
|
48
54
|
url : opt text;
|
|
55
|
+
max_dissolve_delay_seconds : opt nat64;
|
|
56
|
+
max_dissolve_delay_bonus_percentage : opt nat64;
|
|
49
57
|
fallback_controller_principal_ids : vec text;
|
|
50
58
|
token_symbol : opt text;
|
|
59
|
+
final_reward_rate_basis_points : opt nat64;
|
|
51
60
|
neuron_minimum_stake_e8s : opt nat64;
|
|
52
61
|
logo : opt text;
|
|
53
62
|
name : opt text;
|
|
63
|
+
initial_voting_period_seconds : opt nat64;
|
|
54
64
|
neuron_minimum_dissolve_delay_to_vote_seconds : opt nat64;
|
|
55
65
|
description : opt text;
|
|
66
|
+
max_neuron_age_seconds_for_age_bonus : opt nat64;
|
|
67
|
+
initial_reward_rate_basis_points : opt nat64;
|
|
68
|
+
wait_for_quiet_deadline_increase_seconds : opt nat64;
|
|
56
69
|
transaction_fee_e8s : opt nat64;
|
|
57
70
|
sns_initialization_parameters : opt text;
|
|
71
|
+
max_age_bonus_percentage : opt nat64;
|
|
58
72
|
initial_token_distribution : opt InitialTokenDistribution;
|
|
73
|
+
reward_rate_transition_duration_seconds : opt nat64;
|
|
59
74
|
token_name : opt text;
|
|
60
75
|
proposal_reject_cost_e8s : opt nat64;
|
|
61
76
|
};
|
|
@@ -47,16 +47,25 @@ export const idlFactory = ({ IDL }) => {
|
|
|
47
47
|
});
|
|
48
48
|
const SnsInitPayload = IDL.Record({
|
|
49
49
|
'url' : IDL.Opt(IDL.Text),
|
|
50
|
+
'max_dissolve_delay_seconds' : IDL.Opt(IDL.Nat64),
|
|
51
|
+
'max_dissolve_delay_bonus_percentage' : IDL.Opt(IDL.Nat64),
|
|
50
52
|
'fallback_controller_principal_ids' : IDL.Vec(IDL.Text),
|
|
51
53
|
'token_symbol' : IDL.Opt(IDL.Text),
|
|
54
|
+
'final_reward_rate_basis_points' : IDL.Opt(IDL.Nat64),
|
|
52
55
|
'neuron_minimum_stake_e8s' : IDL.Opt(IDL.Nat64),
|
|
53
56
|
'logo' : IDL.Opt(IDL.Text),
|
|
54
57
|
'name' : IDL.Opt(IDL.Text),
|
|
58
|
+
'initial_voting_period_seconds' : IDL.Opt(IDL.Nat64),
|
|
55
59
|
'neuron_minimum_dissolve_delay_to_vote_seconds' : IDL.Opt(IDL.Nat64),
|
|
56
60
|
'description' : IDL.Opt(IDL.Text),
|
|
61
|
+
'max_neuron_age_seconds_for_age_bonus' : IDL.Opt(IDL.Nat64),
|
|
62
|
+
'initial_reward_rate_basis_points' : IDL.Opt(IDL.Nat64),
|
|
63
|
+
'wait_for_quiet_deadline_increase_seconds' : IDL.Opt(IDL.Nat64),
|
|
57
64
|
'transaction_fee_e8s' : IDL.Opt(IDL.Nat64),
|
|
58
65
|
'sns_initialization_parameters' : IDL.Opt(IDL.Text),
|
|
66
|
+
'max_age_bonus_percentage' : IDL.Opt(IDL.Nat64),
|
|
59
67
|
'initial_token_distribution' : IDL.Opt(InitialTokenDistribution),
|
|
68
|
+
'reward_rate_transition_duration_seconds' : IDL.Opt(IDL.Nat64),
|
|
60
69
|
'token_name' : IDL.Opt(IDL.Text),
|
|
61
70
|
'proposal_reject_cost_e8s' : IDL.Opt(IDL.Nat64),
|
|
62
71
|
});
|
|
@@ -99,6 +108,10 @@ export const idlFactory = ({ IDL }) => {
|
|
|
99
108
|
const GetWasmResponse = IDL.Record({ 'wasm' : IDL.Opt(SnsWasm) });
|
|
100
109
|
const DeployedSns = IDL.Record({
|
|
101
110
|
'root_canister_id' : IDL.Opt(IDL.Principal),
|
|
111
|
+
'governance_canister_id' : IDL.Opt(IDL.Principal),
|
|
112
|
+
'index_canister_id' : IDL.Opt(IDL.Principal),
|
|
113
|
+
'swap_canister_id' : IDL.Opt(IDL.Principal),
|
|
114
|
+
'ledger_canister_id' : IDL.Opt(IDL.Principal),
|
|
102
115
|
});
|
|
103
116
|
const ListDeployedSnsesResponse = IDL.Record({
|
|
104
117
|
'instances' : IDL.Vec(DeployedSns),
|
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -17,7 +17,7 @@ account-id`),n=Wr.sha224.create();n.update([...r,...o.toUint8Array(),...t??Array
|
|
|
17
17
|
Expected checksum: ${n.toString("hex")}
|
|
18
18
|
Found checksum: ${r.toString("hex")}`)};var So=o=>{if(o<0||o>100)throw new oo(`${o} is not a valid percentage number.`)};var zt=require("@dfinity/agent"),Pe=async({agent:o,canisterId:t,methodName:r,arg:n})=>{let i=await o.call(t,{methodName:r,arg:n,effectiveCanisterId:t});if(!i.response.ok)throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${t}`,` Request ID: ${i.requestId}`,` HTTP status code: ${i.response.status}`,` HTTP status text: ${i.response.statusText}`].join(`
|
|
19
19
|
`));let p=await zt.polling.pollForResponse(o,t,i.requestId,zt.polling.defaultStrategy());return new Uint8Array(p)},jn=async({agent:o,canisterId:t,methodName:r,arg:n})=>{let i=await o.query(t,{methodName:r,arg:n});if(i.status=="rejected")throw new Error(["Call failed:",` Method: ${r}`,` Canister ID: ${t}`,` HTTP status code: ${i.reject_code}`,` HTTP status text: ${i.reject_message}`].join(`
|
|
20
|
-
`));return new Uint8Array(i.reply.arg)};var je=class{constructor(t,r,n,i,p=!1){this.canisterId=t;this.service=r;this.certifiedService=n;this.agent=i;this.hardwareWallet=p;this.listNeurons=async({certified:t=!0,neuronIds:r})=>{if(this.hardwareWallet&&!t)throw new to;if(this.hardwareWallet)return this.listNeuronsHardwareWallet();let n=Ir(r),i=await this.getGovernanceService(t).list_neurons(n);return Fn({response:i,canisterId:this.canisterId})};this.listKnownNeurons=async(t=!0)=>(await this.getGovernanceService(t).list_known_neurons()).known_neurons.map(n=>{var i,p,l;return{id:((i=n.id[0])==null?void 0:i.id)??BigInt(0),name:((p=n.known_neuron_data[0])==null?void 0:p.name)??"",description:(l=n.known_neuron_data[0])==null?void 0:l.description[0]}});this.listProposals=async({request:t,certified:r=!0})=>{let n=Dr(t),i=await this.getGovernanceService(r).list_proposals(n);return wn(i)};this.stakeNeuron=async({stake:t,principal:r,fromSubAccount:n,ledgerCanister:i})=>{if(t<no)throw new eo(t);let p=new Uint8Array((0,Un.default)(8)),l=(0,ke.uint8ArrayToBigInt)(p),_=this.buildNeuronStakeSubAccount(p,r),y=X.fromPrincipal({principal:this.canisterId,subAccount:_});await i.transfer({memo:l,amount:t,fromSubAccount:n,to:y});let S=await this.claimOrRefreshNeuronFromAccount({controller:r,memo:l});if(S===void 0)throw new Le;return S};this.increaseDissolveDelay=async({neuronId:t,additionalDissolveDelaySeconds:r})=>{if(this.hardwareWallet)return this.increaseDissolveDelayHardwareWallet({neuronId:t,additionalDissolveDelaySeconds:r});let n=rn({neuronId:t,additionalDissolveDelaySeconds:r});return G({request:n,service:this.certifiedService})};this.setDissolveDelay=async({neuronId:t,dissolveDelaySeconds:r})=>{let n=nn({neuronId:t,dissolveDelaySeconds:r});return G({request:n,service:this.certifiedService})};this.startDissolving=async t=>{if(this.hardwareWallet)return this.startDissolvingHardwareWallet(t);let r=cn(t);return G({request:r,service:this.certifiedService})};this.stopDissolving=async t=>{if(this.hardwareWallet)return this.stopDissolvingHardwareWallet(t);let r=un(t);return G({request:r,service:this.certifiedService})};this.joinCommunityFund=async t=>{if(this.hardwareWallet)return this.joinCommunityFundHardwareWallet(t);let r=sn(t);return G({request:r,service:this.certifiedService})};this.autoStakeMaturity=t=>G({request:an(t),service:this.certifiedService});this.leaveCommunityFund=async t=>{let r=pn(t);return G({request:r,service:this.certifiedService})};this.setNodeProviderAccount=async t=>{Ro(t);let r=X.fromHex(t),n=await this.certifiedService.update_node_provider({reward_account:[r.toAccountIdentifierHash()]});if("Err"in n)throw new Z(n.Err)};this.mergeNeurons=async t=>{if(this.hardwareWallet)return this.mergeNeuronsHardwareWallet(t);let r=gn(t);return G({request:r,service:this.certifiedService})};this.splitNeuron=async({neuronId:t,amount:r})=>{let n=Yr({neuronId:t,amount:r}),i=await this.certifiedService.manage_neuron(n),p=Mo(i);if("Split"in p){let l=p.Split.created_neuron_id[0];if(l===void 0)throw new Z({error_message:"Unexpected error splitting neuron. No neuronId in Split response.",error_type:0});return l.id}throw new ae(`Unrecognized Split error in ${JSON.stringify(i)}`)};this.getProposal=async({proposalId:t,certified:r=!0})=>{let[n]=await this.getGovernanceService(r).get_proposal_info(t);return n?Wt(n):void 0};this.makeProposal=async t=>{let r=$r(t);return G({request:r,service:this.certifiedService})};this.registerVote=async({neuronId:t,vote:r,proposalId:n})=>{let i=Jr({neuronId:t,vote:r,proposalId:n});return G({request:i,service:this.certifiedService})};this.setFollowees=async t=>{let r=Xr(t);return G({request:r,service:this.certifiedService})};this.disburse=async({neuronId:t,toAccountId:r,amount:n})=>{if(r!==void 0&&Ro(r),this.hardwareWallet)return this.disburseHardwareWallet({neuronId:t,toAccountId:r,amount:n});let i=r!==void 0?X.fromHex(r):void 0,p=Zr({neuronId:t,toAccountIdentifier:i,amount:n});return G({request:p,service:this.certifiedService})};this.mergeMaturity=async({neuronId:t,percentageToMerge:r})=>{if(So(r),this.hardwareWallet)return this.mergeMaturityHardwareWallet({neuronId:t,percentageToMerge:r});let n=Qr({neuronId:t,percentageToMerge:r});return G({request:n,service:this.certifiedService})};this.stakeMaturity=async({neuronId:t,percentageToStake:r})=>{So(r??100),await G({request:Lr({neuronId:t,percentageToStake:r}),service:this.certifiedService})};this.spawnNeuron=async({neuronId:t,percentageToSpawn:r,newController:n,nonce:i})=>{if(r!==void 0&&So(r),this.hardwareWallet)return this.spawnHardwareWallet({neuronId:t,percentageToSpawn:r,newController:n==null?void 0:n.toText()});let p=en({neuronId:t,percentageToSpawn:r,newController:n,nonce:i}),l=await this.certifiedService.manage_neuron(p),_=Mo(l);if("Spawn"in _&&_.Spawn.created_neuron_id[0]!==void 0)return _.Spawn.created_neuron_id[0].id;throw new ae(`Unrecognized Spawn error in ${JSON.stringify(l)}`)};this.addHotkey=async({neuronId:t,principal:r})=>{if(this.hardwareWallet)return this.addHotkeyHardwareWallet({neuronId:t,principal:r});let n=on({neuronId:t,principal:r});return G({request:n,service:this.certifiedService})};this.removeHotkey=async({neuronId:t,principal:r})=>{if(this.hardwareWallet)return this.removeHotkeyHardwareWallet({neuronId:t,principal:r});let n=tn({neuronId:t,principal:r});return G({request:n,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async({memo:t,controller:r})=>{var l;let n=Kr({memo:t,controller:r}),i=await this.certifiedService.manage_neuron(n),{command:p}=i;if(p.length&&"ClaimOrRefresh"in p[0])return(l=p[0].ClaimOrRefresh.refreshed_neuron_id[0])==null?void 0:l.id;throw new ae(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(i)}`)};this.claimOrRefreshNeuron=async t=>{var p;let r=qr(t),n=await this.service.manage_neuron(r),{command:i}=n;if(i.length&&"ClaimOrRefresh"in i[0])return(p=i[0].ClaimOrRefresh.refreshed_neuron_id[0])==null?void 0:p.id;throw new ae(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(n)}`)};this.buildNeuronStakeSubAccount=(t,r)=>{let n=(0,ke.asciiStringToByteArray)("neuron-stake"),i=kn.sha256.create();return i.update([12,...n,...r.toUint8Array(),...t]),te.fromBytes(new Uint8Array(i.array()))};this.getNeuron=async({certified:t=!0,neuronId:r})=>{let[n]=await this.listNeurons({certified:t,neuronIds:[r]});return n};this.listNeuronsHardwareWallet=async()=>{let t=new Ue.ListNeurons;t.setIncludeNeuronsReadableByCaller(!0);let r=await Pe({agent:this.agent,canisterId:this.canisterId,methodName:"list_neurons_pb",arg:t.serializeBinary()}),n=Ue.ListNeuronsResponse.deserializeBinary(r),i=n.getFullNeuronsList();return n.getNeuronIdsList().map(An({pbNeurons:i,canisterId:this.canisterId}))};this.manageNeuronUpdateCall=async t=>{let r=await Pe({agent:this.agent,canisterId:this.canisterId,methodName:"manage_neuron_pb",arg:t.serializeBinary()});Pn(r)};this.addHotkeyHardwareWallet=async({neuronId:t,principal:r})=>{let n=dn({neuronId:t,principal:r.toText()});await this.manageNeuronUpdateCall(n)};this.removeHotkeyHardwareWallet=async({neuronId:t,principal:r})=>{let n=fn({neuronId:t,principal:r.toText()});await this.manageNeuronUpdateCall(n)};this.increaseDissolveDelayHardwareWallet=async({neuronId:t,additionalDissolveDelaySeconds:r})=>{let n=_n({neuronId:t,additionalDissolveDelaySeconds:r});await this.manageNeuronUpdateCall(n)};this.startDissolvingHardwareWallet=async t=>{let r=bn(t);await this.manageNeuronUpdateCall(r)};this.stopDissolvingHardwareWallet=async t=>{let r=yn(t);await this.manageNeuronUpdateCall(r)};this.joinCommunityFundHardwareWallet=async t=>{let r=hn(t);await this.manageNeuronUpdateCall(r)};this.disburseHardwareWallet=async t=>{let r=vn(t);await this.manageNeuronUpdateCall(r)};this.mergeMaturityHardwareWallet=async t=>{let r=mn(t);await this.manageNeuronUpdateCall(r)};this.spawnHardwareWallet=async t=>{var _;let r=Mn(t),n=await Pe({agent:this.agent,canisterId:this.canisterId,methodName:"manage_neuron_pb",arg:r.serializeBinary()}),i=Ue.ManageNeuronResponse.deserializeBinary(n),p=i.getError();if(p)throw new Z({error_message:p.getErrorMessage(),error_type:p.getErrorType()});let l=(_=i.getSpawn())==null?void 0:_.getCreatedNeuronId();if(l!==void 0)return BigInt(l.getId());throw new ae(`Unrecognized Spawn error in ${JSON.stringify(i)}`)};this.mergeNeuronsHardwareWallet=async t=>{let r=Rn(t);await this.manageNeuronUpdateCall(r)};this.canisterId=t,this.service=r,this.certifiedService=n,this.agent=i,this.hardwareWallet=p}static create(t={}){let r=t.canisterId??Er,{service:n,certifiedService:i,agent:p}=(0,ke.createServices)({options:{...t,canisterId:r},idlFactory:jr,certifiedIdlFactory:Pr});return new je(r,n,i,p,t.hardwareWallet)}getGovernanceService(t){return t?this.certifiedService:this.service}};var Wn=Y(ge());var Te=class{constructor(t,r){this.e8s=t;this.token=r}static fromE8s(t){return new Te(t,fo)}static fromString(t){let r=we(t);return typeof r=="bigint"?new Te(r,fo):r}toE8s(){return this.e8s}toProto(){let t=new Wn.ICPTs;return t.setE8s(this.e8s.toString()),t}};var qn=require("@dfinity/utils");var zn=({IDL:o})=>{let t=o.Nat64,r=o.Record({start:t,length:o.Nat64}),n=o.Nat64,i=o.Vec(o.Nat8),p=o.Record({e8s:o.Nat64}),l=o.Variant({Burn:o.Record({from:i,amount:p}),Mint:o.Record({to:i,amount:p}),Transfer:o.Record({to:i,fee:p,from:i,amount:p})}),_=o.Record({timestamp_nanos:o.Nat64}),y=o.Record({memo:n,operation:o.Opt(l),created_at_time:_}),S=o.Record({transaction:y,timestamp:_,parent_hash:o.Opt(o.Vec(o.Nat8))}),T=o.Record({blocks:o.Vec(S)}),F=o.Variant({BadFirstBlockIndex:o.Record({requested_index:t,first_valid_index:t}),Other:o.Record({error_message:o.Text,error_code:o.Nat64})}),A=o.Variant({Ok:T,Err:F}),E=o.Func([r],[A],[]),j=o.Record({certificate:o.Opt(o.Vec(o.Nat8)),blocks:o.Vec(S),chain_length:o.Nat64,first_block_index:t,archived_blocks:o.Vec(o.Record({callback:E,start:t,length:o.Nat64}))}),N=o.Record({account:i}),V=o.Record({canister_id:o.Principal}),D=o.Record({archives:o.Vec(V)}),z=o.Vec(o.Nat8),W=o.Record({to:i,fee:p,memo:n,from_subaccount:o.Opt(z),created_at_time:o.Opt(_),amount:p}),q=o.Variant({TxTooOld:o.Record({allowed_window_nanos:o.Nat64}),BadFee:o.Record({expected_fee:p}),TxDuplicate:o.Record({duplicate_of:t}),TxCreatedInFuture:o.Null,InsufficientFunds:o.Record({balance:p})}),J=o.Variant({Ok:t,Err:q}),L=o.Record({}),$=o.Record({transfer_fee:p});return o.Service({_blocks:o.Func([r],[j],[]),account_balance:o.Func([N],[p],[]),archives:o.Func([],[D],[]),decimals:o.Func([],[o.Record({decimals:o.Nat32})],[]),name:o.Func([],[o.Record({name:o.Text})],[]),symbol:o.Func([],[o.Record({symbol:o.Text})],[]),transfer:o.Func([W],[J],[]),transfer_fee:o.Func([L],[$],[])})};var Hn=({IDL:o})=>{let t=o.Vec(o.Nat8),r=o.Record({account:t}),n=o.Record({e8s:o.Nat64}),i=o.Record({canister_id:o.Principal}),p=o.Record({archives:o.Vec(i)}),l=o.Nat64,_=o.Record({start:l,length:o.Nat64}),y=o.Nat64,S=o.Variant({Burn:o.Record({from:t,amount:n}),Mint:o.Record({to:t,amount:n}),Transfer:o.Record({to:t,fee:n,from:t,amount:n})}),T=o.Record({timestamp_nanos:o.Nat64}),F=o.Record({memo:y,operation:o.Opt(S),created_at_time:T}),A=o.Record({transaction:F,timestamp:T,parent_hash:o.Opt(o.Vec(o.Nat8))}),E=o.Record({blocks:o.Vec(A)}),j=o.Variant({BadFirstBlockIndex:o.Record({requested_index:l,first_valid_index:l}),Other:o.Record({error_message:o.Text,error_code:o.Nat64})}),N=o.Variant({Ok:E,Err:j}),V=o.Func([_],[N],["query"]),D=o.Record({certificate:o.Opt(o.Vec(o.Nat8)),blocks:o.Vec(A),chain_length:o.Nat64,first_block_index:l,archived_blocks:o.Vec(o.Record({callback:V,start:l,length:o.Nat64}))}),z=o.Vec(o.Nat8),W=o.Record({to:t,fee:n,memo:y,from_subaccount:o.Opt(z),created_at_time:o.Opt(T),amount:n}),q=o.Variant({TxTooOld:o.Record({allowed_window_nanos:o.Nat64}),BadFee:o.Record({expected_fee:n}),TxDuplicate:o.Record({duplicate_of:l}),TxCreatedInFuture:o.Null,InsufficientFunds:o.Record({balance:n})}),J=o.Variant({Ok:l,Err:q}),L=o.Record({}),$=o.Record({transfer_fee:n});return o.Service({account_balance:o.Func([r],[n],["query"]),archives:o.Func([],[p],["query"]),decimals:o.Func([],[o.Record({decimals:o.Nat32})],["query"]),name:o.Func([],[o.Record({name:o.Text})],["query"]),query_blocks:o.Func([_],[D],["query"]),symbol:o.Func([],[o.Record({symbol:o.Text})],["query"]),transfer:o.Func([W],[J],[]),transfer_fee:o.Func([L],[$],["query"])})};var Q=Y(ge());var Gn=require("@dfinity/utils"),No=Y(ge());var In=o=>{let t=new Uint8Array(o).buffer,r=new No.Subaccount;return r.setSubAccount(new Uint8Array(t)),r},Ht=o=>{let t=new No.ICPTs;return t.setE8s(o.toString(10)),t},Vn=o=>({e8s:o}),Dn=({to:o,amount:t,memo:r,fee:n,fromSubAccount:i})=>({to:o.toUint8Array(),fee:Vn(n??ro),amount:Vn(t),memo:r??BigInt(0),created_at_time:[],from_subaccount:i===void 0?[]:[(0,Gn.arrayOfNumberToUint8Array)(i)]});var We=class{constructor(t,r,n,i,p,l,_=!1){this.agent=t;this.canisterId=r;this.service=n;this.certifiedService=i;this.updateFetcher=p;this.queryFetcher=l;this.hardwareWallet=_;this.accountBalance=async({accountIdentifier:t,certified:r=!0})=>this.hardwareWallet?this.accountBalanceHardwareWallet({accountIdentifier:t,certified:r}):(await(r?this.certifiedService:this.service).account_balance({account:t.toUint8Array()})).e8s;this.transactionFee=async()=>{let{transfer_fee:{e8s:t}}=await this.service.transfer_fee({});return t};this.transfer=async t=>{if(this.hardwareWallet)return this.transferHardwareWallet(t);t.fee===void 0&&(t.fee=this.hardwareWallet?ro:await this.transactionFee());let r=Dn(t),n=await this.certifiedService.transfer(r);if("Err"in n)throw Ft(n.Err);return n.Ok};this.accountBalanceHardwareWallet=async({accountIdentifier:t,certified:r=!0})=>{let n=r?this.updateFetcher:this.queryFetcher,i=new Q.AccountBalanceRequest;i.setAccount(t.toProto());let p=await n({agent:this.agent,canisterId:this.canisterId,methodName:"account_balance_pb",arg:i.serializeBinary()});return BigInt(Q.ICPTs.deserializeBinary(new Uint8Array(p)).getE8s())};this.transferHardwareWallet=async({to:t,amount:r,memo:n,fee:i,fromSubAccount:p})=>{let l=new Q.SendRequest;l.setTo(t.toProto());let _=new Q.Payment;_.setReceiverGets(Ht(r)),l.setPayment(_),l.setMaxFee(Ht(i??ro));let y=new Q.Memo;y.setMemo((n??BigInt(0)).toString()),l.setMemo(y),p!==void 0&&l.setFromSubaccount(In(p));try{let S=await this.updateFetcher({agent:this.agent,canisterId:this.canisterId,methodName:"send_pb",arg:l.serializeBinary()});return BigInt(Q.BlockHeight.deserializeBinary(S).getHeight())}catch(S){throw S instanceof Error?wt(S):S}}}static create(t={}){let r=t.canisterId??Or,{service:n,certifiedService:i,agent:p}=(0,qn.createServices)({options:{...t,canisterId:r},idlFactory:Hn,certifiedIdlFactory:zn});return new We(p,r,n,i,t.updateCallOverride??Pe,t.queryCallOverride??jn,t.hardwareWallet)}};var Jn=require("@dfinity/utils");var Kn=({IDL:o})=>{let t=o.Record({allowed_principals:o.Vec(o.Principal),access_controls_enabled:o.Bool,sns_subnet_ids:o.Vec(o.Principal)}),r=o.Record({wasm:o.Vec(o.Nat8),canister_type:o.Int32}),n=o.Record({hash:o.Vec(o.Nat8),wasm:o.Opt(r)}),i=o.Record({message:o.Text}),p=o.Variant({Error:i,Hash:o.Vec(o.Nat8)}),l=o.Record({result:o.Opt(p)}),_=o.Record({total_e8s:o.Nat64}),y=o.Record({controller:o.Opt(o.Principal),dissolve_delay_seconds:o.Nat64,memo:o.Nat64,stake_e8s:o.Nat64}),S=o.Record({developer_neurons:o.Vec(y)}),T=o.Record({airdrop_neurons:o.Vec(y)}),F=o.Record({total_e8s:o.Nat64,initial_swap_amount_e8s:o.Nat64}),A=o.Record({treasury_distribution:o.Opt(_),developer_distribution:o.Opt(S),airdrop_distribution:o.Opt(T),swap_distribution:o.Opt(F)}),E=o.Variant({FractionalDeveloperVotingPower:A}),j=o.Record({url:o.Opt(o.Text),fallback_controller_principal_ids:o.Vec(o.Text),token_symbol:o.Opt(o.Text),neuron_minimum_stake_e8s:o.Opt(o.Nat64),logo:o.Opt(o.Text),name:o.Opt(o.Text),neuron_minimum_dissolve_delay_to_vote_seconds:o.Opt(o.Nat64),description:o.Opt(o.Text),transaction_fee_e8s:o.Opt(o.Nat64),sns_initialization_parameters:o.Opt(o.Text),initial_token_distribution:o.Opt(E),token_name:o.Opt(o.Text),proposal_reject_cost_e8s:o.Opt(o.Nat64)}),N=o.Record({sns_init_payload:o.Opt(j)}),V=o.Record({root:o.Opt(o.Principal),swap:o.Opt(o.Principal),ledger:o.Opt(o.Principal),index:o.Opt(o.Principal),governance:o.Opt(o.Principal)}),D=o.Record({subnet_id:o.Opt(o.Principal),error:o.Opt(i),canisters:o.Opt(V)}),z=o.Record({allowed_principals:o.Vec(o.Principal)}),W=o.Record({archive_wasm_hash:o.Vec(o.Nat8),root_wasm_hash:o.Vec(o.Nat8),swap_wasm_hash:o.Vec(o.Nat8),ledger_wasm_hash:o.Vec(o.Nat8),governance_wasm_hash:o.Vec(o.Nat8),index_wasm_hash:o.Vec(o.Nat8)}),q=o.Record({current_version:o.Opt(W)}),J=o.Record({next_version:o.Opt(W)}),L=o.Record({sns_subnet_ids:o.Vec(o.Principal)}),$=o.Record({hash:o.Vec(o.Nat8)}),fe=o.Record({wasm:o.Opt(r)}),ne=o.Record({root_canister_id:o.Opt(o.Principal)}),_e=o.Record({instances:o.Vec(ne)}),ie=o.Record({added_principals:o.Vec(o.Principal),removed_principals:o.Vec(o.Principal)}),be=o.Variant({Error:i,AllowedPrincipals:z}),ye=o.Record({update_allowed_principals_result:o.Opt(be)}),he=o.Record({sns_subnet_ids_to_add:o.Vec(o.Principal),sns_subnet_ids_to_remove:o.Vec(o.Principal)}),ve=o.Record({error:o.Opt(i)});return o.Service({add_wasm:o.Func([n],[l],[]),deploy_new_sns:o.Func([N],[D],[]),get_allowed_principals:o.Func([o.Record({})],[z],[]),get_latest_sns_version_pretty:o.Func([o.Null],[o.Vec(o.Tuple(o.Text,o.Text))],[]),get_next_sns_version:o.Func([q],[J],[]),get_sns_subnet_ids:o.Func([o.Record({})],[L],[]),get_wasm:o.Func([$],[fe],[]),list_deployed_snses:o.Func([o.Record({})],[_e],[]),update_allowed_principals:o.Func([ie],[ye],[]),update_sns_subnet_list:o.Func([he],[ve],[])})};var Yn=({IDL:o})=>{let t=o.Record({allowed_principals:o.Vec(o.Principal),access_controls_enabled:o.Bool,sns_subnet_ids:o.Vec(o.Principal)}),r=o.Record({wasm:o.Vec(o.Nat8),canister_type:o.Int32}),n=o.Record({hash:o.Vec(o.Nat8),wasm:o.Opt(r)}),i=o.Record({message:o.Text}),p=o.Variant({Error:i,Hash:o.Vec(o.Nat8)}),l=o.Record({result:o.Opt(p)}),_=o.Record({total_e8s:o.Nat64}),y=o.Record({controller:o.Opt(o.Principal),dissolve_delay_seconds:o.Nat64,memo:o.Nat64,stake_e8s:o.Nat64}),S=o.Record({developer_neurons:o.Vec(y)}),T=o.Record({airdrop_neurons:o.Vec(y)}),F=o.Record({total_e8s:o.Nat64,initial_swap_amount_e8s:o.Nat64}),A=o.Record({treasury_distribution:o.Opt(_),developer_distribution:o.Opt(S),airdrop_distribution:o.Opt(T),swap_distribution:o.Opt(F)}),E=o.Variant({FractionalDeveloperVotingPower:A}),j=o.Record({url:o.Opt(o.Text),fallback_controller_principal_ids:o.Vec(o.Text),token_symbol:o.Opt(o.Text),neuron_minimum_stake_e8s:o.Opt(o.Nat64),logo:o.Opt(o.Text),name:o.Opt(o.Text),neuron_minimum_dissolve_delay_to_vote_seconds:o.Opt(o.Nat64),description:o.Opt(o.Text),transaction_fee_e8s:o.Opt(o.Nat64),sns_initialization_parameters:o.Opt(o.Text),initial_token_distribution:o.Opt(E),token_name:o.Opt(o.Text),proposal_reject_cost_e8s:o.Opt(o.Nat64)}),N=o.Record({sns_init_payload:o.Opt(j)}),V=o.Record({root:o.Opt(o.Principal),swap:o.Opt(o.Principal),ledger:o.Opt(o.Principal),index:o.Opt(o.Principal),governance:o.Opt(o.Principal)}),D=o.Record({subnet_id:o.Opt(o.Principal),error:o.Opt(i),canisters:o.Opt(V)}),z=o.Record({allowed_principals:o.Vec(o.Principal)}),W=o.Record({archive_wasm_hash:o.Vec(o.Nat8),root_wasm_hash:o.Vec(o.Nat8),swap_wasm_hash:o.Vec(o.Nat8),ledger_wasm_hash:o.Vec(o.Nat8),governance_wasm_hash:o.Vec(o.Nat8),index_wasm_hash:o.Vec(o.Nat8)}),q=o.Record({current_version:o.Opt(W)}),J=o.Record({next_version:o.Opt(W)}),L=o.Record({sns_subnet_ids:o.Vec(o.Principal)}),$=o.Record({hash:o.Vec(o.Nat8)}),fe=o.Record({wasm:o.Opt(r)}),ne=o.Record({root_canister_id:o.Opt(o.Principal)}),_e=o.Record({instances:o.Vec(ne)}),ie=o.Record({added_principals:o.Vec(o.Principal),removed_principals:o.Vec(o.Principal)}),be=o.Variant({Error:i,AllowedPrincipals:z}),ye=o.Record({update_allowed_principals_result:o.Opt(be)}),he=o.Record({sns_subnet_ids_to_add:o.Vec(o.Principal),sns_subnet_ids_to_remove:o.Vec(o.Principal)}),ve=o.Record({error:o.Opt(i)});return o.Service({add_wasm:o.Func([n],[l],[]),deploy_new_sns:o.Func([N],[D],[]),get_allowed_principals:o.Func([o.Record({})],[z],["query"]),get_latest_sns_version_pretty:o.Func([o.Null],[o.Vec(o.Tuple(o.Text,o.Text))],["query"]),get_next_sns_version:o.Func([q],[J],["query"]),get_sns_subnet_ids:o.Func([o.Record({})],[L],["query"]),get_wasm:o.Func([$],[fe],["query"]),list_deployed_snses:o.Func([o.Record({})],[_e],["query"]),update_allowed_principals:o.Func([ie],[ye],[]),update_sns_subnet_list:o.Func([he],[ve],[])})};var ze=class{constructor(t,r){this.service=t;this.certifiedService=r;this.listSnses=async({certified:t=!0})=>{let r=t?this.certifiedService:this.service,{instances:n}=await r.list_deployed_snses({});return n}}static create(t={}){let{service:r,certifiedService:n}=(0,Jn.createServices)({options:{...t,canisterId:t.canisterId??wr},idlFactory:Yn,certifiedIdlFactory:Kn});return new ze(r,n)}};var $n=({recentBallots:o,proposalId:t})=>{if(!t)return;let r=o.find(({proposalId:n})=>n===t);return r==null?void 0:r.vote},Xn=({neurons:o,proposal:t})=>{let{ballots:r,proposalTimestampSeconds:n}=t;return o.filter(({createdTimestampSeconds:i,neuronId:p})=>{let l=i>n,_=r.find(({neuronId:y})=>y===p)===void 0;return l||_})},Vi=({neurons:o,proposal:t})=>{let{id:r}=t;return o.filter(({recentBallots:n,neuronId:i})=>$n({recentBallots:n,proposalId:r})===void 0&&Xn({neurons:o,proposal:t}).find(({neuronId:p})=>p===i)===void 0)},Gi=({neurons:o,proposal:t})=>{let{id:r}=t;return o.filter(({recentBallots:n})=>$n({recentBallots:n,proposalId:r})!==void 0)};0&&(module.exports={AccountIdentifier,BadFeeError,CouldNotClaimNeuronError,FeatureNotSupportedError,FromStringToTokenError,GenesisTokenCanister,GovernanceCanister,GovernanceError,ICP,ICPToken,InsufficientAmountError,InsufficientFundsError,InvalidAccountIDError,InvalidPercentageError,InvalidSenderError,LedgerCanister,NeuronState,NnsFunction,ProposalRewardStatus,ProposalStatus,SnsWasmCanister,StakeNeuronError,SubAccount,TokenAmount,Topic,TransferError,TxCreatedInFutureError,TxDuplicateError,TxTooOldError,UnrecognizedTypeError,UnsupportedValueError,Vote,accountIdentifierFromBytes,accountIdentifierToBytes,checkAccountId,convertStringToE8s,ineligibleNeurons,mapTransferError,mapTransferProtoError,principalToAccountIdentifier,votableNeurons,votedNeurons});
|
|
20
|
+
`));return new Uint8Array(i.reply.arg)};var je=class{constructor(t,r,n,i,p=!1){this.canisterId=t;this.service=r;this.certifiedService=n;this.agent=i;this.hardwareWallet=p;this.listNeurons=async({certified:t=!0,neuronIds:r})=>{if(this.hardwareWallet&&!t)throw new to;if(this.hardwareWallet)return this.listNeuronsHardwareWallet();let n=Ir(r),i=await this.getGovernanceService(t).list_neurons(n);return Fn({response:i,canisterId:this.canisterId})};this.listKnownNeurons=async(t=!0)=>(await this.getGovernanceService(t).list_known_neurons()).known_neurons.map(n=>{var i,p,l;return{id:((i=n.id[0])==null?void 0:i.id)??BigInt(0),name:((p=n.known_neuron_data[0])==null?void 0:p.name)??"",description:(l=n.known_neuron_data[0])==null?void 0:l.description[0]}});this.listProposals=async({request:t,certified:r=!0})=>{let n=Dr(t),i=await this.getGovernanceService(r).list_proposals(n);return wn(i)};this.stakeNeuron=async({stake:t,principal:r,fromSubAccount:n,ledgerCanister:i})=>{if(t<no)throw new eo(t);let p=new Uint8Array((0,Un.default)(8)),l=(0,ke.uint8ArrayToBigInt)(p),_=this.buildNeuronStakeSubAccount(p,r),y=X.fromPrincipal({principal:this.canisterId,subAccount:_});await i.transfer({memo:l,amount:t,fromSubAccount:n,to:y});let S=await this.claimOrRefreshNeuronFromAccount({controller:r,memo:l});if(S===void 0)throw new Le;return S};this.increaseDissolveDelay=async({neuronId:t,additionalDissolveDelaySeconds:r})=>{if(this.hardwareWallet)return this.increaseDissolveDelayHardwareWallet({neuronId:t,additionalDissolveDelaySeconds:r});let n=rn({neuronId:t,additionalDissolveDelaySeconds:r});return G({request:n,service:this.certifiedService})};this.setDissolveDelay=async({neuronId:t,dissolveDelaySeconds:r})=>{let n=nn({neuronId:t,dissolveDelaySeconds:r});return G({request:n,service:this.certifiedService})};this.startDissolving=async t=>{if(this.hardwareWallet)return this.startDissolvingHardwareWallet(t);let r=cn(t);return G({request:r,service:this.certifiedService})};this.stopDissolving=async t=>{if(this.hardwareWallet)return this.stopDissolvingHardwareWallet(t);let r=un(t);return G({request:r,service:this.certifiedService})};this.joinCommunityFund=async t=>{if(this.hardwareWallet)return this.joinCommunityFundHardwareWallet(t);let r=sn(t);return G({request:r,service:this.certifiedService})};this.autoStakeMaturity=t=>G({request:an(t),service:this.certifiedService});this.leaveCommunityFund=async t=>{let r=pn(t);return G({request:r,service:this.certifiedService})};this.setNodeProviderAccount=async t=>{Ro(t);let r=X.fromHex(t),n=await this.certifiedService.update_node_provider({reward_account:[r.toAccountIdentifierHash()]});if("Err"in n)throw new Z(n.Err)};this.mergeNeurons=async t=>{if(this.hardwareWallet)return this.mergeNeuronsHardwareWallet(t);let r=gn(t);return G({request:r,service:this.certifiedService})};this.splitNeuron=async({neuronId:t,amount:r})=>{let n=Yr({neuronId:t,amount:r}),i=await this.certifiedService.manage_neuron(n),p=Mo(i);if("Split"in p){let l=p.Split.created_neuron_id[0];if(l===void 0)throw new Z({error_message:"Unexpected error splitting neuron. No neuronId in Split response.",error_type:0});return l.id}throw new ae(`Unrecognized Split error in ${JSON.stringify(i)}`)};this.getProposal=async({proposalId:t,certified:r=!0})=>{let[n]=await this.getGovernanceService(r).get_proposal_info(t);return n?Wt(n):void 0};this.makeProposal=async t=>{let r=$r(t);return G({request:r,service:this.certifiedService})};this.registerVote=async({neuronId:t,vote:r,proposalId:n})=>{let i=Jr({neuronId:t,vote:r,proposalId:n});return G({request:i,service:this.certifiedService})};this.setFollowees=async t=>{let r=Xr(t);return G({request:r,service:this.certifiedService})};this.disburse=async({neuronId:t,toAccountId:r,amount:n})=>{if(r!==void 0&&Ro(r),this.hardwareWallet)return this.disburseHardwareWallet({neuronId:t,toAccountId:r,amount:n});let i=r!==void 0?X.fromHex(r):void 0,p=Zr({neuronId:t,toAccountIdentifier:i,amount:n});return G({request:p,service:this.certifiedService})};this.mergeMaturity=async({neuronId:t,percentageToMerge:r})=>{if(So(r),this.hardwareWallet)return this.mergeMaturityHardwareWallet({neuronId:t,percentageToMerge:r});let n=Qr({neuronId:t,percentageToMerge:r});return G({request:n,service:this.certifiedService})};this.stakeMaturity=async({neuronId:t,percentageToStake:r})=>{So(r??100),await G({request:Lr({neuronId:t,percentageToStake:r}),service:this.certifiedService})};this.spawnNeuron=async({neuronId:t,percentageToSpawn:r,newController:n,nonce:i})=>{if(r!==void 0&&So(r),this.hardwareWallet)return this.spawnHardwareWallet({neuronId:t,percentageToSpawn:r,newController:n==null?void 0:n.toText()});let p=en({neuronId:t,percentageToSpawn:r,newController:n,nonce:i}),l=await this.certifiedService.manage_neuron(p),_=Mo(l);if("Spawn"in _&&_.Spawn.created_neuron_id[0]!==void 0)return _.Spawn.created_neuron_id[0].id;throw new ae(`Unrecognized Spawn error in ${JSON.stringify(l)}`)};this.addHotkey=async({neuronId:t,principal:r})=>{if(this.hardwareWallet)return this.addHotkeyHardwareWallet({neuronId:t,principal:r});let n=on({neuronId:t,principal:r});return G({request:n,service:this.certifiedService})};this.removeHotkey=async({neuronId:t,principal:r})=>{if(this.hardwareWallet)return this.removeHotkeyHardwareWallet({neuronId:t,principal:r});let n=tn({neuronId:t,principal:r});return G({request:n,service:this.certifiedService})};this.claimOrRefreshNeuronFromAccount=async({memo:t,controller:r})=>{var l;let n=Kr({memo:t,controller:r}),i=await this.certifiedService.manage_neuron(n),{command:p}=i;if(p.length&&"ClaimOrRefresh"in p[0])return(l=p[0].ClaimOrRefresh.refreshed_neuron_id[0])==null?void 0:l.id;throw new ae(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(i)}`)};this.claimOrRefreshNeuron=async t=>{var p;let r=qr(t),n=await this.service.manage_neuron(r),{command:i}=n;if(i.length&&"ClaimOrRefresh"in i[0])return(p=i[0].ClaimOrRefresh.refreshed_neuron_id[0])==null?void 0:p.id;throw new ae(`Unrecognized ClaimOrRefresh error in ${JSON.stringify(n)}`)};this.buildNeuronStakeSubAccount=(t,r)=>{let n=(0,ke.asciiStringToByteArray)("neuron-stake"),i=kn.sha256.create();return i.update([12,...n,...r.toUint8Array(),...t]),te.fromBytes(new Uint8Array(i.array()))};this.getNeuron=async({certified:t=!0,neuronId:r})=>{let[n]=await this.listNeurons({certified:t,neuronIds:[r]});return n};this.listNeuronsHardwareWallet=async()=>{let t=new Ue.ListNeurons;t.setIncludeNeuronsReadableByCaller(!0);let r=await Pe({agent:this.agent,canisterId:this.canisterId,methodName:"list_neurons_pb",arg:t.serializeBinary()}),n=Ue.ListNeuronsResponse.deserializeBinary(r),i=n.getFullNeuronsList();return n.getNeuronIdsList().map(An({pbNeurons:i,canisterId:this.canisterId}))};this.manageNeuronUpdateCall=async t=>{let r=await Pe({agent:this.agent,canisterId:this.canisterId,methodName:"manage_neuron_pb",arg:t.serializeBinary()});Pn(r)};this.addHotkeyHardwareWallet=async({neuronId:t,principal:r})=>{let n=dn({neuronId:t,principal:r.toText()});await this.manageNeuronUpdateCall(n)};this.removeHotkeyHardwareWallet=async({neuronId:t,principal:r})=>{let n=fn({neuronId:t,principal:r.toText()});await this.manageNeuronUpdateCall(n)};this.increaseDissolveDelayHardwareWallet=async({neuronId:t,additionalDissolveDelaySeconds:r})=>{let n=_n({neuronId:t,additionalDissolveDelaySeconds:r});await this.manageNeuronUpdateCall(n)};this.startDissolvingHardwareWallet=async t=>{let r=bn(t);await this.manageNeuronUpdateCall(r)};this.stopDissolvingHardwareWallet=async t=>{let r=yn(t);await this.manageNeuronUpdateCall(r)};this.joinCommunityFundHardwareWallet=async t=>{let r=hn(t);await this.manageNeuronUpdateCall(r)};this.disburseHardwareWallet=async t=>{let r=vn(t);await this.manageNeuronUpdateCall(r)};this.mergeMaturityHardwareWallet=async t=>{let r=mn(t);await this.manageNeuronUpdateCall(r)};this.spawnHardwareWallet=async t=>{var _;let r=Mn(t),n=await Pe({agent:this.agent,canisterId:this.canisterId,methodName:"manage_neuron_pb",arg:r.serializeBinary()}),i=Ue.ManageNeuronResponse.deserializeBinary(n),p=i.getError();if(p)throw new Z({error_message:p.getErrorMessage(),error_type:p.getErrorType()});let l=(_=i.getSpawn())==null?void 0:_.getCreatedNeuronId();if(l!==void 0)return BigInt(l.getId());throw new ae(`Unrecognized Spawn error in ${JSON.stringify(i)}`)};this.mergeNeuronsHardwareWallet=async t=>{let r=Rn(t);await this.manageNeuronUpdateCall(r)};this.canisterId=t,this.service=r,this.certifiedService=n,this.agent=i,this.hardwareWallet=p}static create(t={}){let r=t.canisterId??Er,{service:n,certifiedService:i,agent:p}=(0,ke.createServices)({options:{...t,canisterId:r},idlFactory:jr,certifiedIdlFactory:Pr});return new je(r,n,i,p,t.hardwareWallet)}getGovernanceService(t){return t?this.certifiedService:this.service}};var Wn=Y(ge());var Te=class{constructor(t,r){this.e8s=t;this.token=r}static fromE8s(t){return new Te(t,fo)}static fromString(t){let r=we(t);return typeof r=="bigint"?new Te(r,fo):r}toE8s(){return this.e8s}toProto(){let t=new Wn.ICPTs;return t.setE8s(this.e8s.toString()),t}};var qn=require("@dfinity/utils");var zn=({IDL:o})=>{let t=o.Nat64,r=o.Record({start:t,length:o.Nat64}),n=o.Nat64,i=o.Vec(o.Nat8),p=o.Record({e8s:o.Nat64}),l=o.Variant({Burn:o.Record({from:i,amount:p}),Mint:o.Record({to:i,amount:p}),Transfer:o.Record({to:i,fee:p,from:i,amount:p})}),_=o.Record({timestamp_nanos:o.Nat64}),y=o.Record({memo:n,operation:o.Opt(l),created_at_time:_}),S=o.Record({transaction:y,timestamp:_,parent_hash:o.Opt(o.Vec(o.Nat8))}),T=o.Record({blocks:o.Vec(S)}),F=o.Variant({BadFirstBlockIndex:o.Record({requested_index:t,first_valid_index:t}),Other:o.Record({error_message:o.Text,error_code:o.Nat64})}),A=o.Variant({Ok:T,Err:F}),E=o.Func([r],[A],[]),j=o.Record({certificate:o.Opt(o.Vec(o.Nat8)),blocks:o.Vec(S),chain_length:o.Nat64,first_block_index:t,archived_blocks:o.Vec(o.Record({callback:E,start:t,length:o.Nat64}))}),N=o.Record({account:i}),V=o.Record({canister_id:o.Principal}),D=o.Record({archives:o.Vec(V)}),z=o.Vec(o.Nat8),W=o.Record({to:i,fee:p,memo:n,from_subaccount:o.Opt(z),created_at_time:o.Opt(_),amount:p}),q=o.Variant({TxTooOld:o.Record({allowed_window_nanos:o.Nat64}),BadFee:o.Record({expected_fee:p}),TxDuplicate:o.Record({duplicate_of:t}),TxCreatedInFuture:o.Null,InsufficientFunds:o.Record({balance:p})}),J=o.Variant({Ok:t,Err:q}),L=o.Record({}),$=o.Record({transfer_fee:p});return o.Service({_blocks:o.Func([r],[j],[]),account_balance:o.Func([N],[p],[]),archives:o.Func([],[D],[]),decimals:o.Func([],[o.Record({decimals:o.Nat32})],[]),name:o.Func([],[o.Record({name:o.Text})],[]),symbol:o.Func([],[o.Record({symbol:o.Text})],[]),transfer:o.Func([W],[J],[]),transfer_fee:o.Func([L],[$],[])})};var Hn=({IDL:o})=>{let t=o.Vec(o.Nat8),r=o.Record({account:t}),n=o.Record({e8s:o.Nat64}),i=o.Record({canister_id:o.Principal}),p=o.Record({archives:o.Vec(i)}),l=o.Nat64,_=o.Record({start:l,length:o.Nat64}),y=o.Nat64,S=o.Variant({Burn:o.Record({from:t,amount:n}),Mint:o.Record({to:t,amount:n}),Transfer:o.Record({to:t,fee:n,from:t,amount:n})}),T=o.Record({timestamp_nanos:o.Nat64}),F=o.Record({memo:y,operation:o.Opt(S),created_at_time:T}),A=o.Record({transaction:F,timestamp:T,parent_hash:o.Opt(o.Vec(o.Nat8))}),E=o.Record({blocks:o.Vec(A)}),j=o.Variant({BadFirstBlockIndex:o.Record({requested_index:l,first_valid_index:l}),Other:o.Record({error_message:o.Text,error_code:o.Nat64})}),N=o.Variant({Ok:E,Err:j}),V=o.Func([_],[N],["query"]),D=o.Record({certificate:o.Opt(o.Vec(o.Nat8)),blocks:o.Vec(A),chain_length:o.Nat64,first_block_index:l,archived_blocks:o.Vec(o.Record({callback:V,start:l,length:o.Nat64}))}),z=o.Vec(o.Nat8),W=o.Record({to:t,fee:n,memo:y,from_subaccount:o.Opt(z),created_at_time:o.Opt(T),amount:n}),q=o.Variant({TxTooOld:o.Record({allowed_window_nanos:o.Nat64}),BadFee:o.Record({expected_fee:n}),TxDuplicate:o.Record({duplicate_of:l}),TxCreatedInFuture:o.Null,InsufficientFunds:o.Record({balance:n})}),J=o.Variant({Ok:l,Err:q}),L=o.Record({}),$=o.Record({transfer_fee:n});return o.Service({account_balance:o.Func([r],[n],["query"]),archives:o.Func([],[p],["query"]),decimals:o.Func([],[o.Record({decimals:o.Nat32})],["query"]),name:o.Func([],[o.Record({name:o.Text})],["query"]),query_blocks:o.Func([_],[D],["query"]),symbol:o.Func([],[o.Record({symbol:o.Text})],["query"]),transfer:o.Func([W],[J],[]),transfer_fee:o.Func([L],[$],["query"])})};var Q=Y(ge());var Gn=require("@dfinity/utils"),No=Y(ge());var In=o=>{let t=new Uint8Array(o).buffer,r=new No.Subaccount;return r.setSubAccount(new Uint8Array(t)),r},Ht=o=>{let t=new No.ICPTs;return t.setE8s(o.toString(10)),t},Vn=o=>({e8s:o}),Dn=({to:o,amount:t,memo:r,fee:n,fromSubAccount:i})=>({to:o.toUint8Array(),fee:Vn(n??ro),amount:Vn(t),memo:r??BigInt(0),created_at_time:[],from_subaccount:i===void 0?[]:[(0,Gn.arrayOfNumberToUint8Array)(i)]});var We=class{constructor(t,r,n,i,p,l,_=!1){this.agent=t;this.canisterId=r;this.service=n;this.certifiedService=i;this.updateFetcher=p;this.queryFetcher=l;this.hardwareWallet=_;this.accountBalance=async({accountIdentifier:t,certified:r=!0})=>this.hardwareWallet?this.accountBalanceHardwareWallet({accountIdentifier:t,certified:r}):(await(r?this.certifiedService:this.service).account_balance({account:t.toUint8Array()})).e8s;this.transactionFee=async()=>{let{transfer_fee:{e8s:t}}=await this.service.transfer_fee({});return t};this.transfer=async t=>{if(this.hardwareWallet)return this.transferHardwareWallet(t);t.fee===void 0&&(t.fee=this.hardwareWallet?ro:await this.transactionFee());let r=Dn(t),n=await this.certifiedService.transfer(r);if("Err"in n)throw Ft(n.Err);return n.Ok};this.accountBalanceHardwareWallet=async({accountIdentifier:t,certified:r=!0})=>{let n=r?this.updateFetcher:this.queryFetcher,i=new Q.AccountBalanceRequest;i.setAccount(t.toProto());let p=await n({agent:this.agent,canisterId:this.canisterId,methodName:"account_balance_pb",arg:i.serializeBinary()});return BigInt(Q.ICPTs.deserializeBinary(new Uint8Array(p)).getE8s())};this.transferHardwareWallet=async({to:t,amount:r,memo:n,fee:i,fromSubAccount:p})=>{let l=new Q.SendRequest;l.setTo(t.toProto());let _=new Q.Payment;_.setReceiverGets(Ht(r)),l.setPayment(_),l.setMaxFee(Ht(i??ro));let y=new Q.Memo;y.setMemo((n??BigInt(0)).toString()),l.setMemo(y),p!==void 0&&l.setFromSubaccount(In(p));try{let S=await this.updateFetcher({agent:this.agent,canisterId:this.canisterId,methodName:"send_pb",arg:l.serializeBinary()});return BigInt(Q.BlockHeight.deserializeBinary(S).getHeight())}catch(S){throw S instanceof Error?wt(S):S}}}static create(t={}){let r=t.canisterId??Or,{service:n,certifiedService:i,agent:p}=(0,qn.createServices)({options:{...t,canisterId:r},idlFactory:Hn,certifiedIdlFactory:zn});return new We(p,r,n,i,t.updateCallOverride??Pe,t.queryCallOverride??jn,t.hardwareWallet)}};var Jn=require("@dfinity/utils");var Kn=({IDL:o})=>{let t=o.Record({allowed_principals:o.Vec(o.Principal),access_controls_enabled:o.Bool,sns_subnet_ids:o.Vec(o.Principal)}),r=o.Record({wasm:o.Vec(o.Nat8),canister_type:o.Int32}),n=o.Record({hash:o.Vec(o.Nat8),wasm:o.Opt(r)}),i=o.Record({message:o.Text}),p=o.Variant({Error:i,Hash:o.Vec(o.Nat8)}),l=o.Record({result:o.Opt(p)}),_=o.Record({total_e8s:o.Nat64}),y=o.Record({controller:o.Opt(o.Principal),dissolve_delay_seconds:o.Nat64,memo:o.Nat64,stake_e8s:o.Nat64}),S=o.Record({developer_neurons:o.Vec(y)}),T=o.Record({airdrop_neurons:o.Vec(y)}),F=o.Record({total_e8s:o.Nat64,initial_swap_amount_e8s:o.Nat64}),A=o.Record({treasury_distribution:o.Opt(_),developer_distribution:o.Opt(S),airdrop_distribution:o.Opt(T),swap_distribution:o.Opt(F)}),E=o.Variant({FractionalDeveloperVotingPower:A}),j=o.Record({url:o.Opt(o.Text),max_dissolve_delay_seconds:o.Opt(o.Nat64),max_dissolve_delay_bonus_percentage:o.Opt(o.Nat64),fallback_controller_principal_ids:o.Vec(o.Text),token_symbol:o.Opt(o.Text),final_reward_rate_basis_points:o.Opt(o.Nat64),neuron_minimum_stake_e8s:o.Opt(o.Nat64),logo:o.Opt(o.Text),name:o.Opt(o.Text),initial_voting_period_seconds:o.Opt(o.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:o.Opt(o.Nat64),description:o.Opt(o.Text),max_neuron_age_seconds_for_age_bonus:o.Opt(o.Nat64),initial_reward_rate_basis_points:o.Opt(o.Nat64),wait_for_quiet_deadline_increase_seconds:o.Opt(o.Nat64),transaction_fee_e8s:o.Opt(o.Nat64),sns_initialization_parameters:o.Opt(o.Text),max_age_bonus_percentage:o.Opt(o.Nat64),initial_token_distribution:o.Opt(E),reward_rate_transition_duration_seconds:o.Opt(o.Nat64),token_name:o.Opt(o.Text),proposal_reject_cost_e8s:o.Opt(o.Nat64)}),N=o.Record({sns_init_payload:o.Opt(j)}),V=o.Record({root:o.Opt(o.Principal),swap:o.Opt(o.Principal),ledger:o.Opt(o.Principal),index:o.Opt(o.Principal),governance:o.Opt(o.Principal)}),D=o.Record({subnet_id:o.Opt(o.Principal),error:o.Opt(i),canisters:o.Opt(V)}),z=o.Record({allowed_principals:o.Vec(o.Principal)}),W=o.Record({archive_wasm_hash:o.Vec(o.Nat8),root_wasm_hash:o.Vec(o.Nat8),swap_wasm_hash:o.Vec(o.Nat8),ledger_wasm_hash:o.Vec(o.Nat8),governance_wasm_hash:o.Vec(o.Nat8),index_wasm_hash:o.Vec(o.Nat8)}),q=o.Record({current_version:o.Opt(W)}),J=o.Record({next_version:o.Opt(W)}),L=o.Record({sns_subnet_ids:o.Vec(o.Principal)}),$=o.Record({hash:o.Vec(o.Nat8)}),fe=o.Record({wasm:o.Opt(r)}),ne=o.Record({root_canister_id:o.Opt(o.Principal),governance_canister_id:o.Opt(o.Principal),index_canister_id:o.Opt(o.Principal),swap_canister_id:o.Opt(o.Principal),ledger_canister_id:o.Opt(o.Principal)}),_e=o.Record({instances:o.Vec(ne)}),ie=o.Record({added_principals:o.Vec(o.Principal),removed_principals:o.Vec(o.Principal)}),be=o.Variant({Error:i,AllowedPrincipals:z}),ye=o.Record({update_allowed_principals_result:o.Opt(be)}),he=o.Record({sns_subnet_ids_to_add:o.Vec(o.Principal),sns_subnet_ids_to_remove:o.Vec(o.Principal)}),ve=o.Record({error:o.Opt(i)});return o.Service({add_wasm:o.Func([n],[l],[]),deploy_new_sns:o.Func([N],[D],[]),get_allowed_principals:o.Func([o.Record({})],[z],[]),get_latest_sns_version_pretty:o.Func([o.Null],[o.Vec(o.Tuple(o.Text,o.Text))],[]),get_next_sns_version:o.Func([q],[J],[]),get_sns_subnet_ids:o.Func([o.Record({})],[L],[]),get_wasm:o.Func([$],[fe],[]),list_deployed_snses:o.Func([o.Record({})],[_e],[]),update_allowed_principals:o.Func([ie],[ye],[]),update_sns_subnet_list:o.Func([he],[ve],[])})};var Yn=({IDL:o})=>{let t=o.Record({allowed_principals:o.Vec(o.Principal),access_controls_enabled:o.Bool,sns_subnet_ids:o.Vec(o.Principal)}),r=o.Record({wasm:o.Vec(o.Nat8),canister_type:o.Int32}),n=o.Record({hash:o.Vec(o.Nat8),wasm:o.Opt(r)}),i=o.Record({message:o.Text}),p=o.Variant({Error:i,Hash:o.Vec(o.Nat8)}),l=o.Record({result:o.Opt(p)}),_=o.Record({total_e8s:o.Nat64}),y=o.Record({controller:o.Opt(o.Principal),dissolve_delay_seconds:o.Nat64,memo:o.Nat64,stake_e8s:o.Nat64}),S=o.Record({developer_neurons:o.Vec(y)}),T=o.Record({airdrop_neurons:o.Vec(y)}),F=o.Record({total_e8s:o.Nat64,initial_swap_amount_e8s:o.Nat64}),A=o.Record({treasury_distribution:o.Opt(_),developer_distribution:o.Opt(S),airdrop_distribution:o.Opt(T),swap_distribution:o.Opt(F)}),E=o.Variant({FractionalDeveloperVotingPower:A}),j=o.Record({url:o.Opt(o.Text),max_dissolve_delay_seconds:o.Opt(o.Nat64),max_dissolve_delay_bonus_percentage:o.Opt(o.Nat64),fallback_controller_principal_ids:o.Vec(o.Text),token_symbol:o.Opt(o.Text),final_reward_rate_basis_points:o.Opt(o.Nat64),neuron_minimum_stake_e8s:o.Opt(o.Nat64),logo:o.Opt(o.Text),name:o.Opt(o.Text),initial_voting_period_seconds:o.Opt(o.Nat64),neuron_minimum_dissolve_delay_to_vote_seconds:o.Opt(o.Nat64),description:o.Opt(o.Text),max_neuron_age_seconds_for_age_bonus:o.Opt(o.Nat64),initial_reward_rate_basis_points:o.Opt(o.Nat64),wait_for_quiet_deadline_increase_seconds:o.Opt(o.Nat64),transaction_fee_e8s:o.Opt(o.Nat64),sns_initialization_parameters:o.Opt(o.Text),max_age_bonus_percentage:o.Opt(o.Nat64),initial_token_distribution:o.Opt(E),reward_rate_transition_duration_seconds:o.Opt(o.Nat64),token_name:o.Opt(o.Text),proposal_reject_cost_e8s:o.Opt(o.Nat64)}),N=o.Record({sns_init_payload:o.Opt(j)}),V=o.Record({root:o.Opt(o.Principal),swap:o.Opt(o.Principal),ledger:o.Opt(o.Principal),index:o.Opt(o.Principal),governance:o.Opt(o.Principal)}),D=o.Record({subnet_id:o.Opt(o.Principal),error:o.Opt(i),canisters:o.Opt(V)}),z=o.Record({allowed_principals:o.Vec(o.Principal)}),W=o.Record({archive_wasm_hash:o.Vec(o.Nat8),root_wasm_hash:o.Vec(o.Nat8),swap_wasm_hash:o.Vec(o.Nat8),ledger_wasm_hash:o.Vec(o.Nat8),governance_wasm_hash:o.Vec(o.Nat8),index_wasm_hash:o.Vec(o.Nat8)}),q=o.Record({current_version:o.Opt(W)}),J=o.Record({next_version:o.Opt(W)}),L=o.Record({sns_subnet_ids:o.Vec(o.Principal)}),$=o.Record({hash:o.Vec(o.Nat8)}),fe=o.Record({wasm:o.Opt(r)}),ne=o.Record({root_canister_id:o.Opt(o.Principal),governance_canister_id:o.Opt(o.Principal),index_canister_id:o.Opt(o.Principal),swap_canister_id:o.Opt(o.Principal),ledger_canister_id:o.Opt(o.Principal)}),_e=o.Record({instances:o.Vec(ne)}),ie=o.Record({added_principals:o.Vec(o.Principal),removed_principals:o.Vec(o.Principal)}),be=o.Variant({Error:i,AllowedPrincipals:z}),ye=o.Record({update_allowed_principals_result:o.Opt(be)}),he=o.Record({sns_subnet_ids_to_add:o.Vec(o.Principal),sns_subnet_ids_to_remove:o.Vec(o.Principal)}),ve=o.Record({error:o.Opt(i)});return o.Service({add_wasm:o.Func([n],[l],[]),deploy_new_sns:o.Func([N],[D],[]),get_allowed_principals:o.Func([o.Record({})],[z],["query"]),get_latest_sns_version_pretty:o.Func([o.Null],[o.Vec(o.Tuple(o.Text,o.Text))],["query"]),get_next_sns_version:o.Func([q],[J],["query"]),get_sns_subnet_ids:o.Func([o.Record({})],[L],["query"]),get_wasm:o.Func([$],[fe],["query"]),list_deployed_snses:o.Func([o.Record({})],[_e],["query"]),update_allowed_principals:o.Func([ie],[ye],[]),update_sns_subnet_list:o.Func([he],[ve],[])})};var ze=class{constructor(t,r){this.service=t;this.certifiedService=r;this.listSnses=async({certified:t=!0})=>{let r=t?this.certifiedService:this.service,{instances:n}=await r.list_deployed_snses({});return n}}static create(t={}){let{service:r,certifiedService:n}=(0,Jn.createServices)({options:{...t,canisterId:t.canisterId??wr},idlFactory:Yn,certifiedIdlFactory:Kn});return new ze(r,n)}};var $n=({recentBallots:o,proposalId:t})=>{if(!t)return;let r=o.find(({proposalId:n})=>n===t);return r==null?void 0:r.vote},Xn=({neurons:o,proposal:t})=>{let{ballots:r,proposalTimestampSeconds:n}=t;return o.filter(({createdTimestampSeconds:i,neuronId:p})=>{let l=i>n,_=r.find(({neuronId:y})=>y===p)===void 0;return l||_})},Vi=({neurons:o,proposal:t})=>{let{id:r}=t;return o.filter(({recentBallots:n,neuronId:i})=>$n({recentBallots:n,proposalId:r})===void 0&&Xn({neurons:o,proposal:t}).find(({neuronId:p})=>p===i)===void 0)},Gi=({neurons:o,proposal:t})=>{let{id:r}=t;return o.filter(({recentBallots:n})=>$n({recentBallots:n,proposalId:r})!==void 0)};0&&(module.exports={AccountIdentifier,BadFeeError,CouldNotClaimNeuronError,FeatureNotSupportedError,FromStringToTokenError,GenesisTokenCanister,GovernanceCanister,GovernanceError,ICP,ICPToken,InsufficientAmountError,InsufficientFundsError,InvalidAccountIDError,InvalidPercentageError,InvalidSenderError,LedgerCanister,NeuronState,NnsFunction,ProposalRewardStatus,ProposalStatus,SnsWasmCanister,StakeNeuronError,SubAccount,TokenAmount,Topic,TransferError,TxCreatedInFutureError,TxDuplicateError,TxTooOldError,UnrecognizedTypeError,UnsupportedValueError,Vote,accountIdentifierFromBytes,accountIdentifierToBytes,checkAccountId,convertStringToE8s,ineligibleNeurons,mapTransferError,mapTransferProtoError,principalToAccountIdentifier,votableNeurons,votedNeurons});
|
|
21
21
|
/**
|
|
22
22
|
* [js-sha256]{@link https://github.com/emn178/js-sha256}
|
|
23
23
|
*
|