forked from celo-org/celo-monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from celo-org/master
master
- Loading branch information
Showing
83 changed files
with
6,823 additions
and
1,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
declare module 'nexmo' | ||
declare module 'express-request-id' | ||
declare module 'bunyan-debug-stream' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { testWithGanache } from '@celo/dev-utils/lib/ganache-test' | ||
import Web3 from 'web3' | ||
import Register from '../account/register' | ||
import SetName from './set-name' | ||
|
||
process.env.NO_SYNCCHECK = 'true' | ||
|
||
testWithGanache('account:set-name cmd', (web3: Web3) => { | ||
test('can set the name of an account', async () => { | ||
const accounts = await web3.eth.getAccounts() | ||
await Register.run(['--from', accounts[0]]) | ||
await SetName.run(['--account', accounts[0], '--name', 'TestName']) | ||
}) | ||
|
||
test('fails if account is not registered', async () => { | ||
const accounts = await web3.eth.getAccounts() | ||
|
||
await expect(SetName.run(['--account', accounts[0], '--name', 'TestName'])).rejects.toThrow( | ||
"Some checks didn't pass!" | ||
) | ||
}) | ||
|
||
test('fails if account is not provided', async () => { | ||
await expect(SetName.run(['--name', 'TestName'])).rejects.toThrow('Missing required flag') | ||
}) | ||
|
||
test('fails if name is not provided', async () => { | ||
const accounts = await web3.eth.getAccounts() | ||
|
||
await expect(SetName.run(['--account', accounts[0]])).rejects.toThrow('Missing required flag') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { flags } from '@oclif/command' | ||
import { BaseCommand } from '../../base' | ||
import { newCheckBuilder } from '../../utils/checks' | ||
import { displaySendTx } from '../../utils/cli' | ||
import { Flags } from '../../utils/command' | ||
|
||
export default class SetName extends BaseCommand { | ||
static description = | ||
"Sets the name of a registered account on-chain. An account's name is an optional human readable identifier" | ||
|
||
static flags = { | ||
...BaseCommand.flags, | ||
account: Flags.address({ required: true }), | ||
name: flags.string({ required: true }), | ||
} | ||
|
||
static args = [] | ||
|
||
static examples = [ | ||
'register --account 0x5409ed021d9299bf6814279a6a1411a7e866a631 --name test-account', | ||
] | ||
|
||
async run() { | ||
const res = this.parse(SetName) | ||
this.kit.defaultAccount = res.flags.account | ||
const accounts = await this.kit.contracts.getAccounts() | ||
|
||
await newCheckBuilder(this) | ||
.isAccount(res.flags.account) | ||
.runChecks() | ||
await displaySendTx('setName', accounts.setName(res.flags.name)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { BaseCommand } from '../../base' | ||
import { printValueMap } from '../../utils/cli' | ||
import { Args } from '../../utils/command' | ||
|
||
export default class Show extends BaseCommand { | ||
static description = | ||
'Show information for an account, including name, authorized vote, validator, and attestation signers, the URL at which account metadata is hosted, the address the account is using with the mobile wallet, and a public key that can be used to encrypt information for the account.' | ||
|
||
static flags = { | ||
...BaseCommand.flags, | ||
} | ||
|
||
static args = [Args.address('address')] | ||
|
||
static examples = ['show 0x5409ed021d9299bf6814279a6a1411a7e866a631'] | ||
|
||
async run() { | ||
const { args } = this.parse(Show) | ||
|
||
const accounts = await this.kit.contracts.getAccounts() | ||
printValueMap(await accounts.getAccountSummary(args.address)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.