-
Notifications
You must be signed in to change notification settings - Fork 115
/
addStakingAccount.ts
29 lines (27 loc) · 1.16 KB
/
addStakingAccount.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import BN from 'bn.js'
import { flags } from '@oclif/command'
import MembershipsCommandBase from '../../base/MembershipsCommandBase'
export default class MembershipAddStakingAccountCommand extends MembershipsCommandBase {
static description = 'Associate a new staking account with an existing membership.'
static flags = {
address: flags.string({
required: false,
description: 'Address of the staking account to be associated with the member',
}),
withBalance: flags.integer({
required: false,
description: 'Allows optionally specifying required initial balance for the staking account',
}),
fundsSource: flags.string({
required: false,
description:
'If provided, this account will be used as funds source for the purpose of initializing the staking accout',
}),
...MembershipsCommandBase.flags,
}
async run(): Promise<void> {
const { address, withBalance, fundsSource } = this.parse(MembershipAddStakingAccountCommand).flags
const { id, membership } = await this.getRequiredMemberContext()
await this.setupStakingAccount(id, membership, address, new BN(withBalance || 0), fundsSource)
}
}