Skip to content

Commit

Permalink
Merge branch 'develop' into feat-multisig-address
Browse files Browse the repository at this point in the history
  • Loading branch information
devchenyan committed Jun 28, 2023
2 parents 4643657 + 94678b0 commit 79f9743
Show file tree
Hide file tree
Showing 86 changed files with 893 additions and 1,041 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/add-replied-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- id: check-access
name: Check if the commenter is a collaborator
uses: actions/github-script@v4
uses: actions/github-script@v6
with:
script: |
try{
Expand All @@ -30,7 +30,7 @@ jobs:

- id: check-issue
name: Check if the comment is replied in an issue
uses: actions/github-script@v4
uses: actions/github-script@v6
with:
script: |
const response = await github.issues.get({
Expand All @@ -45,7 +45,7 @@ jobs:
- id: add-label
name: Add 'replied' label
if: ${{ steps.check-access.outputs.result == 'true' && steps.check-issue.outputs.result == 'true' }}
uses: actions/github-script@v4
uses: actions/github-script@v6
with:
script: |
await github.issues.addLabels({
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/check-spell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Check spell
on:
- pull_request
- push

jobs:
run:
name: Check spell
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- id: changed-files
uses: tj-actions/changed-files@v36

- uses: crate-ci/typos@master
with:
files: ${{ steps.changed-files.outputs.all_changed_files }}
11 changes: 11 additions & 0 deletions _typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[default.extend-words]
thur = "thur"

# defined in database schema
lastest = "lastest"

[files]
extend-exclude = ["CHANGELOG.md", "**/migrations/*.ts"]



8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@
"@types/jest": "27.5.2",
"@types/node": "18.16.18",
"@types/npmlog": "4.1.4",
"@typescript-eslint/eslint-plugin": "5.58.0",
"@typescript-eslint/parser": "5.58.0",
"@typescript-eslint/eslint-plugin": "5.60.1",
"@typescript-eslint/parser": "5.60.1",
"concurrently": "8.2.0",
"cross-env": "7.0.3",
"eslint": "8.38.0",
"eslint-config-prettier": "8.8.0",
"eslint-plugin-prettier": "4.2.1",
"husky": "8.0.3",
"lerna": "7.0.2",
"lerna": "7.1.0",
"lint-staged": "13.2.2",
"ncp": "2.0.0",
"prettier": "2.8.8",
Expand All @@ -65,6 +65,6 @@
"usb": "1.8.8"
},
"volta": {
"node": "18.16.0"
"node": "18.16.1"
}
}
36 changes: 18 additions & 18 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"last 2 chrome versions"
],
"dependencies": {
"@nervosnetwork/ckb-sdk-core": "0.107.0",
"@nervosnetwork/ckb-sdk-utils": "0.107.0",
"@nervosnetwork/ckb-sdk-core": "0.109.0",
"@nervosnetwork/ckb-sdk-utils": "0.109.0",
"canvg": "2.0.0",
"i18next": "21.10.0",
"immer": "9.0.21",
Expand All @@ -56,25 +56,25 @@
"react": "17.0.2",
"react-dom": "17.0.2",
"react-i18next": "12.1.5",
"react-router-dom": "6.4.1",
"react-router-dom": "6.14.0",
"react-transition-group": "4.4.5",
"sass": "1.62.0"
"sass": "1.63.6"
},
"devDependencies": {
"@babel/plugin-proposal-private-property-in-object": "7.21.11",
"@babel/preset-typescript": "7.18.6",
"@storybook/addon-actions": "6.5.12",
"@storybook/addon-essentials": "6.5.12",
"@storybook/addon-interactions": "6.5.12",
"@storybook/addon-links": "6.5.12",
"@storybook/builder-webpack4": "6.5.12",
"@storybook/builder-webpack5": "6.5.12",
"@storybook/manager-webpack4": "6.5.12",
"@storybook/manager-webpack5": "6.5.12",
"@storybook/node-logger": "6.5.12",
"@babel/preset-typescript": "7.22.5",
"@storybook/addon-actions": "6.5.16",
"@storybook/addon-essentials": "6.5.16",
"@storybook/addon-interactions": "6.5.16",
"@storybook/addon-links": "6.5.16",
"@storybook/builder-webpack4": "6.5.16",
"@storybook/builder-webpack5": "6.5.16",
"@storybook/manager-webpack4": "6.5.16",
"@storybook/manager-webpack5": "6.5.16",
"@storybook/node-logger": "6.5.16",
"@storybook/preset-create-react-app": "4.1.2",
"@storybook/react": "6.5.12",
"@storybook/testing-library": "0.0.13",
"@storybook/react": "6.5.16",
"@storybook/testing-library": "0.2.0",
"@types/enzyme": "3.10.13",
"@types/enzyme-adapter-react-16": "1.0.6",
"@types/node": "18.16.18",
Expand All @@ -84,7 +84,7 @@
"@types/styled-components": "5.1.26",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"babel-jest": "25.5.1",
"electron": "24.5.1",
"electron": "24.6.0",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.7",
"eslint-config-airbnb": "19.0.4",
Expand All @@ -96,7 +96,7 @@
"react-scripts": "5.0.1",
"react-test-renderer": "16.14.0",
"storybook-addon-react-router-v6": "0.2.1",
"webpack": "5.76.0"
"webpack": "5.88.0"
},
"resolutions": {
"react-i18next": "12.1.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
border-bottom: 1px solid var(--table-head-border-color);

.tip {
// This selector is only used to increase weight and override the default styles in the Tooltip component.
&:not([data-tooltip='']) {
left: calc(100% - 240px);
}
Expand Down
6 changes: 3 additions & 3 deletions packages/neuron-ui/src/components/DataSetting/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const type = 'ckb'

export const useDataPath = () => {
const [t] = useTranslation()
const [isSaving, setIsSaveing] = useState(false)
const [isSaving, setIsSaving] = useState(false)
const [savingType, setSavingType] = useState<string | null>()
const [prevPath, setPrevPath] = useState<string>()
const [currentPath, setCurrentPath] = useState<string | undefined>()
Expand Down Expand Up @@ -50,7 +50,7 @@ export const useDataPath = () => {
const onConfirm = useCallback(
(e: React.MouseEvent<HTMLDivElement>) => {
const { dataset } = e.currentTarget
setIsSaveing(true)
setIsSaving(true)
setSavingType(dataset.syncType)
setCkbNodeDataPath({
dataPath: currentPath!,
Expand All @@ -63,7 +63,7 @@ export const useDataPath = () => {
}
})
.finally(() => {
setIsSaveing(false)
setIsSaving(false)
setSavingType(null)
})
},
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/GeneralSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { checkForUpdates, downloadUpdate, installUpdate, getVersion } from 'serv
import { LanguageSelect, CheckUpdateIcon } from 'widgets/Icons/icon'
import styles from './generalSetting.module.scss'

interface UpdateDowloadStatusProps {
interface UpdateDownloadStatusProps {
show: boolean
onCancel: () => void
progress: number
Expand All @@ -22,7 +22,7 @@ const UpdateDownloadStatus = ({
progress = 0,
newVersion = '',
releaseNotes = '',
}: UpdateDowloadStatusProps) => {
}: UpdateDownloadStatusProps) => {
const [t] = useTranslation()
const available = newVersion !== '' && progress < 0
const downloaded = progress >= 1
Expand Down
16 changes: 8 additions & 8 deletions packages/neuron-ui/src/components/HDWalletSign/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const HDWalletSign = ({ tx }: { tx: State.DetailedTransaction }) => {
const [isMainnet, setIsMainnet] = useState(false)
const addressPrefix = isMainnet ? ckbCore.utils.AddressPrefix.Mainnet : ckbCore.utils.AddressPrefix.Testnet
const [systemCodeHash, setSystemCodeHash] = useState<string>('')
const [inputVisable, setInputVisable] = useState(true)
const [inputVisible, setInputVisible] = useState(true)
const [activeInputIndex, setActiveInputIndex] = useState(0)

useDidMount(() => {
Expand Down Expand Up @@ -118,27 +118,27 @@ const HDWalletSign = ({ tx }: { tx: State.DetailedTransaction }) => {
}, [activeInputIndex, tx.outputs, renderList])

const showInput = useCallback(() => {
setInputVisable(true)
}, [setInputVisable])
setInputVisible(true)
}, [setInputVisible])

const showOutput = useCallback(() => {
setInputVisable(false)
}, [setInputVisable])
setInputVisible(false)
}, [setInputVisible])

return (
<div className={styles.sign}>
<div className={styles.tabs}>
<button className={inputVisable ? styles.active : ''} onClick={showInput} type="button">
<button className={inputVisible ? styles.active : ''} onClick={showInput} type="button">
{t('hardware-sign.inputs', { index: activeInputIndex, length: tx.inputs.length })}
</button>
<button className={!inputVisable ? styles.active : ''} onClick={showOutput} type="button">
<button className={!inputVisible ? styles.active : ''} onClick={showOutput} type="button">
{t('hardware-sign.outputs', { length: tx.outputs.length })}
</button>
</div>
<div className={styles.table}>
<hr />
<table className={styles.inputList}>
<tbody>{inputVisable ? inputBody : outputBody}</tbody>
<tbody>{inputVisible ? inputBody : outputBody}</tbody>
</table>
<hr />
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/src/components/HardwareSign/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ const HardwareSign = ({
const ensureDeviceAvailable = useCallback(
async (device: DeviceInfo) => {
try {
const conectionRes = await connectDevice(device)
const connectionRes = await connectDevice(device)
let { descriptor } = device
if (!isSuccessResponse(conectionRes)) {
if (!isSuccessResponse(connectionRes)) {
// for win32, opening or closing the ckb app changes the HID descriptor(deviceInfo),
// so if we can't connect to the device, we need to re-search device automatically.
// for unix, the descriptor never changes unless user plugs the device into another USB port,
Expand Down
40 changes: 19 additions & 21 deletions packages/neuron-ui/src/components/ImportHardware/detect-device.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,12 @@ const Info = (
) => {
if (isError) {
return (
<>
<div className={styles.errorInfo}>
<span>
<ErrorIcon type="error" />
</span>
<span className={styles.error}>{msg}</span>
</div>
</>
<div className={styles.errorInfo}>
<span>
<ErrorIcon type="error" />
</span>
<span className={styles.error}>{msg}</span>
</div>
)
}
return (
Expand All @@ -48,20 +46,20 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
dispatch({ step: ImportStep.ImportHardware })
}, [dispatch])

const [scaning, setScaning] = useState(true)
const [scanning, setScanning] = useState(true)
const [error, setError] = useState('')
const [appVersion, setAppVersion] = useState('')
const [firmwareVersion, setFirmwareVersion] = useState('')

const findDevice = useCallback(async () => {
setError('')
setScaning(true)
setScanning(true)
try {
const res = await getDevices(model)
if (isSuccessResponse(res) && Array.isArray(res.result) && res.result.length > 0) {
const [device, ...rest] = res.result
if (rest.length > 0) {
setScaning(false)
setScanning(false)
throw new MultiDeviceException()
}
if (!model) {
Expand All @@ -72,10 +70,10 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
},
})
}
const conectionRes = await connectDevice(device)
if (!isSuccessResponse(conectionRes)) {
setScaning(false)
throw new ConnectFailedException(errorFormatter(conectionRes.message, t))
const connectionRes = await connectDevice(device)
if (!isSuccessResponse(connectionRes)) {
setScanning(false)
throw new ConnectFailedException(errorFormatter(connectionRes.message, t))
}
const firmwareVersionRes = await getDeviceFirmwareVersion(device.descriptor)
if (isSuccessResponse(firmwareVersionRes)) {
Expand All @@ -95,9 +93,9 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
setError(err.message)
}
} finally {
setScaning(false)
setScanning(false)
}
}, [model, setError, setScaning, t])
}, [model, setError, setScanning, t])

useDidMount(() => {
findDevice()
Expand All @@ -117,16 +115,16 @@ const DetectDevice = ({ dispatch, model }: { dispatch: React.Dispatch<ActionType
<section className={styles.detect}>
<h3 className={styles.model}>{productName}</h3>
{errorMsg ? <Info isError msg={errorMsg} /> : null}
{scaning ? <Info isWaiting={scaning} msg={t('import-hardware.waiting')} /> : null}
{firmwareVersion && !errorMsg && !scaning ? (
{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}>
<Button type="cancel" label={t('import-hardware.actions.cancel')} onClick={onBack} />
{!scaning && errorMsg && <Button type="ok" label={t('import-hardware.actions.rescan')} onClick={findDevice} />}
{!scaning && !errorMsg && (
{!scanning && errorMsg && <Button type="ok" label={t('import-hardware.actions.rescan')} onClick={findDevice} />}
{!scanning && !errorMsg && (
<Button type="submit" label={t('import-hardware.actions.next')} onClick={onNext} disabled={!ready} />
)}
</footer>
Expand Down
18 changes: 8 additions & 10 deletions packages/neuron-ui/src/components/NetworkSetting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ReactComponent as DeleteNetwork } from 'widgets/Icons/Delete.svg'
import { ReactComponent as AddSimple } from 'widgets/Icons/AddSimple.svg'
import NetworkEditorDialog from 'components/NetworkEditorDialog'
import { chainState } from 'states'
import { setCurrentNetowrk } from 'services/remote'
import { setCurrentNetwork } from 'services/remote'
import RadioGroup from 'widgets/RadioGroup'
import { useOnHandleNetwork, useOnWindowResize, useToggleChoiceGroupBorder } from 'utils'
import { LIGHT_CLIENT_TESTNET } from 'utils/const'
Expand Down Expand Up @@ -41,7 +41,7 @@ const NetworkSetting = ({ chain = chainState, settings: { networks = [] } }: Sta
const handleChange = useCallback(
checked => {
if (checked !== currentId) {
setCurrentNetowrk(checked)
setCurrentNetwork(checked)
}
},
[currentId]
Expand All @@ -62,14 +62,12 @@ const NetworkSetting = ({ chain = chainState, settings: { networks = [] } }: Sta
),
suffix: (
<div className={styles.suffix}>
{
network.chain === LIGHT_CLIENT_TESTNET ? null : (
<button type="button" aria-label={t('common.edit')} onClick={onHandleNetwork}>
<EditNetwork data-action="edit" data-id={network.id} />
</button>
)
}
{(network.type && network.chain !== LIGHT_CLIENT_TESTNET) ? (
{network.chain === LIGHT_CLIENT_TESTNET ? null : (
<button type="button" aria-label={t('common.edit')} onClick={onHandleNetwork}>
<EditNetwork data-action="edit" data-id={network.id} />
</button>
)}
{network.type && network.chain !== LIGHT_CLIENT_TESTNET ? (
<button type="button" aria-label={t('common.delete')} onClick={onHandleNetwork}>
<DeleteNetwork data-action="delete" data-id={network.id} />
</button>
Expand Down
Loading

0 comments on commit 79f9743

Please sign in to comment.