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

chore(wallet): add fallback random generated wallet name #1264

Merged
merged 5 commits into from
Dec 6, 2019
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
61 changes: 26 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,36 @@
<p align="center">
<img src="./.github/screenshot.png" width="400px" />
<img src="./.github/screenshot.png" width="350px" />
<h2 align="center">nOS Client</h2>
<p align="center">
<strong>nOS</strong> is a blockchain powered virtual operating system that serves as the gateway to Decentralized Applications.
</p>
<p align="center">
<a href="https://github.com/nos/client/releases/latest">
<img src="https://img.shields.io/github/v/release/nos/client" />
</a>
<a href="https://github.com/nos/client/releases">
<img src="https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-blue.svg" alt="platforms" />
</a>
<a href="https://github.com/nos/client/releases">
<img src="https://img.shields.io/github/license/nos/client?color=yellow">
</a>
<a href="http://makeapullrequest.com">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" />
</a>
<a href="https://github.com/nos/client/releases">
<img src="https://img.shields.io/github/downloads/nos/client/total.svg" />
</a>
</p>
<p align="center">
The <strong>nOS Client</strong> (Developer MVP Release) allows for the development of Decentralized Applications that interact with Smart Contracts in the back-end.
</p>
</p>

<h1 align="center">nOS</h1>
<p align="center">
<a href="https://github.com/nos/client/releases">
<img src="https://img.shields.io/github/release/nos/client/all.svg" />
</a>
<a href="http://makeapullrequest.com">
<img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" />
</a>
<a href="https://discordapp.com/invite/eGFAskm">
<img src="https://img.shields.io/badge/chat-discord-brightgreen.svg" />
</a>
<a href="https://circleci.com/gh/nos/client/tree/develop">
<img src="https://img.shields.io/circleci/project/github/nos/client/develop.svg" />
</a>
<a href="https://renovatebot.com/">
<img src="https://img.shields.io/badge/renovate-enabled-brightgreen.svg" />
</a>
<a href="https://github.com/prettier/prettier">
<img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat" />
</a>
<a href="https://codecov.io/gh/nos/client">
<img src="https://codecov.io/gh/nos/client/branch/develop/graph/badge.svg" />
</a>
</p>
<p align="center">
<strong>nOS</strong> is a blockchain powered virtual operating system that serves as the gateway to Decentralized Applications.
</p>
<p align="center">
The <strong>nOS Client</strong> (Developer MVP Release) allows for the development of Decentralized Applications that interact with Smart Contracts in the back-end.
</p>

---

# Getting Started with nOS

The standalone client installers can be found [here](https://github.com/nos/client/releases). To build manually, the client can be cloned from GitHub and run using the development steps below.

### Commands
> Commands

```bash
# Cloning from Github
Expand Down
35 changes: 31 additions & 4 deletions src/renderer/shared/components/NewWallet/Mnemonic/Mnemonic.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,36 @@ export default class Mnemonic extends React.PureComponent {
setPassphrase: func.isRequired,
coinType: number.isRequired,
setCoinType: func.isRequired,
addAccount: func.isRequired
addAccount: func.isRequired,
walletLabel: string.isRequired,
setWalletLabel: func.isRequired
};

static defaultProps = {
className: null
};

render() {
const { className, account, coinType } = this.props;
const { className, account, coinType, passphrase, walletLabel } = this.props;
const { secretWord } = account;

return (
<form className={classNames(className, styles.mnemonic)} onSubmit={this.confirm}>
<Pill>{secretWord}</Pill>
<LabeledInput
id="walletLabel"
type="text"
label="Enter Wallet Label"
placeholder="Wallet Label"
value={walletLabel}
onChange={this.handleChangeWalletLabel}
/>
<LabeledInput
id="passphrase"
type="password"
label="Enter Passphrase"
placeholder="Passphrase"
value={passphrase}
onChange={this.handleChangePassphrase}
/>
<LabeledSelect
Expand Down Expand Up @@ -68,25 +79,41 @@ export default class Mnemonic extends React.PureComponent {
this.props.setPassphrase(event.target.value);
};

handleChangeWalletLabel = (event) => {
this.props.setWalletLabel(event.target.value);
};

handleChangeCoinType = (coinId) => {
this.props.setCoinType(coinId);
};

cancel = () => {
const { onCancel, setPassphrase } = this.props;
const { onCancel, setPassphrase, setWalletLabel } = this.props;
setPassphrase('');
setWalletLabel('');
onCancel();
};

confirm = () => {
const { account, passphrase, coinType, setPassphrase, addAccount } = this.props;
const {
account,
passphrase,
coinType,
setPassphrase,
setWalletLabel,
addAccount,
walletLabel
} = this.props;

const options = {
coinType,
walletLabel,
isHardware: account.isHardware
};

addAccount({ account, passphrase, options });
setPassphrase('');
setWalletLabel('');
};

getCoinTypes = () => {
Expand Down
1 change: 1 addition & 0 deletions src/renderer/shared/components/NewWallet/Mnemonic/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const mapAddAccountActionsToProps = (actions) => ({
export default compose(
withErrorToast(),
withState('passphrase', 'setPassphrase', ''),
withState('walletLabel', 'setWalletLabel', ''),
withState('coinType', 'setCoinType', ({ coinType }) => coinType || DEFAULT_COIN),
withActions(addWalletActions, mapAddAccountActionsToProps),
withProgressChange(addWalletActions, FAILED, (state, props) => {
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/shared/wallet/WalletHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const walletFilterProps = ['signingFunction', 'wif', 'privateKey'];
const config = {
length: 2,
separator: ' ',
style: 'capital',
dictionaries: [colors, animals]
};

Expand All @@ -25,7 +26,7 @@ const newStorageWallet = ({
net = DEFAULT_NET,
account = 0,
change = 0,
walletLabel = uniqueNamesGenerator(config),
walletLabel,
publicKey,
isImport = false
}) => {
Expand All @@ -34,7 +35,7 @@ const newStorageWallet = ({
}
const storageWallet = {
walletId: uuid(),
walletLabel,
walletLabel: walletLabel || uniqueNamesGenerator(config),
canDelete,
isHardware,
index,
Expand Down