@@ -9,6 +9,7 @@ use candid::{CandidType, Encode, Principal};
9
9
use clap:: { Parser , ValueEnum } ;
10
10
use ic_base_types:: PrincipalId ;
11
11
use ic_nns_common:: pb:: v1:: { NeuronId , ProposalId } ;
12
+ use ic_nns_governance:: pb:: v1:: manage_neuron:: NeuronIdOrSubaccount ;
12
13
use ic_nns_governance:: pb:: v1:: {
13
14
manage_neuron:: {
14
15
configure:: Operation , disburse:: Amount , AddHotKey , ChangeAutoStakeMaturity , Command ,
@@ -142,60 +143,61 @@ Cannot use --ledger with these flags. This version of quill only supports the fo
142
143
}
143
144
let mut msgs = Vec :: new ( ) ;
144
145
145
- let id = Some ( NeuronId {
146
+ let id = NeuronId {
146
147
id : parse_neuron_id ( opts. neuron_id ) ?,
147
- } ) ;
148
+ } ;
149
+ let id = Some ( NeuronIdOrSubaccount :: NeuronId ( id) ) ;
148
150
if opts. add_hot_key . is_some ( ) {
149
151
let args = Encode ! ( & ManageNeuron {
150
- id,
152
+ id: None ,
151
153
command: Some ( Command :: Configure ( Configure {
152
154
operation: Some ( Operation :: AddHotKey ( AddHotKey {
153
155
new_hot_key: opts. add_hot_key. map( PrincipalId )
154
156
} ) )
155
157
} ) ) ,
156
- neuron_id_or_subaccount: None ,
158
+ neuron_id_or_subaccount: id . clone ( ) ,
157
159
} ) ?;
158
160
msgs. push ( args) ;
159
161
} ;
160
162
161
163
if opts. remove_hot_key . is_some ( ) {
162
164
let args = Encode ! ( & ManageNeuron {
163
- id,
165
+ id: None ,
164
166
command: Some ( Command :: Configure ( Configure {
165
167
operation: Some ( Operation :: RemoveHotKey ( RemoveHotKey {
166
168
hot_key_to_remove: opts. remove_hot_key. map( PrincipalId )
167
169
} ) )
168
170
} ) ) ,
169
- neuron_id_or_subaccount: None ,
171
+ neuron_id_or_subaccount: id . clone ( ) ,
170
172
} ) ?;
171
173
msgs. push ( args) ;
172
174
} ;
173
175
174
176
if opts. stop_dissolving {
175
177
let args = Encode ! ( & ManageNeuron {
176
- id,
178
+ id: None ,
177
179
command: Some ( Command :: Configure ( Configure {
178
180
operation: Some ( Operation :: StopDissolving ( StopDissolving { } ) )
179
181
} ) ) ,
180
- neuron_id_or_subaccount: None ,
182
+ neuron_id_or_subaccount: id . clone ( ) ,
181
183
} ) ?;
182
184
msgs. push ( args) ;
183
185
}
184
186
185
187
if opts. start_dissolving {
186
188
let args = Encode ! ( & ManageNeuron {
187
- id,
189
+ id: None ,
188
190
command: Some ( Command :: Configure ( Configure {
189
191
operation: Some ( Operation :: StartDissolving ( StartDissolving { } ) )
190
192
} ) ) ,
191
- neuron_id_or_subaccount: None ,
193
+ neuron_id_or_subaccount: id . clone ( ) ,
192
194
} ) ?;
193
195
msgs. push ( args) ;
194
196
}
195
197
196
198
if let Some ( additional_dissolve_delay_seconds) = opts. additional_dissolve_delay_seconds {
197
199
let args = Encode ! ( & ManageNeuron {
198
- id,
200
+ id: None ,
199
201
command: Some ( Command :: Configure ( Configure {
200
202
operation: Some ( Operation :: IncreaseDissolveDelay ( IncreaseDissolveDelay {
201
203
additional_dissolve_delay_seconds: match additional_dissolve_delay_seconds
@@ -235,66 +237,66 @@ Cannot use --ledger with these flags. This version of quill only supports the fo
235
237
}
236
238
} ) )
237
239
} ) ) ,
238
- neuron_id_or_subaccount: None ,
240
+ neuron_id_or_subaccount: id . clone ( ) ,
239
241
} ) ?;
240
242
msgs. push ( args) ;
241
243
} ;
242
244
243
245
if opts. disburse || opts. disburse_amount . is_some ( ) || opts. disburse_to . is_some ( ) {
244
246
let args = Encode ! ( & ManageNeuron {
245
- id,
247
+ id: None ,
246
248
command: Some ( Command :: Disburse ( Disburse {
247
249
to_account: opts. disburse_to. map( |to| to. into_identifier( ) . into( ) ) ,
248
250
amount: opts. disburse_amount. map( |amount| Amount {
249
251
e8s: amount. get_e8s( )
250
252
} ) ,
251
253
} ) ) ,
252
- neuron_id_or_subaccount: None ,
254
+ neuron_id_or_subaccount: id . clone ( ) ,
253
255
} ) ?;
254
256
msgs. push ( args) ;
255
257
} ;
256
258
257
259
if opts. spawn {
258
260
let args = Encode ! ( & ManageNeuron {
259
- id,
261
+ id: None ,
260
262
command: Some ( Command :: Spawn ( Default :: default ( ) ) ) ,
261
- neuron_id_or_subaccount: None ,
263
+ neuron_id_or_subaccount: id . clone ( ) ,
262
264
} ) ?;
263
265
msgs. push ( args) ;
264
266
} ;
265
267
266
268
if let Some ( amount) = opts. split {
267
269
let args = Encode ! ( & ManageNeuron {
268
- id,
270
+ id: None ,
269
271
command: Some ( Command :: Split ( Split {
270
272
amount_e8s: amount * 100_000_000
271
273
} ) ) ,
272
- neuron_id_or_subaccount: None ,
274
+ neuron_id_or_subaccount: id . clone ( ) ,
273
275
} ) ?;
274
276
msgs. push ( args) ;
275
277
} ;
276
278
277
279
if opts. clear_manage_neuron_followees {
278
280
let args = Encode ! ( & ManageNeuron {
279
- id,
281
+ id: None ,
280
282
command: Some ( Command :: Follow ( Follow {
281
283
topic: 1 , // Topic::NeuronManagement as i32,
282
284
followees: Vec :: new( )
283
285
} ) ) ,
284
- neuron_id_or_subaccount: None ,
286
+ neuron_id_or_subaccount: id . clone ( ) ,
285
287
} ) ?;
286
288
msgs. push ( args) ;
287
289
}
288
290
289
291
if let Some ( neuron_id) = opts. merge_from_neuron {
290
292
let args = Encode ! ( & ManageNeuron {
291
- id,
293
+ id: None ,
292
294
command: Some ( Command :: Merge ( Merge {
293
295
source_neuron_id: Some ( NeuronId {
294
296
id: parse_neuron_id( neuron_id) ?
295
297
} ) ,
296
298
} ) ) ,
297
- neuron_id_or_subaccount: None ,
299
+ neuron_id_or_subaccount: id . clone ( ) ,
298
300
} ) ?;
299
301
msgs. push ( args) ;
300
302
} ;
@@ -308,46 +310,46 @@ Cannot use --ledger with these flags. This version of quill only supports the fo
308
310
bail ! ( "Percentage to merge must be a number from 1 to 100" ) ;
309
311
}
310
312
let args = Encode ! ( & ManageNeuron {
311
- id,
313
+ id: None ,
312
314
command: Some ( Command :: StakeMaturity ( StakeMaturity {
313
315
percentage_to_stake: Some ( percentage) ,
314
316
} ) ) ,
315
- neuron_id_or_subaccount: None ,
317
+ neuron_id_or_subaccount: id . clone ( ) ,
316
318
} ) ?;
317
319
msgs. push ( args) ;
318
320
}
319
321
320
322
if opts. join_community_fund {
321
323
let args = Encode ! ( & ManageNeuron {
322
- id,
324
+ id: None ,
323
325
command: Some ( Command :: Configure ( Configure {
324
326
operation: Some ( Operation :: JoinCommunityFund ( JoinCommunityFund { } ) )
325
327
} ) ) ,
326
- neuron_id_or_subaccount: None ,
328
+ neuron_id_or_subaccount: id . clone ( ) ,
327
329
} ) ?;
328
330
msgs. push ( args) ;
329
331
} ;
330
332
331
333
if opts. leave_community_fund {
332
334
let args = Encode ! ( & ManageNeuron {
333
- id,
335
+ id: None ,
334
336
command: Some ( Command :: Configure ( Configure {
335
337
operation: Some ( Operation :: LeaveCommunityFund ( LeaveCommunityFund { } ) )
336
338
} ) ) ,
337
- neuron_id_or_subaccount: None ,
339
+ neuron_id_or_subaccount: id . clone ( ) ,
338
340
} ) ?;
339
341
msgs. push ( args) ;
340
342
}
341
343
342
344
if let Some ( proposals) = opts. register_vote {
343
345
for proposal in proposals {
344
346
let args = Encode ! ( & ManageNeuron {
345
- id,
347
+ id: None ,
346
348
command: Some ( Command :: RegisterVote ( RegisterVote {
347
349
vote: if opts. reject { 2 } else { 1 } ,
348
350
proposal: Some ( ProposalId { id: proposal } ) ,
349
351
} ) ) ,
350
- neuron_id_or_subaccount: None ,
352
+ neuron_id_or_subaccount: id . clone ( ) ,
351
353
} ) ?;
352
354
msgs. push ( args) ;
353
355
}
@@ -356,28 +358,28 @@ Cannot use --ledger with these flags. This version of quill only supports the fo
356
358
if let ( Some ( topic) , Some ( neuron_ids) ) = ( opts. follow_topic , opts. follow_neurons ) {
357
359
let followees = neuron_ids. into_iter ( ) . map ( |x| NeuronId { id : x } ) . collect ( ) ;
358
360
let args = Encode ! ( & ManageNeuron {
359
- id,
361
+ id: None ,
360
362
command: Some ( Command :: Follow ( Follow {
361
363
topic, // Topic::NeuronManagement as i32,
362
364
followees,
363
365
} ) ) ,
364
- neuron_id_or_subaccount: None ,
366
+ neuron_id_or_subaccount: id . clone ( ) ,
365
367
} ) ?;
366
368
msgs. push ( args) ;
367
369
}
368
370
369
371
if let Some ( enable) = opts. auto_stake_maturity {
370
372
let requested_setting_for_auto_stake_maturity = matches ! ( enable, EnableState :: Enabled ) ;
371
373
let args = Encode ! ( & ManageNeuron {
372
- id,
374
+ id: None ,
373
375
command: Some ( Command :: Configure ( Configure {
374
376
operation: Some ( Operation :: ChangeAutoStakeMaturity (
375
377
ChangeAutoStakeMaturity {
376
378
requested_setting_for_auto_stake_maturity,
377
379
}
378
380
) )
379
381
} ) ) ,
380
- neuron_id_or_subaccount: None ,
382
+ neuron_id_or_subaccount: id . clone ( ) ,
381
383
} ) ?;
382
384
msgs. push ( args) ;
383
385
}
0 commit comments