Skip to content

Commit

Permalink
Merge pull request #2884 from nervosnetwork/rc/v0.111.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY authored Oct 17, 2023
2 parents 588a142 + 8dd1d59 commit dc9b87e
Show file tree
Hide file tree
Showing 29 changed files with 290 additions and 250 deletions.
2 changes: 1 addition & 1 deletion .ckb-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.110.2
v0.111.0
20 changes: 9 additions & 11 deletions .github/workflows/update_valid_target.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
name: Update ckb node assume valid target

on:
pull_request:
types: [ready_for_review]
branches:
- master
create:

jobs:
ready-for-release:
name: Update ckb node assume valid target
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref_name, 'rc/') }}
steps:
- name: Create Branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: 'chore-update-valid-target/${{github.head_ref}}'
sha: '${{ github.event.pull_request.head.sha }}'
branch: 'chore-update-valid-target/${{github.ref_name}}'
sha: '${{ github.event.create.head.sha }}'

- name: Checkout
uses: actions/checkout@v3
with:
ref: 'chore-update-valid-target/${{github.head_ref}}'
ref: 'chore-update-valid-target/${{github.ref_name}}'

- name: Setup Node
uses: actions/setup-node@v3
Expand All @@ -37,7 +35,7 @@ jobs:
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE: ${{ github.head_ref }}
BASE: ${{ github.ref_name }}
with:
script: |
const fs = require('node:fs')
Expand All @@ -64,8 +62,8 @@ jobs:
uses: actions/github-script@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE: ${{github.head_ref}}
HEAD: chore-update-valid-target/${{github.head_ref}}
BASE: ${{github.ref}}
HEAD: chore-update-valid-target/${{github.ref_name}}
REPO: ${{github.repository}}
with:
script: |
Expand All @@ -83,5 +81,5 @@ jobs:
head: HEAD,
base: BASE,
title: 'chore: Update ckb node assume valid target',
body: `This PR uses to update ckb node assume valid target for PR https://github.com/${REPO}/pull/${context.issue.number}`,
body: `This PR uses to update ckb node assume valid target for ${BASE} branch`,
})
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
# 0.111.0 (2023-10-19)

### 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.2.4) was released on May. 28th, 2023. This version of CKB Light Client is now bundled and preconfigured in Neuron

#### Caveat

**CKB Light Client** is only activated on testnet, thus only `light testnet` is enabled in Neuron. **CKB Light Client on Mainnet** requires an activation on the mainnet, the timetable can be found at https://github.com/nervosnetwork/ckb/releases/tag/v0.110.1.

### Assumed valid target

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

---

## Bug fixes

* #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


# 0.110.3 (2023-10-11)

### 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.110.3",
"version": "0.111.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.110.3",
"version": "0.111.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neuron-ui",
"version": "0.110.3",
"version": "0.111.0",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -86,7 +86,7 @@
"@types/styled-components": "5.1.26",
"@wojtekmaj/enzyme-adapter-react-17": "0.8.0",
"babel-jest": "25.5.1",
"electron": "24.7.1",
"electron": "24.8.5",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.7",
"eslint-config-airbnb": "19.0.4",
Expand Down
10 changes: 10 additions & 0 deletions packages/neuron-ui/public/css/fonts.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,13 @@
src: url('../fonts/JetBrainsMonoNL-Regular.otf') format('opentype'),
url('../fonts/JetBrainsMonoNL-Regular.ttf') format('opentype');
}

@font-face {
font-family: 'Inter-Regular';
src: url('../fonts/Inter-Regular.otf') format('opentype'), url('../fonts/Inter-Regular.ttf') format('opentype');
}

@font-face {
font-family: 'Inter-Medium';
src: url('../fonts/Inter-Medium.otf') format('opentype'), url('../fonts/Inter-Medium.ttf') format('opentype');
}
Binary file added packages/neuron-ui/public/fonts/Inter-Medium.otf
Binary file not shown.
Binary file added packages/neuron-ui/public/fonts/Inter-Medium.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
15 changes: 10 additions & 5 deletions packages/neuron-ui/src/components/FormattedTokenAmount/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,30 @@ import { HIDE_BALANCE } from 'utils/const'

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

type FormattedTokenAmountProps = { item: State.Transaction; show: boolean }
type FormattedTokenAmountProps = { item: State.Transaction; show: boolean; symbolClassName?: string }
type AmountProps = Omit<FormattedTokenAmountProps, 'isNeedCopy'> & {
sudtAmount: string
isReceive: boolean
amount: string
symbolClassName?: string
}

const Amount = ({ sudtAmount, show, item, isReceive, amount }: AmountProps) => {
const Amount = ({ sudtAmount, show, item, isReceive, amount, symbolClassName }: AmountProps) => {
return sudtAmount ? (
<div className={show && !sudtAmount.includes('-') ? styles.isReceive : ''}>
{show ? `${!sudtAmount.includes('-') ? '+' : ''}${sudtAmount}` : HIDE_BALANCE}&nbsp;
<UANTonkenSymbol name={item.sudtInfo!.sUDT.tokenName} symbol={item.sudtInfo!.sUDT.symbol} />
<UANTonkenSymbol
className={symbolClassName}
name={item.sudtInfo!.sUDT.tokenName}
symbol={item.sudtInfo!.sUDT.symbol}
/>
</div>
) : (
<span className={show && isReceive ? styles.isReceive : ''}>{amount}</span>
)
}

export const FormattedTokenAmount = ({ item, show }: FormattedTokenAmountProps) => {
export const FormattedTokenAmount = ({ item, show, symbolClassName }: FormattedTokenAmountProps) => {
let amount = '--'
let sudtAmount = ''
let copyText = amount
Expand All @@ -51,7 +56,7 @@ export const FormattedTokenAmount = ({ item, show }: FormattedTokenAmountProps)
}
}

const props = { sudtAmount, show, item, isReceive, amount }
const props = { sudtAmount, show, item, isReceive, amount, symbolClassName }

return show ? (
<CopyZone content={copyText}>
Expand Down
8 changes: 8 additions & 0 deletions packages/neuron-ui/src/components/History/history.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,11 @@ body {
.isReceive {
color: $main-color;
}

.tokenName {
max-width: calc(100px + (100vw - 1300px) / 2);
}

.symbol {
max-width: calc(180px + (100vw - 1300px) / 2);
}
110 changes: 19 additions & 91 deletions packages/neuron-ui/src/components/History/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useCallback } from 'react'
import { useNavigate, useLocation } from 'react-router-dom'
import { Trans, useTranslation } from 'react-i18next'
import { useTranslation } from 'react-i18next'
import Pagination from 'widgets/Pagination'
import SUDTAvatar from 'widgets/SUDTAvatar'
import Button from 'widgets/Button'
Expand All @@ -11,27 +11,16 @@ import { Download, Search, ArrowNext } from 'widgets/Icons/icon'
import PageContainer from 'components/PageContainer'
import TransactionStatusWrap from 'components/TransactionStatusWrap'
import FormattedTokenAmount from 'components/FormattedTokenAmount'
import { UANTokenName, isTonkenInfoStandardUAN } from 'components/UANDisplay'
import { useState as useGlobalState, useDispatch } from 'states'
import { exportTransactions } from 'services/remote'

import { ReactComponent as CKBAvatar } from 'widgets/Icons/Nervos.svg'
import { ReactComponent as Success } from 'widgets/Icons/Success.svg'
import { ReactComponent as Pending } from 'widgets/Icons/Pending.svg'
import { ReactComponent as Failure } from 'widgets/Icons/Failure.svg'

import {
RoutePath,
isMainnet as isMainnetUtil,
uniformTimeFormatter,
nftFormatter,
sUDTAmountFormatter,
sudtValueToAmount,
shannonToCKBFormatter,
} from 'utils'
import { RoutePath, isMainnet as isMainnetUtil, uniformTimeFormatter } from 'utils'
import { onEnter } from 'utils/inputDevice'
import { CONFIRMATION_THRESHOLD, DEFAULT_SUDT_FIELDS } from 'utils/const'
import Tooltip from 'widgets/Tooltip'
import TransactionType from 'components/TransactionType'
import RowExtend from './RowExtend'

import { useSearch } from './hooks'
Expand Down Expand Up @@ -73,79 +62,12 @@ const History = () => {

const bestBlockNumber = Math.max(cacheTipBlockNumber, bestKnownBlockNumber)

const handleTransactionInfo = (tx: State.Transaction) => {
let name = '--'
let amount = '--'
let typeLabel: React.ReactNode = '--'
let sudtAmount = ''
let showWithUANFormatter = false

if (tx.nftInfo) {
// NFT
name = walletName
const { type, data } = tx.nftInfo
typeLabel = `${t(`history.${type}`)} m-NFT`
amount = `${type === 'receive' ? '+' : '-'}${nftFormatter(data)}`
} else if (tx.sudtInfo?.sUDT) {
const getTxName = (tx: State.Transaction) => {
if (!tx.nftInfo && tx.sudtInfo?.sUDT) {
// Asset Account
name = tx.sudtInfo.sUDT.tokenName || DEFAULT_SUDT_FIELDS.tokenName
if (['create', 'destroy'].includes(tx.type)) {
// create/destroy an account
showWithUANFormatter = isTonkenInfoStandardUAN(tx.sudtInfo.sUDT.tokenName, tx.sudtInfo.sUDT.symbol)
typeLabel = (
<Trans
i18nKey={`history.${tx.type}SUDT`}
components={[<UANTokenName name={tx.sudtInfo.sUDT.tokenName} symbol={tx.sudtInfo.sUDT.symbol} />]}
/>
)
} else {
// send/receive to/from an account
const type = +tx.sudtInfo.amount <= 0 ? 'send' : 'receive'
typeLabel = `UDT ${t(`history.${type}`)}`
}

if (tx.sudtInfo.sUDT.decimal) {
sudtAmount = sudtValueToAmount(tx.sudtInfo.amount, tx.sudtInfo.sUDT.decimal, true)
amount = `${sUDTAmountFormatter(sudtAmount)} ${tx.sudtInfo.sUDT.symbol}`
}
} else {
// normal tx
name = walletName
amount = `${shannonToCKBFormatter(tx.value, true)} CKB`
if (tx.type === 'create' || tx.type === 'destroy') {
if (tx.assetAccountType === 'CKB') {
typeLabel = `${t(`history.${tx.type}`, { name: 'CKB' })}`
} else {
typeLabel = `${t(`overview.${tx.type}`, { name: 'Unknown' })}`
}
} else {
typeLabel = tx.nervosDao ? 'Nervos DAO' : t(`history.${tx.type}`)
}
}

let indicator = <Pending />
switch (tx.status) {
case 'success': {
indicator = <Success />
break
}
case 'failed': {
indicator = <Failure />
break
}
default: {
// ignore
}
}

return {
name,
amount,
typeLabel,
sudtAmount,
showWithUANFormatter,
indicator,
return tx.sudtInfo.sUDT.tokenName || DEFAULT_SUDT_FIELDS.tokenName
}
return walletName ?? '--'
}

const handleExpandClick = (idx: number | null) => {
Expand All @@ -158,7 +80,7 @@ const History = () => {
dataIndex: 'name',
minWidth: '110px',
render(_, __, item) {
const { name } = handleTransactionInfo(item)
const name = getTxName(item)
return name.length > 8 ? (
<Tooltip tip={<>{name}</>} isTriggerNextToChild showTriangle>
<div className={styles.avatarBox}>
Expand Down Expand Up @@ -186,20 +108,26 @@ const History = () => {
title: t('history.table.type'),
dataIndex: 'type',
align: 'left',
minWidth: '100px',
minWidth: '120px',
render: (_, __, item) => {
const { typeLabel } = handleTransactionInfo(item)
return typeLabel
return (
<TransactionType
item={item}
cacheTipBlockNumber={cacheTipBlockNumber}
bestKnownBlockNumber={bestKnownBlockNumber}
tokenNameClassName={styles.tokenName}
/>
)
},
},
{
title: t('history.table.amount'),
dataIndex: 'amount',
align: 'left',
isBalance: true,
minWidth: '220px',
minWidth: '200px',
render(_, __, item, show) {
return <FormattedTokenAmount item={item} show={show} />
return <FormattedTokenAmount item={item} show={show} symbolClassName={styles.symbol} />
},
},
{
Expand Down
Loading

1 comment on commit dc9b87e

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

Please sign in to comment.