diff --git a/.ckb-version b/.ckb-version index 788549ad69..bb7c6ee9e4 100644 --- a/.ckb-version +++ b/.ckb-version @@ -1 +1 @@ -v0.103.0 +v0.104.0 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..c5ffe03b62 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,29 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + +updates: + - package-ecosystem: "npm" + directory: "/packages/neuron-ui" + schedule: + interval: "weekly" + +updates: + - package-ecosystem: "npm" + directory: "/packages/neuron-wallet" + schedule: + interval: "weekly" + +updates: + - package-ecosystem: "npm" + directory: "/packages/ckb-indexer" + schedule: + interval: "weekly" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..5956cb4205 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "develop", master, rc/* ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "develop" ] + schedule: + - cron: '24 10 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript'] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 335c441f54..e0e6d700f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,33 @@ +# 0.104.0 (2022-09-07) + +### CKB +[CKB v0.104.0](https://github.com/nervosnetwork/ckb/releases/tag/v0.104.0) was released on Jul. 19th, 2022. This version of CKB node is now bundled and preconfigured in Neuron. + +### Assumed valid target + +// TODO +Blocks before `` will be skipped in validation. + + +### New features +* #2442: Import and export multisig configuration which is compatible with ckb-cli.(@yanguoyu) +* #2454: Add the 'contact us' item in the help menu.(@Keith-CY) +* #2461: Remove maturity restriction of header deps.(@yanguoyu) +* #2465: Adapt new UAN for sUDT.(@yanguoyu) +* #2472: Bump ckb to v0.104.0 (@Keith-CY) + +### Bug fixes +* #2447: Show friendly error on creating multisig address.(@yanguoyu) +* #2450: Fix sending multisig tx of multiple input cells.(@yanguoyu) +* #2451: Refine textfield component.(@yanguoyu +* #2464, #2478: Optimize setting data path of ckb node/indexer.(@yanguoyu) +* #2467: Fix ckb process killed unexpectedly.(@yanguoyu) + + +**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.103.2...v0.104.0 + + + # 0.103.2 (2022-07-09) ### New features diff --git a/lerna.json b/lerna.json index d9a2798810..164f8289a2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,8 +1,6 @@ { - "packages": [ - "packages/*" - ], - "version": "0.103.2", + "packages": ["packages/*"], + "version": "0.104.0", "npmClient": "yarn", "useWorkspaces": true } diff --git a/package.json b/package.json index 9d8b788387..e2ae7c3e57 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "@babel/core": "7.17.10", "@types/jest": "27.5.0", "@types/node": "16.11.7", + "@types/npmlog": "4.1.2", "@typescript-eslint/eslint-plugin": "5.23.0", "@typescript-eslint/parser": "5.23.0", "concurrently": "7.0.0", diff --git a/packages/ckb-indexer/package.json b/packages/ckb-indexer/package.json index 3a012e9881..13b3ed9df0 100644 --- a/packages/ckb-indexer/package.json +++ b/packages/ckb-indexer/package.json @@ -15,13 +15,14 @@ "test": "__tests__" }, "dependencies": { - "@ckb-lumos/base": "0.18.0-rc2", - "@ckb-lumos/rpc": "0.18.0-rc2", + "@ckb-lumos/base": "0.18.0", + "@ckb-lumos/rpc": "0.18.0", "ckb-js-toolkit": "0.100.0-rc1", "cross-fetch": "3.1.5" }, "devDependencies": { - "events": "3.3.0" + "events": "3.3.0", + "eslint": "8.22.0" }, "scripts": { "build": "tsc", diff --git a/packages/ckb-indexer/tsconfig.json b/packages/ckb-indexer/tsconfig.json index dd48688d89..ec78ef7742 100644 --- a/packages/ckb-indexer/tsconfig.json +++ b/packages/ckb-indexer/tsconfig.json @@ -5,7 +5,7 @@ "lib": ["es2020", "dom"], "module": "commonjs", "declaration": true, - "sourceMap": true, + "sourceMap": true }, "include": ["src"] } diff --git a/packages/neuron-ui/package.json b/packages/neuron-ui/package.json index e2b3759f89..6cf8659e5a 100644 --- a/packages/neuron-ui/package.json +++ b/packages/neuron-ui/package.json @@ -1,6 +1,6 @@ { "name": "neuron-ui", - "version": "0.103.2", + "version": "0.104.0", "private": true, "author": { "name": "Nervos Core Dev", diff --git a/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx b/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx index 1ca7463ea8..5b7a9b332c 100644 --- a/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx +++ b/packages/neuron-ui/src/components/CompensationPeriodTooltip/index.tsx @@ -3,7 +3,7 @@ import { useTranslation } from 'react-i18next' import { getCompensatedTime, getCompensationPeriod, CONSTANTS, CompensationPeriod, uniformTimeFormatter } from 'utils' import styles from './compensationPeriodTooltip.module.scss' -const { WITHDRAW_EPOCHS, IMMATURE_EPOCHS } = CONSTANTS +const { WITHDRAW_EPOCHS } = CONSTANTS const HOUR = 3_600_000 const HOURS_PER_EPOCH = 4 * HOUR @@ -47,22 +47,6 @@ const CompensationPeriodTooltip = ({ endEpochTimestamp - (1 - CompensationPeriod.REQUEST_START) * WITHDRAW_EPOCHS * HOURS_PER_EPOCH const { days, hours } = getCompensatedTime({ currentEpochValue: baseEpochValue, depositEpochValue }) - const isImmature = baseEpochValue < depositEpochValue + IMMATURE_EPOCHS - - if (isImmature) { - return ( -
-
- {t('nervos-dao.compensation-period.tooltip.compensated-period')} - {t('nervos-dao.compensation-period.tooltip.days-hours', { days, hours })} -
-
-
-
{t('nervos-dao.compensation-period.tooltip.immature-for-withdraw')}
-
-
- ) - } let stage = 'normal' if (baseEpochTimestamp > endingStartEpochTimestamp) { diff --git a/packages/neuron-ui/src/components/DataSetting/hooks.ts b/packages/neuron-ui/src/components/DataSetting/hooks.ts index 44a07d733f..6f7b461a81 100644 --- a/packages/neuron-ui/src/components/DataSetting/hooks.ts +++ b/packages/neuron-ui/src/components/DataSetting/hooks.ts @@ -17,6 +17,8 @@ export const useDataPath = ( type: Parameters[0] ) => { const [t] = useTranslation() + const [isSaving, setIsSaveing] = useState(false) + const [savingType, setSavingType] = useState() const [prevPath, setPrevPath] = useState() const [currentPath, setCurrentPath] = useState() const { dialogRef, openDialog, closeDialog } = useDialogWrapper() @@ -49,14 +51,28 @@ export const useDataPath = ( } }) }, [closeDialog, type]) - const onConfirm = useCallback(() => { - setPath(currentPath!).then(res => { - if (isSuccessResponse(res)) { - setPrevPath(currentPath) - closeDialog() - } - }) - }, [currentPath, closeDialog, setPrevPath, setPath]) + const onConfirm = useCallback( + e => { + const { dataset } = e.currentTarget + setIsSaveing(true) + setSavingType(dataset.syncType) + setPath({ + dataPath: currentPath!, + clearCache: type === 'ckb' && dataset?.resync === 'true', + }) + .then(res => { + if (isSuccessResponse(res)) { + setPrevPath(currentPath) + closeDialog() + } + }) + .finally(() => { + setIsSaveing(false) + setSavingType(null) + }) + }, + [currentPath, closeDialog, setPrevPath, setPath] + ) return { prevPath, currentPath, @@ -64,6 +80,8 @@ export const useDataPath = ( dialogRef, onCancel, onConfirm, + isSaving, + savingType, } } diff --git a/packages/neuron-ui/src/components/DataSetting/index.module.scss b/packages/neuron-ui/src/components/DataSetting/index.module.scss index 63ebb162b1..dcfd558df8 100644 --- a/packages/neuron-ui/src/components/DataSetting/index.module.scss +++ b/packages/neuron-ui/src/components/DataSetting/index.module.scss @@ -9,6 +9,7 @@ .name { font-weight: bold; + display: flex; } .content { @@ -63,4 +64,29 @@ & > svg { flex-shrink: 0; } -} \ No newline at end of file +} + +.infoIconContainer { + position: relative; + display: inline-flex; + align-items: center; + padding-left: 4px; + z-index: 11; + + &::after { + display: none; + position: absolute; + left: -20px; + top: 120%; + content: attr(data-tip); + padding: 4px 12px; + border-radius: 6px; + background: #cccccc; + font-weight: 300; + width: 400px; + } + + &:hover::after { + display: block; + } +} diff --git a/packages/neuron-ui/src/components/DataSetting/index.tsx b/packages/neuron-ui/src/components/DataSetting/index.tsx index eaf994a914..aec1541534 100644 --- a/packages/neuron-ui/src/components/DataSetting/index.tsx +++ b/packages/neuron-ui/src/components/DataSetting/index.tsx @@ -6,8 +6,9 @@ import { useDispatch } from 'states' import { getCkbNodeDataPath, getIndexerDataPath, setCkbNodeDataPath, setIndexerDataPath } from 'services/remote' import { ReactComponent as Attention } from 'widgets/Icons/ExperimentalAttention.svg' import CopyZone from 'widgets/CopyZone' -import { OpenFolder } from 'widgets/Icons/icon' +import { OpenFolder, InfoCircleOutlined } from 'widgets/Icons/icon' import { shell } from 'electron' +import Spinner from 'widgets/Spinner' import { useDataPath } from './hooks' import styles from './index.module.scss' @@ -41,7 +42,7 @@ const itemProps: Record< const SetItem = ({ type }: { type: keyof typeof itemProps }) => { const props = itemProps[type] const [t] = useTranslation() - const { onSetting, prevPath, currentPath, dialogRef, onCancel, onConfirm } = useDataPath( + const { onSetting, prevPath, currentPath, dialogRef, onCancel, onConfirm, isSaving, savingType } = useDataPath( props.getPath, props.setPath, props.type @@ -53,7 +54,15 @@ const SetItem = ({ type }: { type: keyof typeof itemProps }) => { }, [prevPath]) return ( <> -
{t(`settings.data.${props.titleI18nKey}`)}:
+
+ {t(`settings.data.${props.titleI18nKey}`)} + {type === 'ckbNode' ? ( + + + + ) : null} + : +
{prevPath} @@ -65,12 +74,47 @@ const SetItem = ({ type }: { type: keyof typeof itemProps }) => {
{t(`settings.data.${props.tipI18nKey}`, { prevPath, currentPath })}
- {t('settings.data.resync-describe')} + {type === 'ckbNode' + ? t('settings.data.resync-ckb-node-describe') + : t('settings.data.resync-indexer-describe')}
- +
diff --git a/packages/neuron-ui/src/components/MultisigAddressCreateDialog/index.tsx b/packages/neuron-ui/src/components/MultisigAddressCreateDialog/index.tsx index 53f9f5a302..a5ba185406 100644 --- a/packages/neuron-ui/src/components/MultisigAddressCreateDialog/index.tsx +++ b/packages/neuron-ui/src/components/MultisigAddressCreateDialog/index.tsx @@ -51,11 +51,14 @@ const MultisigAddressCreateDialog = ({ const [step, changeStep] = useState(Step.setMN) const [t] = useTranslation() const { m, n, setMBySelect, setNBySelect, errorI18nKey: mnErr } = useMAndN() + const [confirmErr, setConfirmErr] = useState(null) const next = useCallback(() => { changeStep(step + 1) + setConfirmErr(null) }, [changeStep, step]) const back = useCallback(() => { changeStep(step - 1) + setConfirmErr(null) }, [changeStep, step]) const { chain: { networkID }, @@ -89,9 +92,13 @@ const MultisigAddressCreateDialog = ({ n: Number(n), r: Number(r), addresses, - }).then(() => { - closeDialog() }) + .then(() => { + closeDialog() + }) + .catch(err => { + setConfirmErr(err.message) + }) }, [m, n, r, addresses, saveConfig, closeDialog]) return ( @@ -116,6 +123,7 @@ const MultisigAddressCreateDialog = ({ {step === Step.viewMultiAddress && ( )} + {confirmErr &&
{confirmErr}
}