Skip to content

Commit

Permalink
Merge branch 'develop' into feat-425
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Jan 14, 2025
2 parents 421b4c7 + 764e34a commit 9071702
Show file tree
Hide file tree
Showing 33 changed files with 522 additions and 60 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/spam-comment-detection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
issue_comment:
types: [created, edited]

permissions:
issues: write

jobs:
detect-spam:
runs-on: ubuntu-latest
Expand All @@ -21,7 +24,7 @@ jobs:
const issue_number = process.env.ISSUE_NUMBER
const owner = process.env.REPO_OWNER
const repo = process.env.REPO_NAME
const EXTERNAL_LINK_REGEXT = /https:\/\/(?!((\w+\.)?github\.com|github\.com|(\w+\.)?magickbase\.com|(\w+\.)?nervos\.org))/gi
const EXTERNAL_LINK_REGEXT = /https?:\/\/(?!((\w+\.)?github\.com|github\.com|(\w+\.)?magickbase\.com|(\w+\.)?nervos\.org))/gi
if (spam_words.some(w => comment.includes(w))) {
console.info(`Spam comment: ${comment}`)
github.rest.issues.deleteComment({ owner, repo, comment_id })
Expand All @@ -43,4 +46,4 @@ jobs:
ISSUE_NUMBER: ${{ github.event.issue.number }}
REPO_OWNER: ${{github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
SPAM_WORDS: ${{ github.secrets.SPAM_WORDS }}
SPAM_WORDS: ${{ secrets.SPAM_WORDS }}
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,27 @@
# 0.120.0 (2024-12-13)

### CKB Node & Light Client

- [[email protected]](https://github.com/nervosnetwork/ckb/releases/tag/v0.120.0) was released on Dec. 12th, 2024. 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.4.1) was released on Nov. 13th, 2024. This version of CKB Light Client is now bundled and preconfigured in Neuron

### Assumed valid target

Block before `0xe1085c7ce8f4e8461ea75afe63ef21d2c1ce6a5d0bf0f0170042bebdd2fbde04`(at height `14,817,366`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/3282)

---

## New features

- #3271: Support Arabic, FrCanadian/Belgian in User Interface.(@Natixe)

## New Contributors

- @Natixe made their first contribution in https://github.com/nervosnetwork/neuron/pull/3271

**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.119.0...v0.120.0


# 0.119.0 (2024-12-02)

### CKB Node & Light Client
Expand Down
3 changes: 1 addition & 2 deletions compatible.json
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@
},
"0.119": {
"full": [
"0.120",
"0.119",
"0.118",
"0.117",
Expand All @@ -188,7 +187,7 @@
"0.2"
]
},
"0.119": {
"0.120": {
"full": [
"0.119",
"0.118",
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.119.0",
"version": "0.120.0",
"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.119.0",
"version": "0.120.0",
"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.119.0",
"version": "0.120.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,20 @@
}
}

.privateKey {
background: transparent;
border: none;
cursor: pointer;
&:hover {
svg {
g,
path {
stroke: var(--primary-color);
}
}
}
}

@media screen and (max-width: 1330px) {
.container {
.balance {
Expand Down
23 changes: 22 additions & 1 deletion packages/neuron-ui/src/components/AddressBook/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { useTranslation } from 'react-i18next'
import { useState as useGlobalState, useDispatch } from 'states'
import Dialog from 'widgets/Dialog'
import CopyZone from 'widgets/CopyZone'
import { Copy } from 'widgets/Icons/icon'
import ViewPrivateKey from 'components/ViewPrivateKey'
import { Copy, PrivateKey } from 'widgets/Icons/icon'
import Table, { TableProps, SortType } from 'widgets/Table'
import { shannonToCKBFormatter, useLocalDescription } from 'utils'
import { HIDE_BALANCE } from 'utils/const'
Expand Down Expand Up @@ -44,6 +45,7 @@ const AddressBook = ({ onClose }: { onClose?: () => void }) => {

const dispatch = useDispatch()
const { onChangeEditStatus, onSubmitDescription } = useLocalDescription('address', walletId, dispatch)
const [viewPrivateKeyAddress, setViewPrivateKeyAddress] = useState('')

const columns = useMemo<TableProps<State.Address>['columns']>(
() => [
Expand Down Expand Up @@ -149,6 +151,21 @@ const AddressBook = ({ onClose }: { onClose?: () => void }) => {
return 0
},
},
{
title: '',
dataIndex: 'key',
align: 'left',
width: '40px',
render(_, __, { address }) {
return (
<Tooltip tip={t('addresses.view-private-key')} placement="left">
<button type="button" className={styles.privateKey} onClick={() => setViewPrivateKeyAddress(address)}>
<PrivateKey />
</button>
</Tooltip>
)
},
},
],
[t]
)
Expand Down Expand Up @@ -179,6 +196,10 @@ const AddressBook = ({ onClose }: { onClose?: () => void }) => {
}
/>
</div>

{!!viewPrivateKeyAddress && (
<ViewPrivateKey address={viewPrivateKeyAddress} onClose={() => setViewPrivateKeyAddress('')} />
)}
</div>
</Dialog>
)
Expand Down
36 changes: 23 additions & 13 deletions packages/neuron-ui/src/components/Receive/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import Button from 'widgets/Button'
import CopyZone from 'widgets/CopyZone'
import QRCode from 'widgets/QRCode'
import Tooltip from 'widgets/Tooltip'
import { AddressTransform, Download, Copy, Attention, SuccessNoBorder } from 'widgets/Icons/icon'
import ViewPrivateKey from 'components/ViewPrivateKey'
import { AddressTransform, Download, Copy, Attention, SuccessNoBorder, PrivateKey } from 'widgets/Icons/icon'
import VerifyHardwareAddress from './VerifyHardwareAddress'
import styles from './receive.module.scss'
import { useCopyAndDownloadQrCode, useSwitchAddress } from './hooks'
Expand All @@ -29,6 +30,7 @@ export const AddressQrCodeWithCopyZone = ({
)

const [isCopySuccess, setIsCopySuccess] = useState(false)
const [showViewPrivateKey, setShowViewPrivateKey] = useState(false)
const timer = useRef<ReturnType<typeof setTimeout>>()
const { ref, onCopyQrCode, onDownloadQrCode, showCopySuccess } = useCopyAndDownloadQrCode()

Expand Down Expand Up @@ -70,19 +72,27 @@ export const AddressQrCodeWithCopyZone = ({
<CopyZone content={showAddress} className={styles.showAddress}>
{showAddress}
</CopyZone>
<button
type="button"
className={styles.addressToggle}
onClick={onClick}
title={transformLabel}
onFocus={stopPropagation}
onMouseOver={stopPropagation}
onMouseUp={stopPropagation}
>
<AddressTransform />
{transformLabel}
</button>
<div className={styles.actionWrap}>
<button
type="button"
className={styles.addressToggle}
onClick={onClick}
title={transformLabel}
onFocus={stopPropagation}
onMouseOver={stopPropagation}
onMouseUp={stopPropagation}
>
<AddressTransform />
{transformLabel}
</button>
<button type="button" className={styles.privateKey} onClick={() => setShowViewPrivateKey(true)}>
<PrivateKey />
{t('addresses.view-private-key')}
</button>
</div>
</div>

{showViewPrivateKey && <ViewPrivateKey address={showAddress} onClose={() => setShowViewPrivateKey(false)} />}
</div>
)
}
Expand Down
48 changes: 32 additions & 16 deletions packages/neuron-ui/src/components/Receive/receive.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,42 @@
color: var(--main-text-color);
}

.addressToggle {
width: 100%;
.actionWrap {
margin-top: 8px;
appearance: none;
border: none;
background: none;
display: flex;
justify-content: center;
align-items: center;
font-size: 12px;
font-family: PingFang SC;
font-style: normal;
font-weight: 500;
color: var(--primary-color);
line-height: normal;
cursor: pointer;
gap: 32px;

svg {
pointer-events: none;
margin-right: 5px;
button {
appearance: none;
border: none;
background: none;
font-size: 12px;
font-style: normal;
font-weight: 500;
color: var(--primary-color);
line-height: normal;
cursor: pointer;
display: flex;
align-items: center;
}

.addressToggle {
svg {
pointer-events: none;
margin-right: 5px;
}
}

.privateKey {
svg {
width: 16px;
margin-right: 3px;
g,
path {
stroke: var(--primary-color);
}
}
}
}

Expand Down
42 changes: 37 additions & 5 deletions packages/neuron-ui/src/components/SignAndVerify/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
import React, { useState, useEffect, useCallback } from 'react'
import React, { useState, useEffect, useCallback, useMemo } from 'react'
import { TFunction } from 'i18next'
import { useTranslation } from 'react-i18next'
import { showErrorMessage, signMessage, verifyMessage } from 'services/remote'
import { ControllerResponse } from 'services/remote/remoteApiWrapper'
import { ErrorCode, isSuccessResponse, shannonToCKBFormatter, useExitOnWalletChange, useGoBack } from 'utils'
import {
ErrorCode,
isSuccessResponse,
shannonToCKBFormatter,
useExitOnWalletChange,
useGoBack,
validateAddress,
isMainnet as isMainnetUtil,
} from 'utils'
import { isErrorWithI18n } from 'exceptions'
import { useState as useGlobalState } from 'states'
import Button from 'widgets/Button'
import Balance from 'widgets/Balance'
Expand Down Expand Up @@ -130,8 +139,13 @@ const SignAndVerify = () => {
const [message, setMessage] = useState('')
const [signature, setSignature] = useState('')
const [address, setAddress] = useState('')
const { wallet } = useGlobalState()
const {
chain: { networkID },
settings: { networks },
wallet,
} = useGlobalState()
const [isDropdownOpen, setIsDropdownOpen] = useState(false)
const isMainnet = isMainnetUtil(networks, networkID)
useExitOnWalletChange()

const handlePasswordDialogOpen = useCallback(() => {
Expand Down Expand Up @@ -226,12 +240,29 @@ const SignAndVerify = () => {

const onBack = useGoBack()

const addressError = useMemo(() => {
if (!address) {
return undefined
}
try {
validateAddress(address, isMainnet)
} catch (err) {
if (isErrorWithI18n(err)) {
return t(err.message, err.i18n)
}
}
if (wallet?.addresses && !wallet.addresses.find(item => item.address === address)) {
return t('sign-and-verify.address-not-found')
}
return undefined
}, [t, address, isMainnet, wallet.addresses])

return (
<div>
<Dialog
show={showDialog}
title={t('sign-and-verify.sign-or-verify-message')}
disabled={!message || !signature || !address}
disabled={!message || !signature || !address || !!addressError}
onCancel={onBack}
confirmText={t('sign-and-verify.verify')}
onConfirm={handleVerifyMessage}
Expand Down Expand Up @@ -270,6 +301,7 @@ const SignAndVerify = () => {
</div>
}
width="100%"
error={addressError}
/>
</div>
{isDropdownOpen && wallet?.addresses ? (
Expand Down Expand Up @@ -311,7 +343,7 @@ const SignAndVerify = () => {

{wallet?.isWatchOnly || (
<div className={styles.signWrap}>
<Button type="text" disabled={!message || !address} onClick={handlePasswordDialogOpen}>
<Button type="text" disabled={!message || !address || !!addressError} onClick={handlePasswordDialogOpen}>
<Sign />
{t('sign-and-verify.sign')}
</Button>
Expand Down
Loading

1 comment on commit 9071702

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

Please sign in to comment.