@@ -352,4 +352,68 @@ multisigCommand("activate", "Activate a transaction sitting in the multisig")
352
352
await vault . squad . activateTransaction ( transaction ) ;
353
353
} ) ;
354
354
355
+ multisigCommand ( "add-and-delete" , "Change the roster of the multisig" )
356
+ . option (
357
+ "-a, --add <comma_separated_members>" ,
358
+ "addresses to add to the multisig"
359
+ )
360
+ . option (
361
+ "-r, --remove <comma_separated_members>" ,
362
+ "addresses to remove from the multisig"
363
+ )
364
+ . requiredOption (
365
+ "-t, --target-vaults <comma_separated_vaults>" ,
366
+ "the vault whose roster we want to change"
367
+ )
368
+ . action ( async ( options : any ) => {
369
+ const vault : MultisigVault = await loadVaultFromOptions ( options ) ;
370
+
371
+ const targetVaults : PublicKey [ ] = options . targetVaults
372
+ ? options . targetVaults . split ( "," ) . map ( ( m : string ) => new PublicKey ( m ) )
373
+ : [ ] ;
374
+
375
+ let proposalInstructions : TransactionInstruction [ ] = [ ] ;
376
+
377
+ const membersToAdd : PublicKey [ ] = options . add
378
+ ? options . add . split ( "," ) . map ( ( m : string ) => new PublicKey ( m ) )
379
+ : [ ] ;
380
+
381
+ for ( const member of membersToAdd ) {
382
+ for ( const targetVault of targetVaults ) {
383
+ proposalInstructions . push ( await vault . addMemberIx ( member , targetVault ) ) ;
384
+ }
385
+ }
386
+
387
+ const membersToRemove : PublicKey [ ] = options . remove
388
+ ? options . remove . split ( "," ) . map ( ( m : string ) => new PublicKey ( m ) )
389
+ : [ ] ;
390
+
391
+ for ( const member of membersToRemove ) {
392
+ for ( const targetVault of targetVaults ) {
393
+ proposalInstructions . push (
394
+ await vault . removeMemberIx ( member , targetVault )
395
+ ) ;
396
+ }
397
+ }
398
+
399
+ vault . proposeInstructions ( proposalInstructions , options . cluster ) ;
400
+ } ) ;
401
+
402
+ /**
403
+ * READ THIS BEFORE USING THIS COMMAND
404
+ * This command exists because of a bug in mesh where
405
+ * roster change proposals executed through executeInstruction don't work.
406
+ * It is equivalent to executing proposals through the mesh UI.
407
+ * It might not work for some types of proposals that require the crank to
408
+ * execute them.
409
+ * https://github.com/Squads-Protocol/squads-mpl/pull/32
410
+ */
411
+ multisigCommand ( "execute-add-and-delete" , "Execute a roster change proposal" )
412
+ . requiredOption ( "-t, --transaction <pubkey>" , "address of the proposal" )
413
+ . action ( async ( options : any ) => {
414
+ const vault : MultisigVault = await loadVaultFromOptions ( options ) ;
415
+ const proposal = new PublicKey ( options . transaction ) ;
416
+ await vault . squad . executeTransaction ( proposal ) ;
417
+ } ) ;
418
+
355
419
program . parse ( ) ;
0 commit comments