Skip to content

Commit 1c5dec8

Browse files
authored
Merge pull request #1918 from nervosnetwork/rc/v0.34.0
Rc/v0.34.0
2 parents b010785 + f948f4c commit 1c5dec8

File tree

187 files changed

+9042
-1505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+9042
-1505
lines changed

.github/workflows/merge_released_into_develop.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ jobs:
1717
source_branch: 'master'
1818
destination_branch: 'develop'
1919
pr_title: 'Merge released ${{ github.ref }} into develop'
20-
pr_reviewer: 'keith-cy,katat,ququzone,kellyshang'
20+
pr_reviewer: 'keith-cy,katat,yuche,kellyshang'
2121
pr_label: 'auto-pr'
2222
github_token: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
# 0.34.0 (2020-12-16)
2+
3+
[CKB v0.35.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.35.1) was released on Sept. 14th, 2020. This version of CKB node is now bundled and preconfigured in Neuron.
4+
5+
### New features
6+
7+
* Support acp short address generation and parsing.
8+
* Support transfer to PW lock full address.
9+
* Support generating and signing offline transaction.
10+
* Support broadcasting the signed offline transaction.
11+
* Display network type in the navbar.
12+
* Display progress and estimation for synchronization.
13+
* Minor UX changes to `Asset Accounts`.
14+
15+
### Bug fix
16+
17+
* Ensure addresses have been cleaned up for the deleted wallets.
18+
19+
120
# 0.33.2 (2020-11-26)
221

322
[CKB v0.35.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.35.1) was released on Sept. 14th, 2020. This version of CKB node is now bundled and preconfigured in Neuron.
@@ -11,6 +30,23 @@
1130
* Prevent Neuron from quitting when the main window is closed on MacOS.
1231

1332

33+
# 0.34.0-rc1 (2020-11-21)
34+
35+
This is a release candidate to preview the changes in the next official release and may not be stable. Welcome any questions or suggestions.
36+
37+
[CKB v0.35.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.35.1) was released on Sept. 14th, 2020. This version of
38+
CKB node is now bundled and preconfigured in Neuron.
39+
40+
### New features
41+
42+
* Support hardware wallet of Ledger.
43+
* Support generating and signing offline transaction.
44+
* Support broadcasting the signed offline transaction.
45+
* Display network type in the navbar.
46+
* Display progress and left time for sync.
47+
* Minor UX changes to `Asset Accounts`.
48+
49+
1450
# 0.33.1 (2020-11-16)
1551

1652
[CKB v0.35.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.35.1) was released on Sept. 14th, 2020. This version of CKB node is now bundled and preconfigured in Neuron.

azure-pipelines.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ stages:
9292
9393
- stage: release
9494
displayName: Release Binaries
95-
condition: eq(variables['build.sourceBranch'], 'refs/heads/master')
95+
condition: or(startsWith(variables['build.sourceBranch'], 'refs/heads/master'), startsWith(variables['build.sourceBranch'], 'refs/heads/rc'))
9696
jobs:
9797
- job: release_mac
9898
displayName: Release macOS

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.33.2",
5+
"version": "0.34.0",
66
"npmClient": "yarn",
77
"useWorkspaces": true
88
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "neuron",
33
"productName": "Neuron",
44
"description": "CKB Neuron Wallet",
5-
"version": "0.33.2",
5+
"version": "0.34.0",
66
"private": true,
77
"author": {
88
"name": "Nervos Core Dev",
@@ -22,7 +22,7 @@
2222
"packages/*"
2323
],
2424
"scripts": {
25-
"bootstrap": "npx cross-env LUMOS_NODE_RUNTIME=electron LUMOS_NODE_RUNTIME_VERSION=9.0.2 lerna bootstrap && lerna link",
25+
"bootstrap": "yarn policies set-version 1.19.2 && npx cross-env LUMOS_NODE_RUNTIME=electron LUMOS_NODE_RUNTIME_VERSION=9.0.2 lerna bootstrap && lerna link",
2626
"start:ui": "cd packages/neuron-ui && yarn run start",
2727
"start:wallet": "cd packages/neuron-wallet && yarn run start:dev",
2828
"start": "concurrently \"cross-env BROWSER=none yarn run start:ui\" \"wait-on http://localhost:3000 && yarn run start:wallet\"",

packages/neuron-ui/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "neuron-ui",
3-
"version": "0.33.2",
3+
"version": "0.34.0",
44
"private": true,
55
"author": {
66
"name": "Nervos Core Dev",
@@ -43,7 +43,7 @@
4343
"last 2 chrome versions"
4444
],
4545
"dependencies": {
46-
"@bit/primefaces.primereact.calendar": "3.1.8",
46+
"primereact": "5.0.1",
4747
"@nervosnetwork/ckb-sdk-core": "0.32.0",
4848
"@uifabric/experiments": "7.18.6",
4949
"@uifabric/styling": "7.7.3",
@@ -79,7 +79,7 @@
7979
"@types/storybook__addon-storyshots": "5.1.2",
8080
"@types/styled-components": "4.4.0",
8181
"babel-jest": "25.1.0",
82-
"electron": "9.1.2",
82+
"electron": "9.3.2",
8383
"enzyme": "3.11.0",
8484
"enzyme-adapter-react-16": "1.15.2",
8585
"eslint-config-airbnb": "18.0.1",

packages/neuron-ui/src/components/Addresses/index.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ const Addresses = () => {
9696
{addresses.map(addr => {
9797
const isSelected = localDescription.key === addr.address
9898
const typeLabel = addr.type === 0 ? t('addresses.receiving-address') : t('addresses.change-address')
99-
const balance = `${shannonToCKBFormatter(addr.balance)} CKB`
10099

101100
return (
102101
<tr key={addr.address} onContextMenu={onContextMenu(addr)}>
@@ -142,9 +141,9 @@ const Addresses = () => {
142141
}
143142
/>
144143
</td>
145-
<td className={styles.balance} title={balance}>
146-
<CopyZone content={balance.slice(0, -4).replace(/,/g, '')}>
147-
<span className="textOverflow">{balance}</span>
144+
<td className={styles.balance}>
145+
<CopyZone content={shannonToCKBFormatter(addr.balance, false, '')}>
146+
<span className="textOverflow">{`${shannonToCKBFormatter(addr.balance)} CKB`}</span>
148147
</CopyZone>
149148
</td>
150149
<td className={styles.txCount} title={localNumberFormatter(addr.txCount)}>
Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
import React, { useCallback, useState, useMemo } from 'react'
2+
import { useTranslation } from 'react-i18next'
3+
import { ckbCore } from 'services/chain'
4+
import { shannonToCKBFormatter, useDidMount, isSuccessResponse, CONSTANTS } from 'utils'
5+
import { getSystemCodeHash, getAllNetworks, getCurrentNetworkID } from 'services/remote'
6+
import CopyZone from 'widgets/CopyZone'
7+
import { DeviceSignIndex as DeviceSignIndexSubject } from 'services/subjects'
8+
9+
import styles from '../HardwareSign/hardwareSign.module.scss'
10+
11+
const { MAINNET_TAG } = CONSTANTS
12+
13+
const HDWalletSign = ({ tx }: { tx: State.DetailedTransaction }) => {
14+
const [t] = useTranslation()
15+
const [isMainnet, setIsMainnet] = useState(false)
16+
const addressPrefix = isMainnet ? ckbCore.utils.AddressPrefix.Mainnet : ckbCore.utils.AddressPrefix.Testnet
17+
const [systemCodeHash, setSystemCodeHash] = useState<string>('')
18+
const [inputVisable, setInputVisable] = useState(true)
19+
const [activeInputIndex, setActiveInputIndex] = useState(0)
20+
21+
useDidMount(() => {
22+
getSystemCodeHash().then(res => {
23+
if (isSuccessResponse(res)) {
24+
setSystemCodeHash(res.result)
25+
}
26+
})
27+
28+
Promise.all([getAllNetworks(), getCurrentNetworkID()])
29+
.then(([networksRes, idRes]) => {
30+
if (isSuccessResponse(networksRes) && isSuccessResponse(idRes)) {
31+
const network = networksRes.result.find((n: any) => n.id === idRes.result)
32+
if (!network) {
33+
throw new Error('Cannot find current network in the network list')
34+
}
35+
36+
setIsMainnet(network.chain === MAINNET_TAG)
37+
}
38+
})
39+
.catch(err => console.warn(err))
40+
41+
const DeviceSignIndexSubscription = DeviceSignIndexSubject.subscribe(index => {
42+
setActiveInputIndex(index)
43+
})
44+
45+
return () => {
46+
DeviceSignIndexSubscription.unsubscribe()
47+
}
48+
})
49+
50+
const renderList = useCallback(
51+
(cells: Readonly<(State.DetailedInput | State.DetailedOutput)[]>, activeIndex: number, isInput: boolean) =>
52+
cells.map((cell, index) => {
53+
let address = ''
54+
if (!cell.lock) {
55+
address = t('transaction.cell-from-cellbase')
56+
} else {
57+
try {
58+
if (cell.lock.codeHash === systemCodeHash && cell.lock.hashType === 'type') {
59+
address = ckbCore.utils.bech32Address(cell.lock.args, {
60+
prefix: addressPrefix,
61+
type: ckbCore.utils.AddressType.HashIdx,
62+
codeHashOrCodeHashIndex: '0x00',
63+
})
64+
} else {
65+
address = ckbCore.utils.fullPayloadToAddress({
66+
arg: cell.lock.args,
67+
prefix: addressPrefix,
68+
type:
69+
cell.lock.hashType === 'data'
70+
? ckbCore.utils.AddressType.DataCodeHash
71+
: ckbCore.utils.AddressType.TypeCodeHash,
72+
codeHash: cell.lock.codeHash,
73+
})
74+
}
75+
} catch (err) {
76+
console.error(err)
77+
}
78+
}
79+
const capacity = shannonToCKBFormatter(cell.capacity || '0')
80+
81+
const classNames = [styles.tr]
82+
83+
if (activeIndex === index && isInput) {
84+
classNames.push(styles.active)
85+
}
86+
87+
if (index < activeIndex && isInput) {
88+
classNames.push(styles.signed)
89+
}
90+
91+
return (
92+
<tr key={cell.lockHash || ''} data-address={address} className={classNames.join('')}>
93+
<td title={`${index + 1}`}>
94+
<div>{index + 1}</div>
95+
</td>
96+
<td title={address} className={styles.addressCell}>
97+
<CopyZone content={address} name={t('history.copy-address')}>
98+
{address}
99+
</CopyZone>
100+
</td>
101+
<td>
102+
<CopyZone content={capacity.replace(/,/g, '')} name={t('history.copy-balance')}>
103+
{`${capacity} CKB`}
104+
</CopyZone>
105+
</td>
106+
</tr>
107+
)
108+
}),
109+
[t, addressPrefix, systemCodeHash]
110+
)
111+
112+
const inputBody = useMemo(() => {
113+
return renderList(tx.inputs, activeInputIndex, true)
114+
}, [activeInputIndex, tx.inputs, renderList])
115+
116+
const outputBody = useMemo(() => {
117+
return renderList(tx.outputs, activeInputIndex, false)
118+
}, [activeInputIndex, tx.outputs, renderList])
119+
120+
const showInput = useCallback(() => {
121+
setInputVisable(true)
122+
}, [setInputVisable])
123+
124+
const showOutput = useCallback(() => {
125+
setInputVisable(false)
126+
}, [setInputVisable])
127+
128+
return (
129+
<div className={styles.sign}>
130+
<div className={styles.tabs}>
131+
<button className={inputVisable ? styles.active : ''} onClick={showInput} type="button">
132+
{t('hardware-sign.inputs', { index: activeInputIndex, length: tx.inputs.length })}
133+
</button>
134+
<button className={!inputVisable ? styles.active : ''} onClick={showOutput} type="button">
135+
{t('hardware-sign.outputs', { length: tx.outputs.length })}
136+
</button>
137+
</div>
138+
<div className={styles.table}>
139+
<hr />
140+
<table className={styles.inputList}>
141+
<tbody>{inputVisable ? inputBody : outputBody}</tbody>
142+
</table>
143+
<hr />
144+
</div>
145+
</div>
146+
)
147+
}
148+
149+
HDWalletSign.displayName = 'HDWalletSign'
150+
151+
export default HDWalletSign

0 commit comments

Comments
 (0)