Browse Source

content-directory-schemas: fix dev init scripts with respect to setting up lead

Mokhtar Naamani 4 years ago
parent
commit
e5881a130c

+ 19 - 26
content-directory-schemas/scripts/devInitAliceLead.ts

@@ -25,7 +25,14 @@ async function main() {
   if (aliceMemberId === undefined) {
   if (aliceMemberId === undefined) {
     console.log('Perparing Alice member account creation extrinsic...')
     console.log('Perparing Alice member account creation extrinsic...')
     aliceMemberId = (await api.query.members.nextMemberId()).toNumber()
     aliceMemberId = (await api.query.members.nextMemberId()).toNumber()
-    extrinsics.push(api.tx.members.buyMembership(0, 'alice', null, null))
+    extrinsics.push(
+      api.tx.members.buyMembership({
+        root_account: ALICE.address,
+        controller_account: ALICE.address,
+        name: 'Alice',
+        handle: 'Alice',
+      })
+    )
   } else {
   } else {
     console.log(`Alice member id found: ${aliceMemberId}...`)
     console.log(`Alice member id found: ${aliceMemberId}...`)
   }
   }
@@ -36,42 +43,28 @@ async function main() {
     const newApplicationId = (await api.query.contentDirectoryWorkingGroup.nextApplicationId()).toNumber()
     const newApplicationId = (await api.query.contentDirectoryWorkingGroup.nextApplicationId()).toNumber()
     // Create curator lead opening
     // Create curator lead opening
     console.log('Perparing Create Curator Lead Opening extrinsic...')
     console.log('Perparing Create Curator Lead Opening extrinsic...')
-    extrinsics.push(
-      sudo(
-        api.tx.contentDirectoryWorkingGroup.addOpening(
-          { CurrentBlock: null }, // activate_at
-          { max_review_period_length: 9999 }, // OpeningPolicyCommitment
-          'api-examples curator opening', // human_readable_text
-          'Leader' // opening_type
-        )
-      )
-    )
+    extrinsics.push(sudo(api.tx.contentDirectoryWorkingGroup.addOpening('init-alice-lead', 'Leader', null, null)))
 
 
     // Apply to lead opening
     // Apply to lead opening
     console.log('Perparing Apply to Curator Lead Opening as Alice extrinsic...')
     console.log('Perparing Apply to Curator Lead Opening as Alice extrinsic...')
     extrinsics.push(
     extrinsics.push(
-      api.tx.contentDirectoryWorkingGroup.applyOnOpening(
-        aliceMemberId, // member id
-        newOpeningId, // opening id
-        ALICE.address, // address
-        null, // opt role stake
-        null, // opt appl. stake
-        'api-examples curator opening appl.' // human_readable_text
-      )
+      api.tx.contentDirectoryWorkingGroup.applyOnOpening({
+        member_id: aliceMemberId,
+        opening_id: newOpeningId,
+        role_account_id: ALICE.address,
+        reward_account_id: ALICE.address,
+        description: 'api-examples curator opening appl.',
+        stake_parameters: null,
+      })
     )
     )
 
 
-    // Begin review period
-    console.log('Perparing Begin Applicant Review extrinsic...')
-    extrinsics.push(sudo(api.tx.contentDirectoryWorkingGroup.beginApplicantReview(newOpeningId)))
-
     // Fill opening
     // Fill opening
     console.log('Perparing Fill Opening extrinsic...')
     console.log('Perparing Fill Opening extrinsic...')
     extrinsics.push(
     extrinsics.push(
       sudo(
       sudo(
         api.tx.contentDirectoryWorkingGroup.fillOpening(
         api.tx.contentDirectoryWorkingGroup.fillOpening(
-          newOpeningId, // opening id
-          api.createType('ApplicationIdSet', [newApplicationId]), // succesful applicants
-          null // reward policy
+          newOpeningId,
+          api.createType('ApplicationIdSet', [newApplicationId])
         )
         )
       )
       )
     )
     )

+ 1 - 1
scripts/run-dev-chain.sh

@@ -10,4 +10,4 @@ yes | cargo run --release -- purge-chain --dev
 
 
 # Run local development chain -
 # Run local development chain -
 # No need to specify `-p joystream-node` it is the default bin crate in the cargo workspace
 # No need to specify `-p joystream-node` it is the default bin crate in the cargo workspace
-cargo run --release -- --dev
+cargo run --release -- --dev --log runtime

+ 2 - 2
types/src/common.ts

@@ -11,6 +11,7 @@ import {
   U8aFixed,
   U8aFixed,
   BTreeSet,
   BTreeSet,
   UInt,
   UInt,
+  Compact,
 } from '@polkadot/types'
 } from '@polkadot/types'
 import { BlockNumber, Hash as PolkadotHash, Moment } from '@polkadot/types/interfaces'
 import { BlockNumber, Hash as PolkadotHash, Moment } from '@polkadot/types/interfaces'
 import { Codec, Constructor, RegistryTypes } from '@polkadot/types/types'
 import { Codec, Constructor, RegistryTypes } from '@polkadot/types/types'
@@ -39,8 +40,7 @@ export function JoyBTreeSet<V extends UInt>(valType: Constructor<V>): Constructo
       const encoded = new Array<Uint8Array>()
       const encoded = new Array<Uint8Array>()
 
 
       if (!isBare) {
       if (!isBare) {
-        const sizeValue = new UInt(this.registry, this.size)
-        encoded.push(sizeValue.toU8a(isBare))
+        encoded.push(Compact.encodeU8a(this.size))
       }
       }
 
 
       const sorted = Array.from(this).sort((a, b) => (a.lt(b) ? -1 : 1))
       const sorted = Array.from(this).sort((a, b) => (a.lt(b) ? -1 : 1))