Skip to content

Commit

Permalink
Merge branch 'develop' into fix-order-by-time
Browse files Browse the repository at this point in the history
  • Loading branch information
Keith-CY authored Apr 17, 2024
2 parents 619841a + 5b64e71 commit 1ac5d21
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .ckb-light-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.3.6
v0.3.7
29 changes: 29 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
# 0.114.3 (2024-04-16)

### CKB Node & Light Client

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

### Assumed valid target

Block before `0x9443ad8da9172d484367bc5467988cba7a0c46028398309edfdda7d2d79be897`(at height `12,703,957`) will be skipped in validation.(https://github.com/nervosnetwork/neuron/pull/3123)

---

## New features

- #3054: Displaying DAO rewards.(@devchenyan)
- #3066: Support keeping screen awake.(@yanguoyu)

## Bug fixes

- #3055: Fix sending sudt to a new acp cell with extra 142 CKB by offline sign.(@yanguoyu)
- #3103: Handle MacOS crash properly on quitting.(@devchenyan)

## New Contributors

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

**Full Changelog**: https://github.com/nervosnetwork/neuron/compare/v0.114.2...v0.114.3

# 0.114.2 (2024-03-15)

### 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.114.2",
"version": "0.114.3",
"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.114.2",
"version": "0.114.3",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down
3 changes: 2 additions & 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.114.2",
"version": "0.114.3",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -50,6 +50,7 @@
"last 2 chrome versions"
],
"dependencies": {
"@ckb-lumos/bi": "0.21.1",
"@ckb-lumos/base": "0.21.1",
"@ckb-lumos/codec": "0.21.1",
"@nervosnetwork/ckb-sdk-core": "0.109.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,28 @@ export default {
expected: '0',
},
'0 decimal': {
value: '1',
value: '12345',
decimal: '0',
expected: '1',
expected: '12,345',
},
'1 decimal': {
value: '1',
decimal: '1',
expected: '0.1',
},
'2 decimal': {
value: '1234567890',
decimal: '2',
expected: '12,345,678.9',
},
'32 decimal': {
value: '100000000000000000000000000000001',
decimal: '32',
expected: '1.00000000000000000000000000000001',
},
'32 decimal and commas': {
value: '12345678900000000000000000000000000000001',
decimal: '32',
expected: '123,456,789.00000000000000000000000000000001',
},
}
49 changes: 12 additions & 37 deletions packages/neuron-ui/src/utils/formatters.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { formatUnit } from '@ckb-lumos/bi'
import { molecule } from '@ckb-lumos/codec'
import { blockchain } from '@ckb-lumos/base'
import { TFunction } from 'i18next'
Expand Down Expand Up @@ -236,45 +237,19 @@ export const sudtValueToAmount = (
value: string | null = '0',
decimal: string = '0',
showPositiveSign = false,
separator = ','
showCommaSeparator = true
) => {
if (value === null) {
return showPositiveSign ? '+0' : '0'
if (Number.isNaN(Number(value))) {
console.warn(`Invalid sudt value: ${value}`)
}
if (Number.isNaN(+value)) {
console.warn(`sUDT value is not a valid number`)
return showPositiveSign ? '+0' : '0'
}
let sign = ''
if (value.startsWith('-')) {
sign = '-'
} else if (showPositiveSign) {
sign = '+'
}
const unsignedValue = value.replace(/^-?0*/, '')
const dec = +decimal
if (dec === 0) {
return +unsignedValue ? `${sign}${unsignedValue}` : '0'
}
let unsignedSUDTValue = ''
if (unsignedValue.length <= dec) {
unsignedSUDTValue = `0.${unsignedValue.padStart(dec, '0')}`.replace(/\.?0+$/, '')
} else {
const decimalFraction = `.${unsignedValue.slice(-dec)}`.replace(/\.?0+$/, '')
const int = unsignedValue.slice(0, -dec).replace(/\^0+/, '')
unsignedSUDTValue = `${(
int
.split('')
.reverse()
.join('')
.match(/\d{1,3}/g) || ['0']
)
.join(separator)
.split('')
.reverse()
.join('')}${decimalFraction}`
}
return `${sign}${+unsignedSUDTValue === 0 ? '0' : unsignedSUDTValue}`
const val = value === null || Number.isNaN(+value) ? '0' : value
const [int, dec = ''] = formatUnit(val, +decimal).split('.')
const fmt = new Intl.NumberFormat('en-US', {
useGrouping: showCommaSeparator,
signDisplay: showPositiveSign ? 'always' : 'auto',
})
// use any type to avoid TS errors since string is not listed in the args IntlFormatter.prototype.format definition but it works
return `${fmt.format(int as any)}${dec ? `.${dec}` : ''}`
}

export const sUDTAmountFormatter = (amount: string) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/neuron-ui/src/utils/getSUDTAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const getSUDTAmount = ({
let amountToCopy = amount
if (tokenInfo) {
amount = `${sudtValueToAmount(amount, tokenInfo.decimal)} ${tokenInfo.symbol}`
amountToCopy = sudtValueToAmount(amountToCopy, tokenInfo.decimal, false, '')
amountToCopy = sudtValueToAmount(amountToCopy, tokenInfo.decimal, false, false)
}
return {
amount,
Expand Down
4 changes: 2 additions & 2 deletions packages/neuron-wallet/.env
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ DAO_CODE_HASH=0x82d76d1b75fe2fd9a27dfbaa65a039221a380d76c926f378d3f81cf3e7e13f2e
MULTISIG_CODE_HASH=0x5c5069eb0857efc65e1bca0c07df34c31663b3622fd3876c876320fc9634e2a8

# CKB NODE OPTIONS
CKB_NODE_ASSUME_VALID_TARGET='0x397d7d41167051cab2bf1610e334ad3aa5cf612e2cd442f71b91422e0361141e'
CKB_NODE_DATA_SIZE=51
CKB_NODE_ASSUME_VALID_TARGET='0x9443ad8da9172d484367bc5467988cba7a0c46028398309edfdda7d2d79be897'
CKB_NODE_DATA_SIZE=53
4 changes: 2 additions & 2 deletions packages/neuron-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"productName": "Neuron",
"description": "CKB Neuron Wallet",
"homepage": "https://www.nervos.org/",
"version": "0.114.2",
"version": "0.114.3",
"private": true,
"author": {
"name": "Nervos Core Dev",
Expand Down Expand Up @@ -97,7 +97,7 @@
"electron-builder": "24.9.1",
"electron-devtools-installer": "3.2.0",
"jest-when": "3.6.0",
"neuron-ui": "0.114.2",
"neuron-ui": "0.114.3",
"typescript": "5.3.3"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ export default class LightSynchronizer extends Synchronizer {
previousTxHashes.add(previousTxHash)
}
})
if (!previousTxHashes.size) return
await this.lightRpc.createBatchRequest([...previousTxHashes].map(v => ['fetchTransaction' as keyof Base, v])).exec()
}

Expand Down

1 comment on commit 1ac5d21

@github-actions
Copy link

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 8717043019

Please sign in to comment.