Skip to content

Commit ac5aa23

Browse files
authored
feat: optimize Light client sync (nervosnetwork#3345)
1 parent ac6e603 commit ac5aa23

File tree

7 files changed

+19
-28
lines changed

7 files changed

+19
-28
lines changed

packages/neuron-ui/src/components/SetStartBlockNumberDialog/index.tsx

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ const SetStartBlockNumberDialog = ({
8181
const explorerUrl = getExplorerUrl(isMainnet)
8282
openExternal(`${explorerUrl}/address/${address}?sort=time`)
8383
}, [address, isMainnet])
84-
const onViewBlock = useCallback(() => {
85-
const explorerUrl = getExplorerUrl(isMainnet)
86-
openExternal(`${explorerUrl}/block/${startBlockNumber}`)
87-
}, [startBlockNumber, isMainnet])
8884
const onConfirm = useCallback(() => {
8985
if (startBlockNumber !== undefined) {
9086
onUpdateStartBlockNumber(startBlockNumber).catch(res => {
@@ -95,14 +91,16 @@ const SetStartBlockNumberDialog = ({
9591
useEffect(() => {
9692
if (show) {
9793
setStartBlockNumber(initStartBlockNumber)
94+
resetCountDown()
9895
}
99-
}, [show, initStartBlockNumber, setStartBlockNumber])
96+
}, [show, initStartBlockNumber, setStartBlockNumber, resetCountDown])
10097
return (
10198
<Dialog
10299
title={t('set-start-block-number.title')}
103-
confirmText={countdown ? `${t('common.confirm')}(${countdown})` : t('common.confirm')}
100+
confirmText={countdown ? `${t('common.confirm')} (${countdown})` : t('common.confirm')}
104101
show={show}
105102
onCancel={onCancel}
103+
showCancel={false}
106104
onConfirm={onConfirm}
107105
disabled={!startBlockNumber || !!countdown}
108106
contentClassName={styles.setBlockContent}
@@ -120,17 +118,10 @@ const SetStartBlockNumberDialog = ({
120118
value={startBlockNumber === undefined ? '' : localNumberFormatter(startBlockNumber)}
121119
error={blockNumberErr}
122120
suffix={
123-
startBlockNumber !== undefined ? (
124-
<button type="button" className={styles.viewAction} onClick={onViewBlock}>
125-
{t('set-start-block-number.view-block')}
126-
<NewTab />
127-
</button>
128-
) : (
129-
<button type="button" className={styles.viewAction} onClick={onOpenAddressInExplorer}>
130-
{t('set-start-block-number.locate-first-tx')}
131-
<NewTab />
132-
</button>
133-
)
121+
<button type="button" className={styles.viewAction} onClick={onOpenAddressInExplorer}>
122+
{t('set-start-block-number.locate-first-tx')}
123+
<NewTab />
124+
</button>
134125
}
135126
/>
136127
{isSetLessThanBefore ? (

packages/neuron-ui/src/locales/ar.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,8 @@
12601260
"switchToPrice": "التبديل إلى السعر"
12611261
},
12621262
"set-start-block-number": {
1263-
"title": "تعيين رقم كتلة البداية",
1264-
"warn": "تحذير: لن تتم مزامنة المعاملات قبل كتلة البداية للمزامنة",
1263+
"title": "تعيين كتلة بدء المزامنة",
1264+
"warn": "لضمان دقة مزامنة البيانات، يُرجى إدخال رقم الكتلة لأول معاملة في محفظتك",
12651265
"tip": "رقم كتلة المزامنة البدء هو تكوين عند استخدام عقدة ckb خفيفة العميل، ثم يمكنك تعيينه وتسريع المزامنة",
12661266
"input-place-holder": "يرجى إدخال رقم كتلة المزامنة البدء، مثل: 10,100,101",
12671267
"locate-first-tx": "تحديد المعاملة الأولى",

packages/neuron-ui/src/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,8 +1260,8 @@
12601260
"switchToPrice": "Switch to price"
12611261
},
12621262
"set-start-block-number": {
1263-
"title": "Set the start block number",
1264-
"warn": "Warning: Transactions before the start block of synchronization will not be synchronized",
1263+
"title": "Set synchronization start block",
1264+
"warn": "To ensure accurate data synchronization, please enter the block number of your wallet's first transaction",
12651265
"tip": "The start sync block number is configuration when use light client ckb node, then you can set it and quick the sync",
12661266
"input-place-holder": "Please enter the start sync block number, eg: 10,100,101",
12671267
"locate-first-tx": "Locate the first transaction",

packages/neuron-ui/src/locales/es.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1243,8 +1243,8 @@
12431243
"switchToPrice": "Cambio a precio"
12441244
},
12451245
"set-start-block-number": {
1246-
"title": "Configurar el número de bloque inicial",
1247-
"tip": "El número de bloque de sincronización inicial se configura cuando se utiliza el nodo CKB de cliente ligero, por tanto puede configurarlo y acelerar la sincronización",
1246+
"title": "Establecer bloque de inicio de sincronización",
1247+
"warn": "Para garantizar una sincronización precisa de datos, ingrese el número de bloque de la primera transacción de su billetera",
12481248
"input-place-holder": "Ingrese el número de bloque de sincronización inicial, por ejemplo: 10,100,101",
12491249
"locate-first-tx": "Ubicar la primera transacción",
12501250
"view-block": "Ver bloque"

packages/neuron-ui/src/locales/fr.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,8 +1250,8 @@
12501250
"switchToPrice": "Basculer vers le prix"
12511251
},
12521252
"set-start-block-number": {
1253-
"title": "Définir le numéro de bloc de départ",
1254-
"warn": "Veuillez noter que les transactions antérieures à la synchronisation du bloc initial ne seront pas synchronisées !",
1253+
"title": "Définir le bloc de début de synchronisation",
1254+
"warn": "Pour garantir une synchronisation précise des données, veuillez saisir le numéro de bloc de la première transaction de votre portefeuille",
12551255
"tip": "Le numéro de bloc de départ est une configuration lorsque vous utilisez le noeud CKB en mode client léger. Vous pouvez le définir et accélérer la synchronisation.",
12561256
"input-place-holder": "Veuillez entrer le numéro de bloc de départ pour la synchronisation, par exemple : 10, 100, 101",
12571257
"locate-first-tx": "Localiser la première transaction",

packages/neuron-ui/src/locales/zh-tw.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,8 +1253,8 @@
12531253
"switchToPrice": "切換到單價"
12541254
},
12551255
"set-start-block-number": {
1256-
"title": "設置同步起始區塊",
1257-
"warn": "請註意,同步起始區塊之前的交易不會被同步!",
1256+
"title": "設定同步起始區塊",
1257+
"warn": "為確保數據同步準確性,請輸入您錢包第一筆交易的區塊高度",
12581258
"tip": "輕客戶端模式下的訂閱起始點是可配置的,因此您可以設置同步起始區塊以加快同步速度。",
12591259
"input-place-holder": "輸入同步起始區塊高度,例如:10,100,101",
12601260
"locate-first-tx": "定位第一筆交易",

packages/neuron-ui/src/locales/zh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@
12531253
},
12541254
"set-start-block-number": {
12551255
"title": "设置同步起始区块",
1256-
"warn": "请注意,同步起始区块之前的交易不会被同步!",
1256+
"warn": "为确保数据同步准确性,请输入您钱包第一笔交易的区块高度",
12571257
"tip": "轻客户端模式下的订阅起始点是可配置的,因此您可以设置同步起始区块以加快同步速度。",
12581258
"input-place-holder": "输入同步起始区块高度,例如:10,100,101",
12591259
"locate-first-tx": "定位第一笔交易",

0 commit comments

Comments
 (0)