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

[ᚬmaster] Rc/v0.22.2 #993

Merged
merged 13 commits into from
Oct 16, 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
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## [0.22.2](https://github.com/nervosnetwork/neuron/compare/v0.22.1...v0.22.2) (2019-10-16)


### Bug Fixes

* **neuron-ui:** fix the label of skip-data toggle ([dafcb3e](https://github.com/nervosnetwork/neuron/commit/dafcb3e))
* **neuron-ui:** set current wallet to empty when all wallets are deleted ([f146e34](https://github.com/nervosnetwork/neuron/commit/f146e34))


### Features

* Load icon for BrowserWindow to show it on linux launcher ([7ce28b6](https://github.com/nervosnetwork/neuron/commit/7ce28b6))
* **neuron-ui:** display address field of input on the transaction de… ([#987](https://github.com/nervosnetwork/neuron/issues/987)) ([0cb9a1d](https://github.com/nervosnetwork/neuron/commit/0cb9a1d))



## [0.22.1](https://github.com/nervosnetwork/neuron/compare/v0.22.0...v0.22.1) (2019-10-15)


Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Nervos CKB Desktop Wallet

[![Azure Pipelines Build Status](https://dev.azure.com/nervosnetwork/neuron/_apis/build/status/nervosnetwork.neuron?branchName=develop)](https://dev.azure.com/nervosnetwork/neuron/_build/latest?definitionId=8&branchName=develop)
[![TravisCI](https://travis-ci.com/nervosnetwork/neuron.svg?branch=develop)](https://travis-ci.com/nervosnetwork/neuron)
[![Telegram Group](https://cdn.rawgit.com/Patrolavia/telegram-badge/8fe3382b/chat.svg)](https://t.me/nervos_ckb_dev)

---
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.22.1",
"version": "0.22.2",
"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.22.1",
"version": "0.22.2",
"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.22.1",
"version": "0.22.2",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
71 changes: 45 additions & 26 deletions packages/neuron-ui/src/components/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ import { explorerNavButton } from './style.module.scss'

const MIN_CELL_WIDTH = 70

const CompactAddress = ({ address }: { address: string }) => (
<div
title={address}
style={{
overflow: 'hidden',
display: 'flex',
}}
className="monospacedFont"
>
<span className="textOverflow">{address.slice(0, -6)}</span>
<span>{address.slice(-6)}</span>
</div>
)

const Transaction = () => {
const [t] = useTranslation()
const [transaction, setTransaction] = useState(transactionState)
Expand All @@ -27,25 +41,42 @@ const Transaction = () => {
name: t('transaction.index'),
minWidth: 60,
maxWidth: 60,
onRender: (_item?: any, index?: number) => {
onRender: (_input?: State.DetailedInput, index?: number) => {
if (undefined !== index) {
return index
}
return null
},
},
{
key: 'outPointCell',
name: 'OutPoint Cell',
minWidth: 150,
maxWidth: 600,
onRender: (item: any) => {
const text = item.previousOutput ? `${item.previousOutput.txHash}[${item.previousOutput.index}]` : 'none'
return (
<span title={text} className="textOverflow">
{text}
</span>
)
key: 'address',
name: t('transaction.address'),
minWidth: 200,
maxWidth: 500,
onRender: (input?: State.DetailedInput, _index?: number, column?: IColumn) => {
if (!input) {
return null
}
if (!input.lock) {
return t('transaction.cell-from-cellbase')
}
try {
const address = ckbCore.utils.bech32Address(input.lock.args, {
prefix: addressPrefix,
type: ckbCore.utils.AddressType.HashIdx,
codeHashIndex: '0x00',
})
if (column && (column.calculatedWidth || 0) < 450) {
return <CompactAddress address={address} />
}
return (
<span title={address} className="monospacedFont">
{address}
</span>
)
} catch {
return null
}
},
},
{
Expand All @@ -67,7 +98,7 @@ const Transaction = () => {
...col,
})
),
[t]
[addressPrefix, t]
)

const outputColumns: IColumn[] = useMemo(
Expand Down Expand Up @@ -101,19 +132,7 @@ const Transaction = () => {
codeHashIndex: '0x00',
})
if (column && (column.calculatedWidth || 0) < 450) {
return (
<div
title={address}
style={{
overflow: 'hidden',
display: 'flex',
}}
className="monospacedFont"
>
<span className="textOverflow">{address.slice(0, -6)}</span>
<span>{address.slice(-6)}</span>
</div>
)
return <CompactAddress address={address} />
}
return (
<span title={address} className="monospacedFont">
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
"inputs": "Inputs",
"outputs": "Outputs",
"view-in-explorer": "Explorer",
"view-in-explorer-button-title": "View on explorer"
"view-in-explorer-button-title": "View on explorer",
"cell-from-cellbase": "From cellbase"
},
"addresses": {
"addresses": "Addresses",
Expand All @@ -175,7 +176,7 @@
},
"general": {
"display-address-book-in-the-navbar": "Show the address book",
"skip-data-and-type": "Skip the cells which contain data or type script",
"skip-data-and-type": "Skip the Cells which contain Data or Type Script",
"show": "Show",
"hide": "Hide"
},
Expand Down
5 changes: 3 additions & 2 deletions packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@
"inputs": "输入",
"outputs": "输出",
"view-in-explorer": "浏览器",
"view-in-explorer-button-title": "浏览器中查看详情"
"view-in-explorer-button-title": "浏览器中查看详情",
"cell-from-cellbase": "来自 Cellbase"
},
"addresses": {
"addresses": "地址",
Expand All @@ -175,7 +176,7 @@
},
"general": {
"display-address-book-in-the-navbar": "显示地址簿",
"skip-data-and-type": "忽略包含 Data 或 Type Script 的 Cell",
"skip-data-and-type": "忽略包含 Data 或 Type Script 的 Cells",
"show": "显示",
"hide": "隐藏"
},
Expand Down
7 changes: 7 additions & 0 deletions packages/neuron-ui/src/states/initStates/wallet.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { addresses, currentWallet } from 'services/localCache'

export const emptyWallet: State.Wallet = {
name: '',
id: '',
balance: '0',
addresses: [],
}

const wallet = currentWallet.load()

export const walletState: State.Wallet = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
backupWallet as backupRemoteWallet,
showErrorMessage,
} from 'services/remote'
import initStates from 'states/initStates'
import { emptyWallet } from 'states/initStates/wallet'
import { WalletWizardPath } from 'components/WalletWizard'
import i18n from 'utils/i18n'
import { wallets as walletsCache, currentWallet as currentWalletCache } from 'services/localCache'
Expand All @@ -26,7 +26,7 @@ import { addNotification, addPopup } from './app'
export const updateCurrentWallet = () => (dispatch: StateDispatch, history: any) => {
getCurrentWallet().then(res => {
if (res.status === 1) {
const payload = res.result || initStates.wallet
const payload = res.result || emptyWallet
if (!payload || !payload.id) {
history.push(`${Routes.WalletWizard}${WalletWizardPath.Welcome}`)
}
Expand Down
25 changes: 14 additions & 11 deletions packages/neuron-ui/src/types/App/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,19 @@ declare namespace State {
status: 'pending' | 'success' | 'failed'
}

interface DetailedInput {
capacity: string | null
lockHash: string | null
previousOutput: {
blockHash: string | null
cell: {
txHash: string
index: string
} | null
}
lock: CKBComponents.Script | null
}

interface DetailedOutput {
capacity: string
lock: {
Expand All @@ -27,17 +40,7 @@ declare namespace State {
blockHash: string
blockNumber: string
deps: any[]
inputs: {
capacity: string | null
lockHash: string | null
previousOutput: {
blockHash: string | null
cell: {
txHash: string
index: string
} | null
}
}[]
inputs: DetailedInput[]
inputsCount: string
outputs: DetailedOutput[]
outputsCount: string
Expand Down
3 changes: 3 additions & 0 deletions packages/neuron-ui/src/utils/formatters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ export const shannonToCKBFormatter = (shannon: string = '0', showPositiveSign?:
console.warn(`Shannon is not a valid number`)
return shannon
}
if (shannon === null) {
return '0'
}
let sign = ''
if (shannon.startsWith('-')) {
sign = '-'
Expand Down
6 changes: 3 additions & 3 deletions packages/neuron-wallet/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dmg:
win:
verifyUpdateCodeSignature: false
artifactName: "${productName}-v${version}-${os}-${arch}-installer.${ext}"
icon: assets/images/icon.ico
icon: assets/icons/icon.ico
target:
- target: nsis
arch:
Expand All @@ -53,7 +53,7 @@ win:
mac:
artifactName: "${productName}-v${version}-${os}.${ext}"
category: public.app-category.finance
icon: assets/images/icon.icns
icon: assets/icons/icon.icns
hardenedRuntime: true
gatekeeperAssess: false
entitlements: assets/entitlements.plist
Expand All @@ -66,6 +66,6 @@ mac:
linux:
artifactName: "${productName}-v${version}-${os}-${arch}.${ext}"
category: Finance
icon: assets/images/
icon: assets/icons/
target:
- AppImage
4 changes: 2 additions & 2 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.22.1",
"version": "0.22.2",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -64,7 +64,7 @@
"electron-devtools-installer": "2.2.4",
"electron-notarize": "0.1.1",
"lint-staged": "9.2.5",
"neuron-ui": "0.22.1",
"neuron-ui": "0.22.2",
"rimraf": "3.0.0",
"spectron": "8.0.0",
"ts-transformer-imports": "0.4.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export default class Input extends BaseEntity {
previousOutput: this.previousOutput(),
capacity: this.capacity,
lockHash: this.lockHash,
lock: this.lock,
}
}
}
1 change: 1 addition & 0 deletions packages/neuron-wallet/src/startup/create-main-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ function createWindow() {
minHeight: 600,
show: false,
backgroundColor: '#e9ecef',
icon: path.join(__dirname, '../neuron-ui/icon.png'),
webPreferences: {
devTools: env.isDevMode,
nodeIntegration: env.isDevMode || env.isTestMode,
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-wallet/src/types/cell-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export interface Input {
since?: string
capacity?: string | null
lockHash?: string | null
lock?: Script
lock?: Script | null
}

export interface Cell {
Expand Down