Skip to content

Commit

Permalink
Merge branch 'develop' into feat-walletconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Nov 14, 2023
2 parents c00bb75 + bc833eb commit 90c5e1a
Show file tree
Hide file tree
Showing 90 changed files with 1,373 additions and 466 deletions.
2 changes: 1 addition & 1 deletion .ckb-light-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.4
v0.3.0
38 changes: 35 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,35 @@
# 0.111.1 (2023-11-08)

### CKB Node & Light Client

- [[email protected]](https://github.com/nervosnetwork/ckb/releases/tag/v0.111.0) was released on Sep. 14nd, 2023. This version of CKB node is now bundled and preconfigured in Neuron.
- [CKB Light [email protected]](https://github.com/nervosnetwork/ckb-light-client/releases/tag/v0.3.0) was released on Nov. 2nd, 2023. This version of CKB Light Client is now bundled and preconfigured in Neuron

#### Important

**CKB Light Client on Mainnet** is active and available in Neuron 👏. See how to enable Light Client on Mainnet on YouTube: https://www.youtube.com/watch?v=Vl2LGRNqnvk

[![Light Client on Mainnet](https://github.com/nervosnetwork/neuron/assets/7271329/97fb7848-350d-4d45-ab2d-1e79dd3c9716)](https://www.youtube.com/watch?v=Vl2LGRNqnvk)

#### Caveat

◆ "Internal Node" network option is reserved for the built-in CKB node for clarity, and won't be connected to an external CKB node anymore.

### Assumed valid target

Block before `0x79cecdd6f41361e2474290224751284312a018528d1d92f4e18dd6d542feddfe`(at height `11,204,206`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/2923)

---

## New features

- #2913: Use KeyLocker to sign Neuron for Windows, conforming to the new industry standards effective since June 1, 2023.(@keith-cy)
- #2921: Add network option of "Light Client(Mainnet)", and reserve "Internal Node" for built-in CKB Node only.(@yanguoyu)


**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.111.0...v0.111.1


# 0.111.0 (2023-10-19)

### CKB Node & Light Client
Expand All @@ -17,9 +49,9 @@ Block before `0xd5e25ad24400f237aa5f72f3738a9ae77fe082a89937e75143fcc8ef5b009383

## Bug fixes

* #2869: Add a dialog for migration.(@yanguoyu)
* #2870: Fix width of navbar.(@yanguoyu)
* #2873: Fix fallback font on Linux.(@yanguoyu)
- #2869: Add a dialog for migration.(@yanguoyu)
- #2870: Fix width of navbar.(@yanguoyu)
- #2873: Fix fallback font on Linux.(@yanguoyu)


**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.110.3...v0.111.0
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.111.0",
"version": "0.111.1",
"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.111.0",
"version": "0.111.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.111.0",
"version": "0.111.1",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
10 changes: 5 additions & 5 deletions packages/neuron-ui/src/components/DataSetting/hooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useState } from 'react'
import React, { useCallback, useEffect, useState } from 'react'
import { useTranslation } from 'react-i18next'
import {
getCkbNodeDataPath,
Expand All @@ -7,11 +7,11 @@ import {
stopProcessMonitor,
setCkbNodeDataPath,
} from 'services/remote'
import { isSuccessResponse, useDidMount } from 'utils'
import { isSuccessResponse } from 'utils'

const type = 'ckb'

export const useDataPath = () => {
export const useDataPath = (network?: State.Network) => {
const [t] = useTranslation()
const [isSaving, setIsSaving] = useState(false)
const [savingType, setSavingType] = useState<string | null>()
Expand All @@ -20,13 +20,13 @@ export const useDataPath = () => {
const [isDialogOpen, setIsDialogOpen] = useState(false)
const [faidMessage, setFaidMessage] = useState('')

useDidMount(() => {
useEffect(() => {
getCkbNodeDataPath().then(res => {
if (isSuccessResponse(res)) {
setPrevPath(res.result!)
}
})
})
}, [network?.id])
const onSetting = useCallback(() => {
invokeShowOpenDialog({
buttonLabel: t('settings.data.set', { lng: navigator.language }),
Expand Down
42 changes: 13 additions & 29 deletions packages/neuron-ui/src/components/DataSetting/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import React, { useCallback, useEffect, useState, useRef, useMemo } from 'react'
import React, { useCallback, useRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
import Button from 'widgets/Button'
import ClearCache from 'components/ClearCache'
import { useDispatch, useState as useGlobalState } from 'states'
import { shell } from 'electron'
import { getIsCkbRunExternal } from 'services/remote'
import { isSuccessResponse } from 'utils'
import Tooltip from 'widgets/Tooltip'
import Dialog from 'widgets/Dialog'
import AlertDialog from 'widgets/AlertDialog'
import { LIGHT_NETWORK_TYPE } from 'utils/const'
import { NetworkType } from 'utils/const'
import { Attention } from 'widgets/Icons/icon'
import { useDataPath } from './hooks'

Expand Down Expand Up @@ -42,6 +40,12 @@ const PathItem = ({
const DataSetting = () => {
const dispatch = useDispatch()
const [t] = useTranslation()
const resyncRef = useRef<HTMLButtonElement | null>(null)
const {
chain: { networkID },
settings: { networks = [] },
} = useGlobalState()
const network = useMemo(() => networks.find(n => n.id === networkID), [networkID, networks])
const {
onSetting,
prevPath,
Expand All @@ -53,38 +57,20 @@ const DataSetting = () => {
savingType,
faidMessage,
setFaidMessage,
} = useDataPath()

const resyncRef = useRef<HTMLButtonElement | null>(null)
} = useDataPath(network)

const openPath = useCallback(() => {
if (prevPath) {
shell.openPath(prevPath!)
}
}, [prevPath])
const [isCkbRunExternal, setIsCkbRunExternal] = useState<boolean | undefined>()
useEffect(() => {
getIsCkbRunExternal().then(res => {
if (isSuccessResponse(res)) {
setIsCkbRunExternal(res.result ?? false)
} else {
// ignore
}
})
}, [])
const {
chain: { networkID },
settings: { networks = [] },
} = useGlobalState()
const isLightClient = useMemo(
() => networks.find(n => n.id === networkID)?.type === LIGHT_NETWORK_TYPE,
[networkID, networks]
)
const isLightClient = network?.type === NetworkType.Light
const hiddenDataPath = isLightClient || !network?.readonly
return (
<>
<div className={styles.root}>
<div className={styles.leftContainer}>
{isLightClient ? null : (
{hiddenDataPath ? null : (
<div className={styles.label}>
<div>{t('settings.data.ckb-node-data')}</div>
<Tooltip
Expand All @@ -110,9 +96,7 @@ const DataSetting = () => {
</div>
</div>
<div className={styles.rightContainer}>
{isLightClient ? null : (
<PathItem path={prevPath} openPath={openPath} handleClick={onSetting} disabled={isCkbRunExternal} />
)}
{hiddenDataPath ? null : <PathItem path={prevPath} openPath={openPath} handleClick={onSetting} />}
<ClearCache
className={styles.item}
btnClassName={styles.itemBtn}
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/HDWalletSign/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { DeviceSignIndex as DeviceSignIndexSubject } from 'services/subjects'

import styles from '../HardwareSign/hardwareSign.module.scss'

const { MAINNET_TAG } = CONSTANTS
const { MAINNET_CLIENT_LIST } = CONSTANTS

const HDWalletSign = ({ tx }: { tx: State.DetailedTransaction }) => {
const [t] = useTranslation()
Expand All @@ -33,7 +33,7 @@ const HDWalletSign = ({ tx }: { tx: State.DetailedTransaction }) => {
throw new Error('Cannot find current network in the network list')
}

setIsMainnet(network.chain === MAINNET_TAG)
setIsMainnet(MAINNET_CLIENT_LIST.includes(network.chain))
}
})
.catch(err => console.warn(err))
Expand Down
7 changes: 2 additions & 5 deletions packages/neuron-ui/src/components/HistoryDetailPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ import Tooltip from 'widgets/Tooltip'

import {
ErrorCode,
CONSTANTS,
localNumberFormatter,
uniformTimeFormatter,
shannonToCKBFormatter,
isSuccessResponse,
isMainnet as isMainnetUtil,
} from 'utils'
import { HIDE_BALANCE } from 'utils/const'

import styles from './historyDetailPage.module.scss'

const { MAINNET_TAG } = CONSTANTS

type InputOrOutputType = (State.DetailedInput | State.DetailedOutput) & { idx: number }

const InfoItem = ({ label, value, className }: { label: string; value: React.ReactNode; className?: string }) => (
Expand All @@ -46,8 +44,7 @@ const HistoryDetailPage = () => {
settings: { networks },
wallet: currentWallet,
} = useGlobalState()
const network = networks.find(n => n.id === networkID)
const isMainnet = network != null && network.chain === MAINNET_TAG
const isMainnet = isMainnetUtil(networks, networkID)
const [t] = useTranslation()
const [transaction, setTransaction] = useState(transactionState)
const [error, setError] = useState({ code: '', message: '' })
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/MultisigAddress/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { ReactComponent as Transfer } from 'widgets/Icons/Transfer.svg'
import { ReactComponent as Upload } from 'widgets/Icons/Upload.svg'
import { ReactComponent as Edit } from 'widgets/Icons/Edit.svg'
import { Download, Search } from 'widgets/Icons/icon'
import { HIDE_BALANCE, LIGHT_NETWORK_TYPE } from 'utils/const'
import { HIDE_BALANCE, NetworkType } from 'utils/const'
import { onEnter } from 'utils/inputDevice'
import { useSearch, useConfigManage, useExportConfig, useActions, useSubscription } from './hooks'

Expand Down Expand Up @@ -62,7 +62,7 @@ const MultisigAddress = () => {
} = useGlobalState()
const isMainnet = isMainnetUtil(networks, networkID)
const isLightClient = useMemo(
() => networks.find(n => n.id === networkID)?.type === LIGHT_NETWORK_TYPE,
() => networks.find(n => n.id === networkID)?.type === NetworkType.Light,
[networks, networkID]
)
const [isCreateDialogOpen, setIsCreateDialogOpen] = useState(false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { FC, useMemo, useState } from 'react'
import Tabs, { VariantProps } from 'widgets/Tabs'
import { clsx, localNumberFormatter, shannonToCKBFormatter } from 'utils'
import { clsx, localNumberFormatter, shannonToCKBFormatter, isMainnet as isMainnetUtils } from 'utils'
import { useTranslation } from 'react-i18next'
import { scriptToAddress } from '@nervosnetwork/ckb-sdk-utils'
import { onEnter } from 'utils/inputDevice'
import { EyesClose, EyesOpen } from 'widgets/Icons/icon'
import { HIDE_BALANCE, MAINNET_TAG } from 'utils/const'
import { HIDE_BALANCE } from 'utils/const'
import ScriptTag from 'components/ScriptTag'
import LockInfoDialog from 'components/LockInfoDialog'
import { useState as useGlobalState } from 'states'
Expand All @@ -24,8 +24,7 @@ const TabsVariantWithCellsCard: FC<
chain: { networkID },
settings: { networks },
} = useGlobalState()
const network = networks.find(n => n.id === networkID)
const isMainnet = network != null && network.chain === MAINNET_TAG
const isMainnet = isMainnetUtils(networks, networkID)

const [isPrivacyMode, setIsPrivacyMode] = useState(false)
const [showingLockInfo, setShowingLockInfo] = useState<CKBComponents.Script | null>(null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ const NetworkEditorDialog = ({
onCancel,
id,
onSuccess,
url,
}: {
onCancel: () => void
id: 'new' | string
onSuccess: () => void
url?: string
}) => {
const {
settings: { networks = [] },
Expand All @@ -31,7 +33,7 @@ const NetworkEditorDialog = ({
const [editor, setEditor] = useState({
name: '',
nameError: '',
url: '',
url: url ?? '',
urlError: '',
})
const [isUpdating, setIsUpdating] = useState(false)
Expand Down Expand Up @@ -115,6 +117,7 @@ const NetworkEditorDialog = ({
error={editor.urlError}
placeholder={t('settings.network.edit-network.input-rpc')}
autoFocus
disabled={!!url}
/>
<TextField
value={editor.name}
Expand Down
Loading

0 comments on commit 90c5e1a

Please sign in to comment.