Browse Source

CLI adjustments

Leszek Wiesner 3 years ago
parent
commit
6bdbcabb51

+ 3 - 3
cli/src/Api.ts

@@ -470,12 +470,12 @@ export default class Api {
   }
 
   async curatorGroupById(id: number): Promise<CuratorGroup | null> {
-    const exists = !!(await this._api.query.contentDirectory.curatorGroupById.size(id)).toNumber()
-    return exists ? await this._api.query.contentDirectory.curatorGroupById(id) : null
+    const exists = !!(await this._api.query.content.curatorGroupById.size(id)).toNumber()
+    return exists ? await this._api.query.content.curatorGroupById(id) : null
   }
 
   async nextCuratorGroupId(): Promise<number> {
-    return (await this._api.query.contentDirectory.nextCuratorGroupId()).toNumber()
+    return (await this._api.query.content.nextCuratorGroupId()).toNumber()
   }
 
   async channelById(channelId: ChannelId | number | string): Promise<Channel> {

+ 3 - 3
cli/src/base/AccountsCommandBase.ts

@@ -83,7 +83,7 @@ export default abstract class AccountsCommandBase extends ApiCommandBase {
   ): Promise<NamedKeyringPair> {
     while (!name || this.isAccountNameTaken(name)) {
       if (name) {
-        this.warn(`Account ${chalk.white(name)} already exists... Try different name`)
+        this.warn(`Account ${chalk.magentaBright(name)} already exists... Try different name`)
       }
       name = await this.simplePrompt({ message: 'New account name' })
     }
@@ -93,11 +93,11 @@ export default abstract class AccountsCommandBase extends ApiCommandBase {
       const mnemonic = mnemonicGenerate()
       keyring.addFromMnemonic(mnemonic, { name, whenCreated: Date.now() }, type)
       masterKey = keyring.getPairs()[0]
-      this.log(chalk.white(`${chalk.bold('New account memonic: ')}${mnemonic}`))
+      this.log(chalk.magentaBright(`${chalk.bold('New account memonic: ')}${mnemonic}`))
     } else {
       const existingAcc = this.getPairs().find((p) => p.address === masterKey!.address)
       if (existingAcc) {
-        this.error(`Account with this key already exists (${chalk.white(existingAcc.meta.name)})`, {
+        this.error(`Account with this key already exists (${chalk.magentaBright(existingAcc.meta.name)})`, {
           exit: ExitCodes.InvalidInput,
         })
       }

+ 9 - 2
cli/src/base/ApiCommandBase.ts

@@ -11,10 +11,10 @@ import chalk from 'chalk'
 import { InterfaceTypes } from '@polkadot/types/types/registry'
 import { ApiMethodArg, ApiMethodNamedArgs, ApiParamsOptions, ApiParamOptions } from '../Types'
 import { createParamOptions } from '../helpers/promptOptions'
-import { AugmentedSubmittables, SubmittableExtrinsic } from '@polkadot/api/types'
+import { AugmentedSubmittables, SubmittableExtrinsic, AugmentedEvents } from '@polkadot/api/types'
 import { DistinctQuestion } from 'inquirer'
 import { BOOL_PROMPT_OPTIONS } from '../helpers/prompting'
-import { DispatchError } from '@polkadot/types/interfaces/system'
+import { DispatchError, Event } from '@polkadot/types/interfaces/system'
 import { formatBalance } from '@polkadot/util'
 import BN from 'bn.js'
 import _ from 'lodash'
@@ -523,6 +523,13 @@ export default abstract class ApiCommandBase extends StateAwareCommandBase {
     return await this.sendAndFollowTx(account, tx, warnOnly)
   }
 
+  public findEvent<
+    S extends keyof AugmentedEvents<'promise'> & string,
+    M extends keyof AugmentedEvents<'promise'>[S] & string
+  >(result: SubmittableResult, section: S, method: M): Event | undefined {
+    return result.findRecord(section, method)?.event
+  }
+
   async buildAndSendExtrinsic<
     Module extends keyof AugmentedSubmittables<'promise'>,
     Method extends keyof AugmentedSubmittables<'promise'>[Module] & string

+ 23 - 19
cli/src/base/ContentDirectoryCommandBase.ts

@@ -76,31 +76,33 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
     await this.getRequiredLeadContext()
   }
 
-  async getCurationActorByChannel(channel: Channel): Promise<ContentActor> {
-    return channel.owner.isOfType('Curators') ? await this.getActor('Lead') : await this.getActor('Curator')
+  async getCurationActorByChannel(channel: Channel): Promise<[ContentActor, string]> {
+    return channel.owner.isOfType('Curators')
+      ? await this.getContentActor('Lead')
+      : await this.getContentActor('Curator')
   }
 
-  async getChannelOwnerActor(channel: Channel): Promise<ContentActor> {
+  async getChannelOwnerActor(channel: Channel): Promise<[ContentActor, string]> {
     if (channel.owner.isOfType('Curators')) {
       try {
-        return await this.getActor('Lead')
+        return await this.getContentActor('Lead')
       } catch (e) {
         return await this.getCuratorContext(channel.owner.asType('Curators'))
       }
     } else {
-      return await this.getActor('Member')
+      return await this.getContentActor('Member')
     }
   }
 
-  async getCategoryManagementActor(): Promise<ContentActor> {
+  async getCategoryManagementActor(): Promise<[ContentActor, string]> {
     try {
-      return await this.getActor('Lead')
+      return await this.getContentActor('Lead')
     } catch (e) {
-      return await this.getActor('Curator')
+      return await this.getContentActor('Curator')
     }
   }
 
-  async getCuratorContext(requiredGroupId?: CuratorGroupId): Promise<ContentActor> {
+  async getCuratorContext(requiredGroupId?: CuratorGroupId): Promise<[ContentActor, string]> {
     const curator = await this.getRequiredWorkerContext()
 
     let groupId: number
@@ -133,7 +135,10 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
       }
     }
 
-    return createType('ContentActor', { Curator: [groupId, curator.workerId.toNumber()] })
+    return [
+      createType('ContentActor', { Curator: [groupId, curator.workerId.toNumber()] }),
+      curator.roleAccount.toString(),
+    ]
   }
 
   private async curatorGroupChoices(ids?: CuratorGroupId[]) {
@@ -225,19 +230,18 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
     return group
   }
 
-  async getActor(context: typeof CONTEXTS[number]) {
-    let actor: ContentActor
+  async getContentActor(context: typeof CONTEXTS[number]): Promise<[ContentActor, string]> {
+    let contentActorContext: [ContentActor, string]
     if (context === 'Member') {
-      const { id } = await this.getRequiredMemberContext()
-      actor = this.createType('ContentActor', { Member: id })
+      const { id, membership } = await this.getRequiredMemberContext()
+      contentActorContext = [this.createType('ContentActor', { Member: id }), membership.controller_account.toString()]
     } else if (context === 'Curator') {
-      actor = await this.getCuratorContext()
+      contentActorContext = await this.getCuratorContext()
     } else {
-      await this.getRequiredLeadContext()
-
-      actor = this.createType('ContentActor', { Lead: null })
+      const lead = await this.getRequiredLeadContext()
+      contentActorContext = [this.createType('ContentActor', { Lead: null }), lead.roleAccount.toString()]
     }
 
-    return actor
+    return contentActorContext
   }
 }

+ 2 - 2
cli/src/commands/account/export.ts

@@ -63,13 +63,13 @@ export default class AccountExport extends AccountsCommandBase {
       for (const acc of accounts) {
         this.exportAccount(acc.meta.name, exportPath)
       }
-      this.log(chalk.greenBright(`All accounts succesfully exported to: ${chalk.white(exportPath)}!`))
+      this.log(chalk.greenBright(`All accounts succesfully exported to: ${chalk.magentaBright(exportPath)}!`))
     } else {
       if (!name) {
         name = await this.promptForAccount()
       }
       const exportedFilePath: string = this.exportAccount(name, destPath)
-      this.log(chalk.greenBright(`Account succesfully exported to: ${chalk.white(exportedFilePath)}`))
+      this.log(chalk.greenBright(`Account succesfully exported to: ${chalk.magentaBright(exportedFilePath)}`))
     }
   }
 }

+ 3 - 1
cli/src/commands/api/setQueryNodeEndpoint.ts

@@ -32,6 +32,8 @@ export default class ApiSetQueryNodeEndpoint extends ApiCommandBase {
     } else {
       newEndpoint = await this.promptForQueryNodeUri()
     }
-    this.log(chalk.greenBright('Query node endpoint successfuly changed! New endpoint: ') + chalk.white(newEndpoint))
+    this.log(
+      chalk.greenBright('Query node endpoint successfuly changed! New endpoint: ') + chalk.magentaBright(newEndpoint)
+    )
   }
 }

+ 7 - 4
cli/src/commands/content/addCuratorToGroup.ts

@@ -17,8 +17,7 @@ export default class AddCuratorToGroupCommand extends ContentDirectoryCommandBas
   ]
 
   async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
+    const lead = await this.getRequiredLeadContext()
 
     let { groupId, curatorId } = this.parse(AddCuratorToGroupCommand).args
 
@@ -34,8 +33,12 @@ export default class AddCuratorToGroupCommand extends ContentDirectoryCommandBas
       await this.getCurator(curatorId)
     }
 
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'content', 'addCuratorToGroup', [groupId, curatorId])
+    await this.sendAndFollowNamedTx(
+      await this.getDecodedPair(lead.roleAccount.toString()),
+      'content',
+      'addCuratorToGroup',
+      [groupId, curatorId]
+    )
 
     console.log(
       chalk.green(

+ 2 - 4
cli/src/commands/content/createChannel.ts

@@ -27,9 +27,7 @@ export default class CreateChannelCommand extends UploadCommandBase {
     if (!context) {
       context = await this.promptForOwnerContext()
     }
-    const account = await this.getRequiredSelectedAccount()
-    const actor = await this.getActor(context)
-    await this.requestAccountDecoding(account)
+    const [actor, address] = await this.getContentActor(context)
 
     const channelInput = await getInputJson<ChannelInputParameters>(input, ChannelInputSchema)
 
@@ -56,7 +54,7 @@ export default class CreateChannelCommand extends UploadCommandBase {
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    const result = await this.sendAndFollowNamedTx(account, 'content', 'createChannel', [
+    const result = await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'createChannel', [
       actor,
       channelCreationParameters,
     ])

+ 7 - 8
cli/src/commands/content/createChannelCategory.ts

@@ -22,10 +22,7 @@ export default class CreateChannelCategoryCommand extends ContentDirectoryComman
   async run() {
     const { context, input } = this.parse(CreateChannelCategoryCommand).flags
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
-
-    const actor = context ? await this.getActor(context) : await this.getCategoryManagementActor()
+    const [actor, address] = context ? await this.getContentActor(context) : await this.getCategoryManagementActor()
 
     const channelCategoryInput = await getInputJson<ChannelCategoryInputParameters>(input, ChannelCategoryInputSchema)
 
@@ -39,10 +36,12 @@ export default class CreateChannelCategoryCommand extends ContentDirectoryComman
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    const result = await this.sendAndFollowNamedTx(currentAccount, 'content', 'createChannelCategory', [
-      actor,
-      channelCategoryCreationParameters,
-    ])
+    const result = await this.sendAndFollowNamedTx(
+      await this.getDecodedPair(address),
+      'content',
+      'createChannelCategory',
+      [actor, channelCategoryCreationParameters]
+    )
 
     if (result) {
       const event = this.findEvent(result, 'content', 'ChannelCategoryCreated')

+ 2 - 4
cli/src/commands/content/createVideo.ts

@@ -41,10 +41,8 @@ export default class CreateVideoCommand extends UploadCommandBase {
     const { input, channelId } = this.parse(CreateVideoCommand).flags
 
     // Get context
-    const account = await this.getRequiredSelectedAccount()
     const channel = await this.getApi().channelById(channelId)
-    const actor = await this.getChannelOwnerActor(channel)
-    await this.requestAccountDecoding(account)
+    const [actor, address] = await this.getChannelOwnerActor(channel)
 
     // Get input from file
     const videoCreationParametersInput = await getInputJson<VideoInputParameters>(input, VideoInputSchema)
@@ -79,7 +77,7 @@ export default class CreateVideoCommand extends UploadCommandBase {
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    const result = await this.sendAndFollowNamedTx(account, 'content', 'createVideo', [
+    const result = await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'createVideo', [
       actor,
       channelId,
       videoCreationParameters,

+ 7 - 8
cli/src/commands/content/createVideoCategory.ts

@@ -22,10 +22,7 @@ export default class CreateVideoCategoryCommand extends ContentDirectoryCommandB
   async run() {
     const { context, input } = this.parse(CreateVideoCategoryCommand).flags
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
-
-    const actor = context ? await this.getActor(context) : await this.getCategoryManagementActor()
+    const [actor, address] = context ? await this.getContentActor(context) : await this.getCategoryManagementActor()
 
     const videoCategoryInput = await getInputJson<VideoCategoryInputParameters>(input, VideoCategoryInputSchema)
 
@@ -39,10 +36,12 @@ export default class CreateVideoCategoryCommand extends ContentDirectoryCommandB
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    const result = await this.sendAndFollowNamedTx(currentAccount, 'content', 'createVideoCategory', [
-      actor,
-      videoCategoryCreationParameters,
-    ])
+    const result = await this.sendAndFollowNamedTx(
+      await this.getDecodedPair(address),
+      'content',
+      'createVideoCategory',
+      [actor, videoCategoryCreationParameters]
+    )
 
     if (result) {
       const event = this.findEvent(result, 'content', 'VideoCategoryCreated')

+ 5 - 5
cli/src/commands/content/deleteChannelCategory.ts

@@ -22,12 +22,12 @@ export default class DeleteChannelCategoryCommand extends ContentDirectoryComman
     const channelCategoryIds = await this.getApi().channelCategoryIds()
 
     if (channelCategoryIds.some((id) => id.toString() === channelCategoryId)) {
-      const currentAccount = await this.getRequiredSelectedAccount()
-      await this.requestAccountDecoding(currentAccount)
+      const [actor, address] = context ? await this.getContentActor(context) : await this.getCategoryManagementActor()
 
-      const actor = context ? await this.getActor(context) : await this.getCategoryManagementActor()
-
-      await this.sendAndFollowNamedTx(currentAccount, 'content', 'deleteChannelCategory', [actor, channelCategoryId])
+      await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'deleteChannelCategory', [
+        actor,
+        channelCategoryId,
+      ])
     } else {
       this.error('Channel category under given id does not exist...')
     }

+ 5 - 5
cli/src/commands/content/deleteVideoCategory.ts

@@ -22,12 +22,12 @@ export default class DeleteVideoCategoryCommand extends ContentDirectoryCommandB
     const videoCategoryIds = await this.getApi().videoCategoryIds()
 
     if (videoCategoryIds.some((id) => id.toString() === videoCategoryId)) {
-      const currentAccount = await this.getRequiredSelectedAccount()
-      await this.requestAccountDecoding(currentAccount)
+      const [actor, address] = context ? await this.getContentActor(context) : await this.getCategoryManagementActor()
 
-      const actor = context ? await this.getActor(context) : await this.getCategoryManagementActor()
-
-      await this.sendAndFollowNamedTx(currentAccount, 'content', 'deleteVideoCategory', [actor, videoCategoryId])
+      await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'deleteVideoCategory', [
+        actor,
+        videoCategoryId,
+      ])
     } else {
       this.error('Video category under given id does not exist...')
     }

+ 7 - 4
cli/src/commands/content/removeCuratorFromGroup.ts

@@ -17,8 +17,7 @@ export default class RemoveCuratorFromGroupCommand extends ContentDirectoryComma
   ]
 
   async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
+    const lead = await this.getRequiredLeadContext()
 
     let { groupId, curatorId } = this.parse(RemoveCuratorFromGroupCommand).args
 
@@ -38,8 +37,12 @@ export default class RemoveCuratorFromGroupCommand extends ContentDirectoryComma
       await this.getCurator(curatorId)
     }
 
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'content', 'removeCuratorFromGroup', [groupId, curatorId])
+    await this.sendAndFollowNamedTx(
+      await this.getDecodedPair(lead.roleAccount.toString()),
+      'content',
+      'removeCuratorFromGroup',
+      [groupId, curatorId]
+    )
 
     this.log(
       chalk.green(

+ 0 - 4
cli/src/commands/content/reuploadAssets.ts

@@ -19,10 +19,6 @@ export default class ReuploadVideoAssetsCommand extends UploadCommandBase {
   async run() {
     const { input } = this.parse(ReuploadVideoAssetsCommand).flags
 
-    // Get context
-    const account = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(account)
-
     // Get input from file
     const inputData = await getInputJson<AssetsInput>(input, AssetsSchema)
     const inputAssets = inputData.map(({ contentId, path }) => ({

+ 7 - 4
cli/src/commands/content/setCuratorGroupStatus.ts

@@ -18,8 +18,7 @@ export default class SetCuratorGroupStatusCommand extends ContentDirectoryComman
   ]
 
   async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
+    const lead = await this.getRequiredLeadContext()
 
     let { id, status } = this.parse(SetCuratorGroupStatusCommand).args
 
@@ -47,8 +46,12 @@ export default class SetCuratorGroupStatusCommand extends ContentDirectoryComman
       status = !!parseInt(status)
     }
 
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'content', 'setCuratorGroupStatus', [id, status])
+    await this.sendAndFollowNamedTx(
+      await this.getDecodedPair(lead.roleAccount.toString()),
+      'content',
+      'setCuratorGroupStatus',
+      [id, status]
+    )
 
     console.log(
       chalk.green(

+ 2 - 5
cli/src/commands/content/setFeaturedVideos.ts

@@ -14,12 +14,9 @@ export default class SetFeaturedVideosCommand extends ContentDirectoryCommandBas
   async run() {
     const { featuredVideoIds } = this.parse(SetFeaturedVideosCommand).args
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
+    const [actor, address] = await this.getContentActor('Lead')
 
-    const actor = await this.getActor('Lead')
-
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'setFeaturedVideos', [
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'setFeaturedVideos', [
       actor,
       (featuredVideoIds as string).split(','),
     ])

+ 2 - 4
cli/src/commands/content/updateChannel.ts

@@ -45,10 +45,8 @@ export default class UpdateChannelCommand extends UploadCommandBase {
     } = this.parse(UpdateChannelCommand)
 
     // Context
-    const currentAccount = await this.getRequiredSelectedAccount()
     const channel = await this.getApi().channelById(channelId)
-    const actor = await this.getChannelOwnerActor(channel)
-    await this.requestAccountDecoding(currentAccount)
+    const [actor, address] = await this.getChannelOwnerActor(channel)
 
     const channelInput = await getInputJson<ChannelInputParameters>(input, ChannelInputSchema)
 
@@ -76,7 +74,7 @@ export default class UpdateChannelCommand extends UploadCommandBase {
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateChannel', [
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'updateChannel', [
       actor,
       channelId,
       channelUpdateParameters,

+ 2 - 5
cli/src/commands/content/updateChannelCategory.ts

@@ -30,10 +30,7 @@ export default class UpdateChannelCategoryCommand extends ContentDirectoryComman
 
     const { channelCategoryId } = this.parse(UpdateChannelCategoryCommand).args
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
-
-    const actor = context ? await this.getActor(context) : await this.getCategoryManagementActor()
+    const [actor, address] = context ? await this.getContentActor(context) : await this.getCategoryManagementActor()
 
     const channelCategoryInput = await getInputJson<ChannelCategoryInputParameters>(input, ChannelCategoryInputSchema)
 
@@ -47,7 +44,7 @@ export default class UpdateChannelCategoryCommand extends ContentDirectoryComman
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateChannelCategory', [
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'updateChannelCategory', [
       actor,
       channelCategoryId,
       channelCategoryUpdateParameters,

+ 2 - 6
cli/src/commands/content/updateChannelCensorshipStatus.ts

@@ -32,12 +32,8 @@ export default class UpdateChannelCensorshipStatusCommand extends ContentDirecto
       flags: { rationale },
     } = this.parse(UpdateChannelCensorshipStatusCommand)
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-
     const channel = await this.getApi().channelById(id)
-    const actor = await this.getCurationActorByChannel(channel)
-
-    await this.requestAccountDecoding(currentAccount)
+    const [actor, address] = await this.getCurationActorByChannel(channel)
 
     if (status === undefined) {
       status = await this.simplePrompt({
@@ -61,7 +57,7 @@ export default class UpdateChannelCensorshipStatusCommand extends ContentDirecto
       rationale = await this.simplePrompt({ message: 'Please provide the rationale for updating the status' })
     }
 
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateChannelCensorshipStatus', [
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'updateChannelCensorshipStatus', [
       actor,
       id,
       status,

+ 6 - 4
cli/src/commands/content/updateVideo.ts

@@ -32,11 +32,9 @@ export default class UpdateVideoCommand extends UploadCommandBase {
     } = this.parse(UpdateVideoCommand)
 
     // Context
-    const currentAccount = await this.getRequiredSelectedAccount()
     const video = await this.getApi().videoById(videoId)
     const channel = await this.getApi().channelById(video.in_channel.toNumber())
-    const actor = await this.getChannelOwnerActor(channel)
-    await this.requestAccountDecoding(currentAccount)
+    const [actor, address] = await this.getChannelOwnerActor(channel)
 
     const videoInput = await getInputJson<VideoInputParameters>(input, VideoInputSchema)
 
@@ -62,7 +60,11 @@ export default class UpdateVideoCommand extends UploadCommandBase {
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateVideo', [actor, videoId, videoUpdateParameters])
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'updateVideo', [
+      actor,
+      videoId,
+      videoUpdateParameters,
+    ])
 
     await this.uploadAssets(inputAssets, input)
   }

+ 2 - 5
cli/src/commands/content/updateVideoCategory.ts

@@ -31,10 +31,7 @@ export default class UpdateVideoCategoryCommand extends ContentDirectoryCommandB
 
     const { videoCategoryId } = this.parse(UpdateVideoCategoryCommand).args
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
-
-    const actor = context ? await this.getActor(context) : await this.getCategoryManagementActor()
+    const [actor, address] = context ? await this.getContentActor(context) : await this.getCategoryManagementActor()
 
     const videoCategoryInput = await getInputJson<VideoCategoryInputParameters>(input, VideoCategoryInputSchema)
 
@@ -48,7 +45,7 @@ export default class UpdateVideoCategoryCommand extends ContentDirectoryCommandB
 
     await this.requireConfirmation('Do you confirm the provided input?', true)
 
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateVideoCategory', [
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'updateVideoCategory', [
       actor,
       videoCategoryId,
       videoCategoryUpdateParameters,

+ 2 - 6
cli/src/commands/content/updateVideoCensorshipStatus.ts

@@ -32,13 +32,9 @@ export default class UpdateVideoCensorshipStatusCommand extends ContentDirectory
       flags: { rationale },
     } = this.parse(UpdateVideoCensorshipStatusCommand)
 
-    const currentAccount = await this.getRequiredSelectedAccount()
-
     const video = await this.getApi().videoById(id)
     const channel = await this.getApi().channelById(video.in_channel.toNumber())
-    const actor = await this.getCurationActorByChannel(channel)
-
-    await this.requestAccountDecoding(currentAccount)
+    const [actor, address] = await this.getCurationActorByChannel(channel)
 
     if (status === undefined) {
       status = await this.simplePrompt({
@@ -62,7 +58,7 @@ export default class UpdateVideoCensorshipStatusCommand extends ContentDirectory
       rationale = await this.simplePrompt({ message: 'Please provide the rationale for updating the status' })
     }
 
-    await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateVideoCensorshipStatus', [
+    await this.sendAndFollowNamedTx(await this.getDecodedPair(address), 'content', 'updateVideoCensorshipStatus', [
       actor,
       id,
       status,

+ 1 - 1
cli/src/commands/working-groups/cancelOpening.ts

@@ -28,6 +28,6 @@ export default class WorkingGroupsCancelOpening extends WorkingGroupsCommandBase
       [openingId]
     )
 
-    this.log(chalk.green(`Opening ${chalk.white(openingId.toString())} has been cancelled!`))
+    this.log(chalk.green(`Opening ${chalk.magentaBright(openingId.toString())} has been cancelled!`))
   }
 }

+ 2 - 2
cli/src/commands/working-groups/createOpening.ts

@@ -146,7 +146,7 @@ export default class WorkingGroupsCreateOpening extends WorkingGroupsCommandBase
       }
 
       // Send the tx
-      const txSuccess = await this.sendAndFollowNamedTx(
+      const result = await this.sendAndFollowNamedTx(
         await this.getDecodedPair(lead.roleAccount.toString()),
         apiModuleByGroup[this.group],
         'addOpening',
@@ -155,7 +155,7 @@ export default class WorkingGroupsCreateOpening extends WorkingGroupsCommandBase
       )
 
       // Display a success message on success or ask to try again on error
-      if (txSuccess) {
+      if (result) {
         this.log(chalk.green('Opening successfully created!'))
         tryAgain = false
       } else {

+ 1 - 1
cli/src/commands/working-groups/decreaseWorkerStake.ts

@@ -54,7 +54,7 @@ export default class WorkingGroupsDecreaseWorkerStake extends WorkingGroupsComma
     this.log(
       chalk.green(
         `${chalk.magentaBright(formatBalance(amount))} from worker ${chalk.magentaBright(workerId)} stake ` +
-          `has been returned to worker's role account (${chalk.white(groupMember.roleAccount.toString())})!`
+          `has been returned to worker's role account (${chalk.magentaBright(groupMember.roleAccount.toString())})!`
       )
     )
   }

+ 8 - 11
cli/src/commands/working-groups/updateRoleStorage.ts

@@ -19,17 +19,14 @@ export default class WorkingGroupsUpdateRoleStorage extends WorkingGroupsCommand
   async run() {
     const { storage } = this.parse(WorkingGroupsUpdateRoleStorage).args
 
-    const account = await this.getRequiredSelectedAccount()
-
-    // Worker-only gate
-    const worker = await this.getRequiredWorker()
-
-    await this.requestAccountDecoding(account)
-
-    await this.sendAndFollowNamedTx(account, apiModuleByGroup[this.group], 'updateRoleStorage', [
-      worker.workerId,
-      storage,
-    ])
+    const worker = await this.getRequiredWorkerContext()
+
+    await this.sendAndFollowNamedTx(
+      await this.getDecodedPair(worker.roleAccount.toString()),
+      apiModuleByGroup[this.group],
+      'updateRoleStorage',
+      [worker.workerId, storage]
+    )
 
     this.log(chalk.green(`Successfully updated the associated worker storage to: ${chalk.magentaBright(storage)})`))
   }