addCuratorToGroup.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
  2. import chalk from 'chalk'
  3. export default class AddCuratorToGroupCommand extends ContentDirectoryCommandBase {
  4. static description = 'Add Curator to existing Curator Group.'
  5. static args = [
  6. {
  7. name: 'groupId',
  8. required: false,
  9. description: 'ID of the Curator Group',
  10. },
  11. {
  12. name: 'curatorId',
  13. required: false,
  14. description: 'ID of the curator',
  15. },
  16. ]
  17. async run() {
  18. const account = await this.getRequiredSelectedAccount()
  19. await this.requireLead()
  20. let { groupId, curatorId } = this.parse(AddCuratorToGroupCommand).args
  21. if (groupId === undefined) {
  22. groupId = await this.promptForCuratorGroup()
  23. } else {
  24. await this.getCuratorGroup(groupId)
  25. }
  26. if (curatorId === undefined) {
  27. curatorId = await this.promptForCurator()
  28. } else {
  29. await this.getCurator(curatorId)
  30. }
  31. await this.requestAccountDecoding(account)
  32. await this.sendAndFollowNamedTx(account, 'content', 'addCuratorToGroup', [groupId, curatorId])
  33. console.log(
  34. chalk.green(
  35. `Curator ${chalk.magentaBright(curatorId)} succesfully added to group ${chalk.magentaBright(groupId)}!`
  36. )
  37. )
  38. }
  39. }