Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

CLI - ensure it's scriptable #1591

Open Lezek123 opened 3 years ago

Lezek123 commented 3 years ago

Based on https://github.com/Joystream/joystream/issues/1571 and https://github.com/Joystream/joystream/issues/1586

traumschule commented 2 years ago

account:choose was removed in 0334bd3fdb2f65efb1fbc10dc249cbe7a83d87e6. I assume a merge error or was this intentional?

./cli/bin/run account:choose
 ›   Warning: account:choose is not a joystream-cli command.
Did you mean account:create? [y/n]: n

@joystream/cli/0.6.0 linux-x64 node-v14.16.1
giza_staging
Lezek123 commented 2 years ago

This was intentional, since from now on the CLI will try to infer the key based on permissions required to send the associated extrinsic and potentially some additional context provided by the user (ie. memberId, workerId etc.). There will be no need to manually choose a specific key before executing a command.

For example: api.tx.someWorkingGroup.leaveRole extrinsic sent by working-groups:leaveRole command needs to be signed with worker's role key. Based on that and optionally provided workerId (in case multiple worker role keys have been imported) the CLI can infer which key should be used for signing this extrinsic.

traumschule commented 2 years ago

Great news!

# cli/bin/run working-groups:startReviewPeriod 2 -g operationsAlpha                                                                  
Current Group: operationsAlpha

Sending operationsWorkingGroupAlpha.beginApplicantReview extrinsic from jsmoon...
Tx params: [ 2 ]
? Tx fee of 0 will be deduced from you account, do you confirm the transfer? Yes
Extrinsic successful!
Opening 2 status changed to: In Review

~/joystream# cli/bin/run working-groups:fillOpening 2 -g operationsAlpha
Current Group: operationsAlpha
 Select succesful applicants  3: freakstatic,  4: giza1
 Do you want to provide the optional RewardPolicy parameter? Yes
  Providing values for RewardPolicy struct:
    Provide value for amount_per_payout 10000000
    Provide value for next_payment_at_block 22000
    Do you want to provide the optional payout_interval parameter? Yes
      Provide value for u32 600

Sending operationsWorkingGroupAlpha.fillOpening extrinsic from jsmoon...
Tx params: [
  2,
  [ '3', '4' ],
  {
    amount_per_payout: '10,000,000',
    next_payment_at_block: '22,000',
    payout_interval: '600'
  }
]
? Tx fee of 0 will be deduced from you account, do you confirm the transfer? Yes
Extrinsic successful!
Opening 2 successfully filled!
Accepted working group application IDs: 3, 4