diff --git a/packages/neuron-ui/src/components/WalletWizard/walletWizard.module.scss b/packages/neuron-ui/src/components/WalletWizard/walletWizard.module.scss
index 3d1a00bf46..2fe415b424 100644
--- a/packages/neuron-ui/src/components/WalletWizard/walletWizard.module.scss
+++ b/packages/neuron-ui/src/components/WalletWizard/walletWizard.module.scss
@@ -94,6 +94,27 @@ $line-gap: 15px;
.actions {
@include form-footer;
}
+ .createCommend {
+ margin: 24px 0 34px;
+ display: flex;
+ width: 100%;
+ justify-content: center;
+ align-items: center;
+ gap: 32px;
+ .commendItem {
+ display: flex;
+ gap: 4px;
+ align-items: center;
+ color: var(--error-color);
+ &:first-child {
+ color: var(--secondary-text-color);
+ }
+ svg {
+ width: 16px;
+ height: 16px;
+ }
+ }
+ }
}
@keyframes rotating {
@@ -110,12 +131,16 @@ $line-gap: 15px;
.title {
@include header-title;
- margin-bottom: 16px;
+ max-width: 611px;
+ margin: 0 auto 16px;
}
.input {
width: 500px;
margin: 0 auto;
+ input {
+ font-family: 'Inter-Regular';
+ }
}
.inputNotice {
@@ -141,9 +166,9 @@ $line-gap: 15px;
.hint {
font-size: 16px;
- font-weight: 500;
line-height: 22px;
color: var(--secondary-text-color);
+ margin-top: 16px;
margin-bottom: 40px;
& > a {
color: var(--link-color);
@@ -151,6 +176,12 @@ $line-gap: 15px;
}
}
+.tips {
+ font-size: 14px;
+ color: var(--secondary-text-color);
+ margin-top: 12px;
+}
+
.steps {
display: flex;
flex-direction: row;
diff --git a/packages/neuron-ui/src/locales/en.json b/packages/neuron-ui/src/locales/en.json
index 65b3341a08..db85a72669 100644
--- a/packages/neuron-ui/src/locales/en.json
+++ b/packages/neuron-ui/src/locales/en.json
@@ -182,15 +182,19 @@
"input-your-seed": "Please input your wallet seed",
"password": "Password",
"confirm-password": "Confirm Password",
- "set-wallet-name-and-password": "Name your new wallet, and choose a strong password to protect it",
- "set-wallet-name": "Give your new wallet a name",
- "set-a-strong-password-to-protect-your-wallet": "Create a strong password to protect your wallet",
+ "set-wallet-name-and-password": "Please name your wallet on this device and choose a strong password to protect it",
+ "set-wallet-name": "Set a name for the wallet",
+ "set-a-strong-password-to-protect-your-wallet": "Please set a strong password to protect your wallet",
"wallet-suffix": "Wallet {{suffix}}",
- "write-down-seed": "Write down your wallet seed and save it in a safe place",
+ "handwritten-recommended": "Handwritten transcription recommended",
+ "do-not-copy": "Do not copy",
+ "do-not-save-scrrenshots": "Do not save scrrenshots",
+ "replenish-your-seed": "Please replenish your wallet seed",
"new-name": "Use an unused name for the new wallet",
"complex-password": "The password should be 8 to 50 characters long containing at least three character categories among the following: uppercase letters, lowercase letters, numbers, and special symbols.",
"same-password": "The password and confirm password should match",
- "input-seed-verify": "Input created seed to verify",
+ "input-seed-verify": "Please enter the correct wallet seed or click back to recreate the wallet",
+ "input-seed-first-empty-space": "You can paste the entire wallet seed to the first empty space",
"no-wallet": "No wallet?",
"create-wallet": "Create Wallet",
"repeat-password": "Repeat Password",
diff --git a/packages/neuron-ui/src/locales/es.json b/packages/neuron-ui/src/locales/es.json
index b8561c404f..6e2fd2f7cc 100644
--- a/packages/neuron-ui/src/locales/es.json
+++ b/packages/neuron-ui/src/locales/es.json
@@ -175,15 +175,19 @@
"input-your-seed": "Por favor introduce la frase semilla de tu billetera",
"password": "Contraseña",
"confirm-password": "Confirmar Contraseña",
- "set-wallet-name-and-password": "Nombra tu nueva billetera y elige una contraseña segura para protegerla",
- "set-wallet-name": "Dale un nombre a tu nueva billetera",
- "set-a-strong-password-to-protect-your-wallet": "Crea una contraseña segura para proteger tu billetera",
+ "set-wallet-name-and-password": "Por favor, nombra tu billetera en este dispositivo y elige una contraseña fuerte para protegerla",
+ "set-wallet-name": "Establece un nombre para la billetera",
+ "set-a-strong-password-to-protect-your-wallet": "Por favor, establece una contraseña fuerte para proteger tu billetera",
"wallet-suffix": "Billetera {{suffix}}",
- "write-down-seed": "Escribe la frase semilla de tu billetera y guárdala en un lugar seguro",
+ "handwritten-recommended": "Se recomienda transcripción a mano",
+ "do-not-copy": "No copiar",
+ "do-not-save-scrrenshots": "No guardar capturas de pantalla",
+ "replenish-your-seed": "Por favor, repón la semilla de tu billetera",
"new-name": "Usa un nombre no usado previamente para la nueva billetera",
"complex-password": "La contraseña debe tener entre 8 y 50 caracteres y contener al menos tres categorías de caracteres entre las siguientes: letras en mayúscula, letras en minúscula, números y símbolos especiales.",
"same-password": "La contraseña y la confirmación de contraseña deben coincidir",
- "input-seed-verify": "Ingresa la frase semilla creada para verificar",
+ "input-seed-verify": "Por favor, ingresa la semilla correcta de la billetera o haz clic en regresar para recrear la billetera",
+ "input-seed-first-empty-space": "Puede pegar toda la semilla del monedero en el primer espacio vacío",
"no-wallet": "¿No tienes una billetera?",
"create-wallet": "Crear Billetera",
"repeat-password": "Repetir Contraseña",
diff --git a/packages/neuron-ui/src/locales/fr.json b/packages/neuron-ui/src/locales/fr.json
index 985df1b7c9..ec0df27270 100644
--- a/packages/neuron-ui/src/locales/fr.json
+++ b/packages/neuron-ui/src/locales/fr.json
@@ -182,15 +182,19 @@
"input-your-seed": "Veuillez entrer votre graine de Wallet",
"password": "Mot de passe",
"confirm-password": "Confirmer le mot de passe",
- "set-wallet-name-and-password": "Nommez votre nouveau Wallet et choisissez un mot de passe fort pour le protéger",
- "set-wallet-name": "Donnez un nom à votre nouveau Wallet",
- "set-a-strong-password-to-protect-your-wallet": "Créez un mot de passe fort pour protéger votre Wallet",
+ "set-wallet-name-and-password": "Veuillez nommer votre portefeuille sur cet appareil et choisir un mot de passe fort pour le protéger",
+ "set-wallet-name": "Définissez un nom pour le portefeuille",
+ "set-a-strong-password-to-protect-your-wallet": "Veuillez définir un mot de passe fort pour protéger votre portefeuille",
"wallet-suffix": "Wallet {{suffix}}",
- "write-down-seed": "Notez votre graine de Wallet et enregistrez-la dans un endroit sûr",
+ "handwritten-recommended": "Transcription manuscrite recommandée",
+ "do-not-copy": "Ne pas copier",
+ "do-not-save-scrrenshots": "Ne pas sauvegarder de captures d'écran",
+ "replenish-your-seed": "Veuillez reconstituer la graine de votre portefeuille",
"new-name": "Utilisez un nom inutilisé pour le nouveau Wallet",
"complex-password": "Le mot de passe doit contenir entre 8 et 50 caractères, comprenant au moins trois catégories parmi les suivantes : lettres majuscules, lettres minuscules, chiffres et symboles spéciaux.",
"same-password": "Le mot de passe et la confirmation du mot de passe doivent correspondre",
- "input-seed-verify": "Saisissez la graine créée pour vérification",
+ "input-seed-verify": "Veuillez entrer la graine correcte du portefeuille ou cliquez sur retour pour recréer le portefeuille",
+ "input-seed-first-empty-space": "Vous pouvez coller l'intégralité de la graine du portefeuille dans le premier espace vide",
"no-wallet": "Pas de Wallet ?",
"create-wallet": "Créer un Wallet",
"repeat-password": "Répéter le mot de passe",
diff --git a/packages/neuron-ui/src/locales/zh-tw.json b/packages/neuron-ui/src/locales/zh-tw.json
index d12dd36228..0bb1ea2f02 100644
--- a/packages/neuron-ui/src/locales/zh-tw.json
+++ b/packages/neuron-ui/src/locales/zh-tw.json
@@ -176,15 +176,19 @@
"input-your-seed": "請輸入您的助記詞",
"password": "密碼",
"confirm-password": "確認密碼",
- "set-wallet-name-and-password": "為新錢包命名,並設置密碼",
- "set-wallet-name": "為錢包設定名稱",
- "set-a-strong-password-to-protect-your-wallet": "請設定一個强密碼用於保護您的錢包",
+ "set-wallet-name-and-password": "請在此設備上為您的錢包命名,並選擇一個強密碼來保護它",
+ "set-wallet-name": "為錢包設置一個名稱",
+ "set-a-strong-password-to-protect-your-wallet": "請設置一個強密碼來保護您的錢包",
"wallet-suffix": "錢包 {{suffix}}",
- "write-down-seed": "請記下您的助記詞並保存到安全的地方",
+ "handwritten-recommended": "推薦手寫抄錄",
+ "do-not-copy": "不要複製",
+ "do-not-save-scrrenshots": "不要保存截圖",
+ "replenish-your-seed": "請補充您的助記詞",
"new-name": "輸入新的錢包名稱",
"complex-password": "密碼為 8 至 50 字元由大寫字母、小寫字母、數位、特殊符號中至少三種字元組成的字串。",
"same-password": "兩次輸入密碼應一致",
- "input-seed-verify": "輸入新生成的助記詞進行驗證",
+ "input-seed-verify": "請輸入正確的助記詞或點擊返回重新創建錢包",
+ "input-seed-first-empty-space": "您可以將整個錢包助記詞粘貼到第一個空格處",
"no-wallet": "還沒有錢包?",
"create-wallet": "立即創建新錢包",
"repeat-password": "重復密碼",
diff --git a/packages/neuron-ui/src/locales/zh.json b/packages/neuron-ui/src/locales/zh.json
index 0d5bba3a30..9481f370b7 100644
--- a/packages/neuron-ui/src/locales/zh.json
+++ b/packages/neuron-ui/src/locales/zh.json
@@ -175,15 +175,19 @@
"input-your-seed": "请输入您的助记词",
"password": "密码",
"confirm-password": "确认密码",
- "set-wallet-name-and-password": "为新钱包命名, 并设置密码",
- "set-wallet-name": "为钱包设置名称",
- "set-a-strong-password-to-protect-your-wallet": "请设置一个强密码用于保护您的钱包",
+ "set-wallet-name-and-password": "请在此设备上为您的钱包命名,并选择一个强密码来保护它",
+ "set-wallet-name": "为钱包设置一个名称",
+ "set-a-strong-password-to-protect-your-wallet": "请设置一个强密码来保护您的钱包",
"wallet-suffix": "钱包 {{suffix}}",
- "write-down-seed": "请记下您的助记词并保存到安全的地方",
+ "handwritten-recommended": "推荐手写抄录",
+ "do-not-copy": "不要复制",
+ "do-not-save-scrrenshots": "不要保存截图",
+ "replenish-your-seed": "请补充您的助记词",
"new-name": "输入新的钱包名称",
"complex-password": "密码为 8 至 50 位由大写字母、小写字母、数字、特殊符号中至少三类字符组成的字符串。",
"same-password": "两次输入密码应一致",
- "input-seed-verify": "输入新生成的助记词进行验证",
+ "input-seed-verify": "请输入正确的助记词或点击返回重新创建钱包",
+ "input-seed-first-empty-space": "您可以将整个钱包助记词粘贴到第一个空格处",
"no-wallet": "还没有钱包?",
"create-wallet": "立即创建新钱包",
"repeat-password": "重复密码",
diff --git a/packages/neuron-ui/src/widgets/MnemonicInput/index.module.scss b/packages/neuron-ui/src/widgets/MnemonicInput/index.module.scss
index 04d920b55e..28c58d14cf 100644
--- a/packages/neuron-ui/src/widgets/MnemonicInput/index.module.scss
+++ b/packages/neuron-ui/src/widgets/MnemonicInput/index.module.scss
@@ -24,15 +24,44 @@
}
& .wordItem {
+ position: relative;
+ color: var(--input-second-color);
&:focus-within {
- color: #00c891;
+ color: var(--main-text-color);
}
&:not(:focus-within) {
&.errorWords {
- color: #ff1e1e;
& > input {
border-bottom: 1px solid #ff1e1e;
- color: #ff1e1e;
+ }
+ }
+ }
+
+ .dropdown {
+ position: absolute;
+ height: 132px;
+ overflow-y: auto;
+ min-width: 72px;
+ background: var(--secondary-background-color);
+ padding: 2px;
+ border-radius: 6px;
+ z-index: 10;
+ top: 24px;
+ left: 16px;
+
+ .dropdownItem {
+ margin-bottom: 4px;
+ line-height: 16px;
+ padding: 4px;
+ color: var(--main-text-color);
+ border-radius: 4px;
+ border: none;
+ width: 100%;
+ background: none;
+ text-align: start;
+ cursor: pointer;
+ &:hover {
+ background: var(--hover-background-color);
}
}
}
@@ -58,6 +87,11 @@
&:focus {
border-bottom: 1px solid #00c891;
}
+
+ &:disabled {
+ color: var(--input-second-color);
+ border-bottom: none;
+ }
}
}
}
diff --git a/packages/neuron-ui/src/widgets/MnemonicInput/index.tsx b/packages/neuron-ui/src/widgets/MnemonicInput/index.tsx
index 1203d0e1dc..3830b686de 100644
--- a/packages/neuron-ui/src/widgets/MnemonicInput/index.tsx
+++ b/packages/neuron-ui/src/widgets/MnemonicInput/index.tsx
@@ -1,4 +1,6 @@
-import React, { useMemo } from 'react'
+import React, { useMemo, useCallback, useState, useRef } from 'react'
+import mnemonicWordList from '@ckb-lumos/hd/lib/mnemonic/word_list'
+import { useDidMount } from 'utils'
import styles from './index.module.scss'
const MnemonicInput = ({
@@ -6,15 +8,83 @@ const MnemonicInput = ({
words,
inputsWords,
onChangeInputWord,
+ blankIndexes,
}: {
- disabled: boolean
+ disabled?: boolean
words: string
inputsWords: string[]
- onChangeInputWord: React.ChangeEventHandler
+ onChangeInputWord: (
+ e:
+ | React.ChangeEvent
+ | {
+ target: {
+ dataset: { idx: string }
+ value: string
+ }
+ }
+ ) => void
+
+ blankIndexes?: number[]
}) => {
const wordList = useMemo(() => Object.assign(new Array(12).fill(''), words?.split(' ')), [words])
+ const [focusIndex, setFocusIndex] = useState(-1)
+ const mounted = useRef(true)
+ const root = useRef(null)
+
+ const onDropdownClick = useCallback((e: React.SyntheticEvent) => {
+ const {
+ dataset: { idx = '', value },
+ } = e.target as HTMLButtonElement
+ onChangeInputWord({
+ target: {
+ dataset: { idx },
+ value: value || '',
+ },
+ })
+ setFocusIndex(-1)
+ }, [])
+
+ const onFocus = useCallback(
+ (e: React.FocusEvent) => {
+ setFocusIndex(Number(e.target.dataset.idx))
+ },
+ [setFocusIndex]
+ )
+
+ const options = useMemo(
+ () => mnemonicWordList.filter(item => item.indexOf(inputsWords[focusIndex]) === 0),
+ [focusIndex, inputsWords]
+ )
+
+ const onDocumentClick = useCallback(
+ (e: MouseEvent) => {
+ if (mounted.current && e.target instanceof Node && !root.current?.contains?.(e.target) && focusIndex) {
+ setFocusIndex(-1)
+ }
+ },
+ [setFocusIndex, focusIndex]
+ )
+
+ useDidMount(() => {
+ document.addEventListener('click', onDocumentClick, false)
+ return () => document.removeEventListener('click', onDocumentClick, false)
+ })
+
+ const getInputValue = useCallback(
+ (idx: number) => {
+ if (blankIndexes) {
+ return blankIndexes.includes(idx) ? inputsWords[idx] : '***'
+ }
+ if (focusIndex === idx) {
+ return inputsWords[idx]
+ }
+ return inputsWords[idx] ? '***' : ''
+ },
+ [blankIndexes, focusIndex, inputsWords]
+ )
+
return (
-
+
{disabled
? wordList.map((v, idx) => (
))}
From bd4f7975d6f1bbbf31d856781ac0d7a38073d810 Mon Sep 17 00:00:00 2001
From: devchenyan
Date: Tue, 16 Jul 2024 15:18:17 +0800
Subject: [PATCH 31/57] feat: Periodic validation of pending transactions
(#3199)
---
.../sync/indexer-cache-service.ts | 2 +-
.../block-sync-renderer/tx-status-listener.ts | 32 +++++++----
.../src/models/chain/transaction.ts | 1 +
.../src/models/chain/tx-status.ts | 5 ++
.../neuron-wallet/src/services/rpc-service.ts | 18 +++---
.../src/services/tx/failed-transaction.ts | 56 ++++++++++---------
.../src/services/tx/transaction-generator.ts | 2 +-
7 files changed, 68 insertions(+), 48 deletions(-)
diff --git a/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts b/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts
index b3401f6626..efb9d7f3fd 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts
@@ -194,7 +194,7 @@ export default class IndexerCacheService {
const txsWithStatus: TransactionWithStatus[] = []
const fetchBlockDetailsQueue = queue(async (hash: string) => {
const txWithStatus = await this.rpcService.getTransaction(hash)
- if (!txWithStatus) {
+ if (!txWithStatus?.transaction) {
return
}
const blockHeader = await this.rpcService.getHeader(txWithStatus!.txStatus.blockHash!)
diff --git a/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts b/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts
index 1a2532559b..3d996b3cf7 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/tx-status-listener.ts
@@ -7,6 +7,7 @@ import TransactionWithStatus from '../models/chain/transaction-with-status'
import logger from '../utils/logger'
import { getConnection } from '../database/chain/connection'
import { interval } from 'rxjs'
+import TxStatus from '../models/chain/tx-status'
type TransactionDetail = {
hash: string
@@ -18,7 +19,8 @@ type TransactionDetail = {
const getTransactionStatus = async (hash: string) => {
const network = NetworksService.getInstance().getCurrent()
const rpcService = new RpcService(network.remote, network.type)
- const txWithStatus: TransactionWithStatus | undefined = await rpcService.getTransaction(hash)
+ const txWithStatus: TransactionWithStatus | undefined | { transaction: null; txStatus: TxStatus } =
+ await rpcService.getTransaction(hash)
if (!txWithStatus) {
return {
tx: txWithStatus,
@@ -33,6 +35,13 @@ const getTransactionStatus = async (hash: string) => {
blockHash: txWithStatus.txStatus.blockHash,
}
}
+ if (txWithStatus.txStatus.isRejected()) {
+ return {
+ tx: null,
+ status: TransactionStatus.Rejected,
+ blockHash: null,
+ }
+ }
return {
tx: txWithStatus.transaction,
status: TransactionStatus.Pending,
@@ -41,16 +50,16 @@ const getTransactionStatus = async (hash: string) => {
}
const trackingStatus = async () => {
- const pendingTransactions = await FailedTransaction.pendings()
+ const pendingOrFailedTransactions = await FailedTransaction.pendingOrFaileds()
await FailedTransaction.processAmendFailedTxs()
- if (!pendingTransactions.length) {
+ if (!pendingOrFailedTransactions.length) {
return
}
- const pendingHashes = pendingTransactions.map(tx => tx.hash)
+ const pendingOrFailedHashes = pendingOrFailedTransactions.map(tx => tx.hash)
const txs = await Promise.all(
- pendingHashes.map(async hash => {
+ pendingOrFailedHashes.map(async hash => {
try {
const txWithStatus = await getTransactionStatus(hash)
return {
@@ -65,17 +74,18 @@ const trackingStatus = async () => {
})
)
- const failedTxs = txs.filter(
- (tx): tx is TransactionDetail & { status: TransactionStatus.Failed } => tx?.status === TransactionStatus.Failed
- )
- const successTxs = txs.filter(
- (tx): tx is TransactionDetail & { status: TransactionStatus.Success } => tx?.status === TransactionStatus.Success
- )
+ const failedTxs = txs.filter((tx): tx is TransactionDetail => tx?.status === TransactionStatus.Failed)
+ const successTxs = txs.filter((tx): tx is TransactionDetail => tx?.status === TransactionStatus.Success)
+ const rejectedTxs = txs.filter((tx): tx is TransactionDetail => tx?.status === TransactionStatus.Rejected)
if (failedTxs.length) {
await FailedTransaction.updateFailedTxs(failedTxs.map(tx => tx.hash))
}
+ if (rejectedTxs.length) {
+ await FailedTransaction.deleteFailedTxs(rejectedTxs.map(tx => tx.hash))
+ }
+
if (successTxs.length > 0) {
const network = NetworksService.getInstance().getCurrent()
const rpcService = new RpcService(network.remote, network.type)
diff --git a/packages/neuron-wallet/src/models/chain/transaction.ts b/packages/neuron-wallet/src/models/chain/transaction.ts
index 613143dbb4..cc6a0ca38a 100644
--- a/packages/neuron-wallet/src/models/chain/transaction.ts
+++ b/packages/neuron-wallet/src/models/chain/transaction.ts
@@ -14,6 +14,7 @@ export enum TransactionStatus {
Pending = 'pending',
Success = 'success',
Failed = 'failed',
+ Rejected = 'rejected',
}
export interface SudtTokenInfo {
diff --git a/packages/neuron-wallet/src/models/chain/tx-status.ts b/packages/neuron-wallet/src/models/chain/tx-status.ts
index a2c54c553a..ba2292e8d1 100644
--- a/packages/neuron-wallet/src/models/chain/tx-status.ts
+++ b/packages/neuron-wallet/src/models/chain/tx-status.ts
@@ -4,6 +4,7 @@ export enum TxStatusType {
Pending = 'pending',
Proposed = 'proposed',
Committed = 'committed',
+ Rejected = 'rejected',
}
export default class TxStatus {
@@ -28,6 +29,10 @@ export default class TxStatus {
return this.status === TxStatusType.Committed
}
+ public isRejected(): boolean {
+ return this.status === TxStatusType.Rejected
+ }
+
public toSDK() {
return {
blockHash: this.blockHash,
diff --git a/packages/neuron-wallet/src/services/rpc-service.ts b/packages/neuron-wallet/src/services/rpc-service.ts
index 8b59adf858..3f6aab645e 100644
--- a/packages/neuron-wallet/src/services/rpc-service.ts
+++ b/packages/neuron-wallet/src/services/rpc-service.ts
@@ -6,6 +6,7 @@ import TransactionWithStatus from '../models/chain/transaction-with-status'
import logger from '../utils/logger'
import { generateRPC } from '../utils/ckb-rpc'
import { NetworkType } from '../models/network'
+import TxStatus, { TxStatusType } from '../models/chain/tx-status'
export default class RpcService {
private retryTime: number
@@ -29,20 +30,19 @@ export default class RpcService {
return BlockHeader.fromSDK(result)
}
- /**
- * TODO: rejected tx should be handled
- * {
- * transaction: null,
- * txStatus: { blockHash: null, status: 'rejected' }
- * }
- */
- public async getTransaction(hash: string): Promise {
+ public async getTransaction(
+ hash: string
+ ): Promise {
const result = await this.rpc.getTransaction(hash)
if (result?.transaction) {
return TransactionWithStatus.fromSDK(result)
}
- if ((result.txStatus as any) === 'rejected') {
+ if (result.txStatus.status === TxStatusType.Rejected) {
logger.warn(`Transaction[${hash}] was rejected`)
+ return {
+ transaction: null,
+ txStatus: TxStatus.fromSDK(result.txStatus),
+ }
}
return undefined
}
diff --git a/packages/neuron-wallet/src/services/tx/failed-transaction.ts b/packages/neuron-wallet/src/services/tx/failed-transaction.ts
index 996c53d336..96c8f754cf 100644
--- a/packages/neuron-wallet/src/services/tx/failed-transaction.ts
+++ b/packages/neuron-wallet/src/services/tx/failed-transaction.ts
@@ -9,16 +9,41 @@ import { TransactionStatus } from '../../models/chain/transaction'
import AmendTransactionEntity from '../../database/chain/entities/amend-transaction'
export class FailedTransaction {
- public static pendings = async (): Promise => {
- const pendingTransactions = await getConnection()
+ public static pendingOrFaileds = async (): Promise => {
+ const transactions = await getConnection()
.getRepository(TransactionEntity)
.createQueryBuilder('tx')
.where({
- status: TransactionStatus.Pending,
+ status: In([TransactionStatus.Pending, TransactionStatus.Failed]),
})
.getMany()
- return pendingTransactions
+ return transactions
+ }
+
+ public static deleteFailedTxs = async (hashes: string[]) => {
+ await getConnection().manager.transaction(async transactionalEntityManager => {
+ await transactionalEntityManager
+ .createQueryBuilder()
+ .delete()
+ .from(TransactionEntity)
+ .where({ hash: In(hashes) })
+ .execute()
+
+ await transactionalEntityManager
+ .createQueryBuilder()
+ .delete()
+ .from(OutputEntity)
+ .where({ outPointTxHash: In(hashes) })
+ .execute()
+
+ await transactionalEntityManager
+ .createQueryBuilder()
+ .delete()
+ .from(InputEntity)
+ .where({ outPointTxHash: In(hashes) })
+ .execute()
+ })
}
public static processAmendFailedTxs = async () => {
@@ -56,28 +81,7 @@ export class FailedTransaction {
}
})
- await getConnection().manager.transaction(async transactionalEntityManager => {
- await transactionalEntityManager
- .createQueryBuilder()
- .delete()
- .from(TransactionEntity)
- .where({ hash: In(removeTxs) })
- .execute()
-
- await transactionalEntityManager
- .createQueryBuilder()
- .delete()
- .from(OutputEntity)
- .where({ outPointTxHash: In(removeTxs) })
- .execute()
-
- await transactionalEntityManager
- .createQueryBuilder()
- .delete()
- .from(InputEntity)
- .where({ outPointTxHash: In(removeTxs) })
- .execute()
- })
+ await FailedTransaction.deleteFailedTxs(removeTxs)
}
// update tx status to TransactionStatus.Failed
diff --git a/packages/neuron-wallet/src/services/tx/transaction-generator.ts b/packages/neuron-wallet/src/services/tx/transaction-generator.ts
index 78746dc8b5..cb6d7528b9 100644
--- a/packages/neuron-wallet/src/services/tx/transaction-generator.ts
+++ b/packages/neuron-wallet/src/services/tx/transaction-generator.ts
@@ -72,7 +72,7 @@ export class TransactionGenerator {
if (!nftCell) return
const nftTx = await this.getRpcService().getTransaction(outPoint.txHash)
- const nftOriginalOutputData = nftTx?.transaction.outputsData[Number(outPoint.index)]
+ const nftOriginalOutputData = nftTx?.transaction?.outputsData[Number(outPoint.index)]
if (!nftOriginalOutputData) return
nftCell.data = nftOriginalOutputData
From 316a90643791a6098727550f1352775051a6344a Mon Sep 17 00:00:00 2001
From: homura
Date: Wed, 17 Jul 2024 11:41:51 +0900
Subject: [PATCH 32/57] feat: upgrade lumos to 0.23 (#3204)
* feat: upgrade lumos to 0.23
* feat: upgrade lumos to 0.23
* fix: cannot read mock properties
* fix: build crypto with webpack
* fix: tsc
* fix: cannot access storybook
---------
Co-authored-by: Chen Yu
---
package.json | 11 +-
packages/neuron-ui/.storybook/main.ts | 5 +
packages/neuron-ui/config-overrides.js | 6 +-
.../src/components/CellInfoDialog/index.tsx | 2 +-
.../src/components/CellManagement/index.tsx | 2 +-
.../components/HistoryDetailPage/index.tsx | 2 +-
.../src/components/LockInfoDialog/index.tsx | 2 +-
.../src/components/MultisigAddress/hooks.ts | 2 +-
.../src/components/NervosDAO/hooks.ts | 6 +-
.../NervosDAODetail/CellsCard/index.tsx | 2 +-
.../src/components/NervosDAORecord/hooks.ts | 2 +-
.../src/components/ScriptTag/index.tsx | 2 +-
.../neuron-ui/src/components/Send/hooks.ts | 2 +-
.../src/components/SpecialAssetList/hooks.ts | 6 +-
.../src/components/WithdrawDialog/index.tsx | 2 +-
packages/neuron-ui/src/services/chain.ts | 4 +-
.../src/states/stateProvider/reducer.ts | 2 +-
.../src/stories/ScriptTag.stories.tsx | 2 +-
.../tests/getMultisigSignStatus/index.test.ts | 2 +-
.../src/utils/calculateUsedCapacity.ts | 2 +-
packages/neuron-ui/src/utils/formatters.ts | 11 +-
.../src/utils/getLockSupportShortAddress.ts | 2 +-
.../src/utils/getMultisigSignStatus.ts | 2 +-
packages/neuron-ui/src/utils/multisig.ts | 2 +-
.../neuron-ui/src/utils/outPointTransform.ts | 2 +-
packages/neuron-ui/src/utils/parsers.ts | 8 +-
.../neuron-ui/src/utils/scriptAndAddress.ts | 9 +-
.../src/utils/validators/capacity.ts | 2 +-
packages/neuron-wallet/package.json | 14 +-
.../src/block-sync-renderer/index.ts | 3 +-
.../sync/full-synchronizer.ts | 4 +-
.../sync/indexer-cache-service.ts | 2 +-
.../sync/light-synchronizer.ts | 25 +-
.../src/block-sync-renderer/sync/queue.ts | 2 +-
packages/neuron-wallet/src/controllers/api.ts | 2 +-
.../src/controllers/cell-management.ts | 2 +-
packages/neuron-wallet/src/controllers/dao.ts | 2 +-
.../neuron-wallet/src/controllers/hardware.ts | 4 +-
.../neuron-wallet/src/controllers/multisig.ts | 2 +-
.../neuron-wallet/src/controllers/sudt.ts | 2 +-
.../neuron-wallet/src/controllers/wallets.ts | 10 +-
.../src/database/address/meta.ts | 8 +-
.../chain/entities/cell-local-info.ts | 2 +-
.../chain/entities/hd-public-key-info.ts | 4 +-
.../chain/entities/multisig-output.ts | 2 +-
.../database/chain/entities/sync-progress.ts | 4 +-
...652945662504-UpdateOutputChequeLockHash.ts | 2 +-
.../1681360188494-AddTypeSyncProgress.ts | 2 +-
packages/neuron-wallet/src/models/address.ts | 4 +-
.../src/models/asset-account-info.ts | 8 +-
packages/neuron-wallet/src/models/blake2b.ts | 4 +-
.../neuron-wallet/src/models/chain/input.ts | 2 +-
.../src/models/chain/live-cell.ts | 2 +-
.../src/models/chain/out-point.ts | 2 +-
.../neuron-wallet/src/models/chain/output.ts | 4 +-
.../neuron-wallet/src/models/chain/script.ts | 4 +-
.../models/chain/transaction-with-status.ts | 4 +-
.../src/models/chain/transaction.ts | 6 +-
.../src/models/keys/hd-public-key-info.ts | 10 +-
.../src/models/multisig-config.ts | 2 +-
packages/neuron-wallet/src/models/multisig.ts | 8 +-
.../src/models/transaction-size.ts | 2 +-
.../neuron-wallet/src/services/addresses.ts | 32 +-
packages/neuron-wallet/src/services/cells.ts | 4 +-
.../src/services/hardware/common.ts | 4 +-
.../src/services/hardware/hardware.ts | 4 +-
.../src/services/hardware/ledger.ts | 10 +-
.../neuron-wallet/src/services/multisig.ts | 2 +-
packages/neuron-wallet/src/services/node.ts | 2 +-
.../neuron-wallet/src/services/sdk-core.ts | 2 +-
.../src/services/sign-message.ts | 8 +-
.../src/services/sync-progress.ts | 2 +-
.../src/services/transaction-sender.ts | 14 +-
.../src/services/tx/transaction-generator.ts | 2 +-
.../src/services/tx/transaction-service.ts | 6 +-
.../neuron-wallet/src/services/wallets.ts | 24 +-
packages/neuron-wallet/src/types/rpc.d.ts | 2 +
packages/neuron-wallet/src/utils/ckb-rpc.ts | 17 +-
packages/neuron-wallet/src/utils/multisig.ts | 2 +-
.../src/utils/scriptAndAddress.ts | 9 +-
.../neuron-wallet/src/utils/serialization.ts | 4 +-
.../neuron-wallet/src/utils/shannonToCKB.ts | 4 +-
.../neuron-wallet/src/utils/signWitnesses.ts | 12 +-
.../src/utils/sudt-value-to-amount.ts | 2 +-
.../neuron-wallet/src/utils/systemScripts.ts | 2 +-
.../full-synchronizer.test.ts | 4 +-
.../indexer-cache-service.intg.test.ts | 4 +-
.../light-synchronizer.test.ts | 2 +-
.../tests/block-sync-renderer/queue.test.ts | 4 +-
.../block-sync-renderer/synchronizer.test.ts | 8 +-
.../tests/controllers/cell-management.test.ts | 2 +-
.../tests/database/address/meta.test.ts | 4 +-
packages/neuron-wallet/tests/mock/hardware.ts | 6 +-
.../tests/models/asset-account-info.test.ts | 4 +-
.../models/keys/hd-public-key-info.test.ts | 6 +-
.../tests/models/transaction-size.test.ts | 4 +-
.../tests/services/address.test.ts | 4 +-
.../services/asset-account-service.test.ts | 4 +-
.../tests/services/cell-local-info.test.ts | 2 +-
.../tests/services/cells.test.ts | 4 +-
.../tests/services/multisig.test.ts | 2 +-
.../tests/services/tx-wallet.test.ts | 17 +-
.../services/tx/transaction-generator.test.ts | 4 +-
.../services/tx/transaction-sender.test.ts | 13 +-
.../services/tx/transaction-service.test.ts | 2 +-
.../tests/services/wallets.test.ts | 14 +-
.../public-key-info.fixture.ts | 4 +-
yarn.lock | 357 ++++++++++++------
108 files changed, 528 insertions(+), 381 deletions(-)
diff --git a/package.json b/package.json
index 96ebcea5c3..73b120707d 100644
--- a/package.json
+++ b/package.json
@@ -58,6 +58,7 @@
"ncp": "2.0.0",
"prettier": "2.8.8",
"ts-jest": "29.1.4",
+ "ts-node": "^10.9.2",
"typescript": "5.3.3",
"wait-on": "7.0.1"
},
@@ -66,7 +67,15 @@
"@types/react": "18.2.45",
"react-i18next": ">=11.16.4",
"react-refresh": "0.14.0",
- "node-fetch": "2.6.13"
+ "node-fetch": "2.6.13",
+ "@ckb-lumos/ckb-indexer": "0.23.0",
+ "@ckb-lumos/base": "0.23.0",
+ "@ckb-lumos/bi": "0.23.0",
+ "@ckb-lumos/codec": "0.23.0",
+ "@ckb-lumos/common-scripts": "0.23.0",
+ "@ckb-lumos/config-manager": "0.23.0",
+ "@ckb-lumos/lumos": "0.23.0",
+ "@ckb-lumos/rpc": "0.23.0"
},
"volta": {
"node": "20.10.0"
diff --git a/packages/neuron-ui/.storybook/main.ts b/packages/neuron-ui/.storybook/main.ts
index 3cf0dbf366..a8bbc1d2bc 100644
--- a/packages/neuron-ui/.storybook/main.ts
+++ b/packages/neuron-ui/.storybook/main.ts
@@ -12,6 +12,11 @@ export default {
options: {},
},
webpackFinal: config => {
+ config.resolve.fallback = {
+ fs: false,
+ crypto: false,
+ buffer: false,
+ }
config.resolve.alias = {
...config.resolve.alias,
electron: require.resolve('./electron'),
diff --git a/packages/neuron-ui/config-overrides.js b/packages/neuron-ui/config-overrides.js
index 6222691d70..8ffe287136 100644
--- a/packages/neuron-ui/config-overrides.js
+++ b/packages/neuron-ui/config-overrides.js
@@ -4,6 +4,10 @@ const path = require('path')
module.exports = function override(config) {
const webpackConfig = { ...config }
webpackConfig.resolve.alias.electron = path.join(__dirname, 'src/electron-modules')
- webpackConfig.resolve.fallback = { fs: false }
+ webpackConfig.resolve.fallback = {
+ fs: false,
+ crypto: false,
+ buffer: false,
+ }
return webpackConfig
}
diff --git a/packages/neuron-ui/src/components/CellInfoDialog/index.tsx b/packages/neuron-ui/src/components/CellInfoDialog/index.tsx
index e75da3363a..df5cdad484 100644
--- a/packages/neuron-ui/src/components/CellInfoDialog/index.tsx
+++ b/packages/neuron-ui/src/components/CellInfoDialog/index.tsx
@@ -4,7 +4,7 @@ import { calculateUsedCapacity, getExplorerUrl, shannonToCKBFormatter, truncateM
import { useTranslation } from 'react-i18next'
import Tabs from 'widgets/Tabs'
import { type TFunction } from 'i18next'
-import { Script } from '@ckb-lumos/base'
+import { Script } from '@ckb-lumos/lumos'
import Switch from 'widgets/Switch'
import { Copy, ExplorerIcon } from 'widgets/Icons/icon'
import Alert from 'widgets/Alert'
diff --git a/packages/neuron-ui/src/components/CellManagement/index.tsx b/packages/neuron-ui/src/components/CellManagement/index.tsx
index 186e884d6a..994c88e042 100644
--- a/packages/neuron-ui/src/components/CellManagement/index.tsx
+++ b/packages/neuron-ui/src/components/CellManagement/index.tsx
@@ -23,7 +23,7 @@ import { TFunction } from 'i18next'
import TextField from 'widgets/TextField'
import { useSearchParams } from 'react-router-dom'
import CellInfoDialog from 'components/CellInfoDialog'
-import { computeScriptHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash } from '@ckb-lumos/lumos/utils'
import Hardware from 'widgets/Icons/Hardware.png'
import Button from 'widgets/Button'
import Alert from 'widgets/Alert'
diff --git a/packages/neuron-ui/src/components/HistoryDetailPage/index.tsx b/packages/neuron-ui/src/components/HistoryDetailPage/index.tsx
index 8d6f553ec5..8db87ebf76 100644
--- a/packages/neuron-ui/src/components/HistoryDetailPage/index.tsx
+++ b/packages/neuron-ui/src/components/HistoryDetailPage/index.tsx
@@ -3,7 +3,7 @@ import { useNavigate, useParams } from 'react-router-dom'
import { useTranslation } from 'react-i18next'
import { calculateUnlockDaoMaximumWithdraw, getTransaction } from 'services/remote'
import { showPageNotice, transactionState, useDispatch, useState as useGlobalState } from 'states'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import PageContainer from 'components/PageContainer'
import LockInfoDialog from 'components/LockInfoDialog'
import ScriptTag from 'components/ScriptTag'
diff --git a/packages/neuron-ui/src/components/LockInfoDialog/index.tsx b/packages/neuron-ui/src/components/LockInfoDialog/index.tsx
index 7e747e18c8..2242042484 100644
--- a/packages/neuron-ui/src/components/LockInfoDialog/index.tsx
+++ b/packages/neuron-ui/src/components/LockInfoDialog/index.tsx
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next'
import React, { useRef } from 'react'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import Dialog from 'widgets/Dialog'
import { useCopy, useDialog, scriptToAddress } from 'utils'
import { Copy } from 'widgets/Icons/icon'
diff --git a/packages/neuron-ui/src/components/MultisigAddress/hooks.ts b/packages/neuron-ui/src/components/MultisigAddress/hooks.ts
index d5a431f22c..9c3b55bca4 100644
--- a/packages/neuron-ui/src/components/MultisigAddress/hooks.ts
+++ b/packages/neuron-ui/src/components/MultisigAddress/hooks.ts
@@ -15,7 +15,7 @@ import {
OfflineSignJSON,
getMultisigSyncProgress,
} from 'services/remote'
-import { computeScriptHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash } from '@ckb-lumos/lumos/utils'
export const useSearch = (clearSelected: () => void, onFilterConfig: (searchKey: string) => void) => {
const [keywords, setKeywords] = useState('')
diff --git a/packages/neuron-ui/src/components/NervosDAO/hooks.ts b/packages/neuron-ui/src/components/NervosDAO/hooks.ts
index 93498cadf1..fe48897e12 100644
--- a/packages/neuron-ui/src/components/NervosDAO/hooks.ts
+++ b/packages/neuron-ui/src/components/NervosDAO/hooks.ts
@@ -3,12 +3,12 @@ import { AppActions, StateAction } from 'states/stateProvider/reducer'
import { updateNervosDaoData, clearNervosDaoData } from 'states/stateProvider/actionCreators'
import { NavigateFunction } from 'react-router-dom'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import { calculateAPC, CONSTANTS, isSuccessResponse, RoutePath } from 'utils'
import { rpc, getHeader } from 'services/chain'
import { generateDaoWithdrawTx, generateDaoClaimTx } from 'services/remote'
-import { calculateMaximumWithdrawCompatible } from '@ckb-lumos/common-scripts/lib/dao'
+import { calculateMaximumWithdrawCompatible } from '@ckb-lumos/lumos/common-scripts/dao'
const { MILLISECONDS_IN_YEAR, MEDIUM_FEE_RATE } = CONSTANTS
@@ -337,7 +337,7 @@ export const useUpdateDepositEpochList = ({
useEffect(() => {
if (connectionStatus === 'online') {
getBlockHashes(records.map(v => v.depositOutPoint?.txHash).filter(v => !!v) as string[]).then(
- (depositBlockHashes: { txHash: string; blockHash: string | null }[]) => {
+ depositBlockHashes => {
const recordKeyIdx: string[] = []
const batchParams: ['getHeader', string][] = []
records.forEach(record => {
diff --git a/packages/neuron-ui/src/components/NervosDAODetail/CellsCard/index.tsx b/packages/neuron-ui/src/components/NervosDAODetail/CellsCard/index.tsx
index bb8af67050..d22f3f49ee 100644
--- a/packages/neuron-ui/src/components/NervosDAODetail/CellsCard/index.tsx
+++ b/packages/neuron-ui/src/components/NervosDAODetail/CellsCard/index.tsx
@@ -1,6 +1,6 @@
import React, { FC, useMemo, useState } from 'react'
import Tabs, { VariantProps } from 'widgets/Tabs'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import { clsx, localNumberFormatter, shannonToCKBFormatter, scriptToAddress, isMainnet as isMainnetUtils } from 'utils'
import { useTranslation } from 'react-i18next'
import { onEnter } from 'utils/inputDevice'
diff --git a/packages/neuron-ui/src/components/NervosDAORecord/hooks.ts b/packages/neuron-ui/src/components/NervosDAORecord/hooks.ts
index 784a90bc98..a3531451cd 100644
--- a/packages/neuron-ui/src/components/NervosDAORecord/hooks.ts
+++ b/packages/neuron-ui/src/components/NervosDAORecord/hooks.ts
@@ -1,7 +1,7 @@
import { useEffect } from 'react'
import { getHeader } from 'services/chain'
import { calculateAPC, CONSTANTS } from 'utils'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
const { MILLISECONDS_IN_YEAR } = CONSTANTS
diff --git a/packages/neuron-ui/src/components/ScriptTag/index.tsx b/packages/neuron-ui/src/components/ScriptTag/index.tsx
index b93b91ae40..a6ddd7f0e5 100644
--- a/packages/neuron-ui/src/components/ScriptTag/index.tsx
+++ b/packages/neuron-ui/src/components/ScriptTag/index.tsx
@@ -1,5 +1,5 @@
import React from 'react'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import {
MultiSigLockInfo,
LocktimeLockInfo,
diff --git a/packages/neuron-ui/src/components/Send/hooks.ts b/packages/neuron-ui/src/components/Send/hooks.ts
index f631045253..14f77fb349 100644
--- a/packages/neuron-ui/src/components/Send/hooks.ts
+++ b/packages/neuron-ui/src/components/Send/hooks.ts
@@ -1,6 +1,6 @@
import React, { useState, useCallback, useEffect, useMemo } from 'react'
import { TFunction } from 'i18next'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import { AppActions, StateDispatch } from 'states/stateProvider/reducer'
import { generateTx, generateSendingAllTx } from 'services/remote/wallets'
import { ControllerResponse, SuccessFromController } from 'services/remote/remoteApiWrapper'
diff --git a/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts b/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts
index 206ea8ceb1..de2af6f2db 100644
--- a/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts
+++ b/packages/neuron-ui/src/components/SpecialAssetList/hooks.ts
@@ -1,6 +1,6 @@
import React, { useCallback, useEffect } from 'react'
-import { number, bytes } from '@ckb-lumos/codec'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { bytes, Uint64LE } from '@ckb-lumos/lumos/codec'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import { getSUDTAccountList } from 'services/remote'
import { NeuronWalletActions, useDispatch } from 'states'
import {
@@ -145,7 +145,7 @@ export const useSpecialAssetColumnInfo = ({
switch (assetInfo.lock) {
case PresetScript.Locktime: {
- const targetEpochInfo = epochParser(bytes.hexify(number.Uint64LE.pack(`0x${lock.args.slice(-16)}`)))
+ const targetEpochInfo = epochParser(bytes.hexify(Uint64LE.pack(`0x${lock.args.slice(-16)}`)))
const currentEpochInfo = epochParser(epoch)
const targetEpochFraction =
Number(targetEpochInfo.length) > 0 ? Number(targetEpochInfo.index) / Number(targetEpochInfo.length) : 1
diff --git a/packages/neuron-ui/src/components/WithdrawDialog/index.tsx b/packages/neuron-ui/src/components/WithdrawDialog/index.tsx
index 7d83c98df8..02a0756012 100644
--- a/packages/neuron-ui/src/components/WithdrawDialog/index.tsx
+++ b/packages/neuron-ui/src/components/WithdrawDialog/index.tsx
@@ -5,7 +5,7 @@ import { CONSTANTS, shannonToCKBFormatter, localNumberFormatter, useCalculateEpo
import { getTransaction, getHeader } from 'services/chain'
import Dialog from 'widgets/Dialog'
import { Attention } from 'widgets/Icons/icon'
-import { calculateMaximumWithdrawCompatible } from '@ckb-lumos/common-scripts/lib/dao'
+import { calculateMaximumWithdrawCompatible } from '@ckb-lumos/lumos/common-scripts/dao'
import styles from './withdrawDialog.module.scss'
const { WITHDRAW_EPOCHS } = CONSTANTS
diff --git a/packages/neuron-ui/src/services/chain.ts b/packages/neuron-ui/src/services/chain.ts
index 31dac003db..f4e1fdb59e 100644
--- a/packages/neuron-ui/src/services/chain.ts
+++ b/packages/neuron-ui/src/services/chain.ts
@@ -1,6 +1,6 @@
-import { CKBRPC } from '@ckb-lumos/rpc'
+import { RPC } from '@ckb-lumos/lumos'
-export const rpc = new CKBRPC('')
+export const rpc = new RPC('')
export const { getHeader, getBlockchainInfo, getTipHeader, getHeaderByNumber, getFeeRateStatistics, getTransaction } =
rpc
diff --git a/packages/neuron-ui/src/states/stateProvider/reducer.ts b/packages/neuron-ui/src/states/stateProvider/reducer.ts
index 801a9fe30c..76488295fe 100644
--- a/packages/neuron-ui/src/states/stateProvider/reducer.ts
+++ b/packages/neuron-ui/src/states/stateProvider/reducer.ts
@@ -1,4 +1,4 @@
-import type { OutPoint } from '@ckb-lumos/base'
+import type { OutPoint } from '@ckb-lumos/lumos'
import produce, { Draft } from 'immer'
import { OfflineSignJSON } from 'services/remote'
import initStates from 'states/init'
diff --git a/packages/neuron-ui/src/stories/ScriptTag.stories.tsx b/packages/neuron-ui/src/stories/ScriptTag.stories.tsx
index ec88624ea6..15ac80146a 100644
--- a/packages/neuron-ui/src/stories/ScriptTag.stories.tsx
+++ b/packages/neuron-ui/src/stories/ScriptTag.stories.tsx
@@ -1,7 +1,7 @@
import { Meta, StoryObj } from '@storybook/react'
import { withRouter } from 'storybook-addon-react-router-v6'
import { action } from '@storybook/addon-actions'
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import ScriptTag from 'components/ScriptTag'
const scripts: Record = {
diff --git a/packages/neuron-ui/src/tests/getMultisigSignStatus/index.test.ts b/packages/neuron-ui/src/tests/getMultisigSignStatus/index.test.ts
index 71ad89f736..eab3d73406 100644
--- a/packages/neuron-ui/src/tests/getMultisigSignStatus/index.test.ts
+++ b/packages/neuron-ui/src/tests/getMultisigSignStatus/index.test.ts
@@ -1,7 +1,7 @@
import { describe, it, expect } from '@jest/globals'
import { MultisigConfig } from 'services/remote'
import { addressToScript, getMultisigSignStatus } from 'utils'
-import { computeScriptHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash } from '@ckb-lumos/lumos/utils'
const addresses = [
'ckt1qyqwh5hmt8j59njztrfz6z0s9wug3nv5qysqrnfm2h',
diff --git a/packages/neuron-ui/src/utils/calculateUsedCapacity.ts b/packages/neuron-ui/src/utils/calculateUsedCapacity.ts
index 2832513763..e7653fd7f9 100644
--- a/packages/neuron-ui/src/utils/calculateUsedCapacity.ts
+++ b/packages/neuron-ui/src/utils/calculateUsedCapacity.ts
@@ -1,4 +1,4 @@
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
const CODE_HASH_LENGTH = 32
const HASH_TYPE_LENGTH = 1
diff --git a/packages/neuron-ui/src/utils/formatters.ts b/packages/neuron-ui/src/utils/formatters.ts
index 55273b9a7f..982d821a5e 100644
--- a/packages/neuron-ui/src/utils/formatters.ts
+++ b/packages/neuron-ui/src/utils/formatters.ts
@@ -1,10 +1,11 @@
-import { molecule } from '@ckb-lumos/codec'
-import { blockchain } from '@ckb-lumos/base'
-import { formatUnit, ckbDecimals } from '@ckb-lumos/bi'
+import { table, blockchain } from '@ckb-lumos/lumos/codec'
+import { formatUnit } from '@ckb-lumos/lumos/utils'
import { TFunction } from 'i18next'
import { FailureFromController } from 'services/remote/remoteApiWrapper'
import { CapacityUnit } from './enums'
+const CKB_DECIMALS = 8
+
const base = 10e9
const numberParser = (value: string, exchange: string) => {
if (Number.isNaN(+value)) {
@@ -112,7 +113,7 @@ export const shannonToCKBFormatter = (shannon: string, showPositiveSign?: boolea
return new Intl.NumberFormat('en-US', {
useGrouping: showCommaSeparator,
signDisplay: showPositiveSign && +shannon > 0 ? 'always' : 'auto',
- maximumFractionDigits: ckbDecimals,
+ maximumFractionDigits: CKB_DECIMALS,
}).format(formatUnit(BigInt(shannon ?? '0'), 'ckb') as any)
}
@@ -259,7 +260,7 @@ type FormatterOptions = { args: string; data?: string; clusterName?: string; tru
export const sporeFormatter = ({ args, data, clusterName, truncate }: FormatterOptions) => {
let format = 'Spore'
- const SporeData = molecule.table(
+ const SporeData = table(
{
contentType: blockchain.Bytes,
content: blockchain.Bytes,
diff --git a/packages/neuron-ui/src/utils/getLockSupportShortAddress.ts b/packages/neuron-ui/src/utils/getLockSupportShortAddress.ts
index 0247eb8364..82b5ac806f 100644
--- a/packages/neuron-ui/src/utils/getLockSupportShortAddress.ts
+++ b/packages/neuron-ui/src/utils/getLockSupportShortAddress.ts
@@ -1,4 +1,4 @@
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import { AnyoneCanPayLockInfoOnAggron, AnyoneCanPayLockInfoOnLina, DefaultLockInfo, MultiSigLockInfo } from './enums'
const getLockSupportShortAddress = (lock: CKBComponents.Script) => {
diff --git a/packages/neuron-ui/src/utils/getMultisigSignStatus.ts b/packages/neuron-ui/src/utils/getMultisigSignStatus.ts
index 1f351ba59a..91dfe57cc6 100644
--- a/packages/neuron-ui/src/utils/getMultisigSignStatus.ts
+++ b/packages/neuron-ui/src/utils/getMultisigSignStatus.ts
@@ -1,5 +1,5 @@
import { addressToScript } from 'utils'
-import { computeScriptHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash } from '@ckb-lumos/lumos/utils'
import { MultisigConfig } from 'services/remote'
export const getMultisigSignStatus = ({
diff --git a/packages/neuron-ui/src/utils/multisig.ts b/packages/neuron-ui/src/utils/multisig.ts
index a59c6998c6..232acc6a00 100644
--- a/packages/neuron-ui/src/utils/multisig.ts
+++ b/packages/neuron-ui/src/utils/multisig.ts
@@ -1,4 +1,4 @@
-import { ckbHash } from '@ckb-lumos/base/lib/utils'
+import { ckbHash } from '@ckb-lumos/lumos/utils'
import { scriptToAddress } from 'utils'
import { MultiSigLockInfo } from './enums'
import { MAX_M_N_NUMBER } from './const'
diff --git a/packages/neuron-ui/src/utils/outPointTransform.ts b/packages/neuron-ui/src/utils/outPointTransform.ts
index e659458bcf..8a098c4a0b 100644
--- a/packages/neuron-ui/src/utils/outPointTransform.ts
+++ b/packages/neuron-ui/src/utils/outPointTransform.ts
@@ -1,4 +1,4 @@
-import { type CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
export const outPointToStr = (value: CKBComponents.OutPoint): string => {
return `${value.txHash}_${value.index}`
diff --git a/packages/neuron-ui/src/utils/parsers.ts b/packages/neuron-ui/src/utils/parsers.ts
index 10dfafaba8..06b3b05671 100644
--- a/packages/neuron-ui/src/utils/parsers.ts
+++ b/packages/neuron-ui/src/utils/parsers.ts
@@ -1,5 +1,5 @@
-import { since } from '@ckb-lumos/base'
-import { number, bytes } from '@ckb-lumos/codec'
+import { since } from '@ckb-lumos/lumos'
+import { bytes, Uint128LE, Uint64LE } from '@ckb-lumos/lumos/codec'
import { MILLISECONDS, PAGE_SIZE } from './const'
export const listParams = (search: string) => {
@@ -45,7 +45,7 @@ export const toUint128Le = (hexString: string) => {
s = s.slice(0, 34)
}
- return bytes.hexify(number.Uint128LE.pack(s))
+ return bytes.hexify(Uint128LE.pack(s))
}
export const getLockTimestamp = ({
@@ -57,7 +57,7 @@ export const getLockTimestamp = ({
epoch: string
bestKnownBlockTimestamp: number
}) => {
- const targetEpochInfo = epochParser(bytes.hexify(number.Uint64LE.pack(`0x${lockArgs.slice(-16)}`)))
+ const targetEpochInfo = epochParser(bytes.hexify(Uint64LE.pack(`0x${lockArgs.slice(-16)}`)))
const currentEpochInfo = epochParser(epoch)
const targetEpochFraction =
Number(targetEpochInfo.length) > 0 ? Number(targetEpochInfo.index) / Number(targetEpochInfo.length) : 1
diff --git a/packages/neuron-ui/src/utils/scriptAndAddress.ts b/packages/neuron-ui/src/utils/scriptAndAddress.ts
index acea450b72..dfc0965bcc 100644
--- a/packages/neuron-ui/src/utils/scriptAndAddress.ts
+++ b/packages/neuron-ui/src/utils/scriptAndAddress.ts
@@ -1,8 +1,7 @@
-import { type Script } from '@ckb-lumos/base'
-import { predefined } from '@ckb-lumos/config-manager'
-import { encodeToAddress, parseAddress, generateAddress } from '@ckb-lumos/helpers'
-
-const { LINA: MAINNET, AGGRON4: TESTNET } = predefined
+import { type Script } from '@ckb-lumos/lumos'
+import { MAINNET, TESTNET } from '@ckb-lumos/lumos/config'
+import { encodeToAddress, parseAddress } from '@ckb-lumos/lumos/helpers'
+import { generateAddress } from '@ckb-lumos/helpers'
const CONFIGS = {
[MAINNET.PREFIX]: MAINNET,
diff --git a/packages/neuron-ui/src/utils/validators/capacity.ts b/packages/neuron-ui/src/utils/validators/capacity.ts
index d91c15cee1..0d5420bd47 100644
--- a/packages/neuron-ui/src/utils/validators/capacity.ts
+++ b/packages/neuron-ui/src/utils/validators/capacity.ts
@@ -1,6 +1,6 @@
import { CKBToShannonFormatter } from 'utils/formatters'
import { CapacityTooSmallException } from 'exceptions'
-import { bytes as byteUtils } from '@ckb-lumos/codec'
+import { bytes as byteUtils } from '@ckb-lumos/lumos/codec'
import { addressToScript } from 'utils'
export const validateCapacity = (item: State.Output) => {
diff --git a/packages/neuron-wallet/package.json b/packages/neuron-wallet/package.json
index f6af151e56..7ca3b1b10a 100644
--- a/packages/neuron-wallet/package.json
+++ b/packages/neuron-wallet/package.json
@@ -42,15 +42,11 @@
]
},
"dependencies": {
- "@ckb-lumos/base": "0.21.1",
- "@ckb-lumos/bi": "0.21.1",
- "@ckb-lumos/ckb-indexer": "0.21.1",
- "@ckb-lumos/codec": "0.21.1",
- "@ckb-lumos/common-scripts": "0.21.1",
- "@ckb-lumos/config-manager": "0.21.1",
- "@ckb-lumos/hd": "0.21.1",
- "@ckb-lumos/helpers": "0.21.1",
- "@ckb-lumos/rpc": "0.21.1",
+ "@ckb-lumos/base": "0.23.0",
+ "@ckb-lumos/ckb-indexer": "0.23.0",
+ "@ckb-lumos/helpers": "0.23.0",
+ "@ckb-lumos/rpc": "0.23.0",
+ "@ckb-lumos/lumos": "0.23.0",
"@iarna/toml": "2.2.5",
"@ledgerhq/hw-transport-node-hid": "6.27.22",
"@spore-sdk/core": "0.1.0",
diff --git a/packages/neuron-wallet/src/block-sync-renderer/index.ts b/packages/neuron-wallet/src/block-sync-renderer/index.ts
index 892c676618..e62a772353 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/index.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/index.ts
@@ -9,7 +9,8 @@ import DataUpdateSubject from '../models/subjects/data-update'
import AddressCreatedSubject from '../models/subjects/address-created-subject'
import WalletDeletedSubject from '../models/subjects/wallet-deleted-subject'
import TxDbChangedSubject from '../models/subjects/tx-db-changed-subject'
-import { type Cell, type QueryOptions } from '@ckb-lumos/base'
+import { type QueryOptions } from '@ckb-lumos/base'
+import { type Cell } from '@ckb-lumos/lumos'
import { WorkerMessage, StartParams, QueryIndexerParams } from './task'
import logger from '../utils/logger'
import CommonUtils from '../utils/common'
diff --git a/packages/neuron-wallet/src/block-sync-renderer/sync/full-synchronizer.ts b/packages/neuron-wallet/src/block-sync-renderer/sync/full-synchronizer.ts
index eecace1ccf..7682cdbd6c 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/sync/full-synchronizer.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/sync/full-synchronizer.ts
@@ -1,4 +1,4 @@
-import { Tip } from '@ckb-lumos/base'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import logger from '../../utils/logger'
import CommonUtils from '../../utils/common'
import RpcService from '../../services/rpc-service'
@@ -15,7 +15,7 @@ export default class FullSynchronizer extends Synchronizer {
this.rpcService = new RpcService(nodeUrl, nodeType)
}
- private async synchronize(indexerTipBlock: Tip) {
+ private async synchronize(indexerTipBlock: CKBComponents.Tip) {
if (!indexerTipBlock) {
return
}
diff --git a/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts b/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts
index efb9d7f3fd..99f29b49e4 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/sync/indexer-cache-service.ts
@@ -6,7 +6,7 @@ import RpcService from '../../services/rpc-service'
import TransactionWithStatus from '../../models/chain/transaction-with-status'
import SyncInfoEntity from '../../database/chain/entities/sync-info'
import { getConnection } from '../../database/chain/connection'
-import { TransactionCollector, CellCollector, Indexer as CkbIndexer } from '@ckb-lumos/ckb-indexer'
+import { TransactionCollector, Indexer as CkbIndexer, CellCollector } from '@ckb-lumos/ckb-indexer'
export default class IndexerCacheService {
private addressMetas: AddressMeta[]
diff --git a/packages/neuron-wallet/src/block-sync-renderer/sync/light-synchronizer.ts b/packages/neuron-wallet/src/block-sync-renderer/sync/light-synchronizer.ts
index fe89dabefb..765f69c41e 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/sync/light-synchronizer.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/sync/light-synchronizer.ts
@@ -1,28 +1,27 @@
-import type { HexString, Script, TransactionWithStatus } from '@ckb-lumos/base'
+import type { HexString, Script } from '@ckb-lumos/lumos'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import logger from '../../utils/logger'
import { Address } from '../../models/address'
import AddressMeta from '../../database/address/meta'
import { scheduler } from 'timers/promises'
import SyncProgressService from '../../services/sync-progress'
import { Synchronizer } from './synchronizer'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { FetchTransactionReturnType, LightRPC, LightScriptFilter } from '../../utils/ckb-rpc'
import Multisig from '../../services/multisig'
import SyncProgress, { SyncAddressType } from '../../database/chain/entities/sync-progress'
import WalletService from '../../services/wallets'
import AssetAccountInfo from '../../models/asset-account-info'
import { DepType } from '../../models/chain/cell-dep'
-import { molecule } from '@ckb-lumos/codec'
-import { blockchain } from '@ckb-lumos/base'
-import type { Base } from '@ckb-lumos/rpc/lib/Base'
-import { BI } from '@ckb-lumos/bi'
+import { vector, blockchain } from '@ckb-lumos/lumos/codec'
+import type { Base } from '@ckb-lumos/lumos/rpc'
+import { BI } from '@ckb-lumos/lumos'
import IndexerCacheService from './indexer-cache-service'
-import { ScriptType } from '@ckb-lumos/ckb-indexer/lib/type'
import { scriptToAddress } from '../../utils/scriptAndAddress'
import NetworksService from '../../services/networks'
import { getConnection } from '../../database/chain/connection'
-const unpackGroup = molecule.vector(blockchain.OutPoint)
+const unpackGroup = vector(blockchain.OutPoint)
const THRESHOLD_BLOCK_NUMBER_IN_DIFF_WALLET = 100_000
export default class LightSynchronizer extends Synchronizer {
@@ -101,7 +100,7 @@ export default class LightSynchronizer extends Synchronizer {
}: {
script: Script
blockRange: [HexString, HexString]
- scriptType: ScriptType
+ scriptType: CKBComponents.ScriptType
}) {
const res = []
let lastCursor: HexString | undefined = undefined
@@ -293,7 +292,9 @@ export default class LightSynchronizer extends Synchronizer {
private async fetchPreviousOutputs(txHashes: string[]) {
const transactions = await this.lightRpc
- .createBatchRequest<'getTransaction', string[], TransactionWithStatus[]>(txHashes.map(v => ['getTransaction', v]))
+ .createBatchRequest<'getTransaction', string[], CKBComponents.TransactionWithStatus[]>(
+ txHashes.map(v => ['getTransaction', v])
+ )
.exec()
const previousTxHashes = new Set()
transactions
@@ -335,7 +336,9 @@ export default class LightSynchronizer extends Synchronizer {
private async checkTxExist(txHashes: string[]) {
const transactions = await this.lightRpc
- .createBatchRequest<'getTransaction', string[], TransactionWithStatus[]>(txHashes.map(v => ['getTransaction', v]))
+ .createBatchRequest<'getTransaction', string[], CKBComponents.TransactionWithStatus[]>(
+ txHashes.map(v => ['getTransaction', v])
+ )
.exec()
return transactions.every(v => !!v.transaction)
}
diff --git a/packages/neuron-wallet/src/block-sync-renderer/sync/queue.ts b/packages/neuron-wallet/src/block-sync-renderer/sync/queue.ts
index 8eb2b923f3..3d471ea54e 100644
--- a/packages/neuron-wallet/src/block-sync-renderer/sync/queue.ts
+++ b/packages/neuron-wallet/src/block-sync-renderer/sync/queue.ts
@@ -144,7 +144,7 @@ export default class Queue {
}
}
const headers = await rpc
- .createBatchRequest<'getHeader', string[], CKBComponents.BlockHeader[]>(blockHashes.map(v => ['getHeader', v]))
+ .createBatchRequest<'getHeader', string[], CKBComponents.BlockHeader[]>(blockHashes.map(v => ['getHeader', v!]))
.exec()
headers.forEach((blockHeader: CKBComponents.BlockHeader, idx: number) => {
if (blockHeader) {
diff --git a/packages/neuron-wallet/src/controllers/api.ts b/packages/neuron-wallet/src/controllers/api.ts
index 7f5b8b6aed..cecdf4a039 100644
--- a/packages/neuron-wallet/src/controllers/api.ts
+++ b/packages/neuron-wallet/src/controllers/api.ts
@@ -64,7 +64,7 @@ import DataUpdateSubject from '../models/subjects/data-update'
import CellManagement from './cell-management'
import { UpdateCellLocalInfo } from '../database/chain/entities/cell-local-info'
import { CKBLightRunner } from '../services/light-runner'
-import { OutPoint } from '@ckb-lumos/base'
+import { type OutPoint } from '@ckb-lumos/lumos'
import { updateApplicationMenu } from './app/menu'
export type Command = 'export-xpubkey' | 'import-xpubkey' | 'delete-wallet' | 'backup-wallet'
diff --git a/packages/neuron-wallet/src/controllers/cell-management.ts b/packages/neuron-wallet/src/controllers/cell-management.ts
index 9bf158a65f..1ad6b37cb1 100644
--- a/packages/neuron-wallet/src/controllers/cell-management.ts
+++ b/packages/neuron-wallet/src/controllers/cell-management.ts
@@ -1,4 +1,4 @@
-import type { OutPoint as OutPointSDK, Script } from '@ckb-lumos/base'
+import type { OutPoint as OutPointSDK, Script } from '@ckb-lumos/lumos'
import CellLocalInfo, { UpdateCellLocalInfo } from '../database/chain/entities/cell-local-info'
import Output from '../models/chain/output'
import CellsService, { LockScriptCategory, TypeScriptCategory } from '../services/cells'
diff --git a/packages/neuron-wallet/src/controllers/dao.ts b/packages/neuron-wallet/src/controllers/dao.ts
index 2dccf9e798..37e30447ad 100644
--- a/packages/neuron-wallet/src/controllers/dao.ts
+++ b/packages/neuron-wallet/src/controllers/dao.ts
@@ -1,4 +1,4 @@
-import { type OutPoint as OutPointSDK } from '@ckb-lumos/base'
+import { type OutPoint as OutPointSDK } from '@ckb-lumos/lumos'
import { ServiceHasNoResponse, IsRequired } from '../exceptions'
import { ResponseCode } from '../utils/const'
import CellsService from '../services/cells'
diff --git a/packages/neuron-wallet/src/controllers/hardware.ts b/packages/neuron-wallet/src/controllers/hardware.ts
index e8e9aa0cfa..563fe58c89 100644
--- a/packages/neuron-wallet/src/controllers/hardware.ts
+++ b/packages/neuron-wallet/src/controllers/hardware.ts
@@ -2,7 +2,7 @@ import { DeviceInfo, ExtendedPublicKey, PublicKey } from '../services/hardware/c
import { ResponseCode } from '../utils/const'
import HardwareWalletService from '../services/hardware'
import { connectDeviceFailed } from '../exceptions'
-import { AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
export default class HardwareController {
public async connectDevice(deviceInfo: DeviceInfo): Promise> {
@@ -50,7 +50,7 @@ export default class HardwareController {
public async getPublicKey(): Promise> {
const device = HardwareWalletService.getInstance().getCurrent()!
- const defaultPath = AccountExtendedPublicKey.ckbAccountPath
+ const defaultPath = hd.AccountExtendedPublicKey.ckbAccountPath
const pubkey = await device.getPublicKey(defaultPath)
return {
diff --git a/packages/neuron-wallet/src/controllers/multisig.ts b/packages/neuron-wallet/src/controllers/multisig.ts
index ad5912cc84..8dfa307756 100644
--- a/packages/neuron-wallet/src/controllers/multisig.ts
+++ b/packages/neuron-wallet/src/controllers/multisig.ts
@@ -2,7 +2,7 @@ import fs from 'fs'
import path from 'path'
import { dialog, BrowserWindow } from 'electron'
import { t } from 'i18next'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { scriptToAddress, addressToScript } from '../utils/scriptAndAddress'
import { ResponseCode } from '../utils/const'
import { parseMultisigTxJsonFromCkbCli } from '../utils/multisig'
diff --git a/packages/neuron-wallet/src/controllers/sudt.ts b/packages/neuron-wallet/src/controllers/sudt.ts
index 7b9813c497..ad25bbdb6a 100644
--- a/packages/neuron-wallet/src/controllers/sudt.ts
+++ b/packages/neuron-wallet/src/controllers/sudt.ts
@@ -1,4 +1,4 @@
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import LiveCellService from '../services/live-cell-service'
import AssetAccountInfo from '../models/asset-account-info'
import Script, { ScriptHashType } from '../models/chain/script'
diff --git a/packages/neuron-wallet/src/controllers/wallets.ts b/packages/neuron-wallet/src/controllers/wallets.ts
index 98566937b4..50dd050c3f 100644
--- a/packages/neuron-wallet/src/controllers/wallets.ts
+++ b/packages/neuron-wallet/src/controllers/wallets.ts
@@ -4,9 +4,8 @@ import { prefixWith0x } from '../utils/scriptAndAddress'
import { dialog, SaveDialogReturnValue, BrowserWindow, OpenDialogReturnValue } from 'electron'
import WalletsService, { Wallet, WalletProperties, FileKeystoreWallet } from '../services/wallets'
import NetworksService from '../services/networks'
-import { bytes } from '@ckb-lumos/codec'
-import { Keychain, Keystore, ExtendedPrivateKey, AccountExtendedPublicKey } from '@ckb-lumos/hd'
-import { generateMnemonic, validateMnemonic, mnemonicToSeedSync } from '@ckb-lumos/hd/lib/mnemonic'
+import { bytes } from '@ckb-lumos/lumos/codec'
+import { hd } from '@ckb-lumos/lumos'
import CommandSubject from '../models/subjects/command'
import { ResponseCode } from '../utils/const'
import {
@@ -35,6 +34,9 @@ import AddressParser from '../models/address-parser'
import MultisigConfigModel from '../models/multisig-config'
import { generateRPC } from '../utils/ckb-rpc'
+const { Keychain, Keystore, ExtendedPrivateKey, AccountExtendedPublicKey, mnemonic } = hd
+const { generateMnemonic, validateMnemonic, mnemonicToSeedSync } = mnemonic
+
export default class WalletsController {
public async getAll(): Promise[]>> {
const wallets = WalletsService.getInstance().getAll()
@@ -230,7 +232,7 @@ export default class WalletsController {
throw new WalletNotFound(id)
}
- const props: { name: string; keystore?: Keystore; device?: DeviceInfo; startBlockNumber?: string } = {
+ const props: { name: string; keystore?: hd.Keystore; device?: DeviceInfo; startBlockNumber?: string } = {
name: name || wallet.name,
startBlockNumber,
}
diff --git a/packages/neuron-wallet/src/database/address/meta.ts b/packages/neuron-wallet/src/database/address/meta.ts
index 36de7a34f3..5ef8db354d 100644
--- a/packages/neuron-wallet/src/database/address/meta.ts
+++ b/packages/neuron-wallet/src/database/address/meta.ts
@@ -1,6 +1,6 @@
-import { bytes } from '@ckb-lumos/codec'
+import { bytes } from '@ckb-lumos/lumos/codec'
import { Address, AddressVersion } from '../../models/address'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import Script from '../../models/chain/script'
import SystemScriptInfo from '../../models/system-script-info'
import AssetAccountInfo from '../../models/asset-account-info'
@@ -11,7 +11,7 @@ export default class AddressMeta implements Address {
walletId: string
address: string
path: string
- addressType: AddressType
+ addressType: hd.AddressType
addressIndex: number
blake160: string
txCount?: number
@@ -28,7 +28,7 @@ export default class AddressMeta implements Address {
walletId: string,
address: string,
path: string,
- addressType: AddressType,
+ addressType: hd.AddressType,
addressIndex: number,
blake160: string,
version?: AddressVersion,
diff --git a/packages/neuron-wallet/src/database/chain/entities/cell-local-info.ts b/packages/neuron-wallet/src/database/chain/entities/cell-local-info.ts
index 714e012559..a86b1a1885 100644
--- a/packages/neuron-wallet/src/database/chain/entities/cell-local-info.ts
+++ b/packages/neuron-wallet/src/database/chain/entities/cell-local-info.ts
@@ -1,4 +1,4 @@
-import type { OutPoint } from '@ckb-lumos/base'
+import type { OutPoint } from '@ckb-lumos/lumos'
import { Entity, PrimaryColumn, Column } from 'typeorm'
@Entity()
diff --git a/packages/neuron-wallet/src/database/chain/entities/hd-public-key-info.ts b/packages/neuron-wallet/src/database/chain/entities/hd-public-key-info.ts
index e5fa061106..076b5ddc0c 100644
--- a/packages/neuron-wallet/src/database/chain/entities/hd-public-key-info.ts
+++ b/packages/neuron-wallet/src/database/chain/entities/hd-public-key-info.ts
@@ -1,6 +1,6 @@
import { Entity, Column, PrimaryGeneratedColumn, Index, CreateDateColumn } from 'typeorm'
import HdPublicKeyInfoModel from '../../../models/keys/hd-public-key-info'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
@Entity()
export default class HdPublicKeyInfo {
@@ -14,7 +14,7 @@ export default class HdPublicKeyInfo {
walletId!: string
@Column()
- addressType!: AddressType
+ addressType!: hd.AddressType
@Column()
@Index()
diff --git a/packages/neuron-wallet/src/database/chain/entities/multisig-output.ts b/packages/neuron-wallet/src/database/chain/entities/multisig-output.ts
index 628d93f827..61a7a302fb 100644
--- a/packages/neuron-wallet/src/database/chain/entities/multisig-output.ts
+++ b/packages/neuron-wallet/src/database/chain/entities/multisig-output.ts
@@ -1,7 +1,7 @@
import { Entity, BaseEntity, Column, PrimaryColumn } from 'typeorm'
import Script, { ScriptHashType } from '../../../models/chain/script'
import OutPoint from '../../../models/chain/out-point'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { OutputStatus } from '../../../models/chain/output'
@Entity()
diff --git a/packages/neuron-wallet/src/database/chain/entities/sync-progress.ts b/packages/neuron-wallet/src/database/chain/entities/sync-progress.ts
index 75229b5ec4..8400216781 100644
--- a/packages/neuron-wallet/src/database/chain/entities/sync-progress.ts
+++ b/packages/neuron-wallet/src/database/chain/entities/sync-progress.ts
@@ -1,5 +1,5 @@
-import { HexString } from '@ckb-lumos/base'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { HexString } from '@ckb-lumos/lumos'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { Entity, PrimaryColumn, Column } from 'typeorm'
export enum SyncAddressType {
diff --git a/packages/neuron-wallet/src/database/chain/migrations/1652945662504-UpdateOutputChequeLockHash.ts b/packages/neuron-wallet/src/database/chain/migrations/1652945662504-UpdateOutputChequeLockHash.ts
index 01d8d3a719..6b23fd4d6c 100644
--- a/packages/neuron-wallet/src/database/chain/migrations/1652945662504-UpdateOutputChequeLockHash.ts
+++ b/packages/neuron-wallet/src/database/chain/migrations/1652945662504-UpdateOutputChequeLockHash.ts
@@ -1,5 +1,5 @@
import { In, MigrationInterface, QueryRunner } from "typeorm";
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { ScriptHashType } from "../../../models/chain/script";
import Output from "../entities/output";
diff --git a/packages/neuron-wallet/src/database/chain/migrations/1681360188494-AddTypeSyncProgress.ts b/packages/neuron-wallet/src/database/chain/migrations/1681360188494-AddTypeSyncProgress.ts
index 3958f3e287..9a268ee990 100644
--- a/packages/neuron-wallet/src/database/chain/migrations/1681360188494-AddTypeSyncProgress.ts
+++ b/packages/neuron-wallet/src/database/chain/migrations/1681360188494-AddTypeSyncProgress.ts
@@ -1,6 +1,6 @@
import { MigrationInterface, QueryRunner, TableColumn, TableIndex } from "typeorm"
import Multisig from "../../../models/multisig"
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { SyncAddressType } from "../entities/sync-progress"
import MultisigConfig from "../entities/multisig-config"
diff --git a/packages/neuron-wallet/src/models/address.ts b/packages/neuron-wallet/src/models/address.ts
index f8827a1c78..14243b1e86 100644
--- a/packages/neuron-wallet/src/models/address.ts
+++ b/packages/neuron-wallet/src/models/address.ts
@@ -1,4 +1,4 @@
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
export enum AddressVersion {
Testnet = 'testnet',
@@ -9,7 +9,7 @@ export interface Address {
walletId: string
address: string
path: string
- addressType: AddressType
+ addressType: hd.AddressType
addressIndex: number
blake160: string
txCount?: number
diff --git a/packages/neuron-wallet/src/models/asset-account-info.ts b/packages/neuron-wallet/src/models/asset-account-info.ts
index 285abb9cf6..4293a40cbc 100644
--- a/packages/neuron-wallet/src/models/asset-account-info.ts
+++ b/packages/neuron-wallet/src/models/asset-account-info.ts
@@ -1,4 +1,4 @@
-import { bytes, molecule } from '@ckb-lumos/codec'
+import { bytes, struct, createFixedBytesCodec } from '@ckb-lumos/lumos/codec'
import CellDep, { DepType } from './chain/cell-dep'
import Script, { ScriptHashType } from './chain/script'
import OutPoint from './chain/out-point'
@@ -6,9 +6,11 @@ import NetworksService from '../services/networks'
import Transaction from './chain/transaction'
import SystemScriptInfo from './system-script-info'
import { Address } from './address'
-import { createFixedHexBytesCodec } from '@ckb-lumos/codec/lib/blockchain'
import { predefinedSporeConfigs, SporeConfig, SporeScript } from '@spore-sdk/core'
+const createFixedHexBytesCodec = (byteLength: number) =>
+ createFixedBytesCodec({ byteLength, pack: bytes.bytify, unpack: bytes.hexify })
+
export interface ScriptCellInfo {
cellDep: CellDep
codeHash: string
@@ -307,7 +309,7 @@ export default class AssetAccountInfo {
public static findSignPathForCheque(addressInfos: Address[], chequeLockArgs: string) {
const Bytes20 = createFixedHexBytesCodec(20)
- const ChequeLockArgsCodec = molecule.struct(
+ const ChequeLockArgsCodec = struct(
{
receiverLockHash: Bytes20,
senderLockHash: Bytes20,
diff --git a/packages/neuron-wallet/src/models/blake2b.ts b/packages/neuron-wallet/src/models/blake2b.ts
index 33c01368df..1cb5548ab2 100644
--- a/packages/neuron-wallet/src/models/blake2b.ts
+++ b/packages/neuron-wallet/src/models/blake2b.ts
@@ -1,5 +1,5 @@
-import { CKBHasher } from '@ckb-lumos/base/lib/utils'
-import { bytes } from '@ckb-lumos/codec'
+import { CKBHasher } from '@ckb-lumos/lumos/utils'
+import { bytes } from '@ckb-lumos/lumos/codec'
export const BLAKE160_HEX_LENGTH = 42
diff --git a/packages/neuron-wallet/src/models/chain/input.ts b/packages/neuron-wallet/src/models/chain/input.ts
index 352989fab8..fcd587d2c1 100644
--- a/packages/neuron-wallet/src/models/chain/input.ts
+++ b/packages/neuron-wallet/src/models/chain/input.ts
@@ -1,6 +1,6 @@
import OutPoint from './out-point'
import Script from './script'
-import { BI } from '@ckb-lumos/bi'
+import { BI } from '@ckb-lumos/lumos'
import TypeChecker from '../../utils/type-checker'
import { OutputStatus } from './output'
diff --git a/packages/neuron-wallet/src/models/chain/live-cell.ts b/packages/neuron-wallet/src/models/chain/live-cell.ts
index 9a7cda74a2..4efc95dd60 100644
--- a/packages/neuron-wallet/src/models/chain/live-cell.ts
+++ b/packages/neuron-wallet/src/models/chain/live-cell.ts
@@ -1,6 +1,6 @@
import Script, { ScriptHashType } from './script'
import OutPoint from './out-point'
-import { type Cell, type OutPoint as IOutPoint } from '@ckb-lumos/base'
+import { type Cell, type OutPoint as IOutPoint } from '@ckb-lumos/lumos'
const LUMOS_HASH_TYPE_MAP: Record = {
type: ScriptHashType.Type,
diff --git a/packages/neuron-wallet/src/models/chain/out-point.ts b/packages/neuron-wallet/src/models/chain/out-point.ts
index 4b7f050791..19d30636c6 100644
--- a/packages/neuron-wallet/src/models/chain/out-point.ts
+++ b/packages/neuron-wallet/src/models/chain/out-point.ts
@@ -1,4 +1,4 @@
-import { BI } from '@ckb-lumos/bi'
+import { BI } from '@ckb-lumos/lumos'
import TypeChecker from '../../utils/type-checker'
export default class OutPoint {
diff --git a/packages/neuron-wallet/src/models/chain/output.ts b/packages/neuron-wallet/src/models/chain/output.ts
index 9a15c8d774..53ee2579a5 100644
--- a/packages/neuron-wallet/src/models/chain/output.ts
+++ b/packages/neuron-wallet/src/models/chain/output.ts
@@ -1,7 +1,7 @@
import Script from './script'
import OutPoint from './out-point'
-import { bytes as byteUtils } from '@ckb-lumos/codec'
-import { BI } from '@ckb-lumos/bi'
+import { bytes as byteUtils } from '@ckb-lumos/lumos/codec'
+import { BI } from '@ckb-lumos/lumos'
import TypeChecker from '../../utils/type-checker'
// sent: pending transaction's output
diff --git a/packages/neuron-wallet/src/models/chain/script.ts b/packages/neuron-wallet/src/models/chain/script.ts
index a83305a59a..40034ea46f 100644
--- a/packages/neuron-wallet/src/models/chain/script.ts
+++ b/packages/neuron-wallet/src/models/chain/script.ts
@@ -1,5 +1,5 @@
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
-import { bytes as byteUtils } from '@ckb-lumos/codec'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
+import { bytes as byteUtils } from '@ckb-lumos/lumos/codec'
import TypeChecker from '../../utils/type-checker'
export enum ScriptHashType {
diff --git a/packages/neuron-wallet/src/models/chain/transaction-with-status.ts b/packages/neuron-wallet/src/models/chain/transaction-with-status.ts
index 62899b088b..e0972774d3 100644
--- a/packages/neuron-wallet/src/models/chain/transaction-with-status.ts
+++ b/packages/neuron-wallet/src/models/chain/transaction-with-status.ts
@@ -1,7 +1,9 @@
-import { TransactionWithStatus as APITransactionWithStatus } from '@ckb-lumos/base/lib/api'
+import { CKBComponents } from '@ckb-lumos/lumos/rpc'
import Transaction from './transaction'
import TxStatus from './tx-status'
+type APITransactionWithStatus = CKBComponents.TransactionWithStatus
+
export default class TransactionWithStatus {
public transaction: Transaction
public txStatus: TxStatus
diff --git a/packages/neuron-wallet/src/models/chain/transaction.ts b/packages/neuron-wallet/src/models/chain/transaction.ts
index cc6a0ca38a..762d4b5312 100644
--- a/packages/neuron-wallet/src/models/chain/transaction.ts
+++ b/packages/neuron-wallet/src/models/chain/transaction.ts
@@ -2,13 +2,13 @@ import CellDep from './cell-dep'
import Input from './input'
import Output from './output'
import WitnessArgs from './witness-args'
-import { BI } from '@ckb-lumos/bi'
+import { BI } from '@ckb-lumos/lumos'
import { serializeRawTransaction, serializeWitnessArgs } from '../../utils/serialization'
import BlockHeader from './block-header'
import TypeCheckerUtils from '../../utils/type-checker'
import OutPoint from './out-point'
import { Signatures } from '../../models/offline-sign'
-import { utils } from '@ckb-lumos/base'
+import { ckbHash } from '@ckb-lumos/lumos/utils'
export enum TransactionStatus {
Pending = 'pending',
@@ -279,7 +279,7 @@ export default class Transaction {
}
public computeHash(): string {
- return utils.ckbHash(serializeRawTransaction(this.toSDKRawTransaction()))
+ return ckbHash(serializeRawTransaction(this.toSDKRawTransaction()))
}
public toSDKRawTransaction(): CKBComponents.RawTransaction {
diff --git a/packages/neuron-wallet/src/models/keys/hd-public-key-info.ts b/packages/neuron-wallet/src/models/keys/hd-public-key-info.ts
index 86075d9589..b8981a636f 100644
--- a/packages/neuron-wallet/src/models/keys/hd-public-key-info.ts
+++ b/packages/neuron-wallet/src/models/keys/hd-public-key-info.ts
@@ -1,11 +1,11 @@
-import { AddressType, AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { scriptToAddress } from '../../utils/scriptAndAddress'
import SystemScriptInfo from '../../models/system-script-info'
import NetworksService from '../../services/networks'
export default class HdPublicKeyInfoModel {
public walletId: string
- public addressType: AddressType
+ public addressType: hd.AddressType
public addressIndex: number
public publicKeyInBlake160: string
public description?: string
@@ -22,12 +22,12 @@ export default class HdPublicKeyInfoModel {
}
public get path(): string {
- return AccountExtendedPublicKey.pathFor(this.addressType, this.addressIndex)
+ return hd.AccountExtendedPublicKey.pathFor(this.addressType, this.addressIndex)
}
constructor(
walletId: string,
- addressType: AddressType,
+ addressType: hd.AddressType,
addressIndex: number,
publicKeyInBlake160: string,
description?: string
@@ -41,7 +41,7 @@ export default class HdPublicKeyInfoModel {
public static fromObject(params: {
walletId: string
- addressType: AddressType
+ addressType: hd.AddressType
addressIndex: number
publicKeyInBlake160: string
description?: string
diff --git a/packages/neuron-wallet/src/models/multisig-config.ts b/packages/neuron-wallet/src/models/multisig-config.ts
index 5c2258b7e5..a0a49f077d 100644
--- a/packages/neuron-wallet/src/models/multisig-config.ts
+++ b/packages/neuron-wallet/src/models/multisig-config.ts
@@ -1,4 +1,4 @@
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import Multisig from './multisig'
export default class MultisigConfigModel {
diff --git a/packages/neuron-wallet/src/models/multisig.ts b/packages/neuron-wallet/src/models/multisig.ts
index 6d62aaf6a6..e2810df24d 100644
--- a/packages/neuron-wallet/src/models/multisig.ts
+++ b/packages/neuron-wallet/src/models/multisig.ts
@@ -1,7 +1,7 @@
import { MultisigPrefixError } from '../exceptions'
import SystemScriptInfo from './system-script-info'
-import { since } from '@ckb-lumos/base'
-import { bytes, number } from '@ckb-lumos/codec'
+import { since } from '@ckb-lumos/lumos'
+import { bytes, Uint64LE } from '@ckb-lumos/lumos/codec'
import Blake2b, { BLAKE160_HEX_LENGTH } from './blake2b'
export interface MultisigPrefix {
@@ -38,7 +38,7 @@ export default class Multisig {
const leftMinutes = totalMinutes % this.EPOCH_MINUTES
const epochs = Math.floor(totalMinutes / this.EPOCH_MINUTES) + currentEpoch.number
const result = this.epochSince(BigInt(this.EPOCH_MINUTES), BigInt(leftMinutes), BigInt(epochs))
- return bytes.hexify(number.Uint64LE.pack(result))
+ return bytes.hexify(Uint64LE.pack(result))
}
static args(blake160: string, minutes: number, headerEpoch: string): string {
@@ -50,7 +50,7 @@ export default class Multisig {
}
static parseSince(args: string): bigint {
- return number.Uint64LE.unpack(`0x${args.slice(BLAKE160_HEX_LENGTH)}`).toBigInt()
+ return Uint64LE.unpack(`0x${args.slice(BLAKE160_HEX_LENGTH)}`).toBigInt()
}
private static epochSince(length: bigint, index: bigint, number: bigint): bigint {
diff --git a/packages/neuron-wallet/src/models/transaction-size.ts b/packages/neuron-wallet/src/models/transaction-size.ts
index 072575950f..afbe471175 100644
--- a/packages/neuron-wallet/src/models/transaction-size.ts
+++ b/packages/neuron-wallet/src/models/transaction-size.ts
@@ -5,7 +5,7 @@ import Transaction from './chain/transaction'
import Multisig from './multisig'
import Script, { ScriptHashType } from './chain/script'
import BufferUtils from '../utils/buffer'
-import { bytes as byteUtils } from '@ckb-lumos/codec'
+import { bytes as byteUtils } from '@ckb-lumos/lumos/codec'
export default class TransactionSize {
// https://github.com/zhangsoledad/rfcs/blob/zhangsoledad/ckb2023-overview/rfcs/0008-serialization/0008-serialization.md#fixvec---fixed-vector
diff --git a/packages/neuron-wallet/src/services/addresses.ts b/packages/neuron-wallet/src/services/addresses.ts
index 6f7f75b98c..8f16b045a1 100644
--- a/packages/neuron-wallet/src/services/addresses.ts
+++ b/packages/neuron-wallet/src/services/addresses.ts
@@ -1,4 +1,4 @@
-import { AddressType, AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { publicKeyToAddress, DefaultAddressNumber } from '../utils/scriptAndAddress'
import { Address as AddressInterface } from '../models/address'
import AddressCreatedSubject from '../models/subjects/address-created-subject'
@@ -19,9 +19,9 @@ const MAX_ADDRESS_COUNT = 100
export interface AddressMetaInfo {
walletId: string
- addressType: AddressType
+ addressType: hd.AddressType
addressIndex: number
- accountExtendedPublicKey: AccountExtendedPublicKey
+ accountExtendedPublicKey: hd.AccountExtendedPublicKey
}
export default class AddressService {
@@ -58,7 +58,7 @@ export default class AddressService {
private static async generateAndSave(
walletId: string,
- extendedKey: AccountExtendedPublicKey,
+ extendedKey: hd.AccountExtendedPublicKey,
receivingStartIndex: number,
changeStartIndex: number,
receivingAddressCount: number = DefaultAddressNumber.Receiving,
@@ -90,7 +90,7 @@ export default class AddressService {
private static async recursiveGenerateAndSave(
walletId: string,
- extendedKey: AccountExtendedPublicKey,
+ extendedKey: hd.AccountExtendedPublicKey,
isImporting: boolean | undefined,
receivingAddressCount: number = DefaultAddressNumber.Receiving,
changeAddressCount: number = DefaultAddressNumber.Change
@@ -101,8 +101,8 @@ export default class AddressService {
changeAddressCount
)
if (!receivingCount && !changeCount) return undefined
- const maxReceivingAddressIndex = await this.maxAddressIndex(walletId, AddressType.Receiving)
- const maxChangeAddressIndex = await this.maxAddressIndex(walletId, AddressType.Change)
+ const maxReceivingAddressIndex = await this.maxAddressIndex(walletId, hd.AddressType.Receiving)
+ const maxChangeAddressIndex = await this.maxAddressIndex(walletId, hd.AddressType.Change)
const nextReceivingIndex = maxReceivingAddressIndex === undefined ? 0 : maxReceivingAddressIndex + 1
const nextChangeIndex = maxChangeAddressIndex === undefined ? 0 : maxChangeAddressIndex + 1
@@ -159,7 +159,7 @@ export default class AddressService {
changeAddressCount,
}: {
walletId: string
- extendedKey: AccountExtendedPublicKey
+ extendedKey: hd.AccountExtendedPublicKey
isImporting?: boolean
receivingAddressCount?: number
changeAddressCount?: number
@@ -187,7 +187,7 @@ export default class AddressService {
}: {
walletId: string
publicKey: string
- addressType: AddressType
+ addressType: hd.AddressType
addressIndex: number
}): Promise {
const isMainnet = NetworksService.getInstance().isMainnet()
@@ -223,7 +223,7 @@ export default class AddressService {
// Generate both receiving and change addresses.
public static generateAddresses = (
walletId: string,
- extendedKey: AccountExtendedPublicKey,
+ extendedKey: hd.AccountExtendedPublicKey,
receivingStartIndex: number,
changeStartIndex: number,
receivingAddressCount: number = DefaultAddressNumber.Receiving,
@@ -238,7 +238,7 @@ export default class AddressService {
const receiving = Array.from({ length: receivingAddressCount }).map((_, idx) => {
const addressMetaInfo: AddressMetaInfo = {
walletId,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: idx + receivingStartIndex,
accountExtendedPublicKey: extendedKey,
}
@@ -247,7 +247,7 @@ export default class AddressService {
const change = Array.from({ length: changeAddressCount }).map((_, idx) => {
const addressMetaInfo: AddressMetaInfo = {
walletId,
- addressType: AddressType.Change,
+ addressType: hd.AddressType.Change,
addressIndex: idx + changeStartIndex,
accountExtendedPublicKey: extendedKey,
}
@@ -277,7 +277,7 @@ export default class AddressService {
return address
}
- private static async maxAddressIndex(walletId: string, addressType: AddressType): Promise {
+ private static async maxAddressIndex(walletId: string, addressType: hd.AddressType): Promise {
const result = await getConnection()
.getRepository(HdPublicKeyInfo)
.createQueryBuilder()
@@ -296,8 +296,8 @@ export default class AddressService {
private static async getGroupedUnusedAddressesByWalletId(walletId: string) {
const allUnusedAddresses = await this.getUnusedAddressesByWalletId(walletId)
- const unusedReceivingAddresses = allUnusedAddresses.filter(addr => addr.addressType === AddressType.Receiving)
- const unusedChangeAddresses = allUnusedAddresses.filter(addr => addr.addressType === AddressType.Change)
+ const unusedReceivingAddresses = allUnusedAddresses.filter(addr => addr.addressType === hd.AddressType.Receiving)
+ const unusedChangeAddresses = allUnusedAddresses.filter(addr => addr.addressType === hd.AddressType.Change)
return [unusedReceivingAddresses, unusedChangeAddresses]
}
@@ -349,7 +349,7 @@ export default class AddressService {
const publicKeyInfo = await getConnection()
.getRepository(HdPublicKeyInfo)
.createQueryBuilder()
- .where({ walletId, addressType: AddressType.Receiving })
+ .where({ walletId, addressType: hd.AddressType.Receiving })
.orderBy('addressIndex', 'ASC')
.getOne()
diff --git a/packages/neuron-wallet/src/services/cells.ts b/packages/neuron-wallet/src/services/cells.ts
index 03e8cc0a1f..87fdde58fe 100644
--- a/packages/neuron-wallet/src/services/cells.ts
+++ b/packages/neuron-wallet/src/services/cells.ts
@@ -1,5 +1,5 @@
import { Brackets, In, IsNull, Not, type ObjectLiteral } from 'typeorm'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { getConnection } from '../database/chain/connection'
import { scriptToAddress, addressToScript } from '../utils/scriptAndAddress'
import {
@@ -31,7 +31,7 @@ import AssetAccountInfo from '../models/asset-account-info'
import NFT from '../models/nft'
import MultisigConfigModel from '../models/multisig-config'
import MultisigOutput from '../database/chain/entities/multisig-output'
-import { bytes } from '@ckb-lumos/codec'
+import { bytes } from '@ckb-lumos/lumos/codec'
import { generateRPC } from '../utils/ckb-rpc'
import { getClusterById, SporeData, unpackToRawClusterData } from '@spore-sdk/core'
import NetworksService from './networks'
diff --git a/packages/neuron-wallet/src/services/hardware/common.ts b/packages/neuron-wallet/src/services/hardware/common.ts
index 67bde2b3d6..be690f13f6 100644
--- a/packages/neuron-wallet/src/services/hardware/common.ts
+++ b/packages/neuron-wallet/src/services/hardware/common.ts
@@ -1,4 +1,6 @@
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
+
+type AddressType = hd.AddressType
export enum Manufacturer {
Ledger = 'Ledger',
diff --git a/packages/neuron-wallet/src/services/hardware/hardware.ts b/packages/neuron-wallet/src/services/hardware/hardware.ts
index fc0b1f9641..9a1c818090 100644
--- a/packages/neuron-wallet/src/services/hardware/hardware.ts
+++ b/packages/neuron-wallet/src/services/hardware/hardware.ts
@@ -7,13 +7,13 @@ import Multisig from '../../models/multisig'
import WalletService from '../../services/wallets'
import DeviceSignIndexSubject from '../../models/subjects/device-sign-index-subject'
import type { DeviceInfo, ExtendedPublicKey, PublicKey } from './common'
-import { AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import AssetAccountInfo from '../../models/asset-account-info'
export abstract class Hardware {
public deviceInfo: DeviceInfo
public isConnected: boolean
- protected defaultPath = AccountExtendedPublicKey.ckbAccountPath
+ protected defaultPath = hd.AccountExtendedPublicKey.ckbAccountPath
constructor(device: DeviceInfo) {
this.deviceInfo = device
diff --git a/packages/neuron-wallet/src/services/hardware/ledger.ts b/packages/neuron-wallet/src/services/hardware/ledger.ts
index d22bb8713c..1d6a7b791d 100644
--- a/packages/neuron-wallet/src/services/hardware/ledger.ts
+++ b/packages/neuron-wallet/src/services/hardware/ledger.ts
@@ -7,7 +7,7 @@ import type Transport from '@ledgerhq/hw-transport'
import { Observable, timer } from 'rxjs'
import { takeUntil, filter, scan } from 'rxjs/operators'
import Transaction from '../../models/chain/transaction'
-import { AddressType, AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import logger from '../../utils/logger'
import NetworksService from '../../services/networks'
import { generateRPC } from '../../utils/ckb-rpc'
@@ -79,7 +79,7 @@ export default class Ledger extends Hardware {
}
const signature = await this.ledgerCKB!.signTransaction(
- path === AccountExtendedPublicKey.pathForReceiving(0) ? this.defaultPath : path,
+ path === hd.AccountExtendedPublicKey.pathForReceiving(0) ? this.defaultPath : path,
rawTx,
witnesses,
context,
@@ -92,7 +92,7 @@ export default class Ledger extends Hardware {
async signMessage(path: string, messageHex: string) {
const message = this.removePrefix(messageHex)
const signed = await this.ledgerCKB!.signMessage(
- path === AccountExtendedPublicKey.pathForReceiving(0) ? this.defaultPath : path,
+ path === hd.AccountExtendedPublicKey.pathForReceiving(0) ? this.defaultPath : path,
message,
false
)
@@ -108,7 +108,7 @@ export default class Ledger extends Hardware {
const networkService = NetworksService.getInstance()
const isTestnet = !networkService.isMainnet()
const result = await this.ledgerCKB!.getWalletPublicKey(
- path === AccountExtendedPublicKey.pathForReceiving(0) ? this.defaultPath : path,
+ path === hd.AccountExtendedPublicKey.pathForReceiving(0) ? this.defaultPath : path,
isTestnet
)
return result
@@ -143,7 +143,7 @@ export default class Ledger extends Hardware {
manufacturer: e.device.manufacturer,
product: e.device.product,
addressIndex: 0,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
},
]
}, [])
diff --git a/packages/neuron-wallet/src/services/multisig.ts b/packages/neuron-wallet/src/services/multisig.ts
index 2f3da9467f..a2baccd5ee 100644
--- a/packages/neuron-wallet/src/services/multisig.ts
+++ b/packages/neuron-wallet/src/services/multisig.ts
@@ -4,7 +4,7 @@ import MultisigConfig from '../database/chain/entities/multisig-config'
import MultisigOutput from '../database/chain/entities/multisig-output'
import { MultisigConfigNotExistError, MultisigConfigExistError } from '../exceptions/multisig'
import { rpcBatchRequest } from '../utils/rpc-request'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import MultisigOutputChangedSubject from '../models/subjects/multisig-output-db-changed-subject'
import Transaction from '../models/chain/transaction'
import { OutputStatus } from '../models/chain/output'
diff --git a/packages/neuron-wallet/src/services/node.ts b/packages/neuron-wallet/src/services/node.ts
index 220bb5fa35..03cae0df0e 100644
--- a/packages/neuron-wallet/src/services/node.ts
+++ b/packages/neuron-wallet/src/services/node.ts
@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
-import { BI } from '@ckb-lumos/bi'
+import { BI } from '@ckb-lumos/lumos'
import { app as electronApp, dialog, shell, app } from 'electron'
import { t } from 'i18next'
import { interval, BehaviorSubject, merge, Subject } from 'rxjs'
diff --git a/packages/neuron-wallet/src/services/sdk-core.ts b/packages/neuron-wallet/src/services/sdk-core.ts
index 36017e078c..738d7a109a 100644
--- a/packages/neuron-wallet/src/services/sdk-core.ts
+++ b/packages/neuron-wallet/src/services/sdk-core.ts
@@ -1,4 +1,4 @@
-import { CKBRPC } from '@ckb-lumos/rpc'
+import { CKBRPC } from '@ckb-lumos/lumos/rpc'
export const generateCKB = (url: string): CKBRPC => {
return new CKBRPC(url, { fetch: (request, init) => globalThis.fetch(request, { ...init, keepalive: true }) })
diff --git a/packages/neuron-wallet/src/services/sign-message.ts b/packages/neuron-wallet/src/services/sign-message.ts
index 31882eba15..31977328b7 100644
--- a/packages/neuron-wallet/src/services/sign-message.ts
+++ b/packages/neuron-wallet/src/services/sign-message.ts
@@ -1,12 +1,12 @@
import AddressService from './addresses'
import WalletService, { Wallet } from './wallets'
import Blake2b from '../models/blake2b'
-import { key, Keychain } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { ec as EC } from 'elliptic'
import { AddressNotFound } from '../exceptions'
import HardwareWalletService from './hardware'
import AddressParser from '../models/address-parser'
-import { bytes } from '@ckb-lumos/codec'
+import { bytes } from '@ckb-lumos/lumos/codec'
export default class SignMessage {
static GENERATE_COUNT = 100
@@ -50,7 +50,7 @@ export default class SignMessage {
private static signByPrivateKey(privateKey: string, message: string): string {
const digest = SignMessage.signatureHash(message)
- const signature = key.signRecoverable(digest, privateKey)
+ const signature = hd.key.signRecoverable(digest, privateKey)
return signature
}
@@ -101,7 +101,7 @@ export default class SignMessage {
private static getPrivateKey(wallet: Wallet, path: string, password: string): string {
const masterPrivateKey = wallet.loadKeystore().extendedPrivateKey(password)
- const masterKeychain = new Keychain(
+ const masterKeychain = new hd.Keychain(
Buffer.from(bytes.bytify(masterPrivateKey.privateKey)),
Buffer.from(bytes.bytify(masterPrivateKey.chainCode))
)
diff --git a/packages/neuron-wallet/src/services/sync-progress.ts b/packages/neuron-wallet/src/services/sync-progress.ts
index 1c46bdac31..0d5060ec1b 100644
--- a/packages/neuron-wallet/src/services/sync-progress.ts
+++ b/packages/neuron-wallet/src/services/sync-progress.ts
@@ -1,5 +1,5 @@
import { In, LessThan, Not } from 'typeorm'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import SyncProgress, { SyncAddressType } from '../database/chain/entities/sync-progress'
import WalletService from './wallets'
import { getConnection } from '../database/chain/connection'
diff --git a/packages/neuron-wallet/src/services/transaction-sender.ts b/packages/neuron-wallet/src/services/transaction-sender.ts
index a0681e4673..621b87835e 100644
--- a/packages/neuron-wallet/src/services/transaction-sender.ts
+++ b/packages/neuron-wallet/src/services/transaction-sender.ts
@@ -18,7 +18,7 @@ import Multisig from '../models/multisig'
import Blake2b from '../models/blake2b'
import logger from '../utils/logger'
import { signWitnesses } from '../utils/signWitnesses'
-import { bytes, number } from '@ckb-lumos/codec'
+import { bytes, Uint64LE } from '@ckb-lumos/lumos/codec'
import SystemScriptInfo from '../models/system-script-info'
import AddressParser from '../models/address-parser'
import HardwareWalletService from './hardware'
@@ -41,10 +41,10 @@ import { SignStatus } from '../models/offline-sign'
import NetworksService from './networks'
import { generateRPC } from '../utils/ckb-rpc'
import CellsService from './cells'
-import { key, Keychain } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { getClusterByOutPoint } from '@spore-sdk/core'
import CellDep, { DepType } from '../models/chain/cell-dep'
-import { dao } from '@ckb-lumos/common-scripts'
+import { dao } from '@ckb-lumos/lumos/common-scripts'
interface SignInfo {
witnessArgs: WitnessArgs
@@ -417,13 +417,13 @@ export default class TransactionSender {
const serializedEmptyWitnessSize = bytes.bytify(serializedEmptyWitness).byteLength
const blake2b = new Blake2b()
blake2b.update(txHash)
- blake2b.update(bytes.hexify(number.Uint64LE.pack(`0x${serializedEmptyWitnessSize.toString(16)}`)))
+ blake2b.update(bytes.hexify(Uint64LE.pack(`0x${serializedEmptyWitnessSize.toString(16)}`)))
blake2b.update(serializedEmptyWitness)
restWitnesses.forEach(w => {
const wit: string = typeof w === 'string' ? w : serializeWitnessArgs(w.toSDK())
const byteLength = bytes.bytify(wit).byteLength
- blake2b.update(bytes.hexify(number.Uint64LE.pack(`0x${byteLength.toString(16)}`)))
+ blake2b.update(bytes.hexify(Uint64LE.pack(`0x${byteLength.toString(16)}`)))
blake2b.update(wit)
})
@@ -432,7 +432,7 @@ export default class TransactionSender {
if (!wallet.isHardware()) {
// `privateKeyOrPath` variable here is a private key because wallet is not a hardware one. Otherwise, it will be a private key path.
const privateKey = privateKeyOrPath
- emptyWitness.lock = key.signRecoverable(message, privateKey)
+ emptyWitness.lock = hd.key.signRecoverable(message, privateKey)
}
return [emptyWitness, ...restWitnesses]
@@ -930,7 +930,7 @@ export default class TransactionSender {
// Derive all child private keys for specified BIP44 paths.
public getPrivateKeys = (wallet: Wallet, paths: string[], password: string): PathAndPrivateKey[] => {
const masterPrivateKey = wallet.loadKeystore().extendedPrivateKey(password)
- const masterKeychain = new Keychain(
+ const masterKeychain = new hd.Keychain(
Buffer.from(bytes.bytify(masterPrivateKey.privateKey)),
Buffer.from(bytes.bytify(masterPrivateKey.chainCode))
)
diff --git a/packages/neuron-wallet/src/services/tx/transaction-generator.ts b/packages/neuron-wallet/src/services/tx/transaction-generator.ts
index cb6d7528b9..2c0214f958 100644
--- a/packages/neuron-wallet/src/services/tx/transaction-generator.ts
+++ b/packages/neuron-wallet/src/services/tx/transaction-generator.ts
@@ -1,4 +1,4 @@
-import { bytes } from '@ckb-lumos/codec'
+import { bytes } from '@ckb-lumos/lumos/codec'
import CellsService from '../../services/cells'
import {
CapacityTooSmall,
diff --git a/packages/neuron-wallet/src/services/tx/transaction-service.ts b/packages/neuron-wallet/src/services/tx/transaction-service.ts
index 8b43057ed9..288fbfb8b7 100644
--- a/packages/neuron-wallet/src/services/tx/transaction-service.ts
+++ b/packages/neuron-wallet/src/services/tx/transaction-service.ts
@@ -1,4 +1,4 @@
-import { CKBRPC } from '@ckb-lumos/rpc'
+import { CKBRPC } from '@ckb-lumos/lumos/rpc'
import TransactionEntity from '../../database/chain/entities/transaction'
import OutputEntity from '../../database/chain/entities/output'
import { getConnection } from '../../database/chain/connection'
@@ -639,7 +639,7 @@ export class TransactionsService {
hd_public_key_info.publicKeyInBlake160 FROM hd_public_key_info
WHERE
walletId = :walletId
- )
+ )
${lock ? 'AND lockCodeHash = :lockCodeHash AND lockHashType = :lockHashType' : ''}
UNION
SELECT
@@ -652,7 +652,7 @@ export class TransactionsService {
SELECT
hd_public_key_info.publicKeyInBlake160 FROM hd_public_key_info
WHERE
- walletId = :walletId
+ walletId = :walletId
)
${lock ? 'AND lockCodeHash = :lockCodeHash AND lockHashType = :lockHashType' : ''}
) AS cell
diff --git a/packages/neuron-wallet/src/services/wallets.ts b/packages/neuron-wallet/src/services/wallets.ts
index 025bedd07f..2fb2bd6f4f 100644
--- a/packages/neuron-wallet/src/services/wallets.ts
+++ b/packages/neuron-wallet/src/services/wallets.ts
@@ -1,7 +1,7 @@
import { v4 as uuid } from 'uuid'
import { WalletNotFound, IsRequired, UsedName, WalletFunctionNotSupported, DuplicateImportWallet } from '../exceptions'
import Store from '../models/store'
-import { Keystore, AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import WalletDeletedSubject from '../models/subjects/wallet-deleted-subject'
import { WalletListSubject, CurrentWalletSubject } from '../models/subjects/wallets'
import { DefaultAddressNumber } from '../utils/scriptAndAddress'
@@ -29,7 +29,7 @@ export interface WalletProperties {
extendedKey: string // Serialized account extended public key
isHDWallet?: boolean
device?: DeviceInfo
- keystore?: Keystore
+ keystore?: hd.Keystore
startBlockNumber?: string
}
@@ -76,11 +76,11 @@ export abstract class Wallet {
throw new Error('not implemented')
}
- public loadKeystore = (): Keystore => {
+ public loadKeystore = (): hd.Keystore => {
throw new WalletFunctionNotSupported(this.loadKeystore.name)
}
- public saveKeystore = (_keystore: Keystore): void => {
+ public saveKeystore = (_keystore: hd.Keystore): void => {
throw new WalletFunctionNotSupported(this.saveKeystore.name)
}
@@ -92,7 +92,7 @@ export abstract class Wallet {
throw new WalletFunctionNotSupported(this.getDeviceInfo.name)
}
- public accountExtendedPublicKey = (): AccountExtendedPublicKey => {
+ public accountExtendedPublicKey = (): hd.AccountExtendedPublicKey => {
throw new WalletFunctionNotSupported(this.accountExtendedPublicKey.name)
}
@@ -149,8 +149,8 @@ export class FileKeystoreWallet extends Wallet {
this.isHD = true
}
- accountExtendedPublicKey = (): AccountExtendedPublicKey => {
- return AccountExtendedPublicKey.parse(this.extendedKey)
+ accountExtendedPublicKey = (): hd.AccountExtendedPublicKey => {
+ return hd.AccountExtendedPublicKey.parse(this.extendedKey)
}
public toJSON = () => {
@@ -166,14 +166,14 @@ export class FileKeystoreWallet extends Wallet {
public loadKeystore = () => {
const data = fileService.readFileSync(MODULE_NAME, this.keystoreFileName())
- return Keystore.fromJson(data)
+ return hd.Keystore.fromJson(data)
}
static fromJSON = (json: WalletProperties) => {
return new FileKeystoreWallet(json)
}
- public saveKeystore = (keystore: Keystore): void => {
+ public saveKeystore = (keystore: hd.Keystore): void => {
fileService.writeFileSync(MODULE_NAME, this.keystoreFileName(), JSON.stringify({ ...keystore, id: this.id }))
}
@@ -235,8 +235,8 @@ export class HardwareWallet extends Wallet {
this.isHD = false
}
- accountExtendedPublicKey = (): AccountExtendedPublicKey => {
- return AccountExtendedPublicKey.parse(this.extendedKey)
+ accountExtendedPublicKey = (): hd.AccountExtendedPublicKey => {
+ return hd.AccountExtendedPublicKey.parse(this.extendedKey)
}
static fromJSON = (json: WalletProperties) => {
@@ -249,7 +249,7 @@ export class HardwareWallet extends Wallet {
public checkAndGenerateAddresses = async (): Promise => {
const { addressType, addressIndex } = this.getDeviceInfo()
- const { publicKey } = AccountExtendedPublicKey.parse(this.extendedKey)
+ const { publicKey } = hd.AccountExtendedPublicKey.parse(this.extendedKey)
const address = await AddressService.generateAndSaveForPublicKeyQueue.asyncPush({
walletId: this.id,
publicKey,
diff --git a/packages/neuron-wallet/src/types/rpc.d.ts b/packages/neuron-wallet/src/types/rpc.d.ts
index 10a7333fa2..fc922e398b 100644
--- a/packages/neuron-wallet/src/types/rpc.d.ts
+++ b/packages/neuron-wallet/src/types/rpc.d.ts
@@ -100,6 +100,8 @@ declare namespace RPC {
}
time_added_to_pool: Uint64 | null
cycles: Uint64 | null
+ fee: Uint64
+ min_replace_fee: Uint64
}
export interface TransactionPoint {
block_number: BlockNumber
diff --git a/packages/neuron-wallet/src/utils/ckb-rpc.ts b/packages/neuron-wallet/src/utils/ckb-rpc.ts
index fc33fbefe7..9994fa8f88 100644
--- a/packages/neuron-wallet/src/utils/ckb-rpc.ts
+++ b/packages/neuron-wallet/src/utils/ckb-rpc.ts
@@ -1,9 +1,7 @@
-import type { ParamsFormatter } from '@ckb-lumos/rpc'
-import type { Block } from '@ckb-lumos/base'
-import type { Script } from '@ckb-lumos/base'
-import { HexString } from '@ckb-lumos/base'
+import type { HexString, Block, Script } from '@ckb-lumos/lumos'
import { CKBRPC } from '@ckb-lumos/rpc'
import { Method as SdkRpcMethod } from '@ckb-lumos/rpc/lib/method'
+import { type CKBComponents, type ParamsFormatter } from '@ckb-lumos/lumos/rpc'
import * as resultFormatter from '@ckb-lumos/rpc/lib/resultFormatter'
import { formatter as paramsFormatter } from '@ckb-lumos/rpc/lib/paramsFormatter'
import { Base } from '@ckb-lumos/rpc/lib/Base'
@@ -16,12 +14,11 @@ import { request } from 'undici'
import CommonUtils from './common'
import { NetworkType } from '../models/network'
import type { RPCConfig } from '@ckb-lumos/rpc/lib/types/common'
-import type { CKBComponents } from '@ckb-lumos/rpc/lib/types/api'
export interface LightScriptFilter {
script: Script
blockNumber: CKBComponents.BlockNumber
- scriptType: CKBRPC.ScriptType
+ scriptType: CKBComponents.ScriptType
}
export type LightScriptSyncStatus = LightScriptFilter
@@ -67,7 +64,7 @@ const lightRPCProperties: Record[0]
paramsFormatters: [
(searchKey: {
script: CKBComponents.Script
- scriptType: CKBRPC.ScriptType
+ scriptType: CKBComponents.ScriptType
blockRange: [HexString, HexString]
}) => ({
script: {
@@ -149,7 +146,11 @@ export class LightRPC extends Base {
// TODO: the type is not the same as full node here
// @ts-ignore
getTransactions: (
- searchKey: { script: CKBComponents.Script; scriptType: CKBRPC.ScriptType; blockRange: [HexString, HexString] },
+ searchKey: {
+ script: CKBComponents.Script
+ scriptType: CKBComponents.ScriptType
+ blockRange: [HexString, HexString]
+ },
order: 'asc' | 'desc',
limit: HexString,
afterCursor: HexString
diff --git a/packages/neuron-wallet/src/utils/multisig.ts b/packages/neuron-wallet/src/utils/multisig.ts
index 5caef9529a..d692479f75 100644
--- a/packages/neuron-wallet/src/utils/multisig.ts
+++ b/packages/neuron-wallet/src/utils/multisig.ts
@@ -1,4 +1,4 @@
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import Multisig from '../models/multisig'
import MultisigConfigModel from '../models/multisig-config'
import { Signatures, SignStatus } from '../models/offline-sign'
diff --git a/packages/neuron-wallet/src/utils/scriptAndAddress.ts b/packages/neuron-wallet/src/utils/scriptAndAddress.ts
index a20fb27596..cbceca958c 100644
--- a/packages/neuron-wallet/src/utils/scriptAndAddress.ts
+++ b/packages/neuron-wallet/src/utils/scriptAndAddress.ts
@@ -1,7 +1,6 @@
-import { key } from '@ckb-lumos/hd'
-import { type Script } from '@ckb-lumos/base'
-import { predefined } from '@ckb-lumos/config-manager'
-import { encodeToAddress, parseAddress } from '@ckb-lumos/helpers'
+import { type Script, hd } from '@ckb-lumos/lumos'
+import { predefined } from '@ckb-lumos/lumos/config'
+import { encodeToAddress, parseAddress } from '@ckb-lumos/lumos/helpers'
import { systemScripts } from './systemScripts'
export enum DefaultAddressNumber {
@@ -16,7 +15,7 @@ export const publicKeyToAddress = (publicKey: string, isMainnet = false) => {
{
codeHash: systemScripts.SECP256K1_BLAKE160.CODE_HASH,
hashType: systemScripts.SECP256K1_BLAKE160.HASH_TYPE,
- args: key.publicKeyToBlake160(prefixWith0x(publicKey)),
+ args: hd.key.publicKeyToBlake160(prefixWith0x(publicKey)),
},
isMainnet
)
diff --git a/packages/neuron-wallet/src/utils/serialization.ts b/packages/neuron-wallet/src/utils/serialization.ts
index f1559467b3..07cb03c032 100644
--- a/packages/neuron-wallet/src/utils/serialization.ts
+++ b/packages/neuron-wallet/src/utils/serialization.ts
@@ -1,5 +1,5 @@
-import { CellDep, OutPoint, Input, Output, RawTransaction, Transaction, blockchain, WitnessArgs } from '@ckb-lumos/base'
-import { bytes } from '@ckb-lumos/codec'
+import { CellDep, OutPoint, Input, Output, RawTransaction, Transaction, WitnessArgs } from '@ckb-lumos/lumos'
+import { bytes, blockchain } from '@ckb-lumos/lumos/codec'
/**
* @param outPoint always required when serialize
diff --git a/packages/neuron-wallet/src/utils/shannonToCKB.ts b/packages/neuron-wallet/src/utils/shannonToCKB.ts
index 8d9ba94c69..dce470115c 100644
--- a/packages/neuron-wallet/src/utils/shannonToCKB.ts
+++ b/packages/neuron-wallet/src/utils/shannonToCKB.ts
@@ -1,4 +1,6 @@
-import { formatUnit, ckbDecimals } from '@ckb-lumos/bi'
+import { formatUnit } from '@ckb-lumos/lumos/utils'
+
+const ckbDecimals = 8
const shannonToCKB = (shannon: bigint) => {
return new Intl.NumberFormat('en-US', {
diff --git a/packages/neuron-wallet/src/utils/signWitnesses.ts b/packages/neuron-wallet/src/utils/signWitnesses.ts
index 0efade4466..47b97826ed 100644
--- a/packages/neuron-wallet/src/utils/signWitnesses.ts
+++ b/packages/neuron-wallet/src/utils/signWitnesses.ts
@@ -1,7 +1,7 @@
-import { bytes, number } from '@ckb-lumos/codec'
+import { bytes, Uint64LE } from '@ckb-lumos/lumos/codec'
import { serializeWitnessArgs } from './serialization'
-import { CKBHasher } from '@ckb-lumos/base/lib/utils'
-import { key } from '@ckb-lumos/hd'
+import { CKBHasher } from '@ckb-lumos/lumos/utils'
+import { hd } from '@ckb-lumos/lumos'
type StructuredWitness = CKBComponents.WitnessArgs | CKBComponents.Witness
@@ -31,16 +31,16 @@ export const signWitnesses = ({
const hasher = new CKBHasher()
hasher.update(transactionHash)
- hasher.update(number.Uint64LE.pack(serializedEmptyWitnessSize))
+ hasher.update(Uint64LE.pack(serializedEmptyWitnessSize))
hasher.update(serializedEmptyWitnessBytes)
witnesses.slice(1).forEach(witness => {
const witnessBytes = bytes.bytify(typeof witness === 'string' ? witness : serializeWitnessArgs(witness))
- hasher.update(number.Uint64LE.pack(witnessBytes.byteLength))
+ hasher.update(Uint64LE.pack(witnessBytes.byteLength))
hasher.update(witnessBytes)
})
const message = hasher.digestHex()
- emptyWitness.lock = key.signRecoverable(message, privateKey)
+ emptyWitness.lock = hd.key.signRecoverable(message, privateKey)
return [serializeWitnessArgs(emptyWitness), ...witnesses.slice(1)]
}
diff --git a/packages/neuron-wallet/src/utils/sudt-value-to-amount.ts b/packages/neuron-wallet/src/utils/sudt-value-to-amount.ts
index 37c1ed2c03..1f4b8b8429 100644
--- a/packages/neuron-wallet/src/utils/sudt-value-to-amount.ts
+++ b/packages/neuron-wallet/src/utils/sudt-value-to-amount.ts
@@ -1,4 +1,4 @@
-import { formatUnit } from '@ckb-lumos/bi'
+import { formatUnit } from '@ckb-lumos/lumos/utils'
const sudtValueToAmount = (value: string | null = '0', decimal: string | null = '') => {
return value === null || value === '0'
diff --git a/packages/neuron-wallet/src/utils/systemScripts.ts b/packages/neuron-wallet/src/utils/systemScripts.ts
index d238c8d2a7..d11165fe21 100644
--- a/packages/neuron-wallet/src/utils/systemScripts.ts
+++ b/packages/neuron-wallet/src/utils/systemScripts.ts
@@ -1,4 +1,4 @@
-import { predefined } from '@ckb-lumos/config-manager'
+import { predefined } from '@ckb-lumos/lumos/config'
const systemScriptsMainnet = predefined.LINA.SCRIPTS
const systemScriptsTestnet = predefined.AGGRON4.SCRIPTS
diff --git a/packages/neuron-wallet/tests/block-sync-renderer/full-synchronizer.test.ts b/packages/neuron-wallet/tests/block-sync-renderer/full-synchronizer.test.ts
index b4af6a23a4..bceea87ad7 100644
--- a/packages/neuron-wallet/tests/block-sync-renderer/full-synchronizer.test.ts
+++ b/packages/neuron-wallet/tests/block-sync-renderer/full-synchronizer.test.ts
@@ -1,11 +1,13 @@
import { scriptToAddress } from '../../src/utils/scriptAndAddress'
import { when } from 'jest-when'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { Address, AddressVersion } from '../../src/models/address'
import SystemScriptInfo from '../../src/models/system-script-info'
import FullSynchronizer from '../../src/block-sync-renderer/sync/full-synchronizer'
import { flushPromises } from '../test-utils'
+const { AddressType } = hd
+
const stubbedTipFn = jest.fn()
const stubbedGetTransactionFn = jest.fn()
const stubbedGetHeaderFn = jest.fn()
diff --git a/packages/neuron-wallet/tests/block-sync-renderer/indexer-cache-service.intg.test.ts b/packages/neuron-wallet/tests/block-sync-renderer/indexer-cache-service.intg.test.ts
index 2ba8f41a08..4d6022b2d3 100644
--- a/packages/neuron-wallet/tests/block-sync-renderer/indexer-cache-service.intg.test.ts
+++ b/packages/neuron-wallet/tests/block-sync-renderer/indexer-cache-service.intg.test.ts
@@ -1,11 +1,13 @@
import { when } from 'jest-when'
import AddressMeta from '../../src/database/address/meta'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { AddressVersion } from '../../src/models/address'
import IndexerTxHashCache from '../../src/database/chain/entities/indexer-tx-hash-cache'
import RpcService from '../../src/services/rpc-service'
import { closeConnection, getConnection, initConnection } from '../setupAndTeardown'
+const { AddressType } = hd
+
const stubbedGetTransactionFn = jest.fn()
const stubbedGetHeaderFn = jest.fn()
const stubbedCollectFn = jest.fn(() => {
diff --git a/packages/neuron-wallet/tests/block-sync-renderer/light-synchronizer.test.ts b/packages/neuron-wallet/tests/block-sync-renderer/light-synchronizer.test.ts
index 0b8d0b9531..7221546503 100644
--- a/packages/neuron-wallet/tests/block-sync-renderer/light-synchronizer.test.ts
+++ b/packages/neuron-wallet/tests/block-sync-renderer/light-synchronizer.test.ts
@@ -1,4 +1,4 @@
-import type { Script } from '@ckb-lumos/base'
+import type { Script } from '@ckb-lumos/lumos'
import LightSynchronizer from '../../src/block-sync-renderer/sync/light-synchronizer'
import AddressMeta from '../../src/database/address/meta'
diff --git a/packages/neuron-wallet/tests/block-sync-renderer/queue.test.ts b/packages/neuron-wallet/tests/block-sync-renderer/queue.test.ts
index 52051e88e8..d25151e60c 100644
--- a/packages/neuron-wallet/tests/block-sync-renderer/queue.test.ts
+++ b/packages/neuron-wallet/tests/block-sync-renderer/queue.test.ts
@@ -2,7 +2,7 @@ import '../../src/types/ckbComponents.d.ts'
import { Subject } from 'rxjs'
import { Tip } from '@ckb-lumos/base'
import { scriptToAddress } from '../../src/utils/scriptAndAddress'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import SystemScriptInfo from '../../src/models/system-script-info'
import { Address, AddressVersion } from '../../src/models/address'
import Queue from '../../src/block-sync-renderer/sync/queue'
@@ -105,7 +105,7 @@ describe('queue', () => {
blake160: `0x${'0'.repeat(40)}`,
walletId: fakeWalletId,
path: '',
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
txCount: 0,
liveBalance: '',
diff --git a/packages/neuron-wallet/tests/block-sync-renderer/synchronizer.test.ts b/packages/neuron-wallet/tests/block-sync-renderer/synchronizer.test.ts
index 9836446cf2..fc51c62735 100644
--- a/packages/neuron-wallet/tests/block-sync-renderer/synchronizer.test.ts
+++ b/packages/neuron-wallet/tests/block-sync-renderer/synchronizer.test.ts
@@ -1,6 +1,6 @@
import { scriptToAddress } from '../../src/utils/scriptAndAddress'
-import { AddressType } from '@ckb-lumos/hd'
-import { QueryOptions, type Cell } from '@ckb-lumos/base'
+import { type Cell, hd } from '@ckb-lumos/lumos'
+import { QueryOptions } from '@ckb-lumos/base'
import { Address, AddressVersion } from '../../src/models/address'
import SystemScriptInfo from '../../src/models/system-script-info'
import { Synchronizer } from '../../src/block-sync-renderer/sync/synchronizer'
@@ -40,7 +40,7 @@ const addressObj1: Address = {
blake160: '0x',
walletId: walletId1,
path: '',
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
txCount: 0,
liveBalance: '',
@@ -54,7 +54,7 @@ const addressObj2: Address = {
blake160: '0x',
walletId: walletId2,
path: '',
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
txCount: 0,
liveBalance: '',
diff --git a/packages/neuron-wallet/tests/controllers/cell-management.test.ts b/packages/neuron-wallet/tests/controllers/cell-management.test.ts
index c41d19326f..aaab619266 100644
--- a/packages/neuron-wallet/tests/controllers/cell-management.test.ts
+++ b/packages/neuron-wallet/tests/controllers/cell-management.test.ts
@@ -1,4 +1,4 @@
-import type { OutPoint as OutPointSDK } from '@ckb-lumos/base'
+import type { OutPoint as OutPointSDK } from '@ckb-lumos/lumos'
import CellManagement from '../../src/controllers/cell-management'
import CellLocalInfo from '../../src/database/chain/entities/cell-local-info'
import { AddressNotFound, CurrentWalletNotSet } from '../../src/exceptions'
diff --git a/packages/neuron-wallet/tests/database/address/meta.test.ts b/packages/neuron-wallet/tests/database/address/meta.test.ts
index cdc9f5605e..af9b7f4b62 100644
--- a/packages/neuron-wallet/tests/database/address/meta.test.ts
+++ b/packages/neuron-wallet/tests/database/address/meta.test.ts
@@ -1,5 +1,5 @@
import { Address, AddressVersion } from '../../../src/models/address'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import AddressMeta from '../../../src/database/address/meta'
import Multisig from '../../../src/models/multisig'
import AssetAccountInfo from '../../../src/models/asset-account-info'
@@ -9,7 +9,7 @@ describe('Address Dao tests', () => {
walletId: '1',
address: 'ckt1qyqrdsefa43s6m882pcj53m4gdnj4k440axqswmu83',
path: "m/44'/309'/0'/0/0",
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
txCount: 0,
liveBalance: '0',
diff --git a/packages/neuron-wallet/tests/mock/hardware.ts b/packages/neuron-wallet/tests/mock/hardware.ts
index bc8c04f3b3..0ba564fcf0 100644
--- a/packages/neuron-wallet/tests/mock/hardware.ts
+++ b/packages/neuron-wallet/tests/mock/hardware.ts
@@ -1,5 +1,5 @@
import { DeviceInfo } from '../../src/services/hardware/common'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import type { Subscriber } from 'rxjs'
enum Manufacturer {
@@ -12,7 +12,7 @@ export const ledgerNanoS: DeviceInfo = {
product: 'Nano S',
isBluetooth: false,
manufacturer: Manufacturer.Ledger,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
}
@@ -22,7 +22,7 @@ export const LedgerNanoX: DeviceInfo = {
product: 'Nano X',
isBluetooth: true,
manufacturer: Manufacturer.Ledger,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
}
diff --git a/packages/neuron-wallet/tests/models/asset-account-info.test.ts b/packages/neuron-wallet/tests/models/asset-account-info.test.ts
index cb7d34a570..3ade9fa201 100644
--- a/packages/neuron-wallet/tests/models/asset-account-info.test.ts
+++ b/packages/neuron-wallet/tests/models/asset-account-info.test.ts
@@ -2,9 +2,11 @@ import AssetAccountInfo from '../../src/models/asset-account-info'
import CellDep, { DepType } from '../../src/models/chain/cell-dep'
import OutPoint from '../../src/models/chain/out-point'
import { ScriptHashType } from '../../src/models/chain/script'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import AddressMeta from '../../src/database/address/meta'
+const { AddressType } = hd
+
describe('AssetAccountInfo', () => {
const testnetSudtInfo = {
cellDep: new CellDep(
diff --git a/packages/neuron-wallet/tests/models/keys/hd-public-key-info.test.ts b/packages/neuron-wallet/tests/models/keys/hd-public-key-info.test.ts
index a9aee99971..59e59ba484 100644
--- a/packages/neuron-wallet/tests/models/keys/hd-public-key-info.test.ts
+++ b/packages/neuron-wallet/tests/models/keys/hd-public-key-info.test.ts
@@ -1,5 +1,5 @@
import { scriptToAddress } from '../../../src/utils/scriptAndAddress'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import KeyInfos from '../../setupAndTeardown/public-key-info.fixture'
import { systemScripts } from '../../../src/utils/systemScripts'
import { NetworkType } from '../../../src/models/network'
@@ -76,7 +76,7 @@ describe('HdPublicKeyInfoModel', () => {
describe('with change address type', () => {
beforeEach(() => {
keyInfoModel = HdPublicKeyInfoModel.fromObject({
- addressType: AddressType.Change,
+ addressType: hd.AddressType.Change,
addressIndex: 1,
})
})
@@ -87,7 +87,7 @@ describe('HdPublicKeyInfoModel', () => {
describe('with receive address type', () => {
beforeEach(() => {
keyInfoModel = HdPublicKeyInfoModel.fromObject({
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 1,
})
})
diff --git a/packages/neuron-wallet/tests/models/transaction-size.test.ts b/packages/neuron-wallet/tests/models/transaction-size.test.ts
index 26371673b8..884fe631ee 100644
--- a/packages/neuron-wallet/tests/models/transaction-size.test.ts
+++ b/packages/neuron-wallet/tests/models/transaction-size.test.ts
@@ -1,5 +1,6 @@
import TransactionSize from '../../src/models/transaction-size'
-import { bytes as byteUtils } from '@ckb-lumos/codec'
+import { bytes as byteUtils } from '@ckb-lumos/lumos/codec'
+import { type CKBComponents } from '@ckb-lumos/lumos/rpc'
import Script, { ScriptHashType } from '../../src/models/chain/script'
import WitnessArgs from '../../src/models/chain/witness-args'
import Transaction from '../../src/models/chain/transaction'
@@ -115,7 +116,6 @@ describe('TransactionSize', () => {
args: '0x59a27ef3ba84f061517d13f42cf44ed020610061',
hashType: 'type',
},
- type: null,
},
],
outputsData: ['0x1234', '0x'],
diff --git a/packages/neuron-wallet/tests/services/address.test.ts b/packages/neuron-wallet/tests/services/address.test.ts
index c2b09c39e7..3083b5a588 100644
--- a/packages/neuron-wallet/tests/services/address.test.ts
+++ b/packages/neuron-wallet/tests/services/address.test.ts
@@ -1,7 +1,7 @@
import SystemScriptInfo from '../../src/models/system-script-info'
import { OutputStatus } from '../../src/models/chain/output'
import OutputEntity from '../../src/database/chain/entities/output'
-import { AddressType, AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { Address } from '../../src/models/address'
import Transaction from '../../src/database/chain/entities/transaction'
import { TransactionStatus } from '../../src/models/chain/transaction'
@@ -10,6 +10,8 @@ import HdPublicKeyInfo from '../../src/database/chain/entities/hd-public-key-inf
import { closeConnection, getConnection, initConnection } from '../setupAndTeardown'
import { NetworkType } from '../../src/models/network'
+const { AddressType, AccountExtendedPublicKey } = hd
+
const walletId = '1'
const extendedKey = new AccountExtendedPublicKey(
'0x03e5b310636a0f6e7dcdfffa98f28d7ed70df858bb47acf13db830bfde3510b3f3',
diff --git a/packages/neuron-wallet/tests/services/asset-account-service.test.ts b/packages/neuron-wallet/tests/services/asset-account-service.test.ts
index 0e980b8a08..ae909fc8e3 100644
--- a/packages/neuron-wallet/tests/services/asset-account-service.test.ts
+++ b/packages/neuron-wallet/tests/services/asset-account-service.test.ts
@@ -11,7 +11,7 @@ import { TransactionStatus } from '../../src/models/chain/transaction'
import { closeConnection, createAccounts, getConnection, initConnection } from '../setupAndTeardown'
import accounts from '../setupAndTeardown/accounts.fixture'
import HdPublicKeyInfo from '../../src/database/chain/entities/hd-public-key-info'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import OutPoint from '../../src/models/chain/out-point'
import { when } from 'jest-when'
import SystemScriptInfo from '../../src/models/system-script-info'
@@ -146,7 +146,7 @@ describe('AssetAccountService', () => {
const keyInfo = HdPublicKeyInfo.fromObject({
walletId,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 0,
publicKeyInBlake160: blake160,
})
diff --git a/packages/neuron-wallet/tests/services/cell-local-info.test.ts b/packages/neuron-wallet/tests/services/cell-local-info.test.ts
index 066f906415..9d27d3eac5 100644
--- a/packages/neuron-wallet/tests/services/cell-local-info.test.ts
+++ b/packages/neuron-wallet/tests/services/cell-local-info.test.ts
@@ -1,4 +1,4 @@
-import type { OutPoint } from '@ckb-lumos/base'
+import type { OutPoint } from '@ckb-lumos/lumos'
import CellLocalInfoService from '../../src/services/cell-local-info'
import { closeConnection, getConnection, initConnection } from '../setupAndTeardown'
import CellLocalInfo from '../../src/database/chain/entities/cell-local-info'
diff --git a/packages/neuron-wallet/tests/services/cells.test.ts b/packages/neuron-wallet/tests/services/cells.test.ts
index 813a373f69..41997493ba 100644
--- a/packages/neuron-wallet/tests/services/cells.test.ts
+++ b/packages/neuron-wallet/tests/services/cells.test.ts
@@ -1,6 +1,6 @@
-import type { OutPoint as OutPointSDK } from '@ckb-lumos/base'
+import type { OutPoint as OutPointSDK } from '@ckb-lumos/lumos'
import { scriptToAddress } from '../../src/utils/scriptAndAddress'
-import { bytes } from '@ckb-lumos/codec'
+import { bytes } from '@ckb-lumos/lumos/codec'
import OutputEntity from '../../src/database/chain/entities/output'
import InputEntity from '../../src/database/chain/entities/input'
import { OutputStatus } from '../../src/models/chain/output'
diff --git a/packages/neuron-wallet/tests/services/multisig.test.ts b/packages/neuron-wallet/tests/services/multisig.test.ts
index 444c916b22..2b3ffe6f5d 100644
--- a/packages/neuron-wallet/tests/services/multisig.test.ts
+++ b/packages/neuron-wallet/tests/services/multisig.test.ts
@@ -6,7 +6,7 @@ import { OutputStatus } from '../../src/models/chain/output'
import { keyInfos } from '../setupAndTeardown/public-key-info.fixture'
import Multisig from '../../src/models/multisig'
import SystemScriptInfo from '../../src/models/system-script-info'
-import { computeScriptHash as scriptToHash } from '@ckb-lumos/base/lib/utils'
+import { computeScriptHash as scriptToHash } from '@ckb-lumos/lumos/utils'
import { closeConnection, getConnection, initConnection } from '../setupAndTeardown'
import { NetworkType } from '../../src/models/network'
import { scheduler } from 'timers/promises'
diff --git a/packages/neuron-wallet/tests/services/tx-wallet.test.ts b/packages/neuron-wallet/tests/services/tx-wallet.test.ts
index 66cde86d55..17992d97d0 100644
--- a/packages/neuron-wallet/tests/services/tx-wallet.test.ts
+++ b/packages/neuron-wallet/tests/services/tx-wallet.test.ts
@@ -1,7 +1,6 @@
import WalletService from '../../src/services/wallets'
-import { bytes } from '@ckb-lumos/codec'
-import { Keychain, Keystore, ExtendedPrivateKey, AccountExtendedPublicKey } from '@ckb-lumos/hd'
-import { mnemonicToSeedSync } from '@ckb-lumos/hd/lib/mnemonic'
+import { bytes } from '@ckb-lumos/lumos/codec'
+import { hd } from '@ckb-lumos/lumos'
import TransactionSender from '../../src/services/transaction-sender'
import { signWitnesses } from '../../src/utils/signWitnesses'
@@ -41,18 +40,18 @@ describe('get keys with paths', () => {
})
it('get keys', () => {
- const seed = mnemonicToSeedSync(mnemonic)
- const masterKeychain = Keychain.fromSeed(seed)
- const extendedKey = new ExtendedPrivateKey(
+ const seed = hd.mnemonic.mnemonicToSeedSync(mnemonic)
+ const masterKeychain = hd.Keychain.fromSeed(seed)
+ const extendedKey = new hd.ExtendedPrivateKey(
bytes.hexify(masterKeychain.privateKey),
bytes.hexify(masterKeychain.chainCode)
)
const privateKey = bytes.hexify(masterKeychain.derivePath(receivingPath).privateKey)
expect(privateKey).toEqual(receivingPrivateKey)
- const keystore = Keystore.create(extendedKey, password)
+ const keystore = hd.Keystore.create(extendedKey, password)
- const accountKeychain = masterKeychain.derivePath(AccountExtendedPublicKey.ckbAccountPath)
- const accountExtendedPublicKey = new AccountExtendedPublicKey(
+ const accountKeychain = masterKeychain.derivePath(hd.AccountExtendedPublicKey.ckbAccountPath)
+ const accountExtendedPublicKey = new hd.AccountExtendedPublicKey(
bytes.hexify(accountKeychain.publicKey),
bytes.hexify(accountKeychain.chainCode)
)
diff --git a/packages/neuron-wallet/tests/services/tx/transaction-generator.test.ts b/packages/neuron-wallet/tests/services/tx/transaction-generator.test.ts
index c8ba7d414a..6e5af862d0 100644
--- a/packages/neuron-wallet/tests/services/tx/transaction-generator.test.ts
+++ b/packages/neuron-wallet/tests/services/tx/transaction-generator.test.ts
@@ -1,6 +1,6 @@
import { when } from 'jest-when'
-import { bytes } from '@ckb-lumos/codec'
-import { since } from '@ckb-lumos/base'
+import { bytes } from '@ckb-lumos/lumos/codec'
+import { since } from '@ckb-lumos/lumos'
import OutputEntity from '../../../src/database/chain/entities/output'
import InputEntity from '../../../src/database/chain/entities/input'
import TransactionEntity from '../../../src/database/chain/entities/transaction'
diff --git a/packages/neuron-wallet/tests/services/tx/transaction-sender.test.ts b/packages/neuron-wallet/tests/services/tx/transaction-sender.test.ts
index 919d8f3bdd..eaf1894650 100644
--- a/packages/neuron-wallet/tests/services/tx/transaction-sender.test.ts
+++ b/packages/neuron-wallet/tests/services/tx/transaction-sender.test.ts
@@ -1,4 +1,5 @@
-import { bytes } from '@ckb-lumos/codec'
+import { CKBComponents } from '@ckb-lumos/lumos/rpc'
+import { bytes } from '@ckb-lumos/lumos/codec'
import 'dotenv/config'
const stubbedRPCServiceConstructor = jest.fn()
@@ -145,7 +146,7 @@ jest.doMock('services/hardware', () => ({
}),
}))
-jest.doMock('@ckb-lumos/rpc', () => {
+jest.doMock('@ckb-lumos/lumos/rpc', () => {
return {
CKBRPC: class CKBRPC {
url: string
@@ -158,7 +159,7 @@ jest.doMock('@ckb-lumos/rpc', () => {
}
})
-jest.doMock('@ckb-lumos/common-scripts', () => {
+jest.doMock('@ckb-lumos/lumos/common-scripts', () => {
return {
dao: {
calculateMaximumWithdraw: stubbedCalculateDaoMaximumWithdraw,
@@ -187,7 +188,7 @@ import OutPoint from '../../../src/models/chain/out-point'
import Input from '../../../src/models/chain/input'
import Script, { ScriptHashType } from '../../../src/models/chain/script'
import Output from '../../../src/models/chain/output'
-import { AddressType, Keystore } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import WitnessArgs from '../../../src/models/chain/witness-args'
import CellWithStatus from '../../../src/models/chain/cell-with-status'
import SystemScriptInfo from '../../../src/models/system-script-info'
@@ -256,7 +257,7 @@ describe('TransactionSender Test', () => {
name: 'wallet-test1',
id: '11',
extendedKey: 'a',
- keystore: new Keystore(
+ keystore: new hd.Keystore(
{
cipher: 'wallet1',
cipherparams: { iv: 'wallet1' },
@@ -325,7 +326,7 @@ describe('TransactionSender Test', () => {
walletId: fakeWallet.id,
address: '',
path: `m/44'/309'/0'/0/0`,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
addressIndex: 1,
txCount: 0,
liveBalance: '0',
diff --git a/packages/neuron-wallet/tests/services/tx/transaction-service.test.ts b/packages/neuron-wallet/tests/services/tx/transaction-service.test.ts
index 6b5f9165a8..05850caa09 100644
--- a/packages/neuron-wallet/tests/services/tx/transaction-service.test.ts
+++ b/packages/neuron-wallet/tests/services/tx/transaction-service.test.ts
@@ -32,7 +32,7 @@ jest.mock('../../../src/services/rpc-service', () => {
})
const ckbRpcExecMock = jest.fn()
-jest.mock('@ckb-lumos/rpc', () => {
+jest.mock('@ckb-lumos/lumos/rpc', () => {
return {
CKBRPC: class CKBRPC {
url: string
diff --git a/packages/neuron-wallet/tests/services/wallets.test.ts b/packages/neuron-wallet/tests/services/wallets.test.ts
index 5940e0c57a..0d7eec58c6 100644
--- a/packages/neuron-wallet/tests/services/wallets.test.ts
+++ b/packages/neuron-wallet/tests/services/wallets.test.ts
@@ -1,6 +1,6 @@
import { when } from 'jest-when'
import { WalletFunctionNotSupported, DuplicateImportWallet } from '../../src/exceptions/wallet'
-import { AddressType, Keystore, AccountExtendedPublicKey } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import { Manufacturer } from '../../src/services/hardware/common'
import { prefixWith0x } from '../../src/utils/scriptAndAddress'
@@ -76,7 +76,7 @@ describe('wallet service', () => {
name: 'wallet-test1',
id: '',
extendedKey: `${fakePublicKey}${fakeChainCode}`,
- keystore: new Keystore(
+ keystore: new hd.Keystore(
{
cipher: 'wallet1',
cipherparams: { iv: 'wallet1' },
@@ -99,7 +99,7 @@ describe('wallet service', () => {
name: 'wallet-test2',
id: '',
extendedKey: 'b'.repeat(66) + '2'.repeat(64),
- keystore: new Keystore(
+ keystore: new hd.Keystore(
{
cipher: 'wallet2',
cipherparams: { iv: 'wallet2' },
@@ -122,7 +122,7 @@ describe('wallet service', () => {
name: 'wallet-test3',
id: '',
extendedKey: 'c'.repeat(66) + '3'.repeat(64),
- keystore: new Keystore(
+ keystore: new hd.Keystore(
{
cipher: 'wallet3',
cipherparams: { iv: 'wallet1' },
@@ -152,7 +152,7 @@ describe('wallet service', () => {
descriptor: '',
vendorId: '10086',
addressIndex: 0,
- addressType: AddressType.Receiving,
+ addressType: hd.AddressType.Receiving,
},
}
@@ -160,7 +160,7 @@ describe('wallet service', () => {
name: 'wallet-test5',
id: '',
extendedKey: 'b'.repeat(66) + '2'.repeat(64),
- keystore: new Keystore(
+ keystore: new hd.Keystore(
{
cipher: 'wallet5',
cipherparams: { iv: 'wallet1' },
@@ -294,7 +294,7 @@ describe('wallet service', () => {
await wallet.checkAndGenerateAddresses()
})
it('calls AddressService.generateAndSaveForExtendedKey', async () => {
- const { publicKey } = AccountExtendedPublicKey.parse(wallet4.extendedKey)
+ const { publicKey } = hd.AccountExtendedPublicKey.parse(wallet4.extendedKey)
expect(stubbedGenerateAndSaveForPublicKeyQueueAsyncPush).toHaveBeenCalledWith({
walletId: createdWallet.id,
publicKey,
diff --git a/packages/neuron-wallet/tests/setupAndTeardown/public-key-info.fixture.ts b/packages/neuron-wallet/tests/setupAndTeardown/public-key-info.fixture.ts
index d11da66bfb..821b67e66d 100644
--- a/packages/neuron-wallet/tests/setupAndTeardown/public-key-info.fixture.ts
+++ b/packages/neuron-wallet/tests/setupAndTeardown/public-key-info.fixture.ts
@@ -1,7 +1,9 @@
import { scriptToAddress } from '../../src/utils/scriptAndAddress'
-import { AddressType } from '@ckb-lumos/hd'
+import { hd } from '@ckb-lumos/lumos'
import SystemScriptInfo from '../../src/models/system-script-info'
+const AddressType = hd.AddressType
+
const walletId1 = 'w1'
const walletId2 = 'w2'
const walletId3 = 'w3'
diff --git a/yarn.lock b/yarn.lock
index 94e8003987..d7c793eea5 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2117,129 +2117,158 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
-"@ckb-lumos/base@0.21.1", "@ckb-lumos/base@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/base/-/base-0.21.1.tgz#1faf7909b5a68a124256d937cfb0fa03bb6b5457"
- integrity sha512-7O+jBl7pqMsRbYTMNnbpamgaQzvaLZq+ftMtnKZ3A+Zbs6hZcGbz/6nfbRZnyJitPXQHRPT5KAQz6g+TiYqJGg==
- dependencies:
- "@ckb-lumos/bi" "0.21.1"
- "@ckb-lumos/codec" "0.21.1"
- "@ckb-lumos/toolkit" "0.21.1"
+"@ckb-lumos/base@0.23.0", "@ckb-lumos/base@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/base/-/base-0.23.0.tgz#507e2860dd49547268e9088e10aa2051507d4343"
+ integrity sha512-8aLFsUyWIK0rT7GQlYFuXyiG5lQ2bLRK2GvUsxv5G7I3nJ1UyxjwvVOdtlsR/cwhzOam3ujwqASqBIayBL6GLA==
+ dependencies:
+ "@ckb-lumos/bi" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/toolkit" "0.23.0"
"@types/blake2b" "^2.1.0"
"@types/lodash.isequal" "^4.5.5"
blake2b "^2.1.3"
js-xxhash "^1.0.4"
lodash.isequal "^4.5.0"
-"@ckb-lumos/bi@0.21.1", "@ckb-lumos/bi@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/bi/-/bi-0.21.1.tgz#dfaa0968a9ffd990c1c4fcfc0711f20f09eb0485"
- integrity sha512-6q8uesvu3DAM7GReei9H5seino4tnakTeg8uXtZBPDC6rboMohLCPQvEwhl1iHmsybXvBYVQt4Te1BPPZtuaRw==
+"@ckb-lumos/bi@0.23.0", "@ckb-lumos/bi@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/bi/-/bi-0.23.0.tgz#8439d712b823234b858bffff2636ffc21d98199f"
+ integrity sha512-KAy+lyVpL+Al4XD+c9tHrA9DSpHkMusyXtTS81aNZi5MyL6F9jrVmFcqLorhfyfl8Fsv2sEjMe5Neo2Y+w/RJQ==
dependencies:
jsbi "^4.1.0"
-"@ckb-lumos/ckb-indexer@0.21.1":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/ckb-indexer/-/ckb-indexer-0.21.1.tgz#a0e0ac3261c98181dc8c72e9e726030bb210779d"
- integrity sha512-592pMVP3lwTXF7TmlOcayvGYKOhkYpjbLHUDo7By4yWbm7ZpdexaN5hn0X1sjJgMuee5prxGr9/fY684VTpJQw==
- dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
- "@ckb-lumos/codec" "0.21.1"
- "@ckb-lumos/rpc" "0.21.1"
- "@ckb-lumos/toolkit" "0.21.1"
+"@ckb-lumos/ckb-indexer@0.23.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/ckb-indexer/-/ckb-indexer-0.23.0.tgz#67cbf4539904ea511517fda1e23c5ec4515b574d"
+ integrity sha512-yLODLJzvtz4M6W6OJR4iRbBTUGrKReV2dhVePPjbH/HRkRY6f6J6cEM9+qM2I3QABmaCXeAM3hWvnWU9hjalQQ==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/rpc" "0.23.0"
+ "@ckb-lumos/toolkit" "0.23.0"
cross-fetch "^3.1.5"
events "^3.3.0"
-"@ckb-lumos/codec@0.21.1", "@ckb-lumos/codec@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/codec/-/codec-0.21.1.tgz#160f21efa0cded6ea461eb6476f9af6010b682e0"
- integrity sha512-z6IUUxVZrx663iC7VM9CmaQZL8jsdM3ybgz0UCS24JgBXTNec+Uz0/Zrl7yeH6fBpVls44C2wObcHKigKaNVAA==
- dependencies:
- "@ckb-lumos/bi" "0.21.1"
-
-"@ckb-lumos/common-scripts@0.21.1", "@ckb-lumos/common-scripts@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/common-scripts/-/common-scripts-0.21.1.tgz#64776b5ce55d8c66898a3ab592c7f77fe13d865e"
- integrity sha512-EfZQ9wdxPmEsxVVwtBjhpZVKbYCm1FJkMt59ABsIO1Ub7yi0qap7AQl0MMbuLwWIGKwS2w0U3wx/oJPm7z1RXg==
- dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
- "@ckb-lumos/codec" "0.21.1"
- "@ckb-lumos/config-manager" "0.21.1"
- "@ckb-lumos/helpers" "0.21.1"
- "@ckb-lumos/rpc" "0.21.1"
- "@ckb-lumos/toolkit" "0.21.1"
+"@ckb-lumos/codec@0.23.0", "@ckb-lumos/codec@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/codec/-/codec-0.23.0.tgz#abc8c2da95931859d3347608af4b461d27c5daff"
+ integrity sha512-FwYooXnsFDjlHHnlFnCTB1UbBzV72I0VjkRpeauFk5nQ4+/75xl28ywK3J14M+0aHTnYU9msXUTRDAGqC0CaNQ==
+ dependencies:
+ "@ckb-lumos/bi" "0.23.0"
+
+"@ckb-lumos/common-scripts@0.23.0", "@ckb-lumos/common-scripts@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/common-scripts/-/common-scripts-0.23.0.tgz#ccb04214ca7186829036ddcbb0dc1b5326127a90"
+ integrity sha512-Dwic0Al94afdGNu+TGAMmZiU5OVF/zvXbzhCvNmkFS25t8BxPdFjGEc0MlWBI4ZSEoGRrC0O+BOxjzfl5VxSYg==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/config-manager" "0.23.0"
+ "@ckb-lumos/helpers" "0.23.0"
+ "@ckb-lumos/rpc" "0.23.0"
+ "@ckb-lumos/toolkit" "0.23.0"
+ bech32 "^2.0.0"
+ bs58 "^5.0.0"
immutable "^4.3.0"
-"@ckb-lumos/config-manager@0.21.1", "@ckb-lumos/config-manager@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/config-manager/-/config-manager-0.21.1.tgz#857050ebf2ca38096d8fae26b6a8927164798ca3"
- integrity sha512-BmrNqYyaksdCKHWagyC8+R8GUxhIO+sOM5S925jlkpjju2sUbH0Id2/zmdb7I9KxdKnbx3WsR+hqy7/bYqw1lA==
+"@ckb-lumos/config-manager@0.23.0", "@ckb-lumos/config-manager@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/config-manager/-/config-manager-0.23.0.tgz#93a607f7857c9a24fae86735e29f1ca40ee34fb5"
+ integrity sha512-MvNyzGIJTmIpEf5WJB3TkE4icZyZ2HZhFIfJB2SXDRAC84E02jxENPelCnqRbM1rlFHnxjh/5a/oCi5LcXefag==
dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
- "@ckb-lumos/codec" "0.21.1"
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/rpc" "0.23.0"
"@types/deep-freeze-strict" "^1.1.0"
deep-freeze-strict "^1.1.1"
-"@ckb-lumos/hd@0.21.1":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/hd/-/hd-0.21.1.tgz#406026ac2b570f72b4407149cb941d09bb8a0ab6"
- integrity sha512-BnfpJf/sx/dJzL5BrOxPeKbKgv2x74KWd0xwjw1/gBQ2IMhu0S1mLwFsOT3Zu2nuhpQYvZGvr0cd3vD/SoMDow==
+"@ckb-lumos/hd@0.23.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/hd/-/hd-0.23.0.tgz#97ddf6e291bdb44b7b8d61bcf437c3a1b17d0182"
+ integrity sha512-z7EsR/GeX54hq4ukqwW3nrqLCsYrTWIFAjZLR1Ao8xycqQp0IBjCWZLLjRrZY6krbUQpVOoiKo3NBLpPW36LXg==
dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
bn.js "^5.1.3"
elliptic "^6.5.4"
scrypt-js "^3.0.1"
sha3 "^2.1.3"
uuid "^8.3.0"
-"@ckb-lumos/helpers@0.21.1":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/helpers/-/helpers-0.21.1.tgz#fffd455071f51556b2cd2539a255b3759893da08"
- integrity sha512-jFN6DtWzwVNEY4kmnzczRaQqtyRJQwzAEuHRUQ0LqTiIGM+SlfgjH/l/InAG4cIhDOurMudnUJ4ex68wmbkhVw==
- dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
- "@ckb-lumos/codec" "0.21.1"
- "@ckb-lumos/config-manager" "0.21.1"
- "@ckb-lumos/toolkit" "0.21.1"
+"@ckb-lumos/helpers@0.23.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/helpers/-/helpers-0.23.0.tgz#095a6d4752d756287cfbee0360c614d27a5f71f3"
+ integrity sha512-yfD28vSn1BBk8BA+/ivL7pF3rMsx4OPQ+UUJjsQiR1zGdkNR3zhJOecgICeddJGYDTBBDVgwHcuyoekLxQzmGg==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/config-manager" "0.23.0"
+ "@ckb-lumos/toolkit" "0.23.0"
bech32 "^2.0.0"
immutable "^4.3.0"
-"@ckb-lumos/lumos@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/lumos/-/lumos-0.21.1.tgz#ff5a9a10859b305530026668bd14cdc12e5e7532"
- integrity sha512-a5n8xaIUvmaPsw2fBki8Jamy6/6uQnLWDZM9SQX29cZ1YVoAk/slnBmEbCIGXmxDhcuAlLkTeJaiLDKEGrZ6pg==
- dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
- "@ckb-lumos/ckb-indexer" "0.21.1"
- "@ckb-lumos/common-scripts" "0.21.1"
- "@ckb-lumos/config-manager" "0.21.1"
- "@ckb-lumos/hd" "0.21.1"
- "@ckb-lumos/helpers" "0.21.1"
- "@ckb-lumos/rpc" "0.21.1"
- "@ckb-lumos/toolkit" "0.21.1"
-
-"@ckb-lumos/rpc@0.21.1", "@ckb-lumos/rpc@^0.21.0-next.0":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/rpc/-/rpc-0.21.1.tgz#f6a6b3ed6d76adfb84c148e4b4acadb7fbaa7d7a"
- integrity sha512-gZWXYCyQ98s84Pb+buOiYL3HOIxQPLHQdCyo96GFerNw9lB1XsbaGWzfHPYpZvOQqYtnJ1GUfTkQkADrQ7hmew==
- dependencies:
- "@ckb-lumos/base" "0.21.1"
- "@ckb-lumos/bi" "0.21.1"
+"@ckb-lumos/light-client@0.23.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/light-client/-/light-client-0.23.0.tgz#093f28d4183971f1212241271e7b23bad9909689"
+ integrity sha512-O+dbfubDjl0iODiQ8Q+RVJLfuXYNCN6c0am8xEv4vvazLwfw1y/vn6fG/pFu9Mc1GahZ58y9o6fkUgs8ujH3Mg==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/ckb-indexer" "0.23.0"
+ "@ckb-lumos/rpc" "0.23.0"
+ cross-fetch "^3.1.5"
+ events "^3.3.0"
+
+"@ckb-lumos/lumos@0.23.0", "@ckb-lumos/lumos@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/lumos/-/lumos-0.23.0.tgz#638b4780a990f42059f86c3e4e33cbd7e6557782"
+ integrity sha512-ocsmzgTgevVwyQeQkUZrg4PLJCfX48D5MEBNYTMoGh5b1g0f1iEBHcAgw4WBGOKgMJQmGRmWB5P6tPDZ3OZBwQ==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
+ "@ckb-lumos/ckb-indexer" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/common-scripts" "0.23.0"
+ "@ckb-lumos/config-manager" "0.23.0"
+ "@ckb-lumos/hd" "0.23.0"
+ "@ckb-lumos/helpers" "0.23.0"
+ "@ckb-lumos/light-client" "0.23.0"
+ "@ckb-lumos/rpc" "0.23.0"
+ "@ckb-lumos/toolkit" "0.23.0"
+ "@ckb-lumos/transaction-manager" "0.23.0"
+
+"@ckb-lumos/rpc@0.23.0", "@ckb-lumos/rpc@^0.21.0-next.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/rpc/-/rpc-0.23.0.tgz#e17bd281e62e17957db80459e6be25d0c64bbb59"
+ integrity sha512-NEY1Wb2cNMYdHwcZYtd8XZ3CP6WGPd25hcsudoDAFlAt9vjHsPlNiwSS7tcZCZfg1XiJy3taViVgG8pFemgpbA==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/bi" "0.23.0"
abort-controller "^3.0.0"
cross-fetch "^3.1.5"
-"@ckb-lumos/toolkit@0.21.1":
- version "0.21.1"
- resolved "https://registry.yarnpkg.com/@ckb-lumos/toolkit/-/toolkit-0.21.1.tgz#bcf4bf05615375087e3dd02fb087b797a8c67f37"
- integrity sha512-awrFos7uQXEVGbqKSv/8Fc8B8XAfxdYoyYak4zFyAAmxxA0NiTTvk9V8TsOA7zVXpxct4Jal22+qUe+4Jg8T/g==
+"@ckb-lumos/toolkit@0.23.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/toolkit/-/toolkit-0.23.0.tgz#4f5d25ea4292bd77dfc191506984ffc2c38078f7"
+ integrity sha512-7LTsUFfoNCBWJLgh+V/QFnemjGw+y4mmLeQvubwYuJqIPIhIpwKUuKRzkvVG8snA8xVQSfjSSQOs5m3mKp66Kg==
dependencies:
- "@ckb-lumos/bi" "0.21.1"
+ "@ckb-lumos/bi" "0.23.0"
+
+"@ckb-lumos/transaction-manager@0.23.0":
+ version "0.23.0"
+ resolved "https://registry.yarnpkg.com/@ckb-lumos/transaction-manager/-/transaction-manager-0.23.0.tgz#2e90d7f0fe5613fd594a7f0b7a2a48c3336b98dd"
+ integrity sha512-sfwt2g8JlYxr5jRx5r/UZNffTpkwn3sh4dD2THzKmX0S1CsSgww2D1ZD7yruWwSu05ZLKlDPFVKyJ50tNc3LuQ==
+ dependencies:
+ "@ckb-lumos/base" "0.23.0"
+ "@ckb-lumos/ckb-indexer" "0.23.0"
+ "@ckb-lumos/codec" "0.23.0"
+ "@ckb-lumos/rpc" "0.23.0"
+ "@ckb-lumos/toolkit" "0.23.0"
+ immutable "^4.3.0"
"@cnakazawa/watch@^1.0.3":
version "1.0.4"
@@ -2254,6 +2283,13 @@
resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9"
integrity sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==
+"@cspotcode/source-map-support@^0.8.0":
+ version "0.8.1"
+ resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1"
+ integrity sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==
+ dependencies:
+ "@jridgewell/trace-mapping" "0.3.9"
+
"@csstools/normalize.css@*":
version "12.0.0"
resolved "https://registry.yarnpkg.com/@csstools/normalize.css/-/normalize.css-12.0.0.tgz#a9583a75c3f150667771f30b60d9f059473e62c4"
@@ -3152,6 +3188,11 @@
resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz#2203b118c157721addfe69d47b70465463066d78"
integrity sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==
+"@jridgewell/resolve-uri@^3.0.3":
+ version "3.1.2"
+ resolved "https://registry.yarnpkg.com/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz#7a0ee601f60f99a20c7c7c5ff0c80388c1189bd6"
+ integrity sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==
+
"@jridgewell/set-array@^1.0.1":
version "1.1.2"
resolved "https://registry.yarnpkg.com/@jridgewell/set-array/-/set-array-1.1.2.tgz#7c6cf998d6d20b914c0a55a91ae928ff25965e72"
@@ -3175,6 +3216,14 @@
resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32"
integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==
+"@jridgewell/trace-mapping@0.3.9":
+ version "0.3.9"
+ resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz#6534fd5933a53ba7cbf3a17615e273a0d1273ff9"
+ integrity sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==
+ dependencies:
+ "@jridgewell/resolve-uri" "^3.0.3"
+ "@jridgewell/sourcemap-codec" "^1.4.10"
+
"@jridgewell/trace-mapping@^0.3.15", "@jridgewell/trace-mapping@^0.3.17", "@jridgewell/trace-mapping@^0.3.9":
version "0.3.18"
resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.18.tgz#25783b2086daf6ff1dcb53c9249ae480e4dd4cd6"
@@ -5115,6 +5164,26 @@
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==
+"@tsconfig/node10@^1.0.7":
+ version "1.0.11"
+ resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.11.tgz#6ee46400685f130e278128c7b38b7e031ff5b2f2"
+ integrity sha512-DcRjDCujK/kCk/cUe8Xz8ZSpm8mS3mNNpta+jGCA6USEDfktlNvm1+IuZ9eTcDbNk41BHwpHHeW+N1lKCz4zOw==
+
+"@tsconfig/node12@^1.0.7":
+ version "1.0.11"
+ resolved "https://registry.yarnpkg.com/@tsconfig/node12/-/node12-1.0.11.tgz#ee3def1f27d9ed66dac6e46a295cffb0152e058d"
+ integrity sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==
+
+"@tsconfig/node14@^1.0.0":
+ version "1.0.3"
+ resolved "https://registry.yarnpkg.com/@tsconfig/node14/-/node14-1.0.3.tgz#e4386316284f00b98435bf40f72f75a09dabf6c1"
+ integrity sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==
+
+"@tsconfig/node16@^1.0.2":
+ version "1.0.4"
+ resolved "https://registry.yarnpkg.com/@tsconfig/node16/-/node16-1.0.4.tgz#0b92dcc0cc1c81f6f306a381f28e31b1a56536e9"
+ integrity sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==
+
"@tufjs/canonical-json@1.0.0":
version "1.0.0"
resolved "https://registry.yarnpkg.com/@tufjs/canonical-json/-/canonical-json-1.0.0.tgz#eade9fd1f537993bc1f0949f3aea276ecc4fab31"
@@ -6489,11 +6558,23 @@ acorn-walk@^7.1.1, acorn-walk@^7.2.0:
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc"
integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==
+acorn-walk@^8.1.1:
+ version "8.3.3"
+ resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e"
+ integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw==
+ dependencies:
+ acorn "^8.11.0"
+
acorn@^7.1.1, acorn@^7.4.1:
version "7.4.1"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa"
integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==
+acorn@^8.11.0, acorn@^8.4.1:
+ version "8.12.1"
+ resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248"
+ integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==
+
acorn@^8.11.2, acorn@^8.9.0:
version "8.11.2"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.2.tgz#ca0d78b51895be5390a5903c5b3bdcdaf78ae40b"
@@ -6786,6 +6867,11 @@ are-we-there-yet@^3.0.0:
delegates "^1.0.0"
readable-stream "^3.6.0"
+arg@^4.1.0:
+ version "4.1.3"
+ resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089"
+ integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==
+
arg@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/arg/-/arg-5.0.2.tgz#c81433cc427c92c4dcf4865142dbca6f15acd59c"
@@ -7386,6 +7472,11 @@ balanced-match@^1.0.0:
resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
+base-x@^4.0.0:
+ version "4.0.0"
+ resolved "https://registry.yarnpkg.com/base-x/-/base-x-4.0.0.tgz#d0e3b7753450c73f8ad2389b5c018a4af7b2224a"
+ integrity sha512-FuwxlW4H5kh37X/oW59pwTzzTKRzfrrQwhmyspRM7swOEZcHtDZSCt45U6oKgtuFE+WYPblePMVIPR4RZrh/hw==
+
base64-js@^1.3.1, base64-js@^1.5.1:
version "1.5.1"
resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a"
@@ -7661,6 +7752,13 @@ bs-logger@0.x:
dependencies:
fast-json-stable-stringify "2.x"
+bs58@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/bs58/-/bs58-5.0.0.tgz#865575b4d13c09ea2a84622df6c8cbeb54ffc279"
+ integrity sha512-r+ihvQJvahgYT50JD05dyJNKlmmSlMoOGwn1lCcEzanPglg7TxYjioQUYehQ9mAR/+hOSd2jRc/Z2y5UxBymvQ==
+ dependencies:
+ base-x "^4.0.0"
+
bser@2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05"
@@ -8679,6 +8777,11 @@ crc@^3.8.0:
dependencies:
buffer "^5.1.0"
+create-require@^1.1.0:
+ version "1.1.1"
+ resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333"
+ integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==
+
cross-env@7.0.3:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf"
@@ -9286,6 +9389,11 @@ diff-sequences@^29.6.3:
resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921"
integrity sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==
+diff@^4.0.1:
+ version "4.0.2"
+ resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d"
+ integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==
+
dir-compare@^3.0.0:
version "3.3.0"
resolved "https://registry.yarnpkg.com/dir-compare/-/dir-compare-3.3.0.tgz#2c749f973b5c4b5d087f11edaae730db31788416"
@@ -14295,7 +14403,7 @@ make-dir@^3.0.0, make-dir@^3.0.2, make-dir@^3.1.0:
dependencies:
semver "^6.0.0"
-make-error@1.x:
+make-error@1.x, make-error@^1.1.1:
version "1.3.6"
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2"
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==
@@ -18720,16 +18828,7 @@ string-natural-compare@^3.0.1:
resolved "https://registry.yarnpkg.com/string-natural-compare/-/string-natural-compare-3.0.1.tgz#7a42d58474454963759e8e8b7ae63d71c1e7fdf4"
integrity sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==
-"string-width-cjs@npm:string-width@^4.2.0":
- version "4.2.3"
- resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
- integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
- dependencies:
- emoji-regex "^8.0.0"
- is-fullwidth-code-point "^3.0.0"
- strip-ansi "^6.0.1"
-
-"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
+"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -18847,14 +18946,7 @@ stringify-object@^3.3.0:
is-obj "^1.0.1"
is-regexp "^1.0.0"
-"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
- version "6.0.1"
- resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
- integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
- dependencies:
- ansi-regex "^5.0.1"
-
-strip-ansi@^6.0.0, strip-ansi@^6.0.1:
+"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
version "6.0.1"
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -19463,6 +19555,25 @@ ts-jest@29.1.4:
semver "^7.5.3"
yargs-parser "^21.0.1"
+ts-node@^10.9.2:
+ version "10.9.2"
+ resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-10.9.2.tgz#70f021c9e185bccdca820e26dc413805c101c71f"
+ integrity sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==
+ dependencies:
+ "@cspotcode/source-map-support" "^0.8.0"
+ "@tsconfig/node10" "^1.0.7"
+ "@tsconfig/node12" "^1.0.7"
+ "@tsconfig/node14" "^1.0.0"
+ "@tsconfig/node16" "^1.0.2"
+ acorn "^8.4.1"
+ acorn-walk "^8.1.1"
+ arg "^4.1.0"
+ create-require "^1.1.0"
+ diff "^4.0.1"
+ make-error "^1.1.1"
+ v8-compile-cache-lib "^3.0.1"
+ yn "3.1.1"
+
ts-pnp@^1.1.6:
version "1.2.0"
resolved "https://registry.yarnpkg.com/ts-pnp/-/ts-pnp-1.2.0.tgz#a500ad084b0798f1c3071af391e65912c86bca92"
@@ -19512,11 +19623,6 @@ tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.3.0, tslib@^2.4
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.0.tgz#b295854684dbda164e181d259a22cd779dcd7bc3"
integrity sha512-7At1WUettjcSRHXCyYtTselblcHl9PJFFVKiCAy/bY97+BPZXSQ2wbq0P9s8tK2G7dFQfNnlJnPAiArVBVBsfA==
-tslib@^2.5.0:
- version "2.6.3"
- resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0"
- integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==
-
tsutils@^3.21.0:
version "3.21.0"
resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623"
@@ -20033,6 +20139,11 @@ uuid@^9.0.0:
resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.0.tgz#592f550650024a38ceb0c562f2f6aa435761efb5"
integrity sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
+v8-compile-cache-lib@^3.0.1:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf"
+ integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==
+
v8-to-istanbul@^8.1.0:
version "8.1.1"
resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz#77b752fd3975e31bbcef938f85e9bd1c7a8d60ed"
@@ -20636,16 +20747,7 @@ workbox-window@6.6.1:
"@types/trusted-types" "^2.0.2"
workbox-core "6.6.1"
-"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
- version "7.0.0"
- resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
- integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
- dependencies:
- ansi-styles "^4.0.0"
- string-width "^4.1.0"
- strip-ansi "^6.0.0"
-
-wrap-ansi@^7.0.0:
+"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -20849,6 +20951,11 @@ yauzl@^2.10.0:
buffer-crc32 "~0.2.3"
fd-slicer "~1.1.0"
+yn@3.1.1:
+ version "3.1.1"
+ resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
+ integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==
+
yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
From 2ec3ff82ca2bbcf5d614758e3a2569773a0de7dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=A5=E5=9B=BD=E5=AE=87?= <841185308@qq.com>
Date: Fri, 19 Jul 2024 16:29:11 +0800
Subject: [PATCH 33/57] feat: Support XUDT (#3206)
* feat: Support XUDT
* fix: Support xudt args length
* fix: Dynamic calculate min capacity
* fix: Send xudt with live acp udt cell
---
packages/neuron-ui/package.json | 17 +-
.../CellManagement/cellManagement.module.scss | 2 +-
.../src/components/CellManagement/hooks.ts | 7 +-
.../src/components/CellManagement/index.tsx | 4 +-
.../src/components/NervosDAO/hooks.ts | 2 +-
.../src/components/SUDTAccountList/index.tsx | 10 +-
.../src/components/SUDTCreateDialog/index.tsx | 36 ++-
.../components/SUDTMigrateDialog/index.tsx | 8 +-
.../SUDTMigrateToExistAccountDialog/index.tsx | 13 +-
.../SUDTMigrateToNewAccountDialog/index.tsx | 8 +-
.../src/components/SUDTSend/hooks.ts | 5 +-
.../src/components/SUDTSend/index.tsx | 15 +-
.../src/components/SUDTUpdateDialog/index.tsx | 12 +-
.../src/components/SpecialAssetList/hooks.ts | 16 +-
.../src/components/SpecialAssetList/index.tsx | 50 ++--
.../src/components/TransactionType/index.tsx | 2 +-
packages/neuron-ui/src/locales/en.json | 25 +-
packages/neuron-ui/src/locales/es.json | 25 +-
packages/neuron-ui/src/locales/fr.json | 25 +-
packages/neuron-ui/src/locales/zh-tw.json | 25 +-
packages/neuron-ui/src/locales/zh.json | 25 +-
.../neuron-ui/src/services/remote/sudt.ts | 13 +-
.../src/states/stateProvider/reducer.ts | 3 +-
.../src/stories/SUDTCreateDialog.stories.tsx | 6 +-
packages/neuron-ui/src/types/App/index.d.ts | 9 +-
.../neuron-ui/src/types/Controller/index.d.ts | 15 +-
packages/neuron-ui/src/utils/const.ts | 1 +
packages/neuron-ui/src/utils/enums.ts | 7 +
.../src/utils/hooks/createSUDTAccount.ts | 36 ++-
packages/neuron-ui/src/utils/hooks/index.ts | 6 +-
packages/neuron-ui/src/utils/is.ts | 28 ++
.../neuron-ui/src/utils/validators/tokenId.ts | 9 +-
.../sync/light-synchronizer.ts | 1 +
.../src/block-sync-renderer/sync/queue.ts | 6 +-
.../sync/tx-address-finder.ts | 15 +
.../src/controllers/anyone-can-pay.ts | 7 +-
packages/neuron-wallet/src/controllers/api.ts | 15 +-
.../src/controllers/asset-account.ts | 14 +-
.../neuron-wallet/src/controllers/sudt.ts | 10 -
.../database/chain/entities/asset-account.ts | 14 +-
.../chain/entities/sudt-token-info.ts | 10 +-
.../migrations/1720089814860-AddUdtType.ts | 22 ++
.../src/database/chain/ormconfig.ts | 2 +
.../src/models/asset-account-info.ts | 86 +++---
.../neuron-wallet/src/models/asset-account.ts | 11 +-
.../neuron-wallet/src/models/chain/output.ts | 29 +-
.../src/models/chain/transaction.ts | 1 +
.../src/services/anyone-can-pay.ts | 44 ++-
.../src/services/asset-account-service.ts | 144 ++++++---
packages/neuron-wallet/src/services/cells.ts | 51 +++-
.../src/services/sudt-token-info.ts | 6 +-
.../src/services/tx/transaction-generator.ts | 140 ++++++---
.../src/services/tx/transaction-service.ts | 283 +++++++++++-------
packages/neuron-wallet/src/utils/ckb-rpc.ts | 2 +-
packages/neuron-wallet/src/utils/const.ts | 5 +
.../tests/controllers/anyone-can-pay.test.ts | 6 +-
.../tests/models/asset-account-info.test.ts | 20 +-
.../tests/services/anyone-can-pay.test.ts | 38 ++-
.../services/asset-account-service.test.ts | 59 +++-
.../tests/services/cells.test.ts | 27 +-
.../tests/services/multisig.test.ts | 16 +-
.../tests/services/networks.test.ts | 37 ++-
.../tests/services/sudt-token-info.test.ts | 7 +-
.../services/tx/transaction-generator.test.ts | 90 ++++--
.../setupAndTeardown/accounts.fixture.ts | 2 +
65 files changed, 1117 insertions(+), 568 deletions(-)
create mode 100644 packages/neuron-wallet/src/database/chain/migrations/1720089814860-AddUdtType.ts
diff --git a/packages/neuron-ui/package.json b/packages/neuron-ui/package.json
index c832d47fd1..633abb7d55 100644
--- a/packages/neuron-ui/package.json
+++ b/packages/neuron-ui/package.json
@@ -50,14 +50,15 @@
"last 2 chrome versions"
],
"dependencies": {
- "@ckb-lumos/bi": "0.21.1",
- "@ckb-lumos/rpc": "0.21.1",
- "@ckb-lumos/base": "0.21.1",
- "@ckb-lumos/codec": "0.21.1",
- "@ckb-lumos/hd": "0.21.1",
- "@ckb-lumos/helpers": "0.21.1",
- "@ckb-lumos/config-manager": "0.21.1",
- "@ckb-lumos/common-scripts": "0.21.1",
+ "@ckb-lumos/lumos": "0.23.0",
+ "@ckb-lumos/bi": "0.23.0",
+ "@ckb-lumos/rpc": "0.23.0",
+ "@ckb-lumos/base": "0.23.0",
+ "@ckb-lumos/codec": "0.23.0",
+ "@ckb-lumos/hd": "0.23.0",
+ "@ckb-lumos/helpers": "0.23.0",
+ "@ckb-lumos/config-manager": "0.23.0",
+ "@ckb-lumos/common-scripts": "0.23.0",
"canvg": "2.0.0",
"i18next": "23.7.11",
"immer": "9.0.21",
diff --git a/packages/neuron-ui/src/components/CellManagement/cellManagement.module.scss b/packages/neuron-ui/src/components/CellManagement/cellManagement.module.scss
index a142528c7e..a36bad6e1e 100644
--- a/packages/neuron-ui/src/components/CellManagement/cellManagement.module.scss
+++ b/packages/neuron-ui/src/components/CellManagement/cellManagement.module.scss
@@ -53,7 +53,7 @@
.actions {
display: flex;
gap: 16px;
- & > svg {
+ & svg {
cursor: pointer;
&[data-disabled='true'] {
cursor: not-allowed;
diff --git a/packages/neuron-ui/src/components/CellManagement/hooks.ts b/packages/neuron-ui/src/components/CellManagement/hooks.ts
index 1823cc98c0..4977cc6ced 100644
--- a/packages/neuron-ui/src/components/CellManagement/hooks.ts
+++ b/packages/neuron-ui/src/components/CellManagement/hooks.ts
@@ -18,7 +18,8 @@ import { ErrorCode, LockScriptCategory, RoutePath, TypeScriptCategory, isSuccess
import { SortType } from 'widgets/Table'
const cellTypeOrder: Record = {
- [TypeScriptCategory.SUDT]: 1,
+ [TypeScriptCategory.SUDT]: 0,
+ [TypeScriptCategory.XUDT]: 1,
[TypeScriptCategory.NFT]: 2,
[TypeScriptCategory.Spore]: 3,
[TypeScriptCategory.Unknown]: 4,
@@ -47,6 +48,9 @@ const getLockStatusAndReason = (item: State.LiveCellWithLocalInfo) => {
case TypeScriptCategory.DAO:
lockedReason = { key: 'cell-manage.locked-reason.NFT-SUDT-DAO', params: { type: 'Nervos DAO' } }
break
+ case TypeScriptCategory.XUDT:
+ lockedReason = { key: 'cell-manage.locked-reason.NFT-SUDT-DAO', params: { type: 'XUDT' } }
+ break
case TypeScriptCategory.Unknown:
lockedReason = { key: 'cell-manage.locked-reason.Unknown' }
break
@@ -82,6 +86,7 @@ const getCellType = (item: State.LiveCellWithLocalInfo) => {
switch (item.typeScriptType) {
case TypeScriptCategory.NFT:
case TypeScriptCategory.SUDT:
+ case TypeScriptCategory.XUDT:
case TypeScriptCategory.Spore:
case TypeScriptCategory.Unknown:
return item.typeScriptType
diff --git a/packages/neuron-ui/src/components/CellManagement/index.tsx b/packages/neuron-ui/src/components/CellManagement/index.tsx
index 994c88e042..7fbb4860bc 100644
--- a/packages/neuron-ui/src/components/CellManagement/index.tsx
+++ b/packages/neuron-ui/src/components/CellManagement/index.tsx
@@ -193,7 +193,7 @@ const getColumns = ({
@@ -202,7 +202,7 @@ const getColumns = ({
diff --git a/packages/neuron-ui/src/components/NervosDAO/hooks.ts b/packages/neuron-ui/src/components/NervosDAO/hooks.ts
index fe48897e12..e0e900c72c 100644
--- a/packages/neuron-ui/src/components/NervosDAO/hooks.ts
+++ b/packages/neuron-ui/src/components/NervosDAO/hooks.ts
@@ -337,7 +337,7 @@ export const useUpdateDepositEpochList = ({
useEffect(() => {
if (connectionStatus === 'online') {
getBlockHashes(records.map(v => v.depositOutPoint?.txHash).filter(v => !!v) as string[]).then(
- depositBlockHashes => {
+ (depositBlockHashes: { txHash: string; blockHash: string | undefined }[]) => {
const recordKeyIdx: string[] = []
const batchParams: ['getHeader', string][] = []
records.forEach(record => {
diff --git a/packages/neuron-ui/src/components/SUDTAccountList/index.tsx b/packages/neuron-ui/src/components/SUDTAccountList/index.tsx
index fa4f6972ef..b961ca079d 100644
--- a/packages/neuron-ui/src/components/SUDTAccountList/index.tsx
+++ b/packages/neuron-ui/src/components/SUDTAccountList/index.tsx
@@ -24,6 +24,7 @@ import {
isSuccessResponse,
useIsInsufficientToCreateSUDTAccount,
useOnGenerateNewAccountTransaction,
+ UDTType,
} from 'utils'
import { getSUDTAccountList, updateSUDTAccount } from 'services/remote'
@@ -48,7 +49,11 @@ const SUDTAccountList = () => {
const [keyword, setKeyword] = useState('')
const [dialog, setDialog] = useState<{ id: string; action: 'create' | 'update' } | null>(null)
const [isLoaded, setIsLoaded] = useState(false)
- const [insufficient, setInsufficient] = useState({ [AccountType.CKB]: false, [AccountType.SUDT]: false })
+ const [insufficient, setInsufficient] = useState({
+ [AccountType.CKB]: false,
+ [AccountType.SUDT]: false,
+ [AccountType.XUDT]: false,
+ })
const isMainnet = isMainnetUtil(networks, networkID)
const [receiveData, setReceiveData] = useState(null)
@@ -178,6 +183,7 @@ const SUDTAccountList = () => {
tokenName: accountToUpdate.tokenName || DEFAULT_SUDT_FIELDS.tokenName,
symbol: accountToUpdate.symbol || DEFAULT_SUDT_FIELDS.symbol,
isCKB: accountToUpdate.tokenId === DEFAULT_SUDT_FIELDS.CKBTokenId,
+ udtType: accountToUpdate.udtType,
onSubmit: (info: Omit) => {
const params: any = { id: accountToUpdate.accountId }
Object.keys(info).forEach(key => {
@@ -208,7 +214,7 @@ const SUDTAccountList = () => {
: undefined
const handleCreateAccount = useCallback(
- (info: TokenInfo) => {
+ (info: TokenInfo & { udtType?: UDTType }) => {
createAccount(info, () => {
setNotice(t('s-udt.create-account-success'))
})
diff --git a/packages/neuron-ui/src/components/SUDTCreateDialog/index.tsx b/packages/neuron-ui/src/components/SUDTCreateDialog/index.tsx
index fa9c5a0b19..c4710b31c8 100644
--- a/packages/neuron-ui/src/components/SUDTCreateDialog/index.tsx
+++ b/packages/neuron-ui/src/components/SUDTCreateDialog/index.tsx
@@ -10,13 +10,15 @@ import {
isSuccessResponse,
useSUDTAccountInfoErrors,
useFetchTokenInfoList,
- useOpenSUDTTokenUrl,
+ useOpenUDTTokenUrl,
+ UDTType,
} from 'utils'
import { DEFAULT_SUDT_FIELDS } from 'utils/const'
import styles from './sUDTCreateDialog.module.scss'
export enum AccountType {
SUDT = 'sudt',
+ XUDT = 'xudt',
CKB = 'ckb',
}
@@ -33,10 +35,10 @@ export interface TokenInfo extends BasicInfo {
export interface SUDTCreateDialogProps extends TokenInfo {
isMainnet: boolean
- onSubmit: (info: TokenInfo) => void
+ onSubmit: (info: TokenInfo & { udtType?: UDTType }) => void
onCancel: () => void
existingAccountNames?: string[]
- insufficient?: { [AccountType.CKB]: boolean; [AccountType.SUDT]: boolean }
+ insufficient?: { [P in AccountType]: boolean }
}
enum DialogSection {
@@ -49,6 +51,10 @@ const accountTypes: { key: AccountType; label: string }[] = [
key: AccountType.SUDT,
label: 's-udt.create-dialog.sudt-account',
},
+ {
+ key: AccountType.XUDT,
+ label: 's-udt.create-dialog.xudt-account',
+ },
{
key: AccountType.CKB,
label: 's-udt.create-dialog.ckb-account',
@@ -121,13 +127,18 @@ const SUDTCreateDialog = ({
onSubmit,
onCancel,
existingAccountNames = [],
- insufficient = { [AccountType.CKB]: false, [AccountType.SUDT]: false },
+ insufficient = { [AccountType.CKB]: false, [AccountType.SUDT]: false, [AccountType.XUDT]: false },
isMainnet,
}: Partial> &
Pick) => {
const [t] = useTranslation()
const [info, dispatch] = useReducer(reducer, { accountName, tokenId, tokenName, symbol, decimal })
- const [accountType, setAccountType] = useState([AccountType.SUDT, AccountType.CKB].find(at => !insufficient[at]))
+ const [accountType, setAccountType] = useState(
+ [AccountType.SUDT, AccountType.CKB, AccountType.XUDT].find(at => !insufficient[at])
+ )
+ const isUDT = accountType === AccountType.SUDT || accountType === AccountType.XUDT
+ // eslint-disable-next-line no-nested-ternary
+ const udtType = isUDT ? (accountType === AccountType.SUDT ? UDTType.SUDT : UDTType.XUDT) : undefined
const [step, setStep] = useState(DialogSection.Account)
const tokenInfoList = useFetchTokenInfoList()
@@ -135,9 +146,10 @@ const SUDTCreateDialog = ({
const tokenErrors = useSUDTAccountInfoErrors({
info,
- isCKB: AccountType.CKB === accountType,
+ isCKB: !isUDT,
existingAccountNames,
t,
+ udtType,
})
const isAccountNameReady = info.accountName.trim() && !tokenErrors.accountName && accountType
@@ -190,7 +202,7 @@ const SUDTCreateDialog = ({
}
case DialogSection.Token: {
if (isTokenReady) {
- onSubmit({ ...info, accountName: info.accountName.trim(), tokenName: info.tokenName.trim() })
+ onSubmit({ ...info, udtType, accountName: info.accountName.trim(), tokenName: info.tokenName.trim() })
}
break
}
@@ -216,7 +228,7 @@ const SUDTCreateDialog = ({
}
}
}
- const openSUDTTokenUrl = useOpenSUDTTokenUrl(info.tokenId, isMainnet)
+ const openSUDTTokenUrl = useOpenUDTTokenUrl(info.tokenId, udtType, isMainnet)
return (
))}
- {accountType === AccountType.SUDT && !tokenErrors.tokenId && info.tokenId && (
+ {isUDT && !tokenErrors.tokenId && info.tokenId && (
))}
>
diff --git a/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx b/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx
index 34877de9f9..32db8b8135 100644
--- a/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx
+++ b/packages/neuron-ui/src/components/SUDTMigrateToExistAccountDialog/index.tsx
@@ -3,7 +3,13 @@ import { useTranslation } from 'react-i18next'
import { SpecialAssetCell } from 'components/SpecialAssetList/hooks'
import TextField from 'widgets/TextField'
import Dialog from 'widgets/Dialog'
-import { AnyoneCanPayLockInfoOnAggron, getSUDTAmount, isSuccessResponse, validateSpecificAddress } from 'utils'
+import {
+ AnyoneCanPayLockInfoOnAggron,
+ getSUDTAmount,
+ getUdtType,
+ isSuccessResponse,
+ validateSpecificAddress,
+} from 'utils'
import InputSelect from 'widgets/InputSelect'
import { generateSudtMigrateAcpTx } from 'services/remote'
import { AppActions, showGlobalAlertDialog, useDispatch } from 'states'
@@ -53,6 +59,7 @@ const SUDTMigrateToExistAccountDialog = ({
[sUDTAccounts, tokenInfo]
)
const dispatch = useDispatch()
+ const udtType = getUdtType(cell.type)
const onSubmit = useCallback(() => {
generateSudtMigrateAcpTx({
outPoint: cell.outPoint,
@@ -73,7 +80,7 @@ const SUDTMigrateToExistAccountDialog = ({
walletID,
actionType: 'transfer-to-sudt',
onSuccess: () => {
- onSuccess(t('special-assets.send-sudt-success'))
+ onSuccess(t('special-assets.send-sudt-success', { udtType }))
},
},
})
@@ -92,7 +99,7 @@ const SUDTMigrateToExistAccountDialog = ({