Skip to content

Commit

Permalink
Merge pull request #805 from nervosnetwork/rc/v0.17.0-alpha.5
Browse files Browse the repository at this point in the history
[ᚬmaster] chore: Bump to v0.17.0-alpha.5
  • Loading branch information
Keith-CY authored Aug 2, 2019
2 parents d7765cf + 88009ff commit 6cb46eb
Show file tree
Hide file tree
Showing 29 changed files with 227 additions and 124 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
# [0.17.0-alpha.5](https://github.com/nervosnetwork/neuron/compare/v0.17.0-alpha.4...v0.17.0-alpha.5) (2019-08-02)


### Bug Fixes

* **neuron-ui:** remove the quotation mark around error message ([5de8cba](https://github.com/nervosnetwork/neuron/commit/5de8cba))
* **neuron-wallet:** fix the error comes with deleting all wallets ([fa87136](https://github.com/nervosnetwork/neuron/commit/fa87136))


### Features

* using simple queue ([3595368](https://github.com/nervosnetwork/neuron/commit/3595368))
* **neuron-ui:** add basic style on the list header of transaction list ([3a7eeaf](https://github.com/nervosnetwork/neuron/commit/3a7eeaf))
* **neuron-ui:** add check on current wallet id on leaving settings view ([b33a238](https://github.com/nervosnetwork/neuron/commit/b33a238))
* **neuron-ui:** add CKB unit in the transaction fee field ([e6107e5](https://github.com/nervosnetwork/neuron/commit/e6107e5))
* **neuron-ui:** add dynamic prmopt in wallet wizard ([29372db](https://github.com/nervosnetwork/neuron/commit/29372db))
* **neuron-ui:** add notification panel ([f7984b0](https://github.com/nervosnetwork/neuron/commit/f7984b0))
* **neuron-ui:** add popping messages on copying and updating ([cd7d7e5](https://github.com/nervosnetwork/neuron/commit/cd7d7e5))
* **neuron-ui:** add the story of connection status component, and set the network name to 14px ([e940fdf](https://github.com/nervosnetwork/neuron/commit/e940fdf))
* **neuron-ui:** append network ips to network names in networks setting ([427941b](https://github.com/nervosnetwork/neuron/commit/427941b))
* **neuron-ui:** cache language configuration ([49e35c3](https://github.com/nervosnetwork/neuron/commit/49e35c3))
* **neuron-ui:** calculate transaction fee with user-specified price ([9ce3174](https://github.com/nervosnetwork/neuron/commit/9ce3174))
* **neuron-ui:** call generate mnemonic method from neuron-wallet in neuron-ui with remote module ([5a27c7b](https://github.com/nervosnetwork/neuron/commit/5a27c7b))
* **neuron-ui:** call networks controller's methods by remote module ([c4bc431](https://github.com/nervosnetwork/neuron/commit/c4bc431))
* **neuron-ui:** call transactions controller methods with remote module ([4751817](https://github.com/nervosnetwork/neuron/commit/4751817))
* **neuron-ui:** close the tx detail dialog on wallet switching ([5623f3b](https://github.com/nervosnetwork/neuron/commit/5623f3b))
* **neuron-ui:** display balance with thousandth delimiter ([07e4370](https://github.com/nervosnetwork/neuron/commit/07e4370))
* **neuron-ui:** double click on tx item shows its details ([383db66](https://github.com/nervosnetwork/neuron/commit/383db66))
* **neuron-ui:** handle current-wallet update and wallet-list update separately ([bd4c109](https://github.com/nervosnetwork/neuron/commit/bd4c109))
* **neuron-ui:** navigate to the Overview view on wallet switching ([bea4b20](https://github.com/nervosnetwork/neuron/commit/bea4b20))
* Configure dev-app-update.yml for electron-updater ([8fcf184](https://github.com/nervosnetwork/neuron/commit/8fcf184))
* **neuron-ui:** hide the top alert on removing the last error message from the notification panel ([e23d331](https://github.com/nervosnetwork/neuron/commit/e23d331))



# [0.17.0-alpha.4](https://github.com/nervosnetwork/neuron/compare/v0.17.0-alpha.3...v0.17.0-alpha.4) (2019-08-01)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "0.17.0-alpha.4",
"version": "0.17.0-alpha.5",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "neuron",
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"version": "0.17.0-alpha.4",
"version": "0.17.0-alpha.5",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neuron-ui",
"version": "0.17.0-alpha.4",
"version": "0.17.0-alpha.5",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
7 changes: 7 additions & 0 deletions packages/neuron-ui/src/components/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { RouteComponentProps } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { Stack, DetailsList, Text, DetailsListLayoutMode, CheckboxVisibility, IColumn } from 'office-ui-fabric-react'

import { isMainWindow, getWinID } from 'services/remote'

import { AppActions, StateWithDispatch } from 'states/stateProvider/reducer'
import { updateTransaction } from 'states/stateProvider/actionCreators'
import chainState from 'states/initStates/chain'
Expand Down Expand Up @@ -101,6 +103,11 @@ const Transaction = ({
dispatch,
}: React.PropsWithoutRef<StateWithDispatch & RouteComponentProps<{ hash: string }>>) => {
const [t] = useTranslation()
useEffect(() => {
if ((walletID && !isMainWindow(getWinID())) || !walletID) {
window.close()
}
}, [walletID])

useEffect(() => {
dispatch({
Expand Down
36 changes: 32 additions & 4 deletions packages/neuron-ui/src/components/WalletWizard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
import React, { useCallback, useEffect } from 'react'
import React, { useCallback, useEffect, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import { Stack, Text, Label, Image, PrimaryButton, DefaultButton, TextField, FontSizes } from 'office-ui-fabric-react'
import {
Stack,
Icon,
Text,
Label,
Image,
PrimaryButton,
DefaultButton,
TextField,
FontSizes,
} from 'office-ui-fabric-react'

import withWizard, { WizardElementProps, WithWizardState } from 'components/withWizard'
import { generateMnemonic, validateMnemonic, showErrorMessage } from 'services/remote'
import { createWalletWithMnemonic, importWalletWithMnemonic } from 'states/stateProvider/actionCreators'

import { Routes, MnemonicAction, BUTTON_GAP } from 'utils/const'
import { buttonGrommetIconStyles } from 'utils/icons'
import { verifyWalletSubmission } from 'utils/validators'
import { verifyPasswordComplexity } from 'utils/validators'

export enum WalletWizardPath {
Welcome = '/welcome',
Expand Down Expand Up @@ -243,7 +253,10 @@ const Submission = ({
}
}, [type, name, password, imported, history, dispatch])

const disableNext = !verifyWalletSubmission({ name, password, confirmPassword })
const isNameUnused = useMemo(() => name && !wallets.find(w => w.name === name), [name, wallets])
const isPwdComplex = useMemo(() => verifyPasswordComplexity(password) === true, [password])
const isPwdSame = useMemo(() => password && password === confirmPassword, [password, confirmPassword])
const disableNext = !(isNameUnused && isPwdComplex && isPwdSame)

return (
<Stack verticalFill verticalAlign="center" horizontalAlign="stretch" tokens={{ childrenGap: 15 }}>
Expand All @@ -261,6 +274,21 @@ const Submission = ({
</div>
))}

<Stack>
<Stack horizontal tokens={{ childrenGap: 3 }}>
{isNameUnused ? <Icon iconName="Matched" /> : <Icon iconName="Unmatched" />}
<Text variant="xSmall">{t('wizard.new-name')}</Text>
</Stack>
<Stack horizontal tokens={{ childrenGap: 3 }}>
{isPwdComplex ? <Icon iconName="Matched" /> : <Icon iconName="Unmatched" />}
<Text variant="xSmall">{t('wizard.complex-password')}</Text>
</Stack>
<Stack horizontal tokens={{ childrenGap: 3 }}>
{isPwdSame ? <Icon iconName="Matched" /> : <Icon iconName="Unmatched" />}
<Text variant="xSmall">{t('wizard.same-password')}</Text>
</Stack>
</Stack>

<Stack horizontal horizontalAlign="end" tokens={{ childrenGap: BUTTON_GAP }}>
<DefaultButton onClick={history.goBack} text={t('wizard.back')} />
<PrimaryButton onClick={onNext} disabled={disableNext} text={t('wizard.next')} />
Expand Down
6 changes: 5 additions & 1 deletion packages/neuron-ui/src/containers/Main/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ export const useSubscription = ({
updateTransaction({ walletID, hash: txHash })
break
}
case 'wallet': {
case 'current-wallet': {
updateCurrentWallet()(dispatch)
break
}
case 'wallets': {
updateWalletList()(dispatch)
updateCurrentWallet()(dispatch)
break
Expand Down
5 changes: 4 additions & 1 deletion packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"set-wallet-name": "Give your new wallet a name",
"set-a-strong-password-to-protect-your-wallet": "Create a strong password to protect your wallet",
"wallet-suffix": "Wallet {{suffix}}",
"write-down-seed": "Write down your wallet seed and save it in a safe place"
"write-down-seed": "Write down your wallet seed and save it in a safe place",
"new-name": "Use an unused name for the new wallet",
"complex-password": "The password is a string of 8 to 50 characters consisting of three types of characters: uppercase letters, lowercase letters, numbers, and special symbols, and must start with a letter or a number.",
"same-password": "The password and confirm password should be same"
},
"detail": {
"more-transactions": "More"
Expand Down
5 changes: 4 additions & 1 deletion packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"set-wallet-name": "为钱包设置名称",
"set-a-strong-password-to-protect-your-wallet": "请设置一个强密码用于保护您的钱包",
"wallet-suffix": "钱包 {{suffix}}",
"write-down-seed": "请记下您的助记词并保存到安全的地方"
"write-down-seed": "请记下您的助记词并保存到安全的地方",
"new-name": "输入新的钱包名称",
"complex-password": "密码为 8 至 50 位由大写字母、小写字母、数字、特殊符号中三类字符组成的字符串, 且必须以字母或者数字开头",
"same-password": "两次输入密码应一致"
},
"detail": {
"more-transactions": "更多交易记录"
Expand Down
5 changes: 5 additions & 0 deletions packages/neuron-ui/src/services/remote/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ export const showTransactionDetails = controllerMethodWrapper(CONTROLLER_NAME)(c
controller.showTransactionDetails(hash)
)

export const isMainWindow = controllerMethodWrapper(CONTROLLER_NAME)(controller => (winID: number) =>
controller.isMainWindow(winID)
)

export default {
getNeuronWalletState,
handleViewError,
contextMenu,
showTransactionDetails,
isMainWindow,
}
18 changes: 2 additions & 16 deletions packages/neuron-ui/src/states/stateProvider/actionCreators/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,6 @@ import {
} from 'utils/localCache'

export const initAppState = () => (dispatch: StateDispatch, history: any) => {
dispatch({
type: AppActions.UpdateLoadings,
payload: {
addressList: true,
transactionList: true,
},
})
getNeuronWalletState()
.then(res => {
if (res.status) {
Expand Down Expand Up @@ -49,6 +42,8 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
})
if (!wallet) {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
} else {
history.push(Routes.Overview)
}

currentWalletCache.save(wallet)
Expand All @@ -63,15 +58,6 @@ export const initAppState = () => (dispatch: StateDispatch, history: any) => {
.catch(() => {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
})
.finally(() => {
dispatch({
type: AppActions.UpdateLoadings,
payload: {
addressList: false,
transactionList: false,
},
})
})
}

export const addPopup = (text: string) => (dispatch: StateDispatch) => {
Expand Down
4 changes: 4 additions & 0 deletions packages/neuron-ui/src/states/stateProvider/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ export const reducer = (
},
notifications: app.notifications.filter(({ timestamp }) => timestamp !== payload),
showAllNotifications: app.notifications.length > 1,
showTopAlert:
app.notifications.findIndex(message => message.timestamp === payload) === app.notifications.length - 1
? false
: app.showTopAlert,
},
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/types/Subject/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare namespace Subject {
}
interface DataUpdateMetaInfo {
walletID?: string
dataType: 'address' | 'transaction' | 'wallet' | 'network'
dataType: 'address' | 'transaction' | 'current-wallet' | 'wallets' | 'network'
actionType: 'create' | 'update' | 'delete'
}
type NetworkList = State.Network[]
Expand Down
3 changes: 3 additions & 0 deletions packages/neuron-ui/src/utils/loadTheme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
Nodes as ConnectedIcon,
Scan as ScanIcon,
Search as SearchIcon,
StatusGood as MatchedIcon,
SubtractCircle as RemoveIcon,
Update as UpdateIcon,
} from 'grommet-icons'
Expand Down Expand Up @@ -73,6 +74,8 @@ registerIcons({
Disconnected: <AlertIcon size="small" color="red" />,
Updating: <UpdateIcon size="16px" style={{ animation: 'rotate360 3s linear infinite' }} />,
More: <MoreIcon size="16px" />,
Matched: <MatchedIcon size="16px" color="green" />,
Unmatched: <InfoIcon size="16px" color="#d50000" />,
},
})

Expand Down
52 changes: 34 additions & 18 deletions packages/neuron-ui/src/utils/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,46 @@ export const verifyAddress = (address: string): boolean => {
// TODO: verify address, prd required
return address.length === ADDRESS_LENGTH
}
export const verifyWalletSubmission = ({
password,
confirmPassword,
name,
}: {
password: string
confirmPassword: string
name: string
}) => {
return (
password &&
name &&
password === confirmPassword &&
password.length >= MIN_PASSWORD_LENGTH &&
password.length <= MAX_PASSWORD_LENGTH
)
}

export const verifyAmountRange = (amount: string) => {
return +amount >= MIN_AMOUNT
}

export const verifyPasswordComplexity = (password: string) => {
if (!password) {
return 'password-is-empty'
}
if (password.length < MIN_PASSWORD_LENGTH) {
return 'password-is-too-short'
}
if (password.length > MAX_PASSWORD_LENGTH) {
return 'password-is-too-long'
}
let complex = 0
let reg = /\d/
if (reg.test(password)) {
complex++
}
reg = /[a-z]/
if (reg.test(password)) {
complex++
}
reg = /[A-Z]/
if (reg.test(password)) {
complex++
}
reg = /[^0-9a-zA-Z]/
if (reg.test(password)) {
complex++
}
if (complex < 3) {
return 'password-is-too-simple'
}
return true
}

export default {
verifyAddress,
verifyWalletSubmission,
verifyAmountRange,
verifyPasswordComplexity,
}
4 changes: 3 additions & 1 deletion packages/neuron-wallet/dev-app-update.yml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
publish: github
provider: github
owner: nervosnetwork
repo: neuron
2 changes: 2 additions & 0 deletions packages/neuron-wallet/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ dmg:
sign: false

win:
publisherName:
- 杭州秘猿科技有限公司
artifactName: "${productName}-v${version}-${os}-${arch}-installer.${ext}"
icon: assets/images/icon.ico
target:
Expand Down
8 changes: 3 additions & 5 deletions packages/neuron-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"homepage": "https://www.nervos.org/",
"version": "0.17.0-alpha.4",
"version": "0.17.0-alpha.5",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -36,7 +36,6 @@
"dependencies": {
"@nervosnetwork/ckb-sdk-core": "0.17.1",
"@nervosnetwork/ckb-sdk-utils": "0.17.1",
"async": "3.0.1",
"bn.js": "4.11.8",
"chalk": "2.4.2",
"electron-updater": "^4.1.2",
Expand All @@ -46,14 +45,13 @@
"reflect-metadata": "0.1.13",
"rxjs": "6.5.2",
"sha3": "2.0.4",
"sqlite3": "4.0.8",
"sqlite3": "4.0.9",
"typeorm": "0.2.18",
"uuid": "3.3.2",
"winston": "3.2.1"
},
"devDependencies": {
"@nervosnetwork/ckb-types": "0.17.1",
"@types/async": "3.0.0",
"@types/electron-devtools-installer": "2.2.0",
"@types/elliptic": "6.4.8",
"@types/sqlite3": "3.1.5",
Expand All @@ -64,7 +62,7 @@
"electron-devtools-installer": "2.2.4",
"electron-notarize": "0.1.1",
"lint-staged": "9.2.0",
"neuron-ui": "0.17.0-alpha.4",
"neuron-ui": "0.17.0-alpha.5",
"rimraf": "2.6.3",
"spectron": "7.0.0"
}
Expand Down
Loading

0 comments on commit 6cb46eb

Please sign in to comment.