Browse Source

Remove redundant protobuf messages, old content directory related funtionality reworking

iorveth 4 years ago
parent
commit
d0b0df8c91
41 changed files with 39 additions and 3697 deletions
  1. 16 164
      cli/src/base/ContentDirectoryCommandBase.ts
  2. 0 70
      cli/src/base/MediaCommandBase.ts
  3. 0 79
      cli/src/commands/content-directory/addClassSchema.ts
  4. 0 42
      cli/src/commands/content-directory/addCuratorToGroup.ts
  5. 0 44
      cli/src/commands/content-directory/addMaintainerToClass.ts
  6. 0 55
      cli/src/commands/content-directory/class.ts
  7. 0 24
      cli/src/commands/content-directory/classes.ts
  8. 0 50
      cli/src/commands/content-directory/createClass.ts
  9. 0 18
      cli/src/commands/content-directory/createCuratorGroup.ts
  10. 0 58
      cli/src/commands/content-directory/createEntity.ts
  11. 0 39
      cli/src/commands/content-directory/curatorGroup.ts
  12. 0 25
      cli/src/commands/content-directory/curatorGroups.ts
  13. 0 45
      cli/src/commands/content-directory/entities.ts
  14. 0 44
      cli/src/commands/content-directory/entity.ts
  15. 0 57
      cli/src/commands/content-directory/initialize.ts
  16. 0 46
      cli/src/commands/content-directory/removeCuratorFromGroup.ts
  17. 0 35
      cli/src/commands/content-directory/removeCuratorGroup.ts
  18. 0 45
      cli/src/commands/content-directory/removeEntity.ts
  19. 0 44
      cli/src/commands/content-directory/removeMaintainerFromClass.ts
  20. 0 61
      cli/src/commands/content-directory/setCuratorGroupStatus.ts
  21. 0 55
      cli/src/commands/content-directory/updateClassPermissions.ts
  22. 0 61
      cli/src/commands/content-directory/updateEntityPropertyValues.ts
  23. 22 11
      cli/src/commands/content/createChannel.ts
  24. 0 58
      cli/src/commands/media/createChannel.ts
  25. 0 57
      cli/src/commands/media/curateContent.ts
  26. 0 36
      cli/src/commands/media/featuredVideos.ts
  27. 0 25
      cli/src/commands/media/myChannels.ts
  28. 0 33
      cli/src/commands/media/myVideos.ts
  29. 0 44
      cli/src/commands/media/removeChannel.ts
  30. 0 49
      cli/src/commands/media/removeVideo.ts
  31. 0 79
      cli/src/commands/media/setFeaturedVideos.ts
  32. 0 98
      cli/src/commands/media/updateChannel.ts
  33. 0 106
      cli/src/commands/media/updateVideo.ts
  34. 0 59
      cli/src/commands/media/updateVideoLicense.ts
  35. 0 441
      cli/src/commands/media/uploadVideo.ts
  36. 1 7
      cli/src/helpers/JsonSchemaPrompt.ts
  37. 0 159
      content-metadata-protobuf/compiled/proto/Channel_pb.d.ts
  38. 0 1160
      content-metadata-protobuf/compiled/proto/Channel_pb.js
  39. 0 37
      content-metadata-protobuf/proto/Channel.proto
  40. 0 0
      content-metadata-protobuf/src/channel_creation.ts
  41. 0 77
      content-metadata-protobuf/test/channel_creation.ts

+ 16 - 164
cli/src/base/ContentDirectoryCommandBase.ts

@@ -1,33 +1,22 @@
 import ExitCodes from '../ExitCodes'
 import { WorkingGroups } from '../Types'
-import { FlattenRelations } from '@joystream/cd-schemas/types/utility'
-import { BOOL_PROMPT_OPTIONS } from '../helpers/prompting'
 import {
   Channel,
   CuratorGroup,
   CuratorGroupId,
-  Actor,
-  Video,
-  VideoId,
+  ContentActor,
 } from '@joystream/types/content'
-import { ChannelId} from '@joystream/types/common'
+import { ChannelId } from '@joystream/types/common'
 import { Worker } from '@joystream/types/working-group'
 import { CLIError } from '@oclif/errors'
-import { Codec } from '@polkadot/types/types'
-import AbstractInt from '@polkadot/types/codec/AbstractInt'
-import { AnyJson } from '@polkadot/types/types/helpers'
 import _ from 'lodash'
 import { RolesCommandBase } from './WorkingGroupsCommandBase'
 import { createType } from '@joystream/types'
-import chalk from 'chalk'
 import { flags } from '@oclif/command'
-import { DistinctQuestion } from 'inquirer'
 
 const CONTEXTS = ['Member', 'Curator', 'Lead'] as const
 type Context = typeof CONTEXTS[number]
 
-type ParsedPropertyValue = { value: Codec | null; type: PropertyType['type']; subtype: PropertyType['subtype'] }
-
 /**
  * Abstract base class for commands related to content directory
  */
@@ -54,7 +43,7 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
     await this.getRequiredLead()
   }
 
-  async getCuratorContext(): Promise<Actor> {
+  async getCuratorContext(): Promise<ContentActor> {
     const curator = await this.getRequiredWorker()
 
     const groups = await this.getApi().availableCuratorGroups()
@@ -78,14 +67,14 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
       groupId = await this.promptForCuratorGroup('Select Curator Group context', availableGroupIds)
     }
 
-    return createType('Actor', { Curator: [groupId, curator.workerId.toNumber()] })
+    return createType('ContentActor', { Curator: [groupId, curator.workerId.toNumber()] })
   }
 
-  async promptForClass(message = 'Select a class'): Promise<Class> {
-    const classes = await this.getApi().availableClasses()
-    const choices = classes.map(([, c]) => ({ name: c.name.toString(), value: c }))
+  async promptForChannel(message = 'Select a channel'): Promise<Channel> {
+    const classes = await this.getApi().availableChannels()
+    const choices = classes.map(([id, c]) => ({ id: id.toString(), value: c }))
     if (!choices.length) {
-      this.warn('No classes exist to choose from!')
+      this.warn('No channels exist to choose from!')
       this.exit(ExitCodes.InvalidInput)
     }
 
@@ -94,11 +83,11 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
     return selectedClass
   }
 
-  async classEntryByNameOrId(classNameOrId: string): Promise<[ClassId, Class]> {
-    const classes = await this.getApi().availableClasses()
-    const foundClass = classes.find(([id, c]) => id.toString() === classNameOrId || c.name.toString() === classNameOrId)
+  async channelEntryById(channelId: string): Promise<[ChannelId, Channel]> {
+    const channels = await this.getApi().availableChannels()
+    const foundClass = channels.find(([id, c]) => id.toString() === channelId)
     if (!foundClass) {
-      this.error(`Class id not found by class name or id: "${classNameOrId}"!`)
+      this.error(`Class id not found by class name or id: "${channelId}"!`)
     }
 
     return foundClass
@@ -112,8 +101,7 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
         name:
           `Group ${id.toString()} (` +
           `${group.active.valueOf() ? 'Active' : 'Inactive'}, ` +
-          `${group.curators.toArray().length} member(s), ` +
-          `${group.number_of_classes_maintained.toNumber()} classes maintained)`,
+          `${group.curators.toArray().length} member(s), `,
         value: id.toNumber(),
       }))
   }
@@ -194,153 +182,17 @@ export default abstract class ContentDirectoryCommandBase extends RolesCommandBa
     return group
   }
 
-  async getEntity(
-    id: string | number,
-    requiredClass?: string,
-    ownerMemberId?: number,
-    requireSchema = true
-  ): Promise<Entity> {
-    if (typeof id === 'string') {
-      id = parseInt(id)
-    }
-
-    const entity = await this.getApi().entityById(id)
-
-    if (!entity) {
-      this.error(`Entity not found by id: ${id}`, { exit: ExitCodes.InvalidInput })
-    }
-
-    if (requiredClass) {
-      const [classId] = await this.classEntryByNameOrId(requiredClass)
-      if (entity.class_id.toNumber() !== classId.toNumber()) {
-        this.error(`Entity of id ${id} is not of class ${requiredClass}!`, { exit: ExitCodes.InvalidInput })
-      }
-    }
-
-    const { controller } = entity.entity_permissions
-    if (
-      ownerMemberId !== undefined &&
-      (!controller.isOfType('Member') || controller.asType('Member').toNumber() !== ownerMemberId)
-    ) {
-      this.error('Cannot execute this action for specified entity - invalid ownership.', {
-        exit: ExitCodes.AccessDenied,
-      })
-    }
-
-    if (requireSchema && !entity.supported_schemas.toArray().length) {
-      this.error(`${requiredClass || ''} entity of id ${id} has no schema support added!`)
-    }
-
-    return entity
-  }
-
-  async getAndParseKnownEntity<T>(id: string | number, className?: string): Promise<FlattenRelations<T>> {
-    const entity = await this.getEntity(id, className)
-    return this.parseToEntityJson<T>(entity)
-  }
-
-  async entitiesByClassAndOwner(classNameOrId: number | string, ownerMemberId?: number): Promise<[EntityId, Entity][]> {
-    const classId =
-      typeof classNameOrId === 'number' ? classNameOrId : (await this.classEntryByNameOrId(classNameOrId))[0].toNumber()
-
-    return (await this.getApi().entitiesByClassId(classId)).filter(([, entity]) => {
-      const controller = entity.entity_permissions.controller
-      return ownerMemberId !== undefined
-        ? controller.isOfType('Member') && controller.asType('Member').toNumber() === ownerMemberId
-        : true
-    })
-  }
-
-  async promptForEntityEntry(
-    message: string,
-    className: string,
-    propName?: string,
-    ownerMemberId?: number,
-    defaultId?: number | null
-  ): Promise<[EntityId, Entity]> {
-    const [classId, entityClass] = await this.classEntryByNameOrId(className)
-    const entityEntries = await this.entitiesByClassAndOwner(classId.toNumber(), ownerMemberId)
-
-    if (!entityEntries.length) {
-      this.log(`${message}:`)
-      this.error(`No choices available! Exiting...`, { exit: ExitCodes.UnexpectedException })
-    }
-
-    const choosenEntityId = await this.simplePrompt({
-      message,
-      type: 'list',
-      choices: entityEntries.map(([id, entity]) => {
-        const parsedEntityPropertyValues = this.parseEntityPropertyValues(entity, entityClass)
-        return {
-          name: (propName && parsedEntityPropertyValues[propName]?.value?.toString()) || `ID:${id.toString()}`,
-          value: id.toString(), // With numbers there are issues with "default"
-        }
-      }),
-      default: typeof defaultId === 'number' ? defaultId.toString() : undefined,
-    })
-
-    return entityEntries.find(([id]) => choosenEntityId === id.toString())!
-  }
-
-  async promptForEntityId(
-    message: string,
-    className: string,
-    propName?: string,
-    ownerMemberId?: number,
-    defaultId?: number | null
-  ): Promise<number> {
-    return (await this.promptForEntityEntry(message, className, propName, ownerMemberId, defaultId))[0].toNumber()
-  }
-
-  async parseToEntityJson<T = unknown>(entity: Entity): Promise<FlattenRelations<T>> {
-    const entityClass = (await this.classEntryByNameOrId(entity.class_id.toString()))[1]
-    return (_.mapValues(this.parseEntityPropertyValues(entity, entityClass), (v) =>
-      this.parseStoredPropertyInnerValue(v.value)
-    ) as unknown) as FlattenRelations<T>
-  }
-
-  async createEntityList(
-    className: string,
-    includedProps?: string[],
-    filters: [string, string][] = [],
-    ownerMemberId?: number
-  ): Promise<Record<string, string>[]> {
-    const [classId, entityClass] = await this.classEntryByNameOrId(className)
-    // Create object of default "[not set]" values (prevents breaking the table if entity has no schema support)
-    const defaultValues = entityClass.properties
-      .map((p) => p.name.toString())
-      .reduce((d, propName) => {
-        if (!includedProps || includedProps.includes(propName)) {
-          d[propName] = chalk.grey('[not set]')
-        }
-        return d
-      }, {} as Record<string, string>)
-
-    const entityEntries = await this.entitiesByClassAndOwner(classId.toNumber(), ownerMemberId)
-    const parsedEntities = (await Promise.all(
-      entityEntries.map(([id, entity]) => ({
-        'ID': id.toString(),
-        ...defaultValues,
-        ..._.mapValues(this.parseEntityPropertyValues(entity, entityClass, includedProps), (v) =>
-          v.value === null ? chalk.grey('[not set]') : v.value.toString()
-        ),
-      }))
-    )) as Record<string, string>[]
-
-    return parsedEntities.filter((entity) => filters.every(([pName, pValue]) => entity[pName] === pValue))
-  }
-
   async getActor(context: typeof CONTEXTS[number]) {
-    let actor: Actor
+    let actor: ContentActor
     if (context === 'Member') {
       const memberId = await this.getRequiredMemberId()
-      actor = this.createType('Actor', { Member: memberId })
+      actor = this.createType('ContentActor', { Member: memberId })
     } else if (context === 'Curator') {
       actor = await this.getCuratorContext()
     } else {
       await this.getRequiredLead()
 
-      actor = this.createType('Actor', { Lead: null })
+      actor = this.createType('ContentActor', { Lead: null })
     }
 
     return actor

+ 0 - 70
cli/src/base/MediaCommandBase.ts

@@ -1,70 +0,0 @@
-import ContentDirectoryCommandBase from './ContentDirectoryCommandBase'
-import { VideoEntity, KnownLicenseEntity, LicenseEntity } from '@joystream/cd-schemas/types/entities'
-import fs from 'fs'
-import { DistinctQuestion } from 'inquirer'
-import path from 'path'
-import os from 'os'
-
-const MAX_USER_LICENSE_CONTENT_LENGTH = 4096
-
-/**
- * Abstract base class for higher-level media commands
- */
-export default abstract class MediaCommandBase extends ContentDirectoryCommandBase {
-  async promptForNewLicense(): Promise<VideoEntity['license']> {
-    let licenseInput: LicenseEntity
-    const licenseType: 'known' | 'custom' = await this.simplePrompt({
-      type: 'list',
-      message: 'Choose license type',
-      choices: [
-        { name: 'Creative Commons', value: 'known' },
-        { name: 'Custom (user-defined)', value: 'custom' },
-      ],
-    })
-    if (licenseType === 'known') {
-      const [id, knownLicenseEntity] = await this.promptForEntityEntry('Choose License', 'KnownLicense', 'code')
-      const knownLicense = await this.parseToEntityJson<KnownLicenseEntity>(knownLicenseEntity)
-      licenseInput = { knownLicense: id.toNumber() }
-      if (knownLicense.attributionRequired) {
-        licenseInput.attribution = await this.simplePrompt({ message: 'Attribution' })
-      }
-    } else {
-      let licenseContent: null | string = null
-      while (licenseContent === null) {
-        try {
-          let licensePath: string = await this.simplePrompt({ message: 'Path to license file:' })
-          licensePath = path.resolve(process.cwd(), licensePath.replace(/^~/, os.homedir()))
-          licenseContent = fs.readFileSync(licensePath).toString()
-        } catch (e) {
-          this.warn("The file was not found or couldn't be accessed, try again...")
-        }
-        if (licenseContent !== null && licenseContent.length > MAX_USER_LICENSE_CONTENT_LENGTH) {
-          this.warn(`The license content cannot be more than ${MAX_USER_LICENSE_CONTENT_LENGTH} characters long`)
-          licenseContent = null
-        }
-      }
-      licenseInput = { userDefinedLicense: { new: { content: licenseContent } } }
-    }
-
-    return { new: licenseInput }
-  }
-
-  async promptForPublishedBeforeJoystream(current?: number | null): Promise<number | null> {
-    const publishedBefore = await this.simplePrompt({
-      type: 'confirm',
-      message: `Do you want to set optional first publication date (publishedBeforeJoystream)?`,
-      default: typeof current === 'number',
-    })
-    if (publishedBefore) {
-      const options = ({
-        type: 'datetime',
-        message: 'Date of first publication',
-        format: ['yyyy', '-', 'mm', '-', 'dd', ' ', 'hh', ':', 'MM', ' ', 'TT'],
-        initial: current && new Date(current * 1000),
-      } as unknown) as DistinctQuestion // Need to assert, because we use datetime plugin which has no TS support
-      const date = await this.simplePrompt(options)
-      return Math.floor(new Date(date).getTime() / 1000)
-    }
-    return null
-  }
-}

+ 0 - 79
cli/src/commands/content-directory/addClassSchema.ts

@@ -1,79 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import AddClassSchemaSchema from '@joystream/cd-schemas/schemas/extrinsics/AddClassSchema.schema.json'
-import { AddClassSchema } from '@joystream/cd-schemas/types/extrinsics/AddClassSchema'
-import { InputParser } from '@joystream/cd-schemas'
-import { JsonSchemaPrompter, JsonSchemaCustomPrompts } from '../../helpers/JsonSchemaPrompt'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-import { IOFlags, getInputJson, saveOutputJson } from '../../helpers/InputOutput'
-import { Class } from '@joystream/types/content-directory'
-
-export default class AddClassSchemaCommand extends ContentDirectoryCommandBase {
-  static description = 'Add a new schema to a class inside content directory. Requires lead access.'
-
-  static flags = {
-    ...IOFlags,
-  }
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-    await this.requestAccountDecoding(account)
-
-    const { input, output } = this.parse(AddClassSchemaCommand).flags
-
-    let inputJson = await getInputJson<AddClassSchema>(input)
-    if (!inputJson) {
-      let selectedClass: Class | undefined
-      const customPrompts: JsonSchemaCustomPrompts = [
-        [
-          'className',
-          async () => {
-            selectedClass = await this.promptForClass('Select a class to add schema to')
-            return selectedClass.name.toString()
-          },
-        ],
-        [
-          'existingProperties',
-          async () => {
-            const choices = selectedClass!.properties.map((p, i) => ({ name: `${i}: ${p.name.toString()}`, value: i }))
-            if (!choices.length) {
-              return []
-            }
-            return await this.simplePrompt({
-              type: 'checkbox',
-              message: 'Choose existing properties to keep',
-              choices,
-            })
-          },
-        ],
-        [
-          /^newProperties\[\d+\]\.property_type\.(Single|Vector\.vec_type)\.Reference/,
-          async () => this.promptForClassReference(),
-        ],
-        [/^newProperties\[\d+\]\.property_type\.(Single|Vector\.vec_type)\.Text/, { message: 'Provide TextMaxLength' }],
-        [
-          /^newProperties\[\d+\]\.property_type\.(Single|Vector\.vec_type)\.Hash/,
-          { message: 'Provide HashedTextMaxLength' },
-        ],
-      ]
-
-      const prompter = new JsonSchemaPrompter<AddClassSchema>(
-        AddClassSchemaSchema as JSONSchema,
-        undefined,
-        customPrompts
-      )
-
-      inputJson = await prompter.promptAll()
-    }
-
-    this.jsonPrettyPrint(JSON.stringify(inputJson))
-    const confirmed = await this.simplePrompt({ type: 'confirm', message: 'Do you confirm the provided input?' })
-
-    if (confirmed) {
-      saveOutputJson(output, `${inputJson.className}Schema.json`, inputJson)
-      const inputParser = new InputParser(this.getOriginalApi())
-      this.log('Sending the extrinsic...')
-      await this.sendAndFollowTx(account, await inputParser.parseAddClassSchemaExtrinsic(inputJson))
-    }
-  }
-}

+ 0 - 42
cli/src/commands/content-directory/addCuratorToGroup.ts

@@ -1,42 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-
-export default class AddCuratorToGroupCommand extends ContentDirectoryCommandBase {
-  static description = 'Add Curator to existing Curator Group.'
-  static args = [
-    {
-      name: 'groupId',
-      required: false,
-      description: 'ID of the Curator Group',
-    },
-    {
-      name: 'curatorId',
-      required: false,
-      description: 'ID of the curator',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { groupId, curatorId } = this.parse(AddCuratorToGroupCommand).args
-
-    if (groupId === undefined) {
-      groupId = await this.promptForCuratorGroup()
-    } else {
-      await this.getCuratorGroup(groupId)
-    }
-
-    if (curatorId === undefined) {
-      curatorId = await this.promptForCurator()
-    } else {
-      await this.getCurator(curatorId)
-    }
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'addCuratorToGroup', [groupId, curatorId])
-
-    console.log(chalk.green(`Curator ${chalk.white(curatorId)} succesfully added to group ${chalk.white(groupId)}!`))
-  }
-}

+ 0 - 44
cli/src/commands/content-directory/addMaintainerToClass.ts

@@ -1,44 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-
-export default class AddMaintainerToClassCommand extends ContentDirectoryCommandBase {
-  static description = 'Add maintainer (Curator Group) to a class.'
-  static args = [
-    {
-      name: 'className',
-      required: false,
-      description: 'Name or ID of the class (ie. Video)',
-    },
-    {
-      name: 'groupId',
-      required: false,
-      description: 'ID of the Curator Group to add as class maintainer',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { groupId, className } = this.parse(AddMaintainerToClassCommand).args
-
-    if (className === undefined) {
-      className = (await this.promptForClass()).name.toString()
-    }
-
-    const classId = (await this.classEntryByNameOrId(className))[0].toNumber()
-
-    if (groupId === undefined) {
-      groupId = await this.promptForCuratorGroup()
-    } else {
-      await this.getCuratorGroup(groupId)
-    }
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'addMaintainerToClass', [classId, groupId])
-
-    console.log(
-      chalk.green(`Curator Group ${chalk.white(groupId)} added as maintainer to ${chalk.white(className)} class!`)
-    )
-  }
-}

+ 0 - 55
cli/src/commands/content-directory/class.ts

@@ -1,55 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-import { displayCollapsedRow, displayHeader, displayTable } from '../../helpers/display'
-
-export default class ClassCommand extends ContentDirectoryCommandBase {
-  static description = 'Show Class details by id or name.'
-  static args = [
-    {
-      name: 'className',
-      required: true,
-      description: 'Name or ID of the Class',
-    },
-  ]
-
-  async run() {
-    const { className } = this.parse(ClassCommand).args
-    const [id, aClass] = await this.classEntryByNameOrId(className)
-    const permissions = aClass.class_permissions
-    const maintainers = permissions.maintainers.toArray()
-
-    displayCollapsedRow({
-      'Name': aClass.name.toString(),
-      'ID': id.toString(),
-      'Any member': permissions.any_member.toString(),
-      'Entity creation blocked': permissions.entity_creation_blocked.toString(),
-      'All property values locked': permissions.all_entity_property_values_locked.toString(),
-      'Number of entities': aClass.current_number_of_entities.toNumber(),
-      'Max. number of entities': aClass.maximum_entities_count.toNumber(),
-      'Default entity creation voucher max.': aClass.default_entity_creation_voucher_upper_bound.toNumber(),
-    })
-
-    displayHeader(`Maintainers`)
-    this.log(
-      maintainers.length ? maintainers.map((groupId) => chalk.white(`Group ${groupId.toString()}`)).join(', ') : 'NONE'
-    )
-
-    displayHeader(`Properties`)
-    if (aClass.properties.length) {
-      displayTable(
-        aClass.properties.map((p, i) => ({
-          'Index': i,
-          'Name': p.name.toString(),
-          'Type': JSON.stringify(p.property_type.toJSON()),
-          'Required': p.required.toString(),
-          'Unique': p.unique.toString(),
-          'Controller lock': p.locking_policy.is_locked_from_controller.toString(),
-          'Maintainer lock': p.locking_policy.is_locked_from_maintainer.toString(),
-        })),
-        3
-      )
-    } else {
-      this.log('NONE')
-    }
-  }
-}

+ 0 - 24
cli/src/commands/content-directory/classes.ts

@@ -1,24 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-// import chalk from 'chalk'
-import { displayTable } from '../../helpers/display'
-
-export default class ClassesCommand extends ContentDirectoryCommandBase {
-  static description = 'List existing content directory classes.'
-
-  async run() {
-    const classes = await this.getApi().availableClasses()
-
-    displayTable(
-      classes.map(([id, c]) => ({
-        'ID': id.toString(),
-        'Name': c.name.toString(),
-        'Any member': c.class_permissions.any_member.toString(),
-        'Entities': c.current_number_of_entities.toNumber(),
-        'Schemas': c.schemas.length,
-        'Maintainers': c.class_permissions.maintainers.toArray().length,
-        'Properties': c.properties.length,
-      })),
-      3
-    )
-  }
-}

+ 0 - 50
cli/src/commands/content-directory/createClass.ts

@@ -1,50 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import CreateClassSchema from '@joystream/cd-schemas/schemas/extrinsics/CreateClass.schema.json'
-import { CreateClass } from '@joystream/cd-schemas/types/extrinsics/CreateClass'
-import { InputParser } from '@joystream/cd-schemas'
-import { JsonSchemaPrompter, JsonSchemaCustomPrompts } from '../../helpers/JsonSchemaPrompt'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-import { IOFlags, getInputJson, saveOutputJson } from '../../helpers/InputOutput'
-
-export default class CreateClassCommand extends ContentDirectoryCommandBase {
-  static description = 'Create class inside content directory. Requires lead access.'
-  static flags = {
-    ...IOFlags,
-  }
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-    await this.requestAccountDecoding(account)
-
-    const { input, output } = this.parse(CreateClassCommand).flags
-    const existingClassnames = (await this.getApi().availableClasses()).map(([, aClass]) => aClass.name.toString())
-
-    let inputJson = await getInputJson<CreateClass>(input, CreateClassSchema as JSONSchema)
-    if (!inputJson) {
-      const customPrompts: JsonSchemaCustomPrompts<CreateClass> = [
-        [
-          'name',
-          {
-            validate: (className) => existingClassnames.includes(className) && 'A class with this name already exists!',
-          },
-        ],
-        ['class_permissions.maintainers', () => this.promptForCuratorGroups('Select class maintainers')],
-      ]
-
-      const prompter = new JsonSchemaPrompter<CreateClass>(CreateClassSchema as JSONSchema, undefined, customPrompts)
-
-      inputJson = await prompter.promptAll()
-    }
-
-    this.jsonPrettyPrint(JSON.stringify(inputJson))
-    const confirmed = await this.simplePrompt({ type: 'confirm', message: 'Do you confirm the provided input?' })
-
-    if (confirmed) {
-      saveOutputJson(output, `${inputJson.name}Class.json`, inputJson)
-      this.log('Sending the extrinsic...')
-      const inputParser = new InputParser(this.getOriginalApi())
-      await this.sendAndFollowTx(account, inputParser.parseCreateClassExtrinsic(inputJson))
-    }
-  }
-}

+ 0 - 18
cli/src/commands/content-directory/createCuratorGroup.ts

@@ -1,18 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-
-export default class AddCuratorGroupCommand extends ContentDirectoryCommandBase {
-  static description = 'Create new Curator Group.'
-  static aliases = ['addCuratorGroup']
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    await this.requestAccountDecoding(account)
-    await this.buildAndSendExtrinsic(account, 'contentDirectory', 'addCuratorGroup')
-
-    const newGroupId = (await this.getApi().nextCuratorGroupId()) - 1
-    console.log(chalk.green(`New group succesfully created! (ID: ${chalk.white(newGroupId)})`))
-  }
-}

+ 0 - 58
cli/src/commands/content-directory/createEntity.ts

@@ -1,58 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import inquirer from 'inquirer'
-import { InputParser } from '@joystream/cd-schemas'
-import ExitCodes from '../../ExitCodes'
-
-export default class CreateEntityCommand extends ContentDirectoryCommandBase {
-  static description =
-    'Creates a new entity in the specified class (can be executed in Member, Curator or Lead context)'
-
-  static args = [
-    {
-      name: 'className',
-      required: true,
-      description: 'Name or ID of the Class',
-    },
-  ]
-
-  static flags = {
-    context: ContentDirectoryCommandBase.contextFlag,
-  }
-
-  async run() {
-    const { className } = this.parse(CreateEntityCommand).args
-    let { context } = this.parse(CreateEntityCommand).flags
-
-    if (!context) {
-      context = await this.promptForContext()
-    }
-
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
-    const [, entityClass] = await this.classEntryByNameOrId(className)
-
-    const actor = await this.getActor(context, entityClass)
-
-    if (actor.isOfType('Member') && entityClass.class_permissions.any_member.isFalse) {
-      this.error('Choosen actor has no access to create an entity of this type', { exit: ExitCodes.AccessDenied })
-    }
-
-    const answers: {
-      [key: string]: string | number | null
-    } = await inquirer.prompt(this.getQuestionsFromProperties(entityClass.properties.toArray()))
-
-    this.jsonPrettyPrint(JSON.stringify(answers))
-    await this.requireConfirmation('Do you confirm the provided input?')
-
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi(), [
-      {
-        className: entityClass.name.toString(),
-        entries: [answers],
-      },
-    ])
-
-    const operations = await inputParser.getEntityBatchOperations()
-
-    await this.sendAndFollowNamedTx(currentAccount, 'contentDirectory', 'transaction', [actor, operations])
-  }
-}

+ 0 - 39
cli/src/commands/content-directory/curatorGroup.ts

@@ -1,39 +0,0 @@
-import { WorkingGroups } from '../../Types'
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-import { displayCollapsedRow, displayHeader } from '../../helpers/display'
-
-export default class CuratorGroupCommand extends ContentDirectoryCommandBase {
-  static description = 'Show Curator Group details by ID.'
-  static args = [
-    {
-      name: 'id',
-      required: true,
-      description: 'ID of the Curator Group',
-    },
-  ]
-
-  async run() {
-    const { id } = this.parse(CuratorGroupCommand).args
-    const group = await this.getCuratorGroup(id)
-    const classesMaintained = (await this.getApi().availableClasses()).filter(([, c]) =>
-      c.class_permissions.maintainers.toArray().some((gId) => gId.toNumber() === parseInt(id))
-    )
-    const members = (await this.getApi().groupMembers(WorkingGroups.Curators)).filter((curator) =>
-      group.curators.toArray().some((groupCurator) => groupCurator.eq(curator.workerId))
-    )
-
-    displayCollapsedRow({
-      'ID': id,
-      'Status': group.active.valueOf() ? 'Active' : 'Inactive',
-    })
-    displayHeader(`Classes maintained (${classesMaintained.length})`)
-    this.log(classesMaintained.map(([, c]) => chalk.white(c.name.toString())).join(', '))
-    displayHeader(`Group Members (${members.length})`)
-    this.log(
-      members
-        .map((curator) => chalk.white(`${curator.profile.handle} (WorkerID: ${curator.workerId.toString()})`))
-        .join(', ')
-    )
-  }
-}

+ 0 - 25
cli/src/commands/content-directory/curatorGroups.ts

@@ -1,25 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-// import chalk from 'chalk'
-import { displayTable } from '../../helpers/display'
-
-export default class CuratorGroupsCommand extends ContentDirectoryCommandBase {
-  static description = 'List existing Curator Groups.'
-
-  async run() {
-    const groups = await this.getApi().availableCuratorGroups()
-
-    if (groups.length) {
-      displayTable(
-        groups.map(([id, group]) => ({
-          'ID': id.toString(),
-          'Status': group.active.valueOf() ? 'Active' : 'Inactive',
-          'Classes maintained': group.number_of_classes_maintained.toNumber(),
-          'Members': group.curators.toArray().length,
-        })),
-        5
-      )
-    } else {
-      this.log('No Curator Groups available!')
-    }
-  }
-}

+ 0 - 45
cli/src/commands/content-directory/entities.ts

@@ -1,45 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { displayTable } from '../../helpers/display'
-import { flags } from '@oclif/command'
-
-export default class EntitiesCommand extends ContentDirectoryCommandBase {
-  static description = 'Show entities list by class id or name.'
-  static args = [
-    {
-      name: 'className',
-      required: true,
-      description: 'Name or ID of the Class',
-    },
-    {
-      name: 'properties',
-      required: false,
-      description:
-        'Comma-separated properties to include in the results table (ie. code,name). ' +
-        'By default all property values will be included.',
-    },
-  ]
-
-  static flags = {
-    filters: flags.string({
-      required: false,
-      description:
-        'Comma-separated filters, ie. title="Some video",channelId=3.' +
-        'Currently only the = operator is supported.' +
-        'When multiple filters are provided, only the entities that match all of them together will be displayed.',
-    }),
-  }
-
-  async run() {
-    const { className, properties } = this.parse(EntitiesCommand).args
-    const { filters } = this.parse(EntitiesCommand).flags
-    const propsToInclude: string[] | undefined = (properties || undefined) && (properties as string).split(',')
-    const filtersArr: [string, string][] = filters
-      ? filters
-          .split(',')
-          .map((f) => f.split('='))
-          .map(([pName, pValue]) => [pName, pValue.replace(/^"(.+)"$/, '$1')])
-      : []
-
-    displayTable(await this.createEntityList(className, propsToInclude, filtersArr), 3)
-  }
-}

+ 0 - 44
cli/src/commands/content-directory/entity.ts

@@ -1,44 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-import { displayCollapsedRow, displayHeader } from '../../helpers/display'
-import _ from 'lodash'
-
-export default class EntityCommand extends ContentDirectoryCommandBase {
-  static description = 'Show Entity details by id.'
-  static args = [
-    {
-      name: 'id',
-      required: true,
-      description: 'ID of the Entity',
-    },
-  ]
-
-  async run() {
-    const { id } = this.parse(EntityCommand).args
-    const entity = await this.getEntity(id, undefined, undefined, false)
-    const { controller, frozen, referenceable } = entity.entity_permissions
-    const [classId, entityClass] = await this.classEntryByNameOrId(entity.class_id.toString())
-    const propertyValues = this.parseEntityPropertyValues(entity, entityClass)
-
-    displayCollapsedRow({
-      'ID': id,
-      'Class name': entityClass.name.toString(),
-      'Class ID': classId.toNumber(),
-      'Supported schemas': JSON.stringify(entity.supported_schemas.toJSON()),
-      'Controller': controller.type + (controller.isOfType('Member') ? `(${controller.asType('Member')})` : ''),
-      'Frozen': frozen.toString(),
-      'Refrecencable': referenceable.toString(),
-      'Same owner references': entity.reference_counter.same_owner.toNumber(),
-      'Total references': entity.reference_counter.total.toNumber(),
-    })
-    displayHeader('Property values')
-    displayCollapsedRow(
-      _.mapValues(
-        propertyValues,
-        (v) =>
-          (v.value === null ? chalk.grey('[not set]') : v.value.toString()) +
-          ` ${chalk.green(`${v.type}<${v.subtype}>`)}`
-      )
-    )
-  }
-}

+ 0 - 57
cli/src/commands/content-directory/initialize.ts

@@ -1,57 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { InputParser, ExtrinsicsHelper, getInitializationInputs } from '@joystream/cd-schemas'
-import { flags } from '@oclif/command'
-
-export default class InitializeCommand extends ContentDirectoryCommandBase {
-  static description =
-    'Initialize content directory with input data from @joystream/content library or custom, provided one. Requires lead access.'
-
-  static flags = {
-    rootInputsDir: flags.string({
-      required: false,
-      description: 'Custom inputs directory (must follow @joystream/content directory structure)',
-    }),
-  }
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-    await this.requestAccountDecoding(account)
-
-    const {
-      flags: { rootInputsDir },
-    } = this.parse(InitializeCommand)
-
-    const { classInputs, schemaInputs, entityBatchInputs } = getInitializationInputs(rootInputsDir)
-
-    const currentClasses = await this.getApi().availableClasses()
-
-    if (currentClasses.length) {
-      this.log('There are already some existing classes in the current content directory.')
-      await this.requireConfirmation('Do you wish to continue anyway?')
-    }
-
-    const txHelper = new ExtrinsicsHelper(this.getOriginalApi())
-    const parser = new InputParser(this.getOriginalApi(), classInputs, schemaInputs, entityBatchInputs)
-
-    this.log(`Initializing classes (${classInputs.length} input files found)...\n`)
-    const classExtrinsics = parser.getCreateClassExntrinsics()
-    await txHelper.sendAndCheck(account, classExtrinsics, 'Class initialization failed!')
-
-    this.log(`Initializing schemas (${schemaInputs.length} input files found)...\n`)
-    const schemaExtrinsics = await parser.getAddSchemaExtrinsics()
-    await txHelper.sendAndCheck(account, schemaExtrinsics, 'Schemas initialization failed!')
-
-    this.log(`Initializing entities (${entityBatchInputs.length} input files found)`)
-    const entityOperations = await parser.getEntityBatchOperations()
-
-    this.log(`Sending Transaction extrinsic (${entityOperations.length} operations)...\n`)
-    await txHelper.sendAndCheck(
-      account,
-      [this.getOriginalApi().tx.contentDirectory.transaction({ Lead: null }, entityOperations)],
-      'Entity initialization failed!'
-    )
-
-    this.log('DONE')
-  }
-}

+ 0 - 46
cli/src/commands/content-directory/removeCuratorFromGroup.ts

@@ -1,46 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-
-export default class RemoveCuratorFromGroupCommand extends ContentDirectoryCommandBase {
-  static description = 'Remove Curator from Curator Group.'
-  static args = [
-    {
-      name: 'groupId',
-      required: false,
-      description: 'ID of the Curator Group',
-    },
-    {
-      name: 'curatorId',
-      required: false,
-      description: 'ID of the curator',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { groupId, curatorId } = this.parse(RemoveCuratorFromGroupCommand).args
-
-    if (groupId === undefined) {
-      groupId = await this.promptForCuratorGroup()
-    }
-
-    const group = await this.getCuratorGroup(groupId)
-    const groupCuratorIds = group.curators.toArray().map((id) => id.toNumber())
-
-    if (curatorId === undefined) {
-      curatorId = await this.promptForCurator('Choose a Curator to remove', groupCuratorIds)
-    } else {
-      if (!groupCuratorIds.includes(parseInt(curatorId))) {
-        this.error(`Curator ${chalk.white(curatorId)} is not part of group ${chalk.white(groupId)}`)
-      }
-      await this.getCurator(curatorId)
-    }
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'removeCuratorFromGroup', [groupId, curatorId])
-
-    this.log(chalk.green(`Curator ${chalk.white(curatorId)} successfully removed from group ${chalk.white(groupId)}!`))
-  }
-}

+ 0 - 35
cli/src/commands/content-directory/removeCuratorGroup.ts

@@ -1,35 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-import ExitCodes from '../../ExitCodes'
-
-export default class AddCuratorGroupCommand extends ContentDirectoryCommandBase {
-  static description = 'Remove existing Curator Group.'
-  static args = [
-    {
-      name: 'id',
-      required: false,
-      description: 'ID of the Curator Group to remove',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { id } = this.parse(AddCuratorGroupCommand).args
-    if (id === undefined) {
-      id = await this.promptForCuratorGroup('Select Curator Group to remove')
-    }
-
-    const group = await this.getCuratorGroup(id)
-
-    if (group.number_of_classes_maintained.toNumber() > 0) {
-      this.error('Cannot remove a group which has some maintained classes!', { exit: ExitCodes.InvalidInput })
-    }
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'removeCuratorGroup', [id])
-
-    console.log(chalk.green(`Curator Group ${chalk.white(id)} succesfully removed!`))
-  }
-}

+ 0 - 45
cli/src/commands/content-directory/removeEntity.ts

@@ -1,45 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { Actor } from '@joystream/types/content-directory'
-import ExitCodes from '../../ExitCodes'
-
-export default class RemoveEntityCommand extends ContentDirectoryCommandBase {
-  static description = 'Removes a single entity by id (can be executed in Member, Curator or Lead context)'
-  static flags = {
-    context: ContentDirectoryCommandBase.contextFlag,
-  }
-
-  static args = [
-    {
-      name: 'id',
-      required: true,
-      description: 'ID of the entity to remove',
-    },
-  ]
-
-  async run() {
-    let {
-      args: { id },
-      flags: { context },
-    } = this.parse(RemoveEntityCommand)
-
-    const entity = await this.getEntity(id, undefined, undefined, false)
-    const [, entityClass] = await this.classEntryByNameOrId(entity.class_id.toString())
-
-    if (!context) {
-      context = await this.promptForContext()
-    }
-
-    const account = await this.getRequiredSelectedAccount()
-    const actor: Actor = await this.getActor(context, entityClass)
-    if (!actor.isOfType('Curator') && !this.isActorEntityController(actor, entity, false)) {
-      this.error('You are not the entity controller!', { exit: ExitCodes.AccessDenied })
-    }
-
-    await this.requireConfirmation(
-      `Are you sure you want to remove entity ${id} of class ${entityClass.name.toString()}?`
-    )
-    await this.requestAccountDecoding(account)
-
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'removeEntity', [actor, id])
-  }
-}

+ 0 - 44
cli/src/commands/content-directory/removeMaintainerFromClass.ts

@@ -1,44 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-
-export default class AddMaintainerToClassCommand extends ContentDirectoryCommandBase {
-  static description = 'Remove maintainer (Curator Group) from class.'
-  static args = [
-    {
-      name: 'className',
-      required: false,
-      description: 'Name or ID of the class (ie. Video)',
-    },
-    {
-      name: 'groupId',
-      required: false,
-      description: 'ID of the Curator Group to remove from maintainers',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { groupId, className } = this.parse(AddMaintainerToClassCommand).args
-
-    if (className === undefined) {
-      className = (await this.promptForClass()).name.toString()
-    }
-
-    const [classId, aClass] = await this.classEntryByNameOrId(className)
-
-    if (groupId === undefined) {
-      groupId = await this.promptForCuratorGroup('Select a maintainer', aClass.class_permissions.maintainers.toArray())
-    } else {
-      await this.getCuratorGroup(groupId)
-    }
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'removeMaintainerFromClass', [classId, groupId])
-
-    console.log(
-      chalk.green(`Curator Group ${chalk.white(groupId)} removed as maintainer of ${chalk.white(className)} class!`)
-    )
-  }
-}

+ 0 - 61
cli/src/commands/content-directory/setCuratorGroupStatus.ts

@@ -1,61 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import chalk from 'chalk'
-import ExitCodes from '../../ExitCodes'
-
-export default class SetCuratorGroupStatusCommand extends ContentDirectoryCommandBase {
-  static description = 'Set Curator Group status (Active/Inactive).'
-  static args = [
-    {
-      name: 'id',
-      required: false,
-      description: 'ID of the Curator Group',
-    },
-    {
-      name: 'status',
-      required: false,
-      description: 'New status of the group (1 - active, 0 - inactive)',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { id, status } = this.parse(SetCuratorGroupStatusCommand).args
-
-    if (id === undefined) {
-      id = await this.promptForCuratorGroup()
-    } else {
-      await this.getCuratorGroup(id)
-    }
-
-    if (status === undefined) {
-      status = await this.simplePrompt({
-        type: 'list',
-        message: 'Select new status',
-        choices: [
-          { name: 'Active', value: true },
-          { name: 'Inactive', value: false },
-        ],
-      })
-    } else {
-      if (status !== '0' && status !== '1') {
-        this.error('Invalid status provided. Use "1" for Active and "0" for Inactive.', {
-          exit: ExitCodes.InvalidInput,
-        })
-      }
-      status = !!parseInt(status)
-    }
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'setCuratorGroupStatus', [id, status])
-
-    console.log(
-      chalk.green(
-        `Curator Group ${chalk.white(id)} status succesfully changed to: ${chalk.white(
-          status ? 'Active' : 'Inactive'
-        )}!`
-      )
-    )
-  }
-}

+ 0 - 55
cli/src/commands/content-directory/updateClassPermissions.ts

@@ -1,55 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import CreateClassSchema from '@joystream/cd-schemas/schemas/extrinsics/CreateClass.schema.json'
-import chalk from 'chalk'
-import { JsonSchemaCustomPrompts, JsonSchemaPrompter } from '../../helpers/JsonSchemaPrompt'
-import { CreateClass } from '@joystream/cd-schemas/types/extrinsics/CreateClass'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-
-export default class UpdateClassPermissionsCommand extends ContentDirectoryCommandBase {
-  static description = 'Update permissions in given class.'
-  static args = [
-    {
-      name: 'className',
-      required: false,
-      description: 'Name or ID of the class (ie. Video)',
-    },
-  ]
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    await this.requireLead()
-
-    let { className } = this.parse(UpdateClassPermissionsCommand).args
-
-    if (className === undefined) {
-      className = (await this.promptForClass()).name.toString()
-    }
-
-    const [classId, aClass] = await this.classEntryByNameOrId(className)
-    const currentPermissions = aClass.class_permissions
-
-    const customPrompts: JsonSchemaCustomPrompts = [
-      ['class_permissions.maintainers', () => this.promptForCuratorGroups('Select class maintainers')],
-    ]
-
-    const prompter = new JsonSchemaPrompter<CreateClass>(
-      CreateClassSchema as JSONSchema,
-      { class_permissions: currentPermissions.toJSON() as CreateClass['class_permissions'] },
-      customPrompts
-    )
-
-    const newPermissions = await prompter.promptSingleProp('class_permissions')
-
-    await this.requestAccountDecoding(account)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'updateClassPermissions', [
-      classId,
-      newPermissions.any_member,
-      newPermissions.entity_creation_blocked,
-      newPermissions.all_entity_property_values_locked,
-      newPermissions.maintainers,
-    ])
-
-    console.log(chalk.green(`${chalk.white(className)} class permissions updated to:`))
-    this.jsonPrettyPrint(JSON.stringify(newPermissions))
-  }
-}

+ 0 - 61
cli/src/commands/content-directory/updateEntityPropertyValues.ts

@@ -1,61 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import inquirer from 'inquirer'
-import { InputParser } from '@joystream/cd-schemas'
-import ExitCodes from '../../ExitCodes'
-
-export default class UpdateEntityPropertyValues extends ContentDirectoryCommandBase {
-  static description =
-    'Updates the property values of the specified entity (can be executed in Member, Curator or Lead context)'
-
-  static args = [
-    {
-      name: 'id',
-      required: true,
-      description: 'ID of the Entity',
-    },
-  ]
-
-  static flags = {
-    context: ContentDirectoryCommandBase.contextFlag,
-  }
-
-  async run() {
-    const { id } = this.parse(UpdateEntityPropertyValues).args
-    let { context } = this.parse(UpdateEntityPropertyValues).flags
-
-    if (!context) {
-      context = await this.promptForContext()
-    }
-
-    const currentAccount = await this.getRequiredSelectedAccount()
-    await this.requestAccountDecoding(currentAccount)
-
-    const entity = await this.getEntity(id)
-    const [, entityClass] = await this.classEntryByNameOrId(entity.class_id.toString())
-    const defaults = await this.parseToEntityJson(entity)
-
-    const actor = await this.getActor(context, entityClass)
-
-    const isPropertEditableByIndex = await Promise.all(
-      entityClass.properties.map((p, i) => this.isEntityPropertyEditableByActor(entity, i, actor))
-    )
-    const filteredProperties = entityClass.properties.filter((p, i) => isPropertEditableByIndex[i])
-
-    if (!filteredProperties.length) {
-      this.error('No entity properties are editable by choosen actor', { exit: ExitCodes.AccessDenied })
-    }
-
-    const answers: {
-      [key: string]: string | number | null
-    } = await inquirer.prompt(this.getQuestionsFromProperties(filteredProperties, defaults))
-
-    this.jsonPrettyPrint(JSON.stringify(answers))
-    await this.requireConfirmation('Do you confirm the provided input?')
-
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi())
-
-    const operations = await inputParser.getEntityUpdateOperations(answers, entityClass.name.toString(), +id)
-
-    await this.sendAndFollowNamedTx(currentAccount, 'contentDirectory', 'transaction', [actor, operations])
-  }
-}

+ 22 - 11
cli/src/commands/content/createChannel.ts

@@ -1,11 +1,15 @@
 import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { IOFlags, getInputJson, saveOutputJson } from '../../helpers/InputOutput'
-import {ChannelCreationParametersMetadata, AssetsMetadata} from '@joystream/content-metadata-protobuf'
+import { IOFlags, getInputJson } from '../../helpers/InputOutput'
+import {ChannelCreationParameters, NewAsset} from '@joystream/types/content'
+import {ChannelMetadata} from '@joystream/content-metadata-protobuf'
+import { Vec, Option} from '@polkadot/types';
+import AccountId from '@polkadot/types/generic/AccountId';
+import { Bytes } from '@polkadot/types/primitive';
 
 type ChannelCreationParametersInput = {
-  assets?: AssetsMetadata.AsObject,
-  meta?: Uint8Array,
-  rewardAccount?: Uint8Array | string,
+  assets: import("@polkadot/types/types").Constructor<Vec<NewAsset>>,
+  meta: ChannelMetadata.AsObject,
+  reward_account: import("@polkadot/types/types").Constructor<Option<AccountId>>,
 }
 
 export default class CreateChannelCommand extends ContentDirectoryCommandBase {
@@ -28,12 +32,19 @@ export default class CreateChannelCommand extends ContentDirectoryCommandBase {
     const actor = await this.getActor(context)
 
     if (input) {
-      let channelCreationParameters = await getInputJson<ChannelCreationParametersMetadata>(input)
-
-      let channelCreationParametersInput: ChannelCreationParametersInput = {
-        assets: channelCreationParameters.getAssets()?.toObject(),
-        meta: channelCreationParameters.getMeta()?.serializeBinary(),
-        rewardAccount: channelCreationParameters.getRewardAccount()
+      let channelCreationParametersInput = await getInputJson<ChannelCreationParametersInput>(input)
+      let channelMetadata = new ChannelMetadata()
+      channelMetadata.setTitle(channelCreationParametersInput.meta.title!)
+      channelMetadata.setDescription(channelCreationParametersInput.meta.description!)
+      channelMetadata.setIsPublic(channelCreationParametersInput.meta.isPublic!)
+      channelMetadata.setLanguage(channelCreationParametersInput.meta.language!)
+      channelMetadata.setCoverPhoto(channelCreationParametersInput.meta.coverPhoto!)
+      channelMetadata.setAvatarPhoto(channelCreationParametersInput.meta.avatarPhoto!)
+      channelMetadata.setCategory(channelCreationParametersInput.meta.category!)
+
+      let channelCreationParameters: ChannelCreationParameters = {
+        meta: channelMetadata.serializeBinary() as Bytes,
+        reward_account: channelCreationParametersInput.reward_account,
       }
 
       this.jsonPrettyPrint(JSON.stringify(channelCreationParameters))

+ 0 - 58
cli/src/commands/media/createChannel.ts

@@ -1,58 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import ChannelEntitySchema from '@joystream/cd-schemas/schemas/entities/ChannelEntity.schema.json'
-import { ChannelEntity } from '@joystream/cd-schemas/types/entities/ChannelEntity'
-import { InputParser } from '@joystream/cd-schemas'
-import { IOFlags, getInputJson, saveOutputJson } from '../../helpers/InputOutput'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-import { JsonSchemaCustomPrompts, JsonSchemaPrompter } from '../../helpers/JsonSchemaPrompt'
-
-import { flags } from '@oclif/command'
-import _ from 'lodash'
-
-export default class CreateChannelCommand extends ContentDirectoryCommandBase {
-  static description = 'Create a new channel on Joystream (requires a membership).'
-  static flags = {
-    ...IOFlags,
-    confirm: flags.boolean({ char: 'y', name: 'confirm', required: false, description: 'Confirm the provided input' }),
-  }
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    const memberId = await this.getRequiredMemberId()
-    const actor = { Member: memberId }
-
-    await this.requestAccountDecoding(account)
-
-    const channelJsonSchema = (ChannelEntitySchema as unknown) as JSONSchema
-
-    const { input, output, confirm } = this.parse(CreateChannelCommand).flags
-
-    let inputJson = await getInputJson<ChannelEntity>(input, channelJsonSchema)
-    if (!inputJson) {
-      const customPrompts: JsonSchemaCustomPrompts = [
-        ['language', () => this.promptForEntityId('Choose channel language', 'Language', 'name')],
-        ['isCensored', 'skip'],
-      ]
-
-      const prompter = new JsonSchemaPrompter<ChannelEntity>(channelJsonSchema, undefined, customPrompts)
-
-      inputJson = await prompter.promptAll()
-    }
-
-    this.jsonPrettyPrint(JSON.stringify(inputJson))
-    const confirmed =
-      confirm || (await this.simplePrompt({ type: 'confirm', message: 'Do you confirm the provided input?' }))
-
-    if (confirmed) {
-      saveOutputJson(output, `${_.startCase(inputJson.handle)}Channel.json`, inputJson)
-      const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi(), [
-        {
-          className: 'Channel',
-          entries: [inputJson],
-        },
-      ])
-      const operations = await inputParser.getEntityBatchOperations()
-      await this.sendAndFollowNamedTx(account, 'contentDirectory', 'transaction', [actor, operations])
-    }
-  }
-}

+ 0 - 57
cli/src/commands/media/curateContent.ts

@@ -1,57 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { InputParser } from '@joystream/cd-schemas'
-import { flags } from '@oclif/command'
-import { ChannelEntity } from '@joystream/cd-schemas/types/entities/ChannelEntity'
-import { VideoEntity } from '@joystream/cd-schemas/types/entities/VideoEntity'
-
-const CLASSES = ['Channel', 'Video'] as const
-const STATUSES = ['Accepted', 'Censored'] as const
-
-export default class CurateContentCommand extends ContentDirectoryCommandBase {
-  static description = `Set the curation status of given entity (${CLASSES.join('/')}). Requires Curator access.`
-  static flags = {
-    className: flags.enum({
-      options: [...CLASSES],
-      description: `Name of the class of the entity to curate (${CLASSES.join('/')})`,
-      char: 'c',
-      required: true,
-    }),
-    status: flags.enum({
-      description: `Specifies the curation status (${STATUSES.join('/')})`,
-      char: 's',
-      options: [...STATUSES],
-      required: true,
-    }),
-    id: flags.integer({
-      description: 'ID of the entity to curate',
-      required: true,
-    }),
-  }
-
-  async run() {
-    const { className, status, id } = this.parse(CurateContentCommand).flags
-
-    const account = await this.getRequiredSelectedAccount()
-    // Get curator actor with required maintainer access to $className (Video/Channel) class
-    const actor = await this.getCuratorContext([className])
-
-    await this.requestAccountDecoding(account)
-
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi())
-
-    await this.getEntity(id, className) // Check if entity exists and is of given class
-
-    const entityUpdateInput: Partial<ChannelEntity & VideoEntity> = {
-      isCensored: status === 'Censored',
-    }
-
-    this.log(`Updating the ${className} with:`)
-    this.jsonPrettyPrint(JSON.stringify(entityUpdateInput))
-    const confirmed = await this.simplePrompt({ type: 'confirm', message: 'Do you confirm the provided input?' })
-
-    if (confirmed) {
-      const operations = await inputParser.getEntityUpdateOperations(entityUpdateInput, className, id)
-      await this.sendAndFollowNamedTx(account, 'contentDirectory', 'transaction', [actor, operations], true)
-    }
-  }
-}

+ 0 - 36
cli/src/commands/media/featuredVideos.ts

@@ -1,36 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { displayTable } from '../../helpers/display'
-import { FeaturedVideoEntity, VideoEntity } from '@joystream/cd-schemas/types/entities'
-import chalk from 'chalk'
-
-export default class FeaturedVideosCommand extends ContentDirectoryCommandBase {
-  static description = 'Show a list of currently featured videos.'
-
-  async run() {
-    const featuredEntries = await this.entitiesByClassAndOwner('FeaturedVideo')
-    const featured = await Promise.all(
-      featuredEntries
-        .filter(([, entity]) => entity.supported_schemas.toArray().length) // Ignore FeaturedVideo entities without schema
-        .map(([, entity]) => this.parseToEntityJson<FeaturedVideoEntity>(entity))
-    )
-
-    const videoIds: number[] = featured.map(({ video: videoId }) => videoId)
-
-    const videos = await Promise.all(videoIds.map((videoId) => this.getAndParseKnownEntity<VideoEntity>(videoId)))
-
-    if (videos.length) {
-      displayTable(
-        videos.map(({ title, channel }, index) => ({
-          featuredVideoEntityId: featuredEntries[index][0].toNumber(),
-          videoId: videoIds[index],
-          channelId: channel,
-          title,
-        })),
-        3
-      )
-      this.log(`\nTIP: Use ${chalk.bold('content-directory:entity ID')} command to see more details about given video`)
-    } else {
-      this.log(`No videos have been featured yet! Set some with ${chalk.bold('media:setFeaturedVideos')}`)
-    }
-  }
-}

+ 0 - 25
cli/src/commands/media/myChannels.ts

@@ -1,25 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { ChannelEntity } from '@joystream/cd-schemas/types/entities/ChannelEntity'
-import { displayTable } from '../../helpers/display'
-import chalk from 'chalk'
-
-export default class MyChannelsCommand extends ContentDirectoryCommandBase {
-  static description = "Show the list of channels associated with current account's membership."
-
-  async run() {
-    const memberId = await this.getRequiredMemberId()
-
-    const props: (keyof ChannelEntity)[] = ['handle', 'isPublic']
-
-    const list = await this.createEntityList('Channel', props, [], memberId)
-
-    if (list.length) {
-      displayTable(list, 3)
-      this.log(
-        `\nTIP: Use ${chalk.bold('content-directory:entity ID')} command to see more details about given channel`
-      )
-    } else {
-      this.log(`No channels created yet! Create a channel with ${chalk.bold('media:createChannel')}`)
-    }
-  }
-}

+ 0 - 33
cli/src/commands/media/myVideos.ts

@@ -1,33 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { VideoEntity } from '@joystream/cd-schemas/types/entities/VideoEntity'
-import { displayTable } from '../../helpers/display'
-import chalk from 'chalk'
-import { flags } from '@oclif/command'
-
-export default class MyVideosCommand extends ContentDirectoryCommandBase {
-  static description = "Show the list of videos associated with current account's membership."
-  static flags = {
-    channel: flags.integer({
-      char: 'c',
-      required: false,
-      description: 'Channel id to filter the videos by',
-    }),
-  }
-
-  async run() {
-    const memberId = await this.getRequiredMemberId()
-
-    const { channel } = this.parse(MyVideosCommand).flags
-    const props: (keyof VideoEntity)[] = ['title', 'isPublic', 'channel']
-    const filters: [string, string][] = channel !== undefined ? [['channel', channel.toString()]] : []
-
-    const list = await this.createEntityList('Video', props, filters, memberId)
-
-    if (list.length) {
-      displayTable(list, 3)
-      this.log(`\nTIP: Use ${chalk.bold('content-directory:entity ID')} command to see more details about given video`)
-    } else {
-      this.log(`No videos uploaded yet! Upload a video with ${chalk.bold('media:uploadVideo')}`)
-    }
-  }
-}

+ 0 - 44
cli/src/commands/media/removeChannel.ts

@@ -1,44 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { Entity } from '@joystream/types/content-directory'
-import { createType } from '@joystream/types'
-import { ChannelEntity } from '@joystream/cd-schemas/types/entities'
-
-export default class RemoveChannelCommand extends ContentDirectoryCommandBase {
-  static description = 'Removes a channel (required controller access).'
-  static args = [
-    {
-      name: 'id',
-      required: false,
-      description: 'ID of the Channel entity',
-    },
-  ]
-
-  async run() {
-    const {
-      args: { id },
-    } = this.parse(RemoveChannelCommand)
-
-    const account = await this.getRequiredSelectedAccount()
-    const memberId = await this.getRequiredMemberId()
-    const actor = createType('Actor', { Member: memberId })
-
-    await this.requestAccountDecoding(account)
-
-    let channelEntity: Entity, channelId: number
-    if (id) {
-      channelId = parseInt(id)
-      channelEntity = await this.getEntity(channelId, 'Channel', memberId)
-    } else {
-      const [id, channel] = await this.promptForEntityEntry('Select a channel to remove', 'Channel', 'handle', memberId)
-      channelId = id.toNumber()
-      channelEntity = channel
-    }
-    const channel = await this.parseToEntityJson<ChannelEntity>(channelEntity)
-
-    await this.requireConfirmation(`Are you sure you want to remove "${channel.handle}" channel?`)
-
-    const api = this.getOriginalApi()
-    this.log(`Removing Channel entity (ID: ${channelId})...`)
-    await this.sendAndFollowTx(account, api.tx.contentDirectory.removeEntity(actor, channelId))
-  }
-}

+ 0 - 49
cli/src/commands/media/removeVideo.ts

@@ -1,49 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { Entity } from '@joystream/types/content-directory'
-import { VideoEntity } from '@joystream/cd-schemas/types/entities'
-import { createType } from '@joystream/types'
-
-export default class RemoveVideoCommand extends ContentDirectoryCommandBase {
-  static description = 'Remove given Video entity and associated entities (VideoMedia, License) from content directory.'
-  static args = [
-    {
-      name: 'id',
-      required: false,
-      description: 'ID of the Video entity',
-    },
-  ]
-
-  async run() {
-    const {
-      args: { id },
-    } = this.parse(RemoveVideoCommand)
-
-    const account = await this.getRequiredSelectedAccount()
-    const memberId = await this.getRequiredMemberId()
-    const actor = createType('Actor', { Member: memberId })
-
-    await this.requestAccountDecoding(account)
-
-    let videoEntity: Entity, videoId: number
-    if (id) {
-      videoId = parseInt(id)
-      videoEntity = await this.getEntity(videoId, 'Video', memberId)
-    } else {
-      const [id, video] = await this.promptForEntityEntry('Select a video to remove', 'Video', 'title', memberId)
-      videoId = id.toNumber()
-      videoEntity = video
-    }
-
-    const video = await this.parseToEntityJson<VideoEntity>(videoEntity)
-
-    await this.requireConfirmation(`Are you sure you want to remove the "${video.title}" video?`)
-
-    const api = this.getOriginalApi()
-    this.log(`Removing the Video entity (ID: ${videoId})...`)
-    await this.sendAndFollowTx(account, api.tx.contentDirectory.removeEntity(actor, videoId))
-    this.log(`Removing the VideoMedia entity (ID: ${video.media})...`)
-    await this.sendAndFollowTx(account, api.tx.contentDirectory.removeEntity(actor, video.media))
-    this.log(`Removing the License entity (ID: ${video.license})...`)
-    await this.sendAndFollowTx(account, api.tx.contentDirectory.removeEntity(actor, video.license))
-  }
-}

+ 0 - 79
cli/src/commands/media/setFeaturedVideos.ts

@@ -1,79 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import { VideoEntity } from '@joystream/cd-schemas/types/entities'
-import { InputParser, ExtrinsicsHelper } from '@joystream/cd-schemas'
-import { FlattenRelations } from '@joystream/cd-schemas/types/utility'
-import { flags } from '@oclif/command'
-import { createType } from '@joystream/types'
-
-export default class SetFeaturedVideosCommand extends ContentDirectoryCommandBase {
-  static description = 'Set currently featured videos (requires lead/maintainer access).'
-  static args = [
-    {
-      name: 'videoIds',
-      required: true,
-      description: 'Comma-separated video ids',
-    },
-  ]
-
-  static flags = {
-    add: flags.boolean({
-      description: 'If provided - currently featured videos will not be removed.',
-      required: false,
-    }),
-  }
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    let actor = createType('Actor', { Lead: null })
-    try {
-      await this.getRequiredLead()
-    } catch (e) {
-      actor = await this.getCuratorContext(['FeaturedVideo'])
-    }
-
-    await this.requestAccountDecoding(account)
-
-    const {
-      args: { videoIds },
-      flags: { add },
-    } = this.parse(SetFeaturedVideosCommand)
-
-    const ids: number[] = videoIds.split(',').map((id: string) => parseInt(id))
-
-    const videos: [number, FlattenRelations<VideoEntity>][] = (
-      await Promise.all(ids.map((id) => this.getAndParseKnownEntity<VideoEntity>(id, 'Video')))
-    ).map((video, index) => [ids[index], video])
-
-    this.log(
-      `Featured videos that will ${add ? 'be added to' : 'replace'} existing ones:`,
-      videos.map(([id, { title }]) => ({ id, title }))
-    )
-
-    await this.requireConfirmation('Do you confirm the provided input?')
-
-    if (!add) {
-      const currentlyFeaturedIds = (await this.entitiesByClassAndOwner('FeaturedVideo')).map(([id]) => id.toNumber())
-      const removeTxs = currentlyFeaturedIds.map((id) =>
-        this.getOriginalApi().tx.contentDirectory.removeEntity(actor, id)
-      )
-
-      if (currentlyFeaturedIds.length) {
-        this.log(`Removing existing FeaturedVideo entities (${currentlyFeaturedIds.join(', ')})...`)
-
-        const txHelper = new ExtrinsicsHelper(this.getOriginalApi())
-        await txHelper.sendAndCheck(account, removeTxs, 'The removal of existing FeaturedVideo entities failed')
-      }
-    }
-
-    this.log('Adding new FeaturedVideo entities...')
-    const featuredVideoEntries = videos.map(([id]) => ({ video: id }))
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi(), [
-      {
-        className: 'FeaturedVideo',
-        entries: featuredVideoEntries,
-      },
-    ])
-    const operations = await inputParser.getEntityBatchOperations()
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'transaction', [actor, operations])
-  }
-}

+ 0 - 98
cli/src/commands/media/updateChannel.ts

@@ -1,98 +0,0 @@
-import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
-import ChannelEntitySchema from '@joystream/cd-schemas/schemas/entities/ChannelEntity.schema.json'
-import { ChannelEntity } from '@joystream/cd-schemas/types/entities/ChannelEntity'
-import { InputParser } from '@joystream/cd-schemas'
-import { IOFlags, getInputJson, saveOutputJson } from '../../helpers/InputOutput'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-import { JsonSchemaCustomPrompts, JsonSchemaPrompter } from '../../helpers/JsonSchemaPrompt'
-import { Actor, Entity } from '@joystream/types/content-directory'
-import { flags } from '@oclif/command'
-import { createType } from '@joystream/types'
-import _ from 'lodash'
-
-export default class UpdateChannelCommand extends ContentDirectoryCommandBase {
-  static description = 'Update one of the owned channels on Joystream (requires a membership).'
-  static flags = {
-    ...IOFlags,
-    asCurator: flags.boolean({
-      description: 'Provide this flag in order to use Curator context for the update',
-      required: false,
-    }),
-  }
-
-  static args = [
-    {
-      name: 'id',
-      description: 'ID of the channel to update',
-      required: false,
-    },
-  ]
-
-  async run() {
-    const {
-      args: { id },
-      flags: { asCurator },
-    } = this.parse(UpdateChannelCommand)
-
-    const account = await this.getRequiredSelectedAccount()
-
-    let memberId: number | undefined, actor: Actor
-
-    if (asCurator) {
-      actor = await this.getCuratorContext(['Channel'])
-    } else {
-      memberId = await this.getRequiredMemberId()
-      actor = createType('Actor', { Member: memberId })
-    }
-
-    await this.requestAccountDecoding(account)
-
-    let channelEntity: Entity, channelId: number
-    if (id) {
-      channelId = parseInt(id)
-      channelEntity = await this.getEntity(channelId, 'Channel', memberId)
-    } else {
-      const [id, channel] = await this.promptForEntityEntry('Select a channel to update', 'Channel', 'handle', memberId)
-      channelId = id.toNumber()
-      channelEntity = channel
-    }
-
-    const currentValues = await this.parseToEntityJson<ChannelEntity>(channelEntity)
-    this.jsonPrettyPrint(JSON.stringify(currentValues))
-
-    const channelJsonSchema = (ChannelEntitySchema as unknown) as JSONSchema
-
-    const { input, output } = this.parse(UpdateChannelCommand).flags
-
-    let inputJson = await getInputJson<ChannelEntity>(input, channelJsonSchema)
-    if (!inputJson) {
-      const customPrompts: JsonSchemaCustomPrompts<ChannelEntity> = [
-        [
-          'language',
-          () =>
-            this.promptForEntityId('Choose channel language', 'Language', 'name', undefined, currentValues.language),
-        ],
-      ]
-
-      if (!asCurator) {
-        // Skip isCensored is it's not updated by the curator
-        customPrompts.push(['isCensored', 'skip'])
-      }
-
-      const prompter = new JsonSchemaPrompter<ChannelEntity>(channelJsonSchema, currentValues, customPrompts)
-
-      inputJson = await prompter.promptAll()
-    }
-
-    this.jsonPrettyPrint(JSON.stringify(inputJson))
-    const confirmed = await this.simplePrompt({ type: 'confirm', message: 'Do you confirm the provided input?' })
-
-    if (confirmed) {
-      saveOutputJson(output, `${_.startCase(inputJson.handle)}Channel.json`, inputJson)
-      const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi())
-      const updateOperations = await inputParser.getEntityUpdateOperations(inputJson, 'Channel', channelId)
-      this.log('Sending the extrinsic...')
-      await this.sendAndFollowNamedTx(account, 'contentDirectory', 'transaction', [actor, updateOperations])
-    }
-  }
-}

+ 0 - 106
cli/src/commands/media/updateVideo.ts

@@ -1,106 +0,0 @@
-import VideoEntitySchema from '@joystream/cd-schemas/schemas/entities/VideoEntity.schema.json'
-import { VideoEntity } from '@joystream/cd-schemas/types/entities/VideoEntity'
-import { InputParser } from '@joystream/cd-schemas'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-import { JsonSchemaCustomPrompts, JsonSchemaPrompter } from '../../helpers/JsonSchemaPrompt'
-import { Actor, Entity } from '@joystream/types/content-directory'
-import { createType } from '@joystream/types'
-import { flags } from '@oclif/command'
-import MediaCommandBase from '../../base/MediaCommandBase'
-
-export default class UpdateVideoCommand extends MediaCommandBase {
-  static description = 'Update existing video information (requires controller/maintainer access).'
-  static flags = {
-    // TODO: ...IOFlags, - providing input as json
-    asCurator: flags.boolean({
-      description: 'Specify in order to update the video as curator',
-      required: false,
-    }),
-  }
-
-  static args = [
-    {
-      name: 'id',
-      description: 'ID of the Video to update',
-      required: false,
-    },
-  ]
-
-  async run() {
-    const {
-      args: { id },
-      flags: { asCurator },
-    } = this.parse(UpdateVideoCommand)
-
-    const account = await this.getRequiredSelectedAccount()
-
-    let memberId: number | undefined, actor: Actor
-
-    if (asCurator) {
-      actor = await this.getCuratorContext(['Video'])
-    } else {
-      memberId = await this.getRequiredMemberId()
-      actor = createType('Actor', { Member: memberId })
-    }
-
-    await this.requestAccountDecoding(account)
-
-    let videoEntity: Entity, videoId: number
-    if (id) {
-      videoId = parseInt(id)
-      videoEntity = await this.getEntity(videoId, 'Video', memberId)
-    } else {
-      const [id, video] = await this.promptForEntityEntry('Select a video to update', 'Video', 'title', memberId)
-      videoId = id.toNumber()
-      videoEntity = video
-    }
-
-    const currentValues = await this.parseToEntityJson<VideoEntity>(videoEntity)
-    const videoJsonSchema = (VideoEntitySchema as unknown) as JSONSchema
-
-    const {
-      language: currLanguageId,
-      category: currCategoryId,
-      publishedBeforeJoystream: currPublishedBeforeJoystream,
-    } = currentValues
-
-    const customizedPrompts: JsonSchemaCustomPrompts<VideoEntity> = [
-      [
-        'language',
-        () => this.promptForEntityId('Choose Video language', 'Language', 'name', undefined, currLanguageId),
-      ],
-      [
-        'category',
-        () => this.promptForEntityId('Choose Video category', 'ContentCategory', 'name', undefined, currCategoryId),
-      ],
-      ['publishedBeforeJoystream', () => this.promptForPublishedBeforeJoystream(currPublishedBeforeJoystream)],
-    ]
-    const videoPrompter = new JsonSchemaPrompter<VideoEntity>(videoJsonSchema, currentValues, customizedPrompts)
-
-    // Prompt for other video data
-    const updatedProps: Partial<VideoEntity> = await videoPrompter.promptMultipleProps([
-      'language',
-      'category',
-      'title',
-      'description',
-      'thumbnailUrl',
-      'duration',
-      'isPublic',
-      'isExplicit',
-      'hasMarketing',
-      'publishedBeforeJoystream',
-      'skippableIntroDuration',
-    ])
-
-    if (asCurator) {
-      updatedProps.isCensored = await videoPrompter.promptSingleProp('isCensored')
-    }
-
-    this.jsonPrettyPrint(JSON.stringify(updatedProps))
-
-    // Parse inputs into operations and send final extrinsic
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi())
-    const videoUpdateOperations = await inputParser.getEntityUpdateOperations(updatedProps, 'Video', videoId)
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'transaction', [actor, videoUpdateOperations], true)
-  }
-}

+ 0 - 59
cli/src/commands/media/updateVideoLicense.ts

@@ -1,59 +0,0 @@
-import MediaCommandBase from '../../base/MediaCommandBase'
-import { LicenseEntity, VideoEntity } from '@joystream/cd-schemas/types/entities'
-import { InputParser } from '@joystream/cd-schemas'
-import { Entity } from '@joystream/types/content-directory'
-import { createType } from '@joystream/types'
-
-export default class UpdateVideoLicenseCommand extends MediaCommandBase {
-  static description = 'Update existing video license (requires controller/maintainer access).'
-  // TODO: ...IOFlags, - providing input as json
-
-  static args = [
-    {
-      name: 'id',
-      description: 'ID of the Video',
-      required: false,
-    },
-  ]
-
-  async run() {
-    const {
-      args: { id },
-    } = this.parse(UpdateVideoLicenseCommand)
-
-    const account = await this.getRequiredSelectedAccount()
-    const memberId = await this.getRequiredMemberId()
-    const actor = createType('Actor', { Member: memberId })
-
-    await this.requestAccountDecoding(account)
-
-    let videoEntity: Entity, videoId: number
-    if (id) {
-      videoId = parseInt(id)
-      videoEntity = await this.getEntity(videoId, 'Video', memberId)
-    } else {
-      const [id, video] = await this.promptForEntityEntry('Select a video to update', 'Video', 'title', memberId)
-      videoId = id.toNumber()
-      videoEntity = video
-    }
-
-    const video = await this.parseToEntityJson<VideoEntity>(videoEntity)
-    const currentLicense = await this.getAndParseKnownEntity<LicenseEntity>(video.license)
-
-    this.log('Current license:', currentLicense)
-
-    const updateInput: Partial<VideoEntity> = {
-      license: await this.promptForNewLicense(),
-    }
-
-    const api = this.getOriginalApi()
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi())
-    const videoUpdateOperations = await inputParser.getEntityUpdateOperations(updateInput, 'Video', videoId)
-
-    this.log('Setting new license...')
-    await this.sendAndFollowTx(account, api.tx.contentDirectory.transaction(actor, videoUpdateOperations), true)
-
-    this.log(`Removing old License entity (ID: ${video.license})...`)
-    await this.sendAndFollowTx(account, api.tx.contentDirectory.removeEntity(actor, video.license))
-  }
-}

+ 0 - 441
cli/src/commands/media/uploadVideo.ts

@@ -1,441 +0,0 @@
-import VideoEntitySchema from '@joystream/cd-schemas/schemas/entities/VideoEntity.schema.json'
-import VideoMediaEntitySchema from '@joystream/cd-schemas/schemas/entities/VideoMediaEntity.schema.json'
-import { VideoEntity } from '@joystream/cd-schemas/types/entities/VideoEntity'
-import { VideoMediaEntity } from '@joystream/cd-schemas/types/entities/VideoMediaEntity'
-import { InputParser } from '@joystream/cd-schemas'
-import { JSONSchema } from '@apidevtools/json-schema-ref-parser'
-import { JsonSchemaPrompter } from '../../helpers/JsonSchemaPrompt'
-import { flags } from '@oclif/command'
-import fs from 'fs'
-import ExitCodes from '../../ExitCodes'
-import { ContentId } from '@joystream/types/storage'
-import ipfsHash from 'ipfs-only-hash'
-import { cli } from 'cli-ux'
-import axios, { AxiosRequestConfig } from 'axios'
-import { URL } from 'url'
-import ipfsHttpClient from 'ipfs-http-client'
-import first from 'it-first'
-import last from 'it-last'
-import toBuffer from 'it-to-buffer'
-import ffprobeInstaller from '@ffprobe-installer/ffprobe'
-import ffmpeg from 'fluent-ffmpeg'
-import MediaCommandBase from '../../base/MediaCommandBase'
-import { getInputJson, validateInput, IOFlags } from '../../helpers/InputOutput'
-
-ffmpeg.setFfprobePath(ffprobeInstaller.path)
-
-const DATA_OBJECT_TYPE_ID = 1
-const MAX_FILE_SIZE = 2000 * 1024 * 1024
-
-type VideoMetadata = {
-  width?: number
-  height?: number
-  codecName?: string
-  codecFullName?: string
-  duration?: number
-}
-
-export default class UploadVideoCommand extends MediaCommandBase {
-  static description = 'Upload a new Video to a channel (requires a membership).'
-  static flags = {
-    input: IOFlags.input,
-    channel: flags.integer({
-      char: 'c',
-      required: false,
-      description:
-        'ID of the channel to assign the video to (if omitted - one of the owned channels can be selected from the list)',
-    }),
-    confirm: flags.boolean({ char: 'y', name: 'confirm', required: false, description: 'Confirm the provided input' }),
-  }
-
-  static args = [
-    {
-      name: 'filePath',
-      required: true,
-      description: 'Path to the media file to upload',
-    },
-  ]
-
-  private createReadStreamWithProgressBar(filePath: string, barTitle: string, fileSize?: number) {
-    // Progress CLI UX:
-    // https://github.com/oclif/cli-ux#cliprogress
-    // https://www.npmjs.com/package/cli-progress
-    if (!fileSize) {
-      fileSize = fs.statSync(filePath).size
-    }
-    const progress = cli.progress({ format: `${barTitle} | {bar} | {value}/{total} KB processed` })
-    let processedKB = 0
-    const fileSizeKB = Math.ceil(fileSize / 1024)
-    progress.start(fileSizeKB, processedKB)
-    return {
-      fileStream: fs
-        .createReadStream(filePath)
-        .pause() // Explicitly pause to prevent switching to flowing mode (https://nodejs.org/api/stream.html#stream_event_data)
-        .on('error', () => {
-          progress.stop()
-          this.error(`Error while trying to read data from: ${filePath}!`, {
-            exit: ExitCodes.FsOperationFailed,
-          })
-        })
-        .on('data', (data) => {
-          processedKB += data.length / 1024
-          progress.update(processedKB)
-        })
-        .on('end', () => {
-          progress.update(fileSizeKB)
-          progress.stop()
-        }),
-      progressBar: progress,
-    }
-  }
-
-  private async calculateFileIpfsHash(filePath: string, fileSize: number): Promise<string> {
-    const { fileStream } = this.createReadStreamWithProgressBar(filePath, 'Calculating file hash', fileSize)
-    const hash: string = await ipfsHash.of(fileStream)
-
-    return hash
-  }
-
-  private async getDiscoveryDataViaLocalIpfsNode(ipnsIdentity: string): Promise<any> {
-    const ipfs = ipfsHttpClient({
-      // TODO: Allow customizing node url:
-      // host: 'localhost', port: '5001', protocol: 'http',
-      timeout: 10000,
-    })
-
-    const ipnsAddress = `/ipns/${ipnsIdentity}/`
-    const ipfsName = await last(
-      ipfs.name.resolve(ipnsAddress, {
-        recursive: false,
-        nocache: false,
-      })
-    )
-    const data: any = await first(ipfs.get(ipfsName))
-    const buffer = await toBuffer(data.content)
-
-    return JSON.parse(buffer.toString())
-  }
-
-  private async getDiscoveryDataViaBootstrapEndpoint(storageProviderId: number): Promise<any> {
-    const bootstrapEndpoint = await this.getApi().getRandomBootstrapEndpoint()
-    if (!bootstrapEndpoint) {
-      this.error('No bootstrap endpoints available', { exit: ExitCodes.ApiError })
-    }
-    this.log('Bootstrap endpoint:', bootstrapEndpoint)
-    const discoveryEndpoint = new URL(`discover/v0/${storageProviderId}`, bootstrapEndpoint).toString()
-    try {
-      const data = (await axios.get(discoveryEndpoint)).data
-      return data
-    } catch (e) {
-      this.error(`Cannot retrieve data from bootstrap enpoint (${discoveryEndpoint})`, {
-        exit: ExitCodes.ExternalInfrastructureError,
-      })
-    }
-  }
-
-  private async getUploadUrlFromDiscoveryData(data: any, contentId: ContentId): Promise<string> {
-    if (typeof data === 'object' && data !== null && data.serialized) {
-      const unserialized = JSON.parse(data.serialized)
-      if (unserialized.asset && unserialized.asset.endpoint && typeof unserialized.asset.endpoint === 'string') {
-        return new URL(`asset/v0/${contentId.encode()}`, unserialized.asset.endpoint).toString()
-      }
-    }
-    this.error(`Unexpected discovery data: ${JSON.stringify(data)}`)
-  }
-
-  private async getUploadUrl(ipnsIdentity: string, storageProviderId: number, contentId: ContentId): Promise<string> {
-    let data: any
-    try {
-      this.log('Trying to connect to local ipfs node...')
-      data = await this.getDiscoveryDataViaLocalIpfsNode(ipnsIdentity)
-    } catch (e) {
-      this.warn("Couldn't get data from local ipfs node, resolving to bootstrap endpoint...")
-      data = await this.getDiscoveryDataViaBootstrapEndpoint(storageProviderId)
-    }
-
-    const uploadUrl = await this.getUploadUrlFromDiscoveryData(data, contentId)
-
-    return uploadUrl
-  }
-
-  private async getVideoMetadata(filePath: string): Promise<VideoMetadata | null> {
-    let metadata: VideoMetadata | null = null
-    const metadataPromise = new Promise<VideoMetadata>((resolve, reject) => {
-      ffmpeg.ffprobe(filePath, (err, data) => {
-        if (err) {
-          reject(err)
-          return
-        }
-        const videoStream = data.streams.find((s) => s.codec_type === 'video')
-        if (videoStream) {
-          resolve({
-            width: videoStream.width,
-            height: videoStream.height,
-            codecName: videoStream.codec_name,
-            codecFullName: videoStream.codec_long_name,
-            duration: videoStream.duration !== undefined ? Math.ceil(Number(videoStream.duration)) || 0 : undefined,
-          })
-        } else {
-          reject(new Error('No video stream found in file'))
-        }
-      })
-    })
-
-    try {
-      metadata = await metadataPromise
-    } catch (e) {
-      const message = e.message || e
-      this.warn(`Failed to get video metadata via ffprobe (${message})`)
-    }
-
-    return metadata
-  }
-
-  private async uploadVideo(filePath: string, fileSize: number, uploadUrl: string) {
-    const { fileStream, progressBar } = this.createReadStreamWithProgressBar(filePath, 'Uploading', fileSize)
-    fileStream.on('end', () => {
-      cli.action.start('Waiting for the file to be processed...')
-    })
-
-    try {
-      const config: AxiosRequestConfig = {
-        headers: {
-          'Content-Type': '', // https://github.com/Joystream/storage-node-joystream/issues/16
-          'Content-Length': fileSize.toString(),
-        },
-        maxContentLength: MAX_FILE_SIZE,
-        maxBodyLength: MAX_FILE_SIZE,
-      }
-      await axios.put(uploadUrl, fileStream, config)
-      cli.action.stop()
-
-      this.log('File uploaded!')
-    } catch (e) {
-      progressBar.stop()
-      cli.action.stop()
-      const msg = (e.response && e.response.data && e.response.data.message) || e.message || e
-      this.error(`Unexpected error when trying to upload a file: ${msg}`, {
-        exit: ExitCodes.ExternalInfrastructureError,
-      })
-    }
-  }
-
-  private async promptForVideoInput(
-    channelId: number,
-    fileSize: number,
-    contentId: ContentId,
-    videoMetadata: VideoMetadata | null
-  ) {
-    // Set the defaults
-    const videoMediaDefaults: Partial<VideoMediaEntity> = {
-      pixelWidth: videoMetadata?.width,
-      pixelHeight: videoMetadata?.height,
-    }
-    const videoDefaults: Partial<VideoEntity> = {
-      duration: videoMetadata?.duration,
-      skippableIntroDuration: 0,
-    }
-
-    // Prompt for data
-    const videoJsonSchema = (VideoEntitySchema as unknown) as JSONSchema
-    const videoMediaJsonSchema = (VideoMediaEntitySchema as unknown) as JSONSchema
-
-    const videoMediaPrompter = new JsonSchemaPrompter<VideoMediaEntity>(videoMediaJsonSchema, videoMediaDefaults)
-    const videoPrompter = new JsonSchemaPrompter<VideoEntity>(videoJsonSchema, videoDefaults)
-
-    // Prompt for the data
-    const encodingSuggestion =
-      videoMetadata && videoMetadata.codecFullName ? ` (suggested: ${videoMetadata.codecFullName})` : ''
-    const encoding = await this.promptForEntityId(
-      `Choose Video encoding${encodingSuggestion}`,
-      'VideoMediaEncoding',
-      'name'
-    )
-    const { pixelWidth, pixelHeight } = await videoMediaPrompter.promptMultipleProps(['pixelWidth', 'pixelHeight'])
-    const language = await this.promptForEntityId('Choose Video language', 'Language', 'name')
-    const category = await this.promptForEntityId('Choose Video category', 'ContentCategory', 'name')
-    const videoProps = await videoPrompter.promptMultipleProps([
-      'title',
-      'description',
-      'thumbnailUrl',
-      'duration',
-      'isPublic',
-      'isExplicit',
-      'hasMarketing',
-      'skippableIntroDuration',
-    ])
-
-    const license = await videoPrompter.promptSingleProp('license', () => this.promptForNewLicense())
-    const publishedBeforeJoystream = await videoPrompter.promptSingleProp('publishedBeforeJoystream', () =>
-      this.promptForPublishedBeforeJoystream()
-    )
-
-    // Create final inputs
-    const videoMediaInput: VideoMediaEntity = {
-      encoding,
-      pixelWidth,
-      pixelHeight,
-      size: fileSize,
-      location: { new: { joystreamMediaLocation: { new: { dataObjectId: contentId.encode() } } } },
-    }
-    return {
-      ...videoProps,
-      channel: channelId,
-      language,
-      category,
-      license,
-      media: { new: videoMediaInput },
-      publishedBeforeJoystream,
-    }
-  }
-
-  private async getVideoInputFromFile(
-    filePath: string,
-    channelId: number,
-    fileSize: number,
-    contentId: ContentId,
-    videoMetadata: VideoMetadata | null
-  ) {
-    let videoInput = await getInputJson<any>(filePath)
-    if (typeof videoInput !== 'object' || videoInput === null) {
-      this.error('Invalid input json - expected an object', { exit: ExitCodes.InvalidInput })
-    }
-    const videoMediaDefaults: Partial<VideoMediaEntity> = {
-      pixelWidth: videoMetadata?.width,
-      pixelHeight: videoMetadata?.height,
-      size: fileSize,
-    }
-    const videoDefaults: Partial<VideoEntity> = {
-      channel: channelId,
-      duration: videoMetadata?.duration,
-    }
-    const inputVideoMedia =
-      videoInput.media && typeof videoInput.media === 'object' && (videoInput.media as any).new
-        ? (videoInput.media as any).new
-        : {}
-    videoInput = {
-      ...videoDefaults,
-      ...videoInput,
-      media: {
-        new: {
-          ...videoMediaDefaults,
-          ...inputVideoMedia,
-          location: { new: { joystreamMediaLocation: { new: { dataObjectId: contentId.encode() } } } },
-        },
-      },
-    }
-
-    const videoJsonSchema = (VideoEntitySchema as unknown) as JSONSchema
-    await validateInput(videoInput, videoJsonSchema)
-
-    return videoInput as VideoEntity
-  }
-
-  async run() {
-    const account = await this.getRequiredSelectedAccount()
-    const memberId = await this.getRequiredMemberId()
-    const actor = { Member: memberId }
-
-    await this.requestAccountDecoding(account)
-
-    const {
-      args: { filePath },
-      flags: { channel: inputChannelId, input, confirm },
-    } = this.parse(UploadVideoCommand)
-
-    // Basic file validation
-    if (!fs.existsSync(filePath)) {
-      this.error('File does not exist under provided path!', { exit: ExitCodes.FileNotFound })
-    }
-
-    const { size: fileSize } = fs.statSync(filePath)
-    if (fileSize > MAX_FILE_SIZE) {
-      this.error(`File size too large! Max. file size is: ${(MAX_FILE_SIZE / 1024 / 1024).toFixed(2)} MB`)
-    }
-
-    const videoMetadata = await this.getVideoMetadata(filePath)
-    this.log('Video media file parameters established:', { ...(videoMetadata || {}), size: fileSize })
-
-    // Check if any providers are available
-    if (!(await this.getApi().isAnyProviderAvailable())) {
-      this.error('No active storage providers available! Try again later...', {
-        exit: ExitCodes.ActionCurrentlyUnavailable,
-      })
-    }
-
-    // Start by prompting for a channel to make sure user has one available
-    let channelId: number
-    if (inputChannelId === undefined) {
-      channelId = await this.promptForEntityId(
-        'Select a channel to publish the video under',
-        'Channel',
-        'handle',
-        memberId
-      )
-    } else {
-      await this.getEntity(inputChannelId, 'Channel', memberId) // Validates if exists and belongs to member
-      channelId = inputChannelId
-    }
-
-    // Calculate hash and create content id
-    const contentId = ContentId.generate(this.getTypesRegistry())
-    const ipfsCid = await this.calculateFileIpfsHash(filePath, fileSize)
-
-    this.log('Video identification established:', {
-      contentId: contentId.toString(),
-      encodedContentId: contentId.encode(),
-      ipfsHash: ipfsCid,
-    })
-
-    // Send dataDirectory.addContent extrinsic
-    await this.sendAndFollowNamedTx(account, 'dataDirectory', 'addContent', [
-      memberId,
-      contentId,
-      DATA_OBJECT_TYPE_ID,
-      fileSize,
-      ipfsCid,
-    ])
-
-    const dataObject = await this.getApi().dataByContentId(contentId)
-    if (!dataObject) {
-      this.error('Data object could not be retrieved from chain', { exit: ExitCodes.ApiError })
-    }
-
-    this.log('Data object:', dataObject.toJSON())
-
-    // Get storage provider identity
-    const storageProviderId = dataObject.liaison.toNumber()
-    const ipnsIdentity = await this.getApi().ipnsIdentity(storageProviderId)
-
-    if (!ipnsIdentity) {
-      this.error('Storage provider IPNS identity could not be determined', { exit: ExitCodes.ApiError })
-    }
-
-    // Resolve upload url and upload the video
-    const uploadUrl = await this.getUploadUrl(ipnsIdentity, storageProviderId, contentId)
-    this.log('Resolved upload url:', uploadUrl)
-
-    await this.uploadVideo(filePath, fileSize, uploadUrl)
-
-    // No input, create prompting helpers
-    const videoInput = input
-      ? await this.getVideoInputFromFile(input, channelId, fileSize, contentId, videoMetadata)
-      : await this.promptForVideoInput(channelId, fileSize, contentId, videoMetadata)
-
-    this.jsonPrettyPrint(JSON.stringify(videoInput))
-
-    if (!confirm) {
-      await this.requireConfirmation('Do you confirm the provided input?', true)
-    }
-
-    // Parse inputs into operations and send final extrinsic
-    const inputParser = InputParser.createWithKnownSchemas(this.getOriginalApi(), [
-      {
-        className: 'Video',
-        entries: [videoInput],
-      },
-    ])
-    const operations = await inputParser.getEntityBatchOperations()
-    await this.sendAndFollowNamedTx(account, 'contentDirectory', 'transaction', [actor, operations])
-  }
-}

+ 1 - 7
cli/src/helpers/JsonSchemaPrompt.ts

@@ -4,8 +4,6 @@ import _ from 'lodash'
 import RefParser, { JSONSchema } from '@apidevtools/json-schema-ref-parser'
 import chalk from 'chalk'
 import { BOOL_PROMPT_OPTIONS } from './prompting'
-import { getSchemasLocation } from '@joystream/cd-schemas'
-import path from 'path'
 
 type CustomPromptMethod = () => Promise<any>
 type CustomPrompt = DistinctQuestion | CustomPromptMethod | { $item: CustomPrompt } | 'skip'
@@ -14,10 +12,6 @@ type CustomPrompt = DistinctQuestion | CustomPromptMethod | { $item: CustomPromp
 // eslint-disable-next-line @typescript-eslint/ban-types
 export type JsonSchemaCustomPrompts<T = Record<string, unknown>> = [keyof T | (string & {}) | RegExp, CustomPrompt][]
 
-// Default schema path for resolving refs
-// TODO: Would be nice to skip the filename part (but without it it doesn't work)
-const DEFAULT_SCHEMA_PATH = getSchemasLocation('entities') + path.sep
-
 export class JsonSchemaPrompter<JsonResult> {
   schema: JSONSchema
   schemaPath: string
@@ -29,7 +23,7 @@ export class JsonSchemaPrompter<JsonResult> {
     schema: JSONSchema,
     defaults?: Partial<JsonResult>,
     customPrompts?: JsonSchemaCustomPrompts,
-    schemaPath: string = DEFAULT_SCHEMA_PATH
+    schemaPath: string = ""
   ) {
     this.customPropmpts = customPrompts
     this.schema = schema

+ 0 - 159
content-metadata-protobuf/compiled/proto/Channel_pb.d.ts

@@ -83,162 +83,3 @@ export namespace ChannelCategoryMetadata {
   }
 }
 
-export class Upload extends jspb.Message {
-  hasContentId(): boolean;
-  clearContentId(): void;
-  getContentId(): number | undefined;
-  setContentId(value: number): void;
-
-  hasTypeId(): boolean;
-  clearTypeId(): void;
-  getTypeId(): number | undefined;
-  setTypeId(value: number): void;
-
-  hasSize(): boolean;
-  clearSize(): void;
-  getSize(): number | undefined;
-  setSize(value: number): void;
-
-  hasIpfsContentId(): boolean;
-  clearIpfsContentId(): void;
-  getIpfsContentId(): Uint8Array | string;
-  getIpfsContentId_asU8(): Uint8Array;
-  getIpfsContentId_asB64(): string;
-  setIpfsContentId(value: Uint8Array | string): void;
-
-  serializeBinary(): Uint8Array;
-  toObject(includeInstance?: boolean): Upload.AsObject;
-  static toObject(includeInstance: boolean, msg: Upload): Upload.AsObject;
-  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
-  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
-  static serializeBinaryToWriter(message: Upload, writer: jspb.BinaryWriter): void;
-  static deserializeBinary(bytes: Uint8Array): Upload;
-  static deserializeBinaryFromReader(message: Upload, reader: jspb.BinaryReader): Upload;
-}
-
-export namespace Upload {
-  export type AsObject = {
-    contentId?: number,
-    typeId?: number,
-    size?: number,
-    ipfsContentId: Uint8Array | string,
-  }
-}
-
-export class Urls extends jspb.Message {
-  clearUrlsList(): void;
-  getUrlsList(): Array<Uint8Array | string>;
-  getUrlsList_asU8(): Array<Uint8Array>;
-  getUrlsList_asB64(): Array<string>;
-  setUrlsList(value: Array<Uint8Array | string>): void;
-  addUrls(value: Uint8Array | string, index?: number): Uint8Array | string;
-
-  serializeBinary(): Uint8Array;
-  toObject(includeInstance?: boolean): Urls.AsObject;
-  static toObject(includeInstance: boolean, msg: Urls): Urls.AsObject;
-  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
-  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
-  static serializeBinaryToWriter(message: Urls, writer: jspb.BinaryWriter): void;
-  static deserializeBinary(bytes: Uint8Array): Urls;
-  static deserializeBinaryFromReader(message: Urls, reader: jspb.BinaryReader): Urls;
-}
-
-export namespace Urls {
-  export type AsObject = {
-    urlsList: Array<Uint8Array | string>,
-  }
-}
-
-export class NewAssetMetadata extends jspb.Message {
-  hasUpload(): boolean;
-  clearUpload(): void;
-  getUpload(): Upload | undefined;
-  setUpload(value?: Upload): void;
-
-  hasUrls(): boolean;
-  clearUrls(): void;
-  getUrls(): Urls | undefined;
-  setUrls(value?: Urls): void;
-
-  getNewAssetCase(): NewAssetMetadata.NewAssetCase;
-  serializeBinary(): Uint8Array;
-  toObject(includeInstance?: boolean): NewAssetMetadata.AsObject;
-  static toObject(includeInstance: boolean, msg: NewAssetMetadata): NewAssetMetadata.AsObject;
-  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
-  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
-  static serializeBinaryToWriter(message: NewAssetMetadata, writer: jspb.BinaryWriter): void;
-  static deserializeBinary(bytes: Uint8Array): NewAssetMetadata;
-  static deserializeBinaryFromReader(message: NewAssetMetadata, reader: jspb.BinaryReader): NewAssetMetadata;
-}
-
-export namespace NewAssetMetadata {
-  export type AsObject = {
-    upload?: Upload.AsObject,
-    urls?: Urls.AsObject,
-  }
-
-  export enum NewAssetCase {
-    NEW_ASSET_NOT_SET = 0,
-    UPLOAD = 1,
-    URLS = 2,
-  }
-}
-
-export class AssetsMetadata extends jspb.Message {
-  clearNewAssetList(): void;
-  getNewAssetList(): Array<NewAssetMetadata>;
-  setNewAssetList(value: Array<NewAssetMetadata>): void;
-  addNewAsset(value?: NewAssetMetadata, index?: number): NewAssetMetadata;
-
-  serializeBinary(): Uint8Array;
-  toObject(includeInstance?: boolean): AssetsMetadata.AsObject;
-  static toObject(includeInstance: boolean, msg: AssetsMetadata): AssetsMetadata.AsObject;
-  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
-  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
-  static serializeBinaryToWriter(message: AssetsMetadata, writer: jspb.BinaryWriter): void;
-  static deserializeBinary(bytes: Uint8Array): AssetsMetadata;
-  static deserializeBinaryFromReader(message: AssetsMetadata, reader: jspb.BinaryReader): AssetsMetadata;
-}
-
-export namespace AssetsMetadata {
-  export type AsObject = {
-    newAssetList: Array<NewAssetMetadata.AsObject>,
-  }
-}
-
-export class ChannelCreationParametersMetadata extends jspb.Message {
-  hasAssets(): boolean;
-  clearAssets(): void;
-  getAssets(): AssetsMetadata | undefined;
-  setAssets(value?: AssetsMetadata): void;
-
-  hasMeta(): boolean;
-  clearMeta(): void;
-  getMeta(): ChannelMetadata | undefined;
-  setMeta(value?: ChannelMetadata): void;
-
-  hasRewardAccount(): boolean;
-  clearRewardAccount(): void;
-  getRewardAccount(): Uint8Array | string;
-  getRewardAccount_asU8(): Uint8Array;
-  getRewardAccount_asB64(): string;
-  setRewardAccount(value: Uint8Array | string): void;
-
-  serializeBinary(): Uint8Array;
-  toObject(includeInstance?: boolean): ChannelCreationParametersMetadata.AsObject;
-  static toObject(includeInstance: boolean, msg: ChannelCreationParametersMetadata): ChannelCreationParametersMetadata.AsObject;
-  static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
-  static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
-  static serializeBinaryToWriter(message: ChannelCreationParametersMetadata, writer: jspb.BinaryWriter): void;
-  static deserializeBinary(bytes: Uint8Array): ChannelCreationParametersMetadata;
-  static deserializeBinaryFromReader(message: ChannelCreationParametersMetadata, reader: jspb.BinaryReader): ChannelCreationParametersMetadata;
-}
-
-export namespace ChannelCreationParametersMetadata {
-  export type AsObject = {
-    assets?: AssetsMetadata.AsObject,
-    meta?: ChannelMetadata.AsObject,
-    rewardAccount: Uint8Array | string,
-  }
-}
-

+ 0 - 1160
content-metadata-protobuf/compiled/proto/Channel_pb.js

@@ -11,13 +11,8 @@ var jspb = require('google-protobuf');
 var goog = jspb;
 var global = Function('return this')();
 
-goog.exportSymbol('proto.muthu.other.AssetsMetadata', null, global);
 goog.exportSymbol('proto.muthu.other.ChannelCategoryMetadata', null, global);
-goog.exportSymbol('proto.muthu.other.ChannelCreationParametersMetadata', null, global);
 goog.exportSymbol('proto.muthu.other.ChannelMetadata', null, global);
-goog.exportSymbol('proto.muthu.other.NewAssetMetadata', null, global);
-goog.exportSymbol('proto.muthu.other.Upload', null, global);
-goog.exportSymbol('proto.muthu.other.Urls', null, global);
 
 /**
  * Generated by JsPbCodeGenerator.
@@ -578,1159 +573,4 @@ proto.muthu.other.ChannelCategoryMetadata.prototype.hasName = function() {
 };
 
 
-
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.muthu.other.Upload = function(opt_data) {
-  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.muthu.other.Upload, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
-  proto.muthu.other.Upload.displayName = 'proto.muthu.other.Upload';
-}
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto suitable for use in Soy templates.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
- * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
- *     for transitional soy proto support: http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.muthu.other.Upload.prototype.toObject = function(opt_includeInstance) {
-  return proto.muthu.other.Upload.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Whether to include the JSPB
- *     instance for transitional soy proto support:
- *     http://goto/soy-param-migration
- * @param {!proto.muthu.other.Upload} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.Upload.toObject = function(includeInstance, msg) {
-  var f, obj = {
-    contentId: jspb.Message.getField(msg, 1),
-    typeId: jspb.Message.getField(msg, 2),
-    size: jspb.Message.getField(msg, 3),
-    ipfsContentId: msg.getIpfsContentId_asB64()
-  };
-
-  if (includeInstance) {
-    obj.$jspbMessageInstance = msg;
-  }
-  return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.muthu.other.Upload}
- */
-proto.muthu.other.Upload.deserializeBinary = function(bytes) {
-  var reader = new jspb.BinaryReader(bytes);
-  var msg = new proto.muthu.other.Upload;
-  return proto.muthu.other.Upload.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.muthu.other.Upload} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.muthu.other.Upload}
- */
-proto.muthu.other.Upload.deserializeBinaryFromReader = function(msg, reader) {
-  while (reader.nextField()) {
-    if (reader.isEndGroup()) {
-      break;
-    }
-    var field = reader.getFieldNumber();
-    switch (field) {
-    case 1:
-      var value = /** @type {number} */ (reader.readUint64());
-      msg.setContentId(value);
-      break;
-    case 2:
-      var value = /** @type {number} */ (reader.readUint64());
-      msg.setTypeId(value);
-      break;
-    case 3:
-      var value = /** @type {number} */ (reader.readUint64());
-      msg.setSize(value);
-      break;
-    case 4:
-      var value = /** @type {!Uint8Array} */ (reader.readBytes());
-      msg.setIpfsContentId(value);
-      break;
-    default:
-      reader.skipField();
-      break;
-    }
-  }
-  return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.muthu.other.Upload.prototype.serializeBinary = function() {
-  var writer = new jspb.BinaryWriter();
-  proto.muthu.other.Upload.serializeBinaryToWriter(this, writer);
-  return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.muthu.other.Upload} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.Upload.serializeBinaryToWriter = function(message, writer) {
-  var f = undefined;
-  f = /** @type {number} */ (jspb.Message.getField(message, 1));
-  if (f != null) {
-    writer.writeUint64(
-      1,
-      f
-    );
-  }
-  f = /** @type {number} */ (jspb.Message.getField(message, 2));
-  if (f != null) {
-    writer.writeUint64(
-      2,
-      f
-    );
-  }
-  f = /** @type {number} */ (jspb.Message.getField(message, 3));
-  if (f != null) {
-    writer.writeUint64(
-      3,
-      f
-    );
-  }
-  f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 4));
-  if (f != null) {
-    writer.writeBytes(
-      4,
-      f
-    );
-  }
-};
-
-
-/**
- * optional uint64 content_id = 1;
- * @return {number}
- */
-proto.muthu.other.Upload.prototype.getContentId = function() {
-  return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 1, 0));
-};
-
-
-/** @param {number} value */
-proto.muthu.other.Upload.prototype.setContentId = function(value) {
-  jspb.Message.setField(this, 1, value);
-};
-
-
-proto.muthu.other.Upload.prototype.clearContentId = function() {
-  jspb.Message.setField(this, 1, undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.Upload.prototype.hasContentId = function() {
-  return jspb.Message.getField(this, 1) != null;
-};
-
-
-/**
- * optional uint64 type_id = 2;
- * @return {number}
- */
-proto.muthu.other.Upload.prototype.getTypeId = function() {
-  return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 2, 0));
-};
-
-
-/** @param {number} value */
-proto.muthu.other.Upload.prototype.setTypeId = function(value) {
-  jspb.Message.setField(this, 2, value);
-};
-
-
-proto.muthu.other.Upload.prototype.clearTypeId = function() {
-  jspb.Message.setField(this, 2, undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.Upload.prototype.hasTypeId = function() {
-  return jspb.Message.getField(this, 2) != null;
-};
-
-
-/**
- * optional uint64 size = 3;
- * @return {number}
- */
-proto.muthu.other.Upload.prototype.getSize = function() {
-  return /** @type {number} */ (jspb.Message.getFieldWithDefault(this, 3, 0));
-};
-
-
-/** @param {number} value */
-proto.muthu.other.Upload.prototype.setSize = function(value) {
-  jspb.Message.setField(this, 3, value);
-};
-
-
-proto.muthu.other.Upload.prototype.clearSize = function() {
-  jspb.Message.setField(this, 3, undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.Upload.prototype.hasSize = function() {
-  return jspb.Message.getField(this, 3) != null;
-};
-
-
-/**
- * optional bytes ipfs_content_id = 4;
- * @return {!(string|Uint8Array)}
- */
-proto.muthu.other.Upload.prototype.getIpfsContentId = function() {
-  return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 4, ""));
-};
-
-
-/**
- * optional bytes ipfs_content_id = 4;
- * This is a type-conversion wrapper around `getIpfsContentId()`
- * @return {string}
- */
-proto.muthu.other.Upload.prototype.getIpfsContentId_asB64 = function() {
-  return /** @type {string} */ (jspb.Message.bytesAsB64(
-      this.getIpfsContentId()));
-};
-
-
-/**
- * optional bytes ipfs_content_id = 4;
- * Note that Uint8Array is not supported on all browsers.
- * @see http://caniuse.com/Uint8Array
- * This is a type-conversion wrapper around `getIpfsContentId()`
- * @return {!Uint8Array}
- */
-proto.muthu.other.Upload.prototype.getIpfsContentId_asU8 = function() {
-  return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
-      this.getIpfsContentId()));
-};
-
-
-/** @param {!(string|Uint8Array)} value */
-proto.muthu.other.Upload.prototype.setIpfsContentId = function(value) {
-  jspb.Message.setField(this, 4, value);
-};
-
-
-proto.muthu.other.Upload.prototype.clearIpfsContentId = function() {
-  jspb.Message.setField(this, 4, undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.Upload.prototype.hasIpfsContentId = function() {
-  return jspb.Message.getField(this, 4) != null;
-};
-
-
-
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.muthu.other.Urls = function(opt_data) {
-  jspb.Message.initialize(this, opt_data, 0, -1, proto.muthu.other.Urls.repeatedFields_, null);
-};
-goog.inherits(proto.muthu.other.Urls, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
-  proto.muthu.other.Urls.displayName = 'proto.muthu.other.Urls';
-}
-/**
- * List of repeated fields within this message type.
- * @private {!Array<number>}
- * @const
- */
-proto.muthu.other.Urls.repeatedFields_ = [1];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto suitable for use in Soy templates.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
- * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
- *     for transitional soy proto support: http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.muthu.other.Urls.prototype.toObject = function(opt_includeInstance) {
-  return proto.muthu.other.Urls.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Whether to include the JSPB
- *     instance for transitional soy proto support:
- *     http://goto/soy-param-migration
- * @param {!proto.muthu.other.Urls} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.Urls.toObject = function(includeInstance, msg) {
-  var f, obj = {
-    urlsList: msg.getUrlsList_asB64()
-  };
-
-  if (includeInstance) {
-    obj.$jspbMessageInstance = msg;
-  }
-  return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.muthu.other.Urls}
- */
-proto.muthu.other.Urls.deserializeBinary = function(bytes) {
-  var reader = new jspb.BinaryReader(bytes);
-  var msg = new proto.muthu.other.Urls;
-  return proto.muthu.other.Urls.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.muthu.other.Urls} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.muthu.other.Urls}
- */
-proto.muthu.other.Urls.deserializeBinaryFromReader = function(msg, reader) {
-  while (reader.nextField()) {
-    if (reader.isEndGroup()) {
-      break;
-    }
-    var field = reader.getFieldNumber();
-    switch (field) {
-    case 1:
-      var value = /** @type {!Uint8Array} */ (reader.readBytes());
-      msg.addUrls(value);
-      break;
-    default:
-      reader.skipField();
-      break;
-    }
-  }
-  return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.muthu.other.Urls.prototype.serializeBinary = function() {
-  var writer = new jspb.BinaryWriter();
-  proto.muthu.other.Urls.serializeBinaryToWriter(this, writer);
-  return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.muthu.other.Urls} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.Urls.serializeBinaryToWriter = function(message, writer) {
-  var f = undefined;
-  f = message.getUrlsList_asU8();
-  if (f.length > 0) {
-    writer.writeRepeatedBytes(
-      1,
-      f
-    );
-  }
-};
-
-
-/**
- * repeated bytes urls = 1;
- * @return {!(Array<!Uint8Array>|Array<string>)}
- */
-proto.muthu.other.Urls.prototype.getUrlsList = function() {
-  return /** @type {!(Array<!Uint8Array>|Array<string>)} */ (jspb.Message.getRepeatedField(this, 1));
-};
-
-
-/**
- * repeated bytes urls = 1;
- * This is a type-conversion wrapper around `getUrlsList()`
- * @return {!Array<string>}
- */
-proto.muthu.other.Urls.prototype.getUrlsList_asB64 = function() {
-  return /** @type {!Array<string>} */ (jspb.Message.bytesListAsB64(
-      this.getUrlsList()));
-};
-
-
-/**
- * repeated bytes urls = 1;
- * Note that Uint8Array is not supported on all browsers.
- * @see http://caniuse.com/Uint8Array
- * This is a type-conversion wrapper around `getUrlsList()`
- * @return {!Array<!Uint8Array>}
- */
-proto.muthu.other.Urls.prototype.getUrlsList_asU8 = function() {
-  return /** @type {!Array<!Uint8Array>} */ (jspb.Message.bytesListAsU8(
-      this.getUrlsList()));
-};
-
-
-/** @param {!(Array<!Uint8Array>|Array<string>)} value */
-proto.muthu.other.Urls.prototype.setUrlsList = function(value) {
-  jspb.Message.setField(this, 1, value || []);
-};
-
-
-/**
- * @param {!(string|Uint8Array)} value
- * @param {number=} opt_index
- */
-proto.muthu.other.Urls.prototype.addUrls = function(value, opt_index) {
-  jspb.Message.addToRepeatedField(this, 1, value, opt_index);
-};
-
-
-proto.muthu.other.Urls.prototype.clearUrlsList = function() {
-  this.setUrlsList([]);
-};
-
-
-
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.muthu.other.NewAssetMetadata = function(opt_data) {
-  jspb.Message.initialize(this, opt_data, 0, -1, null, proto.muthu.other.NewAssetMetadata.oneofGroups_);
-};
-goog.inherits(proto.muthu.other.NewAssetMetadata, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
-  proto.muthu.other.NewAssetMetadata.displayName = 'proto.muthu.other.NewAssetMetadata';
-}
-/**
- * Oneof group definitions for this message. Each group defines the field
- * numbers belonging to that group. When of these fields' value is set, all
- * other fields in the group are cleared. During deserialization, if multiple
- * fields are encountered for a group, only the last value seen will be kept.
- * @private {!Array<!Array<number>>}
- * @const
- */
-proto.muthu.other.NewAssetMetadata.oneofGroups_ = [[1,2]];
-
-/**
- * @enum {number}
- */
-proto.muthu.other.NewAssetMetadata.NewAssetCase = {
-  NEW_ASSET_NOT_SET: 0,
-  UPLOAD: 1,
-  URLS: 2
-};
-
-/**
- * @return {proto.muthu.other.NewAssetMetadata.NewAssetCase}
- */
-proto.muthu.other.NewAssetMetadata.prototype.getNewAssetCase = function() {
-  return /** @type {proto.muthu.other.NewAssetMetadata.NewAssetCase} */(jspb.Message.computeOneofCase(this, proto.muthu.other.NewAssetMetadata.oneofGroups_[0]));
-};
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto suitable for use in Soy templates.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
- * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
- *     for transitional soy proto support: http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.muthu.other.NewAssetMetadata.prototype.toObject = function(opt_includeInstance) {
-  return proto.muthu.other.NewAssetMetadata.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Whether to include the JSPB
- *     instance for transitional soy proto support:
- *     http://goto/soy-param-migration
- * @param {!proto.muthu.other.NewAssetMetadata} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.NewAssetMetadata.toObject = function(includeInstance, msg) {
-  var f, obj = {
-    upload: (f = msg.getUpload()) && proto.muthu.other.Upload.toObject(includeInstance, f),
-    urls: (f = msg.getUrls()) && proto.muthu.other.Urls.toObject(includeInstance, f)
-  };
-
-  if (includeInstance) {
-    obj.$jspbMessageInstance = msg;
-  }
-  return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.muthu.other.NewAssetMetadata}
- */
-proto.muthu.other.NewAssetMetadata.deserializeBinary = function(bytes) {
-  var reader = new jspb.BinaryReader(bytes);
-  var msg = new proto.muthu.other.NewAssetMetadata;
-  return proto.muthu.other.NewAssetMetadata.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.muthu.other.NewAssetMetadata} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.muthu.other.NewAssetMetadata}
- */
-proto.muthu.other.NewAssetMetadata.deserializeBinaryFromReader = function(msg, reader) {
-  while (reader.nextField()) {
-    if (reader.isEndGroup()) {
-      break;
-    }
-    var field = reader.getFieldNumber();
-    switch (field) {
-    case 1:
-      var value = new proto.muthu.other.Upload;
-      reader.readMessage(value,proto.muthu.other.Upload.deserializeBinaryFromReader);
-      msg.setUpload(value);
-      break;
-    case 2:
-      var value = new proto.muthu.other.Urls;
-      reader.readMessage(value,proto.muthu.other.Urls.deserializeBinaryFromReader);
-      msg.setUrls(value);
-      break;
-    default:
-      reader.skipField();
-      break;
-    }
-  }
-  return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.muthu.other.NewAssetMetadata.prototype.serializeBinary = function() {
-  var writer = new jspb.BinaryWriter();
-  proto.muthu.other.NewAssetMetadata.serializeBinaryToWriter(this, writer);
-  return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.muthu.other.NewAssetMetadata} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.NewAssetMetadata.serializeBinaryToWriter = function(message, writer) {
-  var f = undefined;
-  f = message.getUpload();
-  if (f != null) {
-    writer.writeMessage(
-      1,
-      f,
-      proto.muthu.other.Upload.serializeBinaryToWriter
-    );
-  }
-  f = message.getUrls();
-  if (f != null) {
-    writer.writeMessage(
-      2,
-      f,
-      proto.muthu.other.Urls.serializeBinaryToWriter
-    );
-  }
-};
-
-
-/**
- * optional Upload upload = 1;
- * @return {?proto.muthu.other.Upload}
- */
-proto.muthu.other.NewAssetMetadata.prototype.getUpload = function() {
-  return /** @type{?proto.muthu.other.Upload} */ (
-    jspb.Message.getWrapperField(this, proto.muthu.other.Upload, 1));
-};
-
-
-/** @param {?proto.muthu.other.Upload|undefined} value */
-proto.muthu.other.NewAssetMetadata.prototype.setUpload = function(value) {
-  jspb.Message.setOneofWrapperField(this, 1, proto.muthu.other.NewAssetMetadata.oneofGroups_[0], value);
-};
-
-
-proto.muthu.other.NewAssetMetadata.prototype.clearUpload = function() {
-  this.setUpload(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.NewAssetMetadata.prototype.hasUpload = function() {
-  return jspb.Message.getField(this, 1) != null;
-};
-
-
-/**
- * optional Urls urls = 2;
- * @return {?proto.muthu.other.Urls}
- */
-proto.muthu.other.NewAssetMetadata.prototype.getUrls = function() {
-  return /** @type{?proto.muthu.other.Urls} */ (
-    jspb.Message.getWrapperField(this, proto.muthu.other.Urls, 2));
-};
-
-
-/** @param {?proto.muthu.other.Urls|undefined} value */
-proto.muthu.other.NewAssetMetadata.prototype.setUrls = function(value) {
-  jspb.Message.setOneofWrapperField(this, 2, proto.muthu.other.NewAssetMetadata.oneofGroups_[0], value);
-};
-
-
-proto.muthu.other.NewAssetMetadata.prototype.clearUrls = function() {
-  this.setUrls(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.NewAssetMetadata.prototype.hasUrls = function() {
-  return jspb.Message.getField(this, 2) != null;
-};
-
-
-
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.muthu.other.AssetsMetadata = function(opt_data) {
-  jspb.Message.initialize(this, opt_data, 0, -1, proto.muthu.other.AssetsMetadata.repeatedFields_, null);
-};
-goog.inherits(proto.muthu.other.AssetsMetadata, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
-  proto.muthu.other.AssetsMetadata.displayName = 'proto.muthu.other.AssetsMetadata';
-}
-/**
- * List of repeated fields within this message type.
- * @private {!Array<number>}
- * @const
- */
-proto.muthu.other.AssetsMetadata.repeatedFields_ = [1];
-
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto suitable for use in Soy templates.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
- * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
- *     for transitional soy proto support: http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.muthu.other.AssetsMetadata.prototype.toObject = function(opt_includeInstance) {
-  return proto.muthu.other.AssetsMetadata.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Whether to include the JSPB
- *     instance for transitional soy proto support:
- *     http://goto/soy-param-migration
- * @param {!proto.muthu.other.AssetsMetadata} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.AssetsMetadata.toObject = function(includeInstance, msg) {
-  var f, obj = {
-    newAssetList: jspb.Message.toObjectList(msg.getNewAssetList(),
-    proto.muthu.other.NewAssetMetadata.toObject, includeInstance)
-  };
-
-  if (includeInstance) {
-    obj.$jspbMessageInstance = msg;
-  }
-  return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.muthu.other.AssetsMetadata}
- */
-proto.muthu.other.AssetsMetadata.deserializeBinary = function(bytes) {
-  var reader = new jspb.BinaryReader(bytes);
-  var msg = new proto.muthu.other.AssetsMetadata;
-  return proto.muthu.other.AssetsMetadata.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.muthu.other.AssetsMetadata} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.muthu.other.AssetsMetadata}
- */
-proto.muthu.other.AssetsMetadata.deserializeBinaryFromReader = function(msg, reader) {
-  while (reader.nextField()) {
-    if (reader.isEndGroup()) {
-      break;
-    }
-    var field = reader.getFieldNumber();
-    switch (field) {
-    case 1:
-      var value = new proto.muthu.other.NewAssetMetadata;
-      reader.readMessage(value,proto.muthu.other.NewAssetMetadata.deserializeBinaryFromReader);
-      msg.addNewAsset(value);
-      break;
-    default:
-      reader.skipField();
-      break;
-    }
-  }
-  return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.muthu.other.AssetsMetadata.prototype.serializeBinary = function() {
-  var writer = new jspb.BinaryWriter();
-  proto.muthu.other.AssetsMetadata.serializeBinaryToWriter(this, writer);
-  return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.muthu.other.AssetsMetadata} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.AssetsMetadata.serializeBinaryToWriter = function(message, writer) {
-  var f = undefined;
-  f = message.getNewAssetList();
-  if (f.length > 0) {
-    writer.writeRepeatedMessage(
-      1,
-      f,
-      proto.muthu.other.NewAssetMetadata.serializeBinaryToWriter
-    );
-  }
-};
-
-
-/**
- * repeated NewAssetMetadata new_asset = 1;
- * @return {!Array<!proto.muthu.other.NewAssetMetadata>}
- */
-proto.muthu.other.AssetsMetadata.prototype.getNewAssetList = function() {
-  return /** @type{!Array<!proto.muthu.other.NewAssetMetadata>} */ (
-    jspb.Message.getRepeatedWrapperField(this, proto.muthu.other.NewAssetMetadata, 1));
-};
-
-
-/** @param {!Array<!proto.muthu.other.NewAssetMetadata>} value */
-proto.muthu.other.AssetsMetadata.prototype.setNewAssetList = function(value) {
-  jspb.Message.setRepeatedWrapperField(this, 1, value);
-};
-
-
-/**
- * @param {!proto.muthu.other.NewAssetMetadata=} opt_value
- * @param {number=} opt_index
- * @return {!proto.muthu.other.NewAssetMetadata}
- */
-proto.muthu.other.AssetsMetadata.prototype.addNewAsset = function(opt_value, opt_index) {
-  return jspb.Message.addToRepeatedWrapperField(this, 1, opt_value, proto.muthu.other.NewAssetMetadata, opt_index);
-};
-
-
-proto.muthu.other.AssetsMetadata.prototype.clearNewAssetList = function() {
-  this.setNewAssetList([]);
-};
-
-
-
-/**
- * Generated by JsPbCodeGenerator.
- * @param {Array=} opt_data Optional initial data array, typically from a
- * server response, or constructed directly in Javascript. The array is used
- * in place and becomes part of the constructed object. It is not cloned.
- * If no data is provided, the constructed object will be empty, but still
- * valid.
- * @extends {jspb.Message}
- * @constructor
- */
-proto.muthu.other.ChannelCreationParametersMetadata = function(opt_data) {
-  jspb.Message.initialize(this, opt_data, 0, -1, null, null);
-};
-goog.inherits(proto.muthu.other.ChannelCreationParametersMetadata, jspb.Message);
-if (goog.DEBUG && !COMPILED) {
-  proto.muthu.other.ChannelCreationParametersMetadata.displayName = 'proto.muthu.other.ChannelCreationParametersMetadata';
-}
-
-
-if (jspb.Message.GENERATE_TO_OBJECT) {
-/**
- * Creates an object representation of this proto suitable for use in Soy templates.
- * Field names that are reserved in JavaScript and will be renamed to pb_name.
- * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
- * For the list of reserved names please see:
- *     com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
- * @param {boolean=} opt_includeInstance Whether to include the JSPB instance
- *     for transitional soy proto support: http://goto/soy-param-migration
- * @return {!Object}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.toObject = function(opt_includeInstance) {
-  return proto.muthu.other.ChannelCreationParametersMetadata.toObject(opt_includeInstance, this);
-};
-
-
-/**
- * Static version of the {@see toObject} method.
- * @param {boolean|undefined} includeInstance Whether to include the JSPB
- *     instance for transitional soy proto support:
- *     http://goto/soy-param-migration
- * @param {!proto.muthu.other.ChannelCreationParametersMetadata} msg The msg instance to transform.
- * @return {!Object}
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.ChannelCreationParametersMetadata.toObject = function(includeInstance, msg) {
-  var f, obj = {
-    assets: (f = msg.getAssets()) && proto.muthu.other.AssetsMetadata.toObject(includeInstance, f),
-    meta: (f = msg.getMeta()) && proto.muthu.other.ChannelMetadata.toObject(includeInstance, f),
-    rewardAccount: msg.getRewardAccount_asB64()
-  };
-
-  if (includeInstance) {
-    obj.$jspbMessageInstance = msg;
-  }
-  return obj;
-};
-}
-
-
-/**
- * Deserializes binary data (in protobuf wire format).
- * @param {jspb.ByteSource} bytes The bytes to deserialize.
- * @return {!proto.muthu.other.ChannelCreationParametersMetadata}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.deserializeBinary = function(bytes) {
-  var reader = new jspb.BinaryReader(bytes);
-  var msg = new proto.muthu.other.ChannelCreationParametersMetadata;
-  return proto.muthu.other.ChannelCreationParametersMetadata.deserializeBinaryFromReader(msg, reader);
-};
-
-
-/**
- * Deserializes binary data (in protobuf wire format) from the
- * given reader into the given message object.
- * @param {!proto.muthu.other.ChannelCreationParametersMetadata} msg The message object to deserialize into.
- * @param {!jspb.BinaryReader} reader The BinaryReader to use.
- * @return {!proto.muthu.other.ChannelCreationParametersMetadata}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.deserializeBinaryFromReader = function(msg, reader) {
-  while (reader.nextField()) {
-    if (reader.isEndGroup()) {
-      break;
-    }
-    var field = reader.getFieldNumber();
-    switch (field) {
-    case 1:
-      var value = new proto.muthu.other.AssetsMetadata;
-      reader.readMessage(value,proto.muthu.other.AssetsMetadata.deserializeBinaryFromReader);
-      msg.setAssets(value);
-      break;
-    case 2:
-      var value = new proto.muthu.other.ChannelMetadata;
-      reader.readMessage(value,proto.muthu.other.ChannelMetadata.deserializeBinaryFromReader);
-      msg.setMeta(value);
-      break;
-    case 3:
-      var value = /** @type {!Uint8Array} */ (reader.readBytes());
-      msg.setRewardAccount(value);
-      break;
-    default:
-      reader.skipField();
-      break;
-    }
-  }
-  return msg;
-};
-
-
-/**
- * Serializes the message to binary data (in protobuf wire format).
- * @return {!Uint8Array}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.serializeBinary = function() {
-  var writer = new jspb.BinaryWriter();
-  proto.muthu.other.ChannelCreationParametersMetadata.serializeBinaryToWriter(this, writer);
-  return writer.getResultBuffer();
-};
-
-
-/**
- * Serializes the given message to binary data (in protobuf wire
- * format), writing to the given BinaryWriter.
- * @param {!proto.muthu.other.ChannelCreationParametersMetadata} message
- * @param {!jspb.BinaryWriter} writer
- * @suppress {unusedLocalVariables} f is only used for nested messages
- */
-proto.muthu.other.ChannelCreationParametersMetadata.serializeBinaryToWriter = function(message, writer) {
-  var f = undefined;
-  f = message.getAssets();
-  if (f != null) {
-    writer.writeMessage(
-      1,
-      f,
-      proto.muthu.other.AssetsMetadata.serializeBinaryToWriter
-    );
-  }
-  f = message.getMeta();
-  if (f != null) {
-    writer.writeMessage(
-      2,
-      f,
-      proto.muthu.other.ChannelMetadata.serializeBinaryToWriter
-    );
-  }
-  f = /** @type {!(string|Uint8Array)} */ (jspb.Message.getField(message, 3));
-  if (f != null) {
-    writer.writeBytes(
-      3,
-      f
-    );
-  }
-};
-
-
-/**
- * optional AssetsMetadata assets = 1;
- * @return {?proto.muthu.other.AssetsMetadata}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.getAssets = function() {
-  return /** @type{?proto.muthu.other.AssetsMetadata} */ (
-    jspb.Message.getWrapperField(this, proto.muthu.other.AssetsMetadata, 1));
-};
-
-
-/** @param {?proto.muthu.other.AssetsMetadata|undefined} value */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.setAssets = function(value) {
-  jspb.Message.setWrapperField(this, 1, value);
-};
-
-
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.clearAssets = function() {
-  this.setAssets(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.hasAssets = function() {
-  return jspb.Message.getField(this, 1) != null;
-};
-
-
-/**
- * optional ChannelMetadata meta = 2;
- * @return {?proto.muthu.other.ChannelMetadata}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.getMeta = function() {
-  return /** @type{?proto.muthu.other.ChannelMetadata} */ (
-    jspb.Message.getWrapperField(this, proto.muthu.other.ChannelMetadata, 2));
-};
-
-
-/** @param {?proto.muthu.other.ChannelMetadata|undefined} value */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.setMeta = function(value) {
-  jspb.Message.setWrapperField(this, 2, value);
-};
-
-
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.clearMeta = function() {
-  this.setMeta(undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.hasMeta = function() {
-  return jspb.Message.getField(this, 2) != null;
-};
-
-
-/**
- * optional bytes reward_account = 3;
- * @return {!(string|Uint8Array)}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.getRewardAccount = function() {
-  return /** @type {!(string|Uint8Array)} */ (jspb.Message.getFieldWithDefault(this, 3, ""));
-};
-
-
-/**
- * optional bytes reward_account = 3;
- * This is a type-conversion wrapper around `getRewardAccount()`
- * @return {string}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.getRewardAccount_asB64 = function() {
-  return /** @type {string} */ (jspb.Message.bytesAsB64(
-      this.getRewardAccount()));
-};
-
-
-/**
- * optional bytes reward_account = 3;
- * Note that Uint8Array is not supported on all browsers.
- * @see http://caniuse.com/Uint8Array
- * This is a type-conversion wrapper around `getRewardAccount()`
- * @return {!Uint8Array}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.getRewardAccount_asU8 = function() {
-  return /** @type {!Uint8Array} */ (jspb.Message.bytesAsU8(
-      this.getRewardAccount()));
-};
-
-
-/** @param {!(string|Uint8Array)} value */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.setRewardAccount = function(value) {
-  jspb.Message.setField(this, 3, value);
-};
-
-
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.clearRewardAccount = function() {
-  jspb.Message.setField(this, 3, undefined);
-};
-
-
-/**
- * Returns whether this field is set.
- * @return {!boolean}
- */
-proto.muthu.other.ChannelCreationParametersMetadata.prototype.hasRewardAccount = function() {
-  return jspb.Message.getField(this, 3) != null;
-};
-
-
 goog.object.extend(exports, proto.muthu.other);

+ 0 - 37
content-metadata-protobuf/proto/Channel.proto

@@ -27,41 +27,4 @@ message ChannelMetadata {
 message ChannelCategoryMetadata {
     // Category Name
     optional string name = 1;
-}
-
-/// Content parameters for the asset to be uploaded
-message Upload {    
-    optional uint64 content_id = 1;
-    optional uint64 type_id = 2;
-    optional uint64 size = 3;
-    optional bytes ipfs_content_id = 4;
-}
-
-/// Represents multiple urls
-message Urls {
-    repeated bytes urls = 1;
-}
-
-/// Specifies how a new asset will be provided on creating and updating
-message NewAssetMetadata {
-    oneof new_asset {
-        /// Upload to the storage system
-        Upload upload = 1;
-        /// Multiple url strings pointing at an asset
-        Urls urls = 2;
-    }
-}
-
-/// Represents an array of new assets metadata
-message AssetsMetadata {
-    repeated NewAssetMetadata new_asset = 1;
-}
-
-message ChannelCreationParametersMetadata {
-    /// Assets referenced by metadata
-    optional AssetsMetadata assets = 1;
-    /// Metadata about the channel.
-    optional ChannelMetadata meta = 2;
-    /// Reward account.
-    optional bytes reward_account = 3;
 }

+ 0 - 0
content-metadata-protobuf/src/channel_creation.ts


+ 0 - 77
content-metadata-protobuf/test/channel_creation.ts

@@ -1,77 +0,0 @@
-import { ChannelCreationParametersMetadata, AssetsMetadata, NewAssetMetadata, Urls, ChannelMetadata, Upload } from '../src'
-import { assert } from 'chai'
-
-describe('Channel Creation Metadata', () => {
-  it('Message', () => {
-    const channelCreation = new ChannelCreationParametersMetadata()
-
-    const rewardAccount = "0x0a11c9bcc81f8bd314e80bc51cbfacf30eaeb57e863196a79cccdc8bf4750d21"
-
-    channelCreation.setAssets(new AssetsMetadata())
-    channelCreation.setMeta(new ChannelMetadata())
-    channelCreation.setRewardAccount(rewardAccount)
-
-    assert.deepEqual(channelCreation.toObject(), {
-      assets: {
-        newAssetList: [],
-      },
-      meta: {
-        avatarPhoto: undefined,
-        category: undefined,
-        coverPhoto: undefined,
-        description: undefined,
-        isPublic: undefined,
-        language: undefined,
-        title: undefined
-      },
-      rewardAccount: rewardAccount,
-    })
-  })
-})
-
-describe('Assets Creation Metadata', () => {
-    it('Message', () => {
-      const assetsCreation = new AssetsMetadata()
-  
-      const newAsset = new NewAssetMetadata()
-      assetsCreation.addNewAsset(newAsset)
-  
-      assert.deepEqual(assetsCreation.toObject(), {
-        newAssetList: [{
-          upload: undefined,
-          urls: undefined,
-        }],
-      })
-    })
-})
-
-describe('Urls Creation Metadata', () => {
-  it('Message', () => {
-
-    const urls = new Urls()
-    const url = "https://s2.coinmarketcap.com/static/img/coins/64x64/1.png"
-    urls.addUrls(url) 
-
-    assert.deepEqual(urls.toObject(), {
-      urlsList: [url]
-    })
-  })
-})
-
-describe('Upload Creation Metadata', () => {
-  it('Message', () => {
-
-    const upload = new Upload()
-    upload.setContentId(1)
-    upload.setIpfsContentId("0x01")
-    upload.setSize(10000)
-    upload.setTypeId(5)
-
-    assert.deepEqual(upload.toObject(), {
-      contentId: 1,
-      typeId: 5,
-      size: 10000,
-      ipfsContentId: "0x01",
-    })
-  })
-})