Skip to content

Commit

Permalink
Merge branch 'develop' into feat-377
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan authored Jun 1, 2024
2 parents 4aad5da + 5d4afb1 commit 2a9d12a
Show file tree
Hide file tree
Showing 42 changed files with 494 additions and 246 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
38 changes: 38 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# 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
Expand Down
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.116.0",
"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.116.0",
"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.116.0",
"version": "0.116.2",
"private": true,
"author": {
"name": "Nervos Core Dev",
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
76 changes: 47 additions & 29 deletions packages/neuron-ui/src/containers/Main/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ const MainContent = () => {
[network, networks]
)

const isLightClientNetwork = network?.type === 2

useSyncChainData({
chainURL: network?.remote ?? '',
dispatch,
Expand Down Expand Up @@ -98,6 +100,48 @@ const MainContent = () => {
}
}, [])

const dialogProps = (function getDialogProps() {
if (isLightClientNetwork) {
return {
onConfirm: onCloseSwitchNetwork,
children: t('main.external-node-detected-dialog.external-node-is-light'),
}
}
if (sameUrlNetworks.length) {
return {
onConfirm: onSwitchNetwork,
children: (
<>
<span className={styles.chooseNetworkTip}>
{t('main.external-node-detected-dialog.body-tips-with-network')}
</span>
<div className={styles.networks}>
<RadioGroup
onChange={onChangeSelected}
options={sameUrlNetworks.map(v => ({
value: v.id,
label: `${v.name} (${v.remote})`,
}))}
inputIdPrefix="main-switch"
/>
</div>
<div className={styles.addNetwork}>
<Button type="text" onClick={onOpenEditorDialog}>
<AddSimple />
{t('main.external-node-detected-dialog.add-network')}
</Button>
</div>
</>
),
}
}
return {
onConfirm: onOpenEditorDialog,
confirmText: t('main.external-node-detected-dialog.add-network'),
children: t('main.external-node-detected-dialog.body-tips-without-network'),
}
})()

return (
<div onContextMenu={onContextMenu}>
<Outlet />
Expand All @@ -124,39 +168,13 @@ const MainContent = () => {
<Dialog
show={isSwitchNetworkShow}
onCancel={onCloseSwitchNetwork}
onConfirm={sameUrlNetworks.length ? onSwitchNetwork : onOpenEditorDialog}
confirmText={sameUrlNetworks.length ? undefined : t('main.external-node-detected-dialog.add-network')}
onConfirm={dialogProps.onConfirm}
confirmText={dialogProps.confirmText}
cancelText={t('main.external-node-detected-dialog.ignore-external-node')}
title={t('main.external-node-detected-dialog.title')}
className={styles.networkDialog}
>
{sameUrlNetworks.length ? (
<span className={styles.chooseNetworkTip}>
{t('main.external-node-detected-dialog.body-tips-with-network')}
</span>
) : (
t('main.external-node-detected-dialog.body-tips-without-network')
)}
{sameUrlNetworks.length ? (
<>
<div className={styles.networks}>
<RadioGroup
onChange={onChangeSelected}
options={sameUrlNetworks.map(v => ({
value: v.id,
label: `${v.name} (${v.remote})`,
}))}
inputIdPrefix="main-switch"
/>
</div>
<div className={styles.addNetwork}>
<Button type="text" onClick={onOpenEditorDialog}>
<AddSimple />
{t('main.external-node-detected-dialog.add-network')}
</Button>
</div>
</>
) : null}
{dialogProps.children}
</Dialog>
{showEditorDialog ? (
<NetworkEditorDialog
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,8 @@
"body-tips-without-network": "\"Internal Node\" is reserved for the built-in CKB node, please add a new network option for the external node.",
"body-tips-with-network": "\"Internal Node\" is reserved for the built-in CKB node, please select from the following network options or add a new one for the external node.",
"add-network": "Add Network",
"ignore-external-node": "Ignore external node"
"ignore-external-node": "Ignore external node",
"external-node-is-light": "Neuron does not support external light client nodes due to different security assumptions for light clients. Would you like to connect to the \"Light Client\" ?"
},
"no-disk-space-dialog": {
"tip": "Due to insufficient disk space, synchronization has been stopped. <br /> Please allocate more disk space or migrate the data to another disk.",
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -1192,7 +1192,8 @@
"body-tips-without-network": "\"Internal Node\" está reservado para el nodo CKB incorporado, agregue una nueva opción de red para el nodo externo.",
"body-tips-with-network": "\"Internal Node\" está reservado para el nodo CKB incorporado, seleccione una de las siguientes opciones de red o agregue una nueva para el nodo externo.",
"add-network": "Agregar red",
"ignore-external-node": "Ignorar nodo externo"
"ignore-external-node": "Ignorar nodo externo",
"external-node-is-light": "Debido a las diferentes suposiciones de seguridad del cliente ligero, Neuron no admite nodos de cliente ligero externos. ¿Desea conectarse a un \"Light Client\" ?"
},
"no-disk-space-dialog": {
"tip": "La sincronización se ha detenido debido a falta de espacio en disco. <br /> Asigne más espacio en disco o migre los datos a otro disco.",
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -1202,7 +1202,8 @@
"body-tips-without-network": "\"Noeud interne\" est réservé au noeud CKB intégré, veuillez ajouter une nouvelle option réseau pour le noeud externe.",
"body-tips-with-network": "\"Noeud interne\" est réservé au noeud CKB intégré, veuillez sélectionner parmi les options réseau suivantes ou en ajouter une nouvelle pour le noeud externe.",
"add-network": "Ajouter un réseau",
"ignore-external-node": "Ignorer le noeud externe"
"ignore-external-node": "Ignorer le noeud externe",
"external-node-is-light": "En raison de différentes hypothèses de sécurité du client léger, Neuron ne prend pas en charge les nœuds clients légers externes. Voulez-vous vous connecter à un \"Light Client\" ?"
},
"no-disk-space-dialog": {
"tip": "En raison d'un espace disque insuffisant, la synchronisation a été interrompue. <br /> Veuillez allouer plus d'espace disque ou migrer les données vers un autre disque.",
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,8 @@
"body-tips-without-network": "\"Internal Node\" 僅用於連接內置節點,請添加新的網絡選項以連接外部節點。",
"body-tips-with-network": "\"Internal Node\" 僅用於連接內置節點,請選擇以下網絡選項或添加新的網絡選項以連接外部節點。",
"add-network": "添加網絡",
"ignore-external-node": "忽略外部節點"
"ignore-external-node": "忽略外部節點",
"external-node-is-light": "由於輕客戶端的安全假設不同,Neuron 不支持外部輕客戶端節點。您想連接到 \"Light Client\" 嗎?"
},
"no-disk-space-dialog": {
"tip": "由於磁盤空間不足,同步已停止。 <br /> 請分配更多磁盤空間或將數據遷移到其他磁盤。",
Expand Down
3 changes: 2 additions & 1 deletion packages/neuron-ui/src/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,8 @@
"body-tips-without-network": "\"Internal Node\" 仅用于连接内置节点,请添加新的网络选项以连接外部节点。",
"body-tips-with-network": "\"Internal Node\" 仅用于连接内置节点,请选择以下网络选项或添加新的网络选项以连接外部节点。",
"add-network": "添加网络",
"ignore-external-node": "忽略外部节点"
"ignore-external-node": "忽略外部节点",
"external-node-is-light": "由于轻客户端的安全假设不同,Neuron 不支持外部轻客户端节点。您想连接到 \"Light Client\" 吗?"
},
"no-disk-space-dialog": {
"tip": "由于磁盘空间不足,同步已停止。 <br /> 请分配更多磁盘空间或将数据迁移到其他磁盘。",
Expand Down
1 change: 0 additions & 1 deletion packages/neuron-ui/src/services/remote/hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export type Version = string

export const getDevices = remoteApi<Model | null, DeviceInfo[]>('detect-device')
export const getDeviceCkbAppVersion = remoteApi<Descriptor, Version>('get-device-ckb-app-version')
export const getDeviceFirmwareVersion = remoteApi<Descriptor, Version>('get-device-firmware-version')
export const getDeviceExtendedPublickey = remoteApi<void, ExtendedPublicKey>('get-device-extended-public-key')
export const getDevicePublicKey = remoteApi<void, PublicKey>('get-device-public-key')
export const connectDevice = remoteApi<DeviceInfo, void>('connect-device')
Expand Down
1 change: 0 additions & 1 deletion packages/neuron-ui/src/services/remote/remoteApiWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ type Action =
// Hardware Wallet
| 'detect-device'
| 'get-device-ckb-app-version'
| 'get-device-firmware-version'
| 'get-device-public-key'
| 'get-device-extended-public-key'
| 'connect-device'
Expand Down
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.116.0",
"version": "0.116.2",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -97,7 +97,7 @@
"electron-builder": "24.9.1",
"electron-devtools-installer": "3.2.0",
"jest-when": "3.6.0",
"neuron-ui": "0.116.0",
"neuron-ui": "0.116.2",
"typescript": "5.3.3"
}
}
7 changes: 3 additions & 4 deletions packages/neuron-wallet/src/block-sync-renderer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import DataUpdateSubject from '../models/subjects/data-update'
import AddressCreatedSubject from '../models/subjects/address-created-subject'
import WalletDeletedSubject from '../models/subjects/wallet-deleted-subject'
import TxDbChangedSubject from '../models/subjects/tx-db-changed-subject'
import { LumosCellQuery, LumosCell } from './sync/synchronizer'
import { type Cell, type QueryOptions } from '@ckb-lumos/base'
import { WorkerMessage, StartParams, QueryIndexerParams } from './task'
import logger from '../utils/logger'
import CommonUtils from '../utils/common'
Expand Down Expand Up @@ -88,7 +88,7 @@ export const switchToNetwork = async (newNetwork: Network, reconnected = false,
await resetSyncTaskQueue.asyncPush(shouldSync)
}

export const queryIndexer = async (query: LumosCellQuery): Promise<LumosCell[]> => {
export const queryIndexer = async (query: QueryOptions): Promise<Cell[]> => {
const _child = child
if (!_child) {
return []
Expand All @@ -102,7 +102,7 @@ export const queryIndexer = async (query: LumosCellQuery): Promise<LumosCell[]>
return registerRequest(_child, msg).catch(err => {
logger.error(`Sync:\tfailed to register query indexer task`, err)
return []
}) as Promise<LumosCell[]>
}) as Promise<Cell[]>
}

export const createBlockSyncTask = async () => {
Expand Down Expand Up @@ -177,7 +177,6 @@ export const createBlockSyncTask = async () => {
genesisHash: network.genesisHash,
url: network.remote,
addressMetas,
indexerUrl: network.remote,
nodeType: network.type,
}
const msg: Required<WorkerMessage<StartParams>> = { type: 'call', channel: 'start', id: requestId++, message }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import IndexerCacheService from './indexer-cache-service'
export default class FullSynchronizer extends Synchronizer {
private rpcService: RpcService

constructor(addresses: Address[], nodeUrl: string, indexerUrl: string, nodeType: NetworkType) {
super({ addresses, nodeUrl, indexerUrl })
constructor(addresses: Address[], nodeUrl: string, nodeType: NetworkType) {
super({ addresses, nodeUrl })
this.rpcService = new RpcService(nodeUrl, nodeType)
}

Expand Down
Loading

1 comment on commit 2a9d12a

@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 9328243480

Please sign in to comment.