Skip to content

Commit

Permalink
Merge pull request #1142 from nervosnetwork/rc/v0.25.1
Browse files Browse the repository at this point in the history
[ᚬmaster] Rc/v0.25.1
  • Loading branch information
ashchan authored Nov 18, 2019
2 parents 53b13da + 56d4a34 commit d63b85c
Show file tree
Hide file tree
Showing 44 changed files with 402 additions and 292 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
## [0.25.1](https://github.com/nervosnetwork/neuron/compare/v0.25.0...v0.25.1) (2019-11-18)


### Bug Fixes

* Genesis block should be scanned when next scan range ([6947864](https://github.com/nervosnetwork/neuron/commit/6947864)), closes [#1](https://github.com/nervosnetwork/neuron/issues/1)
* set restart start number to -1 ([06b030e](https://github.com/nervosnetwork/neuron/commit/06b030e))
* sync when start node ([219d99c](https://github.com/nervosnetwork/neuron/commit/219d99c))
* **neuron-ui:** remove /s from difficulty units ([2a45e63](https://github.com/nervosnetwork/neuron/commit/2a45e63))


### Features

* Add a clear cache button on general settings view ([429be9c](https://github.com/nervosnetwork/neuron/commit/429be9c))
* Add description for clear cache feature ([38aa4c4](https://github.com/nervosnetwork/neuron/commit/38aa4c4))
* Delete cell db files when clearing cache ([83ff29d](https://github.com/nervosnetwork/neuron/commit/83ff29d))
* Do not update network info too often ([819793a](https://github.com/nervosnetwork/neuron/commit/819793a))
* Only update network's genesis hash and chain when they're actually fetched from RPC and valid ([507131b](https://github.com/nervosnetwork/neuron/commit/507131b))
* Show popup message when clearing cache finishes ([7dfe670](https://github.com/nervosnetwork/neuron/commit/7dfe670))
* start/stop syncing with sync controller ([afde49d](https://github.com/nervosnetwork/neuron/commit/afde49d))
* **neuron-ui:** add clear cache button on the general settings ([7419d37](https://github.com/nervosnetwork/neuron/commit/7419d37))
* **neuron-ui:** update the i18n texts of nervos dao. ([b445a0c](https://github.com/nervosnetwork/neuron/commit/b445a0c))
* **neuron-ui:** update the pagination style ([646cf8f](https://github.com/nervosnetwork/neuron/commit/646cf8f))



# [0.25.0](https://github.com/nervosnetwork/neuron/compare/v0.24.5...v0.25.0) (2019-11-16)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ $ yarn bootstrap

### Start Neuron

A local CKB node is required for Neuron wallet to talk to it via RPC APIs and get data. Please follow the [Nervos CKB doc](https://docs.nervos.org/getting-started/introduction) to get CKB node up and running first.
A local CKB node is required for Neuron wallet to talk to it via RPC APIs and get data. Please follow the [Nervos CKB doc](https://docs.nervos.org/references/neuron-wallet-guide.html#1-run-a-ckb-mainnet-node) to get CKB node up and running first.

### Start Neuron in Development Mode

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.25.0",
"version": "0.25.1",
"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.25.0",
"version": "0.25.1",
"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.25.0",
"version": "0.25.1",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const DAORecord = ({
metaInfo = t('nervos-dao.blocks-left', {
epochs: localNumberFormatter(epochs),
blocks: localNumberFormatter(currentEpochInfo.length - currentEpochInfo.index),
days: localNumberFormatter(epochs / BigInt(6)),
days: localNumberFormatter(Math.round(Number(epochs) / 6)),
})
}
}
Expand Down Expand Up @@ -153,7 +153,7 @@ const DAORecord = ({
</div>
<div className={styles.secondaryInfo}>
<span>{`APC: ~${apc}%`}</span>
<span>{uniformTimeFormatter(+timestamp)}</span>
<span>{t('nervos-dao.deposit-at', { time: uniformTimeFormatter(+timestamp) })}</span>
<span>{metaInfo}</span>
</div>
</div>
Expand Down
45 changes: 41 additions & 4 deletions packages/neuron-ui/src/components/GeneralSetting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,45 @@
import React from 'react'
import { Stack } from 'office-ui-fabric-react'
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { Stack, PrimaryButton, Spinner, Text } from 'office-ui-fabric-react'
import { StateWithDispatch } from 'states/stateProvider/reducer'
import { addPopup } from 'states/stateProvider/actionCreators'
import { clearCellCache } from 'services/remote'

const GeneralSetting = () => {
return <Stack tokens={{ childrenGap: 15 }} />
const GeneralSetting = ({ dispatch }: React.PropsWithoutRef<StateWithDispatch>) => {
const [t] = useTranslation()
const [clearing, setClearing] = useState(false)

const clearCache = useCallback(() => {
setClearing(true)
setTimeout(() => {
clearCellCache().finally(() => {
addPopup('clear-cache-successfully')(dispatch)
setClearing(false)
})
}, 100)
}, [dispatch])

return (
<Stack tokens={{ childrenGap: 15 }}>
<Stack horizontal horizontalAlign="start">
<PrimaryButton
onClick={clearCache}
disabled={clearing}
ariaDescription="Create new network configuration"
styles={{
root: {
minWidth: 150,
},
}}
>
{clearing ? <Spinner /> : t('settings.general.clear-cache')}
</PrimaryButton>
</Stack>
<Text as="p" variant="medium">
{t('settings.general.clear-cache-description')}
</Text>
</Stack>
)
}

GeneralSetting.displayName = 'GeneralSetting'
Expand Down
40 changes: 30 additions & 10 deletions packages/neuron-ui/src/components/NervosDAO/DepositDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useMemo } from 'react'
import {
Stack,
Dialog,
Expand All @@ -7,13 +7,15 @@ import {
Text,
DefaultButton,
PrimaryButton,
ActionButton,
DialogType,
DialogFooter,
Spinner,
SpinnerSize,
} from 'office-ui-fabric-react'
import { useTranslation } from 'react-i18next'
import { SHANNON_CKB_RATIO } from 'utils/const'
import { useTranslation, Trans } from 'react-i18next'
import { SHANNON_CKB_RATIO, NERVOS_DAO_RFC_URL } from 'utils/const'
import { openExternal } from 'services/remote'

const DepositDialog = ({
show,
Expand All @@ -28,6 +30,28 @@ const DepositDialog = ({
errorMessage,
}: any) => {
const [t] = useTranslation()
const rfcLink = useMemo(
() => (
<ActionButton
styles={{
root: {
height: 20,
margin: 0,
padding: 0,
textDecoration: 'underline',
fontSize: 14,
color: 'rgb(0, 120, 212)',
},
label: {
margin: 0,
},
}}
onClick={() => openExternal(NERVOS_DAO_RFC_URL)}
ariaLabel="Nervos DAO RFC"
/>
),
[]
)
const maxValue = +(BigInt(balance) / BigInt(SHANNON_CKB_RATIO)).toString()

if (!show) {
Expand Down Expand Up @@ -63,13 +87,9 @@ const DepositDialog = ({
<Text as="h2" variant="large">
{`${t('nervos-dao.notice')}:`}
</Text>
{t('nervos-dao.deposit-terms')
.split('\n')
.map(term => (
<Text as="p" key={term}>
{term}
</Text>
))}
<Text as="p">
<Trans i18nKey="nervos-dao.deposit-terms" components={[rfcLink]} />
</Text>
</Stack>
<DialogFooter>
<DefaultButton onClick={onDismiss} text={t('nervos-dao.cancel')} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,17 @@ const WithdrawDialog = ({
? t('nervos-dao.notice-wait-time', {
epochs: localNumberFormatter(epochs),
blocks: localNumberFormatter(currentEpochInfo.length - currentEpochInfo.index),
days: localNumberFormatter(epochs / BigInt(6)),
days: localNumberFormatter(Math.round(Number(epochs) / 6)),
})
: ''

const alert =
epochs <= BigInt(5) && epochs >= BigInt(0)
? t('nervos-dao.withdraw-alert', {
epochs,
hours: epochs * BigInt(4),
days: (epochs + BigInt(180)) / BigInt(6),
epochs: localNumberFormatter(epochs),
hours: localNumberFormatter(epochs * BigInt(4)),
nextLeftEpochs: localNumberFormatter(epochs + BigInt(180)),
days: localNumberFormatter(Math.round((Number(epochs) + 180) / 6)),
})
: ''

Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/NervosDAO/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ const NervosDAO = ({
return (
<>
<Text as="h2" variant="xxLarge">
{t('nervos-dao.deposit-receipts')}
{t('nervos-dao.deposit-records')}
</Text>
<Stack>
{records.map((record, i) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/Settings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { WalletWizardPath } from 'components/WalletWizard'
import { Routes } from 'utils/const'

const pivotItems = [
// { label: 'settings.setting-tabs.general', url: Routes.SettingsGeneral },
{ label: 'settings.setting-tabs.general', url: Routes.SettingsGeneral },
{ label: 'settings.setting-tabs.wallets', url: Routes.SettingsWallets },
{ label: 'settings.setting-tabs.network', url: Routes.SettingsNetworks },
]
Expand Down
44 changes: 17 additions & 27 deletions packages/neuron-ui/src/containers/Main/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useMemo } from 'react'
import { Route, RouteComponentProps, Switch, Redirect } from 'react-router-dom'
import { Route, RouteComponentProps } from 'react-router-dom'
import { useTranslation } from 'react-i18next'

import { useState } from 'states/stateProvider'
Expand Down Expand Up @@ -102,12 +102,12 @@ export const mainContents: CustomRouter.Route[] = [
exact: false,
comp: ImportKeystore,
},
// {
// name: `PasswordRequest`,
// path: '/',
// exact: false,
// comp: PasswordRequest,
// },
{
name: `PasswordRequest`,
path: '/',
exact: false,
comp: PasswordRequest,
},
{
name: `NervosDAO`,
path: Routes.NervosDAO,
Expand Down Expand Up @@ -158,26 +158,16 @@ const MainContent = ({

return (
<>
<Route
path="/"
key="PasswordRequest"
render={routerProps => {
return <PasswordRequest {...routerProps} {...neuronWalletState} dispatch={dispatch} />
}}
/>
<Switch>
<Redirect from={Routes.SettingsGeneral} to={Routes.SettingsWallets} />
{mainContents.map(container => (
<Route
exact={container.exact}
path={`${container.path}${container.params || ''}`}
key={container.name}
render={routerProps => {
return <container.comp {...routerProps} {...neuronWalletState} dispatch={dispatch} />
}}
/>
))}
</Switch>
{mainContents.map(container => (
<Route
exact={container.exact}
path={`${container.path}${container.params || ''}`}
key={container.name}
render={routerProps => {
return <container.comp {...routerProps} {...neuronWalletState} dispatch={dispatch} />
}}
/>
))}
</>
)
}
Expand Down
25 changes: 12 additions & 13 deletions packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@
"network": "Network"
},
"general": {
"skip-data-and-type": "Skip the Cells which contain Data or Type Script",
"clear-cache": "Clear cache",
"clear-cache-description": "Clear cache if you encounter data sync or balance display problems. Neuron will rescan block data.",
"show": "Show",
"hide": "Hide"
},
Expand Down Expand Up @@ -257,6 +258,7 @@
"delete-wallet-successfully": "The wallet was deleted",
"create-network-successfully": "The network was created",
"update-network-successfully": "The network was updated",
"clear-cache-successfully": "The cache was cleared",
"addr-copied": "Address has been copied to the clipboard",
"qrcode-copied": "QR Code has been copied to the clipboard",
"view-the-run-node-doc": "View the guide in browser",
Expand Down Expand Up @@ -319,29 +321,26 @@
"free": "Free",
"locked": "Locked",
"deposit": "Deposit",
"deposit-receipts": "Deposit Receipts",
"deposit-records": "Deposit Records",
"apc": "APC",
"deposit-at": "Deposit at {{time}}",
"claim": "Claim",
"withdraw": "Withdraw",
"fee": "Transaction fee",
"deposit-to-nervos-dao": "Deposit to Nervos DAO",
"withdraw-from-nervos-dao": "Withdraw from Nervos DAO",
"notice": "Notice",
"cancel": "Cancel",
"proceed": "Proceed",
"deposit-value": "Deposit",
"compensation": "Compensation",
"notice-wait-time": "Notice: You need to wait {{epochs}} epochs {{blocks}} blocks(~{{days}} days) to claim the saving.",
"deposit-terms": "Nervos DAO needs 102 CKB for receipt storage, which is not compensation-bearing.\nNervos DAO is a system layer decentralized infrastructure. Your saving here is secure.\nAccording to the Nervos DAO protocol, you need at least 180 epochs to withdraw your deposit.",
"deposited-action-label": "Withdraw",
"withdrawing-action-label": "Claim",
"minimal-fee-required": "The minimum deposit capacity is {{minimal}} CKB",
"notice-wait-time": "Notice: You need to wait {{epochs}} epochs {{blocks}} blocks(~{{days}} days) to complete the withdraw.",
"deposit-terms": "Nervos DAO needs 102 CKBytes for deposit cell storage, which is not compensation-bearing. Please visit the <0>Nervos DAO RFC</0> for more information about Nervos DAO",
"deposited-action-label": "Request withdraw",
"withdrawing-action-label": "Withdraw",
"minimal-fee-required": "The minimum deposit capacity is {{minimal}} CKBytes",
"compensation-accumulated": "{{blockNumber}} blocks compensation accumulated",
"blocks-left": "{{epochs}} epochs {{blocks}} blocks left(~{{days}} days)",
"withdraw-alert": "Hint: these are only {{epochs}} epochs (~{{hours}} hours) left to the next deposit claim period. If your start withdrawing transaction is not confirmed before that, your deposit will be locked until the next period (~{{days}} days). And you won’t get more compensation for the prolonged lock period.",
"insufficient-period-alert-title": "Insufficient Period",
"insufficient-period-alert-message": "Nervos DAO needs at least 4 epochs to handle your request."
"withdraw-alert": "Hint: these are only {{epochs}} epochs (~{{hours}} hours) until the end of your current lock period. If you wish to withdraw in current lock period, please send withdraw request in time. There are {{nextLeftEpochs}} epochs(~{{days}} days) until the end of your next lock period.",
"insufficient-period-alert-title": "Referenced Header is Invalid",
"insufficient-period-alert-message": "Only mature header can be referenced in transactions(Matureness requires 4 epochs)"
}
}
}
Loading

0 comments on commit d63b85c

Please sign in to comment.