diff --git a/.eslintrc.json b/.eslintrc.json index 0f4de86..c441d25 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -10,7 +10,8 @@ "env": { "es6": true, "browser": true, - "jest/globals": true + "jest/globals": true, + "node":true }, "parserOptions": { "sourceType": "module", diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5937821 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "standard.enable": false +} diff --git a/package.json b/package.json index ef0fa99..479e80a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ansy", - "version": "1.4.0", + "version": "2.0.0", "main": "src/index.js", "author": "Yak Jun Xiang ", "license": "MIT", @@ -15,6 +15,7 @@ "dependencies": { "bigi": "^1.4.2", "bs58": "^4.0.1", + "bs58check": "^2.0.2", "crypto-js": "^3.1.9-1", "ecurve": "^1.0.5", "hash.js": "^1.1.3", @@ -24,7 +25,8 @@ "qrcode": "^0.8.2", "react": "^15.6.1", "react-dom": "^15.6.1", - "react-scripts": "^1.0.10" + "react-scripts": "^1.0.10", + "scryptsy": "^2.0.0" }, "devDependencies": { "eslint": "^3.19.0", diff --git a/src/App.js b/src/App.js index 109b320..ff75222 100644 --- a/src/App.js +++ b/src/App.js @@ -2,6 +2,7 @@ import React, { Component } from 'react' import Form from './components/Form' import Footer from './components/Footer' import Wallet from './components/Wallet' +import NEP2Wallet from './components/NEP2Wallet' import './App.css' class App extends Component { @@ -13,6 +14,7 @@ class App extends Component { this.print = this.print.bind(this) this.addWallet = this.addWallet.bind(this) this.removeWallet = this.removeWallet.bind(this) + this.toggleWallet = this.toggleWallet.bind(this) } addWallet(newWallet) { @@ -29,6 +31,18 @@ class App extends Component { this.setState({ wallets: this.state.wallets.filter((w) => w.address !== addr) }) } + toggleWallet(addr, newType) { + this.setState({ + wallets: this.state.wallets.filter((w) => { + if (w.address === addr) { + return Object.assign(w, {type: newType}) + } else { + return w + } + }) + }) + } + print() { if (this.state.wallets.length > 0) { window.print() @@ -38,12 +52,20 @@ class App extends Component { } WalletList(props) { - const listItems = props.map((p) => - - ) + const listItems = props.map((p) => { + if (p.type === "NEP2") { + return ( + + ) + } else { + return ( + + ) + } + }) const pages = [] while (listItems.length) { - pages.push(this.WalletPage(listItems.splice(0,4))) + pages.push(this.WalletPage(listItems.splice(0, 4))) } return (
{pages}
diff --git a/src/components/Footer.js b/src/components/Footer.js index 597c9da..bf908c8 100644 --- a/src/components/Footer.js +++ b/src/components/Footer.js @@ -5,7 +5,7 @@ class Footer extends Component { render() { return (
- this.private = i} /> - this.address = i} /> + this.private = i} /> + this.address = i} /> + this.conPassword = i} />

Or generate a new Private Key!

+ this.genPassword = i} /> +

Warning: Encryption will take a while

diff --git a/src/components/NEP2Wallet.js b/src/components/NEP2Wallet.js new file mode 100644 index 0000000..8570005 --- /dev/null +++ b/src/components/NEP2Wallet.js @@ -0,0 +1,68 @@ +import React from 'react' +import PropTypes from 'prop-types' +import QR from './QR.js' +import Wallet from './Wallet' + +export default class NEP2Wallet extends Wallet { + constructor(props) { + super(props) + this.state.nep2 = this.props.data.nep2 + } + toggle() { + this.props.toggleCallback(this.state.address, 'Normal') + } + render() { + let leftAlign = { textAlign: 'left' } + const uiStyle = { flexGrow: 0, flexBasis: 0, width: 0 } + const cardStyle = { flexGrow: 1, margin: 0 } + const noSpace = { padding: 0, paddingLeft: "0.6rem" } + const noResize = { resize: "none" } + return ( +
+
+
+
+ +
+
+
+
+ + +
+