Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for signer or registered account #7098

Merged
merged 2 commits into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/cli/src/commands/account/show.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { BaseCommand } from '../../base'
import { newCheckBuilder } from '../../utils/checks'
import { printValueMapRecursive } from '../../utils/cli'
import { Args } from '../../utils/command'

Expand All @@ -16,7 +17,9 @@ export default class Show extends BaseCommand {

async run() {
const { args } = this.parse(Show)

await newCheckBuilder(this, args.address)
.isSignerOrAccount()
.runChecks()
const accounts = await this.kit.contracts.getAccounts()
const address = await accounts.signerToAccount(args.address)
printValueMapRecursive(await accounts.getAccountSummary(address))
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/src/utils/checks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ class CheckBuilder {
const res =
(await accounts.isAccount(this.signer!)) || (await accounts.isSigner(this.signer!))
return res
})
}),
`${this.signer} is not a signer or registered as an account. Try authorizing as a signer or running account:register.`
)

isVoteSignerOrAccount = () =>
Expand Down