|
@@ -1,28 +1,28 @@
|
|
|
import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
|
|
|
-import { IOFlags, getInputJson, } from '../../helpers/InputOutput'
|
|
|
-import { 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';
|
|
|
+import { IOFlags, getInputJson } from '../../helpers/InputOutput'
|
|
|
+import { 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 ChannelUpdateParametersInput = {
|
|
|
- assets: Option<Vec<NewAsset>>,
|
|
|
- new_meta: ChannelMetadata.AsObject,
|
|
|
- reward_account: Option<AccountId>,
|
|
|
+ assets: Option<Vec<NewAsset>>
|
|
|
+ new_meta: ChannelMetadata.AsObject
|
|
|
+ reward_account: Option<AccountId>
|
|
|
}
|
|
|
|
|
|
type ChannelUpdateParameters = {
|
|
|
- assets: Option<Vec<NewAsset>>,
|
|
|
- new_meta: Bytes,
|
|
|
- reward_account: Option<AccountId>,
|
|
|
+ assets: Option<Vec<NewAsset>>
|
|
|
+ new_meta: Bytes
|
|
|
+ reward_account: Option<AccountId>
|
|
|
}
|
|
|
|
|
|
export default class UpdateChannelCommand extends ContentDirectoryCommandBase {
|
|
|
static description = 'Update existing content directory channel.'
|
|
|
static flags = {
|
|
|
context: ContentDirectoryCommandBase.contextFlag,
|
|
|
- input: IOFlags.input
|
|
|
+ input: IOFlags.input,
|
|
|
}
|
|
|
|
|
|
static args = [
|
|
@@ -34,7 +34,6 @@ export default class UpdateChannelCommand extends ContentDirectoryCommandBase {
|
|
|
]
|
|
|
|
|
|
async run() {
|
|
|
-
|
|
|
let { context, input } = this.parse(UpdateChannelCommand).flags
|
|
|
|
|
|
const { channelId } = this.parse(UpdateChannelCommand).args
|
|
@@ -60,7 +59,7 @@ export default class UpdateChannelCommand extends ContentDirectoryCommandBase {
|
|
|
channelMetadata.setAvatarPhoto(channelUpdateParametersInput.new_meta.avatarPhoto!)
|
|
|
channelMetadata.setCategory(channelUpdateParametersInput.new_meta.category!)
|
|
|
|
|
|
- const serialized = channelMetadata.serializeBinary();
|
|
|
+ const serialized = channelMetadata.serializeBinary()
|
|
|
|
|
|
const meta = this.createType('Bytes', '0x' + Buffer.from(serialized).toString('hex'))
|
|
|
|
|
@@ -77,11 +76,14 @@ export default class UpdateChannelCommand extends ContentDirectoryCommandBase {
|
|
|
this.jsonPrettyPrint(JSON.stringify(channelUpdateParameters))
|
|
|
const confirmed = await this.simplePrompt({ type: 'confirm', message: 'Do you confirm the provided input?' })
|
|
|
|
|
|
- if (confirmed) {
|
|
|
+ if (confirmed) {
|
|
|
this.log('Sending the extrinsic...')
|
|
|
|
|
|
- await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateChannel', [actor, channelId, channelUpdateParameters])
|
|
|
-
|
|
|
+ await this.sendAndFollowNamedTx(currentAccount, 'content', 'updateChannel', [
|
|
|
+ actor,
|
|
|
+ channelId,
|
|
|
+ channelUpdateParameters,
|
|
|
+ ])
|
|
|
}
|
|
|
} else {
|
|
|
this.error('Input invalid or was not provided...')
|