forked from aragonone/court-backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stake.js
23 lines (19 loc) · 780 Bytes
/
stake.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const logger = require('@aragonone/court-backend-shared/helpers/logger')('stake')
const command = 'stake'
const describe = 'Stake ANJ tokens for a juror'
const builder = {
juror: { alias: 'j', describe: 'Address of the juror staking the tokens', type: 'string', demand: true },
amount: { alias: 'a', describe: 'Number of ANJ tokens to stake', type: 'string', demand: true },
data: { alias: 'd', describe: 'Optional data that can be used to ask for token activation', type: 'string' },
}
const handlerAsync = async (environment, { juror, amount, data }) => {
const court = await environment.getCourt()
await court.stake(juror, amount, data)
logger.success(`Staked ${amount} ANJ for ${juror}`)
}
module.exports = {
command,
describe,
builder,
handlerAsync
}