Skip to content

Commit

Permalink
Merge branch 'develop' into feat-368
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan authored Jun 5, 2024
2 parents 36cf7cc + f6b48b8 commit fbb496c
Show file tree
Hide file tree
Showing 84 changed files with 1,351 additions and 645 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update_wallet_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'chore-update-wallet-env/${{github.ref_name}}'
sha: '${{ github.event.create.head.sha }}'
sha: '${{ github.sha }}'

- name: Checkout
uses: actions/checkout@v4
Expand Down
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,77 @@
# 0.116.2 (2024-05-29)

### CKB Node & Light Client

- [CKB@v0.116.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.116.1) was released on May. 11st, 2024. This version of CKB node is now bundled and preconfigured in Neuron.
- [CKB Light Client@v0.3.7](https://github.com/nervosnetwork/ckb-light-client/releases/tag/v0.3.7) was released on Apr. 13th, 2024. This version of CKB Light Client is now bundled and preconfigured in Neuron

### Assumed valid target

Block before `0x6dd077b407d019a0bce0cbad8c34e69a524ae4b2599b9feda2c7491f3559d32c`(at height `13,007,704`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/3157)

---

## Bug fixes

- 3179: Remove the display of the ledger firmware version because it causes the Nervos app to crash on the ledger device.(@yanguoyu)

**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.116.1...v0.116.2

# 0.116.1 (2024-05-28)

### CKB Node & Light Client

- [CKB@v0.116.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.116.1) was released on May. 11st, 2024. This version of CKB node is now bundled and preconfigured in Neuron.
- [CKB Light Client@v0.3.7](https://github.com/nervosnetwork/ckb-light-client/releases/tag/v0.3.7) was released on Apr. 13th, 2024. This version of CKB Light Client is now bundled and preconfigured in Neuron

### Assumed valid target

Block before `0x6dd077b407d019a0bce0cbad8c34e69a524ae4b2599b9feda2c7491f3559d32c`(at height `13,007,704`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/3157)

---

## Bug fixes

- 3173: Fix importing an account from a hardware wallet.(@yanguoyu)

**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.116.0...v0.116.1

# 0.116.0 (2024-05-24)

### CKB Node & Light Client

- [CKB@v0.116.1](https://github.com/nervosnetwork/ckb/releases/tag/v0.116.1) was released on May. 11st, 2024. This version of CKB node is now bundled and preconfigured in Neuron.
- [CKB Light Client@v0.3.7](https://github.com/nervosnetwork/ckb-light-client/releases/tag/v0.3.7) was released on Apr. 13th, 2024. This version of CKB Light Client is now bundled and preconfigured in Neuron

### Assumed valid target

Block before `0x6dd077b407d019a0bce0cbad8c34e69a524ae4b2599b9feda2c7491f3559d32c`(at height `13,007,704`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/3157)

---

[![Neuron@v0.116.0](https://github.com/Magickbase/neuron-public-issues/assets/7271329/ec10aa01-47fe-47a3-9636-3d4e86fc6c9b)](https://youtu.be/QXv8by2C8zU)

YouTube: https://youtu.be/QXv8by2C8zU

---

## New features

- 3134: Support 'replace-by-fee' nervos dao transactions and sudt transactions.(@devchenyan)
- 3144: Reduce size of light client log in debug information and reveal start-block-number in log.(@yanguoyu)
- 3064: Support locking window by pin code.(@yanguoyu)
- 3131: Add detailed result for nervos dao transaction.(@devchenyan)

## Bug fixes

- 3121: Locate the first transaction on Explorer directly when users want to set the start-block-number for light client.(@yanguoyu)
- 3101: Show migration instruction properly.(@devchenyan)
- 3062: Migrate legacy ACP to active ACP account(@yanguoyu)
- 3141: Fix some issues about light client synchronizaiton.(@yanguoyu)
- 3120: Remove all sync data when start-block-number is set less than before.(@yanguoyu)

**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.114.3...v0.116.0

# 0.114.3 (2024-04-16)

### CKB Node & Light Client
Expand Down
16 changes: 16 additions & 0 deletions compatible.json
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,22 @@
"0.3",
"0.2"
]
},
"0.116": {
"full": [
"0.116",
"0.115",
"0.114",
"0.113",
"0.112",
"0.111",
"0.110",
"0.109"
],
"light": [
"0.3",
"0.2"
]
}
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages": ["packages/*"],
"version": "0.114.3",
"version": "0.116.2",
"npmClient": "yarn",
"$schema": "node_modules/lerna/schemas/lerna-schema.json"
}
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.114.3",
"version": "0.116.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.114.3",
"version": "0.116.2",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/AmendSUDTSend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ const AmendSUDTSend = () => {
</div>
<div className={styles.rightFooter}>
<div className={styles.actions}>
<Button type="submit" disabled={disabled} label={t('send.send')}>
<Button type="submit" disabled={!!disabled} label={t('send.send')}>
{sending ? <Spinner /> : (t('send.submit-transaction') as string)}
</Button>
</div>
Expand Down
33 changes: 23 additions & 10 deletions packages/neuron-ui/src/components/AmendSend/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,28 +96,41 @@ const AmendSend = () => {
return ''
}

const inputsCapacity = useMemo(() => {
if (transaction) {
return transaction.inputs.reduce((total, cur) => {
return total + BigInt(cur.capacity || '0')
}, BigInt(0))
}
return undefined
}, [transaction])

const items: {
address: string
amount: string
capacity: string
isLastOutput: boolean
output: State.DetailedOutput
}[] = useMemo(() => {
if (transaction && transaction.outputs.length) {
if (transaction && transaction.outputs.length && inputsCapacity) {
const lastOutputAddress = getLastOutputAddress(transaction.outputs)
return transaction.outputs.map(output => {
const address = scriptToAddress(output.lock, { isMainnet })
const capacity =
transaction.outputs.length === 1 && address === lastOutputAddress
? (inputsCapacity - fee).toString()
: output.capacity
return {
capacity: output.capacity,
capacity,
address,
output,
amount: shannonToCKBFormatter(output.capacity || '0'),
amount: shannonToCKBFormatter(capacity || '0'),
isLastOutput: address === lastOutputAddress,
}
})
}
return []
}, [transaction?.outputs])
}, [transaction?.outputs, inputsCapacity, fee])

const outputsCapacity = useMemo(() => {
const outputList = items.length === 1 ? items : items.filter(item => !item.isLastOutput)
Expand All @@ -129,15 +142,15 @@ const AmendSend = () => {
const totalAmount = shannonToCKBFormatter(outputsCapacity.toString())

const lastOutputsCapacity = useMemo(() => {
if (transaction) {
const inputsCapacity = transaction.inputs.reduce((total, cur) => {
return total + BigInt(cur.capacity || '0')
}, BigInt(0))
if (inputsCapacity) {
if (items.length === 1) {
return BigInt(items[0].capacity || '0')
}

return inputsCapacity - outputsCapacity - fee
}
return undefined
}, [transaction, fee, outputsCapacity])
}, [inputsCapacity, fee, outputsCapacity, items])

useEffect(() => {
if (transaction && lastOutputsCapacity !== undefined) {
Expand Down Expand Up @@ -237,7 +250,7 @@ const AmendSend = () => {
<span>{t('send.allow-use-sent-cell')}</span>
</label>
<div className={styles.actions}>
<Button type="submit" disabled={disabled} label={t('send.send')}>
<Button type="submit" disabled={!!disabled} label={t('send.send')}>
{sending ? <Spinner /> : (t('send.submit-transaction') as string)}
</Button>
</div>
Expand Down
24 changes: 15 additions & 9 deletions packages/neuron-ui/src/components/FormattedTokenAmount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ type FormattedTokenAmountProps = { item: State.Transaction; show: boolean; symbo
type AmountProps = Omit<FormattedTokenAmountProps, 'isNeedCopy'> & {
sudtAmount?: string
isReceive: boolean
amount: string
amount?: string
symbolClassName?: string
}

Expand All @@ -30,18 +30,18 @@ const Amount = ({ sudtAmount, show, item, isReceive, amount, symbolClassName, sy
</div>
) : (
<div>
<span className={show ? styles.amount : ''} data-direction={isReceive ? 'receive' : 'send'}>
{amount}
<span className={show ? styles.amount : ''} data-direction={amount && (isReceive ? 'receive' : 'send')}>
{amount ?? '--'}
</span>
&nbsp;{symbol}
&nbsp;{amount ? symbol : ''}
</div>
)
}

export const FormattedTokenAmount = ({ item, show, symbolClassName }: FormattedTokenAmountProps) => {
let amount = '--'
let amount: string | undefined
let sudtAmount = ''
let copyText = amount
let copyText: string | undefined = amount
let isReceive = false
let symbol = ''

Expand All @@ -61,16 +61,22 @@ export const FormattedTokenAmount = ({ item, show, symbolClassName }: FormattedT
isReceive = !sudtAmount.includes('-')
}
} else {
amount = show ? `${shannonToCKBFormatter(item.value, true)}` : `${HIDE_BALANCE}`
isReceive = !amount.includes('-')
amount = show
? `${shannonToCKBFormatter(item.nervosDao ? item.daoCapacity ?? '--' : item.value, true)}`
: `${HIDE_BALANCE}`
isReceive = !amount?.includes('-')
copyText = `${amount} CKB`
symbol = 'CKB'
if (item.nervosDao && item.daoCapacity === undefined) {
amount = undefined
copyText = undefined
}
}
}

const props = { sudtAmount, show, item, isReceive, amount, symbolClassName, symbol }

return show ? (
return show && copyText ? (
<CopyZone content={copyText}>
<Amount {...props} />
</CopyZone>
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/components/History/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const History = () => {
sortable: true,
},
{
title: t('history.table.amount'),
title: t('history.table.asset'),
dataIndex: 'amount',
align: 'left',
isBalance: true,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useCallback, useState } from 'react'
import { useTranslation } from 'react-i18next'
import Button from 'widgets/Button'
import { getDevices, getDeviceFirmwareVersion, getDeviceCkbAppVersion, connectDevice } from 'services/remote'
import { getDevices, getDeviceCkbAppVersion, connectDevice } from 'services/remote'
import { isSuccessResponse, errorFormatter, useDidMount } from 'utils'
import { ReactComponent as SuccessInfo } from 'widgets/Icons/SuccessInfo.svg'
import { Error as ErrorIcon } from 'widgets/Icons/icon'
Expand Down Expand Up @@ -50,7 +50,6 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
const [scanning, setScanning] = useState(true)
const [error, setError] = useState('')
const [appVersion, setAppVersion] = useState('')
const [firmwareVersion, setFirmwareVersion] = useState('')

const findDevice = useCallback(async () => {
setError('')
Expand All @@ -76,10 +75,6 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
setScanning(false)
throw new ConnectFailedException(errorFormatter(connectionRes.message, t))
}
const firmwareVersionRes = await getDeviceFirmwareVersion(device.descriptor)
if (isSuccessResponse(firmwareVersionRes)) {
setFirmwareVersion(firmwareVersionRes.result!)
}
const ckbVersionRes = await getDeviceCkbAppVersion(device.descriptor)
if (isSuccessResponse(ckbVersionRes)) {
setAppVersion(ckbVersionRes.result!)
Expand Down Expand Up @@ -117,9 +112,6 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
<h3 className={styles.model}>{productName}</h3>
{errorMsg ? <Info isError msg={errorMsg} /> : null}
{scanning ? <Info isWaiting={scanning} msg={t('import-hardware.waiting')} /> : null}
{firmwareVersion && !errorMsg && !scanning ? (
<Info msg={t('import-hardware.firmware-version', { version: firmwareVersion })} />
) : null}
{appVersion ? <Info msg={t('import-hardware.app-version', { version: appVersion })} /> : null}
</section>
<footer className={styles.dialogFooter}>
Expand Down
Loading

1 comment on commit fbb496c

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Packaging for test is done in 9386685799

Please sign in to comment.