diff --git a/_typos.toml b/_typos.toml index 09deee0241..369e09719d 100644 --- a/_typos.toml +++ b/_typos.toml @@ -1,11 +1,9 @@ [default.extend-words] thur = "thur" +numer = "numer" # defined in database schema lastest = "lastest" [files] extend-exclude = ["CHANGELOG.md", "**/migrations/*.ts"] - - - diff --git a/packages/neuron-wallet/package.json b/packages/neuron-wallet/package.json index 5d3c4b135a..5d4c4cf89c 100644 --- a/packages/neuron-wallet/package.json +++ b/packages/neuron-wallet/package.json @@ -42,17 +42,16 @@ ] }, "dependencies": { - "@ckb-lumos/base": "0.20.0-alpha.3", - "@ckb-lumos/bi": "0.20.0-alpha.3", - "@ckb-lumos/ckb-indexer": "0.20.0-alpha.3", - "@ckb-lumos/codec": "0.20.0-alpha.3", - "@ckb-lumos/config-manager": "0.20.0-alpha.3", - "@ckb-lumos/hd": "0.20.0-alpha.3", - "@ckb-lumos/helpers": "0.20.0-alpha.3", - "@ckb-lumos/rpc": "0.20.0-alpha.3", + "@ckb-lumos/base": "^0.21.0-next.1", + "@ckb-lumos/bi": "^0.21.0-next.1", + "@ckb-lumos/ckb-indexer": "^0.21.0-next.1", + "@ckb-lumos/codec": "^0.21.0-next.1", + "@ckb-lumos/config-manager": "^0.21.0-next.1", + "@ckb-lumos/hd": "^0.21.0-next.1", + "@ckb-lumos/helpers": "^0.21.0-next.1", + "@ckb-lumos/rpc": "^0.21.0-next.1", "@iarna/toml": "2.2.5", "@ledgerhq/hw-transport-node-hid": "6.27.16", - "@nervosnetwork/ckb-sdk-core": "0.109.0", "archiver": "5.3.0", "async": "3.2.4", "bn.js": "4.12.0", 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 506af6dc94..b8c29c11a9 100644 --- a/packages/neuron-wallet/src/block-sync-renderer/sync/queue.ts +++ b/packages/neuron-wallet/src/block-sync-renderer/sync/queue.ts @@ -146,7 +146,7 @@ export default class Queue { const headers = await rpc .createBatchRequest<'getHeader', string[], CKBComponents.BlockHeader[]>(blockHashes.map(v => ['getHeader', v])) .exec() - headers.forEach((blockHeader, idx) => { + headers.forEach((blockHeader: CKBComponents.BlockHeader, idx: number) => { if (blockHeader) { const header = BlockHeader.fromSDK(blockHeader) txs[idx].timestamp = header.timestamp diff --git a/packages/neuron-wallet/src/controllers/offline-sign.ts b/packages/neuron-wallet/src/controllers/offline-sign.ts index b6a0a0c0af..058c5d0e6f 100644 --- a/packages/neuron-wallet/src/controllers/offline-sign.ts +++ b/packages/neuron-wallet/src/controllers/offline-sign.ts @@ -40,7 +40,8 @@ export default class OfflineSignController { const rpc = generateRPC(NodeService.getInstance().nodeUrl) if (context === undefined) { - const rawTx = rpc.paramsFormatter.toRawTransaction(tx.toSDKRawTransaction()) + const rawSdkTx = tx.toSDKRawTransaction() + const rawTx = rpc.paramsFormatter.toRawTransaction(rawSdkTx) const txs = await Promise.all(rawTx.inputs.map(i => rpc.getTransaction(i.previous_output!.tx_hash))) context = txs.map(i => rpc.paramsFormatter.toRawTransaction(i.transaction)) } diff --git a/packages/neuron-wallet/src/models/chain/block.ts b/packages/neuron-wallet/src/models/chain/block.ts index bc6a4b5a2c..6d643742eb 100644 --- a/packages/neuron-wallet/src/models/chain/block.ts +++ b/packages/neuron-wallet/src/models/chain/block.ts @@ -14,7 +14,9 @@ export default class Block { const header = BlockHeader.fromSDK(block.header) return new Block( header, - block.transactions.map(tx => Transaction.fromSDK(tx, header)) + block.transactions.map((tx: CKBComponents.RawTransaction | CKBComponents.Transaction) => + Transaction.fromSDK(tx, header) + ) ) } } diff --git a/packages/neuron-wallet/src/models/chain/transaction.ts b/packages/neuron-wallet/src/models/chain/transaction.ts index 2af594c38c..885c3b182a 100644 --- a/packages/neuron-wallet/src/models/chain/transaction.ts +++ b/packages/neuron-wallet/src/models/chain/transaction.ts @@ -298,7 +298,7 @@ export default class Transaction { blockHeader?: BlockHeader ): Transaction { const txHash: string | undefined = (tx as CKBComponents.Transaction).hash - const outputs = tx.outputs.map((o, i) => { + const outputs = tx.outputs.map((o: CKBComponents.CellOutput, i: number) => { const output = Output.fromSDK(o) if (txHash) { output.setOutPoint(new OutPoint(txHash, i.toString())) @@ -307,9 +307,9 @@ export default class Transaction { }) return new Transaction( tx.version, - tx.cellDeps.map(cd => CellDep.fromSDK(cd)), + tx.cellDeps.map((cd: CKBComponents.CellDep) => CellDep.fromSDK(cd)), tx.headerDeps, - tx.inputs.map(i => Input.fromSDK(i)), + tx.inputs.map((i: CKBComponents.CellInput) => Input.fromSDK(i)), outputs, tx.outputsData, tx.witnesses, diff --git a/packages/neuron-wallet/src/services/sdk-core.ts b/packages/neuron-wallet/src/services/sdk-core.ts index ad93376d7f..a951c08ff6 100644 --- a/packages/neuron-wallet/src/services/sdk-core.ts +++ b/packages/neuron-wallet/src/services/sdk-core.ts @@ -1,4 +1,4 @@ -import CKB from '@nervosnetwork/ckb-sdk-core' +import { CKBRPC } from '@ckb-lumos/rpc' import https from 'https' import http from 'http' @@ -19,14 +19,14 @@ const getHttpAgent = () => { return httpAgent } -export const generateCKB = (url: string): CKB => { - const ckb = new CKB(url) +export const generateCKB = (url: string): CKBRPC => { + const rpc = new CKBRPC(url) if (url.startsWith('https')) { - ckb.rpc.setNode({ url, httpsAgent: getHttpsAgent() }) + rpc.setNode({ url, httpsAgent: getHttpsAgent() }) } else { - ckb.rpc.setNode({ url, httpAgent: getHttpAgent() }) + rpc.setNode({ url, httpAgent: getHttpAgent() }) } - return ckb + return rpc } export default { diff --git a/packages/neuron-wallet/src/services/transaction-sender.ts b/packages/neuron-wallet/src/services/transaction-sender.ts index 893fb90a9a..672f25181f 100644 --- a/packages/neuron-wallet/src/services/transaction-sender.ts +++ b/packages/neuron-wallet/src/services/transaction-sender.ts @@ -1,4 +1,3 @@ -import signWitnesses from '@nervosnetwork/ckb-sdk-core/lib/signWitnesses' import NodeService from './node' import { serializeWitnessArgs } from '../utils/serialization' import { scriptToAddress } from '../utils/scriptAndAddress' @@ -21,6 +20,7 @@ import Script from '../models/chain/script' import Multisig from '../models/multisig' import Blake2b from '../models/blake2b' import logger from '../utils/logger' +import { signWitnesses } from '../utils/signWitnesses' import { bytes as byteUtils, bytes, number } from '@ckb-lumos/codec' import SystemScriptInfo from '../models/system-script-info' import AddressParser from '../models/address-parser' @@ -42,7 +42,7 @@ import { getMultisigStatus } from '../utils/multisig' import { SignStatus } from '../models/offline-sign' import NetworksService from './networks' import { generateRPC } from '../utils/ckb-rpc' -import CKB from '@nervosnetwork/ckb-sdk-core' +import { CKBRPC } from '@ckb-lumos/rpc' import CellsService from './cells' import hd from '@ckb-lumos/hd' @@ -216,7 +216,8 @@ export default class TransactionSender { wit.lock = serializedMultisig + wit.lock!.slice(2) signed[0] = serializeWitnessArgs(wit.toSDK()) } else { - signed = signWitnesses(privateKey)({ + signed = signWitnesses({ + privateKey, transactionHash: txHash, witnesses: serializedWitnesses.map(wit => { if (typeof wit === 'string') { @@ -791,9 +792,8 @@ export default class TransactionSender { depositOutPoint: OutPoint, withdrawBlockHash: string ): Promise => { - const ckb = new CKB(NodeService.getInstance().nodeUrl) + const ckb = new CKBRPC(NodeService.getInstance().nodeUrl) const result = await ckb.calculateDaoMaximumWithdraw(depositOutPoint.toSDK(), withdrawBlockHash) - return BigInt(result) } diff --git a/packages/neuron-wallet/src/services/tx/transaction-service.ts b/packages/neuron-wallet/src/services/tx/transaction-service.ts index c38d3a3e03..833b112b61 100644 --- a/packages/neuron-wallet/src/services/tx/transaction-service.ts +++ b/packages/neuron-wallet/src/services/tx/transaction-service.ts @@ -1,5 +1,5 @@ import { getConnection } from 'typeorm' -import CKB from '@nervosnetwork/ckb-sdk-core' +import { CKBRPC } from '@ckb-lumos/rpc' import TransactionEntity from '../../database/chain/entities/transaction' import OutputEntity from '../../database/chain/entities/output' import Transaction, { @@ -507,14 +507,14 @@ export class TransactionsService { const inputTxHashes = inputs.map(v => v.previousOutput?.txHash).filter((v): v is string => !!v) if (!inputTxHashes.length) return inputs const url: string = NetworksService.getInstance().getCurrent().remote - const ckb = new CKB(url) - const inputTxs = await ckb.rpc + const ckb = new CKBRPC(url) + const inputTxs = await ckb .createBatchRequest<'getTransaction', string[], CKBComponents.TransactionWithStatus[]>( inputTxHashes.map(v => ['getTransaction', v]) ) .exec() const inputTxMap = new Map() - inputTxs.forEach((v, idx) => { + inputTxs.forEach((v: { transaction: CKBComponents.Transaction }, idx: number) => { inputTxMap.set(inputTxHashes[idx], v.transaction) }) return inputs.map(v => { diff --git a/packages/neuron-wallet/src/types/ckbComponents.d.ts b/packages/neuron-wallet/src/types/ckbComponents.d.ts new file mode 100644 index 0000000000..56e2ff19b7 --- /dev/null +++ b/packages/neuron-wallet/src/types/ckbComponents.d.ts @@ -0,0 +1,280 @@ +import type { Agent as HttpsAgent } from 'node:https' +import type { Agent as HttpAgent } from 'node:http' + +declare global { + declare namespace CKBComponents { + type DAO = string + type Hash = string + type Number = string + type Hash256 = string + type UInt32 = string + type UInt64 = string + type U256 = string + type Index = string + type Version = string + type Count = string + type Difficulty = string + type BlockNumber = string + type EpochInHeader = string + type Capacity = string + type ProposalShortId = string + type Timestamp = string + type Nonce = string + type Cycles = string + type Size = string + type OutputsValidator = 'default' | 'passthrough' | undefined + type RationalU256 = Record<'denom' | 'numer', string> + type ProposalWindow = Record<'closest' | 'farthest', BlockNumber> + type EpochNumberWithFraction = string + type EpochNumber = string + enum TransactionStatus { + Pending = 'pending', + Proposed = 'proposed', + Committed = 'committed', + } + type ScriptHashType = api.HashType + type DepType = 'code' | 'depGroup' + type JsonBytes = string + /** + * @typedef Bytes, keep consistent with CKB + * @description Bytes will be serialized to string + * @see https://github.com/nervosnetwork/ckb/blob/develop/util/jsonrpc-types/src/blockchain.rs#L19 + */ + type Bytes = string + type Since = string + interface Node { + url: string + httpAgent?: HttpAgent + httpsAgent?: HttpsAgent + } + interface Method { + name: string + method: string + paramsFormatters: function[] + resultFormatters?: function + } + /** + * RPC Units + */ + type Witness = Bytes + type Script = api.Script + type CellInput = api.Input + type CellOutput = api.Output + type Cell = CellOutput + type OutPoint = api.OutPoint + type CellDep = api.CellDep + type RawTransaction = api.RawTransaction & { + witnesses: Witness[] + } + type Transaction = Required + type TransactionWithStatus = api.TransactionWithStatus + type BlockHeader = api.Header + type Block = api.Block + type UncleBlock = api.UncleBlock + type LiveCell = api.LiveCell + type AlertMessage = api.AlertMessage + type BlockchainInfo = api.ChainInfo + type LocalNodeInfo = api.LocalNode + type RemoteNodeInfo = api.RemoteNode + type TxPoolInfo = api.TxPoolInfo + type Epoch = api.Epoch + type RunDryResult = api.DryRunResult + type BannedAddress = api.BannedAddr + type WitnessArgs = api.WitnessArgs + type BlockEconomicState = api.BlockEconomicState + type SyncState = api.SyncState + type TransactionProof = api.TransactionProof + type TxVerbosity = api.TxVerbosity + type TxPoolVerbosity = api.TxPoolVerbosity + type RawTxPool = api.RawTxPool + type Consensus = api.Consensus + type HardForks = api.HardForks + type HardForkFeature = api.HardforkFeature + type SoftForkStatus = api.SoftForkStatus + type SoftFork = api.SoftFork + type Buried = api.Buried + type Rfc0043 = api.Rfc0043 + type Ratio = api.Ratio + type Deployment = api.Deployment + type QueryOptions = api.QueryOptions + interface TransactionPoint { + blockNumber: BlockNumber + index: Index + txHash: Hash256 + } + interface TransactionByLockHash { + consumedBy: undefined | TransactionPoint + createdBy: TransactionPoint + } + type TransactionsByLockHash = TransactionByLockHash[] + interface FeeRate { + feeRate: string + } + interface CellIncludingOutPoint { + blockHash: Hash256 + capacity: Capacity + lock: Script + outPoint: OutPoint + cellbase: boolean + outputDataLen: string + } + type TransactionTrace = { + action: string + info: string + time: Timestamp + }[] + enum CellStatus { + Live = 'live', + Unknown = 'unknown', + } + interface LiveCellByLockHash { + cellOutput: CellOutput + createdBy: TransactionPoint + cellbase: boolean + outputDataLen: string + } + type LiveCellsByLockHash = LiveCellByLockHash[] + interface PeersState { + lastUpdated: string + blocksInFlight: string + peer: string + } + interface LockHashIndexState { + blockHash: Hash256 + blockNumber: BlockNumber + lockHash: Hash256 + } + type LockHashIndexStates = LockHashIndexState[] + type BannedAddresses = BannedAddress[] + interface CellbaseOutputCapacityDetails { + primary: string + proposalReward: string + secondary: string + total: string + txFee: string + } + interface RawTransactionToSign extends Omit { + witnesses: (WitnessArgs | Witness)[] + } + interface CapacityByLockHash { + blockNumber: BlockNumber + capacity: Capacity + cellsCount: string + } + type TxPoolIds = Record<'pending' | 'proposed', Array> + interface Tip { + blockNumber: BlockNumber + blockHash: Hash256 + } + type ScriptType = 'type' | 'lock' + type Order = 'asc' | 'desc' + type IOType = 'input' | 'output' | 'both' + type ScriptSearchMode = 'prefix' | 'exact' + interface IndexerCell { + blockNumber: BlockNumber + outPoint: OutPoint + output: { + capacity: Capacity + lock: Script + type?: Script + } + outputData: string + txIndex: string + } + interface IndexerCellWithoutData extends Omit { + outputData: null + } + interface GetCellsResult { + lastCursor: string + objects: WithData extends true ? IndexerCell[] : IndexerCellWithoutData[] + } + type IndexerTransaction = Grouped extends true + ? GroupedIndexerTransaction + : UngroupedIndexerTransaction + type UngroupedIndexerTransaction = { + txHash: Hash256 + blockNumber: BlockNumber + ioIndex: number + ioType: IOType + txIndex: number + } + type GroupedIndexerTransaction = { + txHash: Hash256 + blockNumber: BlockNumber + txIndex: number + cells: Array<[IOType, number]> + } + interface GetTransactionsResult { + lastCursor: Hash256 + objects: IndexerTransaction[] + } + interface CKBIndexerQueryOptions extends QueryOptions { + outputDataLenRange?: HexadecimalRange + outputCapacityRange?: HexadecimalRange + scriptLenRange?: HexadecimalRange + bufferSize?: number + withData?: boolean + groupByTransaction?: boolean + } + type HexadecimalRange = [string, string] + interface SearchFilter { + script?: Script + scriptLenRange?: HexadecimalRange + outputDataLenRange?: HexadecimalRange + outputCapacityRange?: HexadecimalRange + blockRange?: HexadecimalRange + } + interface SearchKey { + script: Script + scriptType: ScriptType + filter?: SearchFilter + scriptSearchMode?: ScriptSearchMode + } + interface GetLiveCellsResult { + lastCursor: string + objects: WithData extends true ? IndexerCell[] : IndexerCellWithoutData[] + } + interface GetCellsSearchKey extends SearchKey { + withData?: WithData + } + interface GetTransactionsSearchKey extends SearchKey { + groupByTransaction?: Group + } + interface CellsCapacity { + capacity: Capacity + blockHash: Hash256 + blockNumber: BlockNumber + } + interface BlockFilter { + data: api.HexString + hash: api.Hash + } + interface TransactionAndWitnessProof { + blockHash: Hash256 + transactionsProof: api.MerkleProof + witnessesProof: api.MerkleProof + } + type TransactionView = api.Transaction & { + hash: api.Hash + } + interface BlockView { + header: BlockHeader + uncles: UncleBlock[] + transactions: TransactionView[] + proposals: ProposalShortId[] + } + type SerializedBlock = api.HexString + interface FeeRateStatistics { + mean: UInt64 + median: UInt64 + } + interface EstimateCycles { + cycles: UInt64 + } + type DeploymentPos = api.DeploymentPos + type DeploymentState = api.DeploymentState + type DeploymentInfo = api.DeploymentInfo + type DeploymentsInfo = api.DeploymentsInfo + } + //# sourceMappingURL=api.d.ts.map +} diff --git a/packages/neuron-wallet/src/types/ckbRpc.d.ts b/packages/neuron-wallet/src/types/ckbRpc.d.ts new file mode 100644 index 0000000000..0fe9dcad1e --- /dev/null +++ b/packages/neuron-wallet/src/types/ckbRpc.d.ts @@ -0,0 +1,3 @@ +declare namespace CKBRPC { + type ScriptType = 'lock' | 'type' +} diff --git a/packages/neuron-wallet/src/types/rpc.d.ts b/packages/neuron-wallet/src/types/rpc.d.ts index 0fe9dcad1e..10a7333fa2 100644 --- a/packages/neuron-wallet/src/types/rpc.d.ts +++ b/packages/neuron-wallet/src/types/rpc.d.ts @@ -1,3 +1,458 @@ -declare namespace CKBRPC { - type ScriptType = 'lock' | 'type' +declare namespace RPC { + export type ProposalShortId = CKBComponents.ProposalShortId + export type Number = CKBComponents.Number + export type UInt32 = CKBComponents.UInt32 + export type Uint64 = CKBComponents.UInt64 + export type U256 = CKBComponents.U256 + export type Count = CKBComponents.Count + export type DAO = CKBComponents.DAO + export type Hash = CKBComponents.Hash + export type Hash256 = CKBComponents.Hash256 + export type Version = CKBComponents.Version + export type Capacity = CKBComponents.Capacity + export type Witness = CKBComponents.Witness + export type Bytes = CKBComponents.Bytes + export type Index = CKBComponents.Index + export type Since = CKBComponents.Since + export type Timestamp = CKBComponents.Timestamp + export type BlockNumber = CKBComponents.BlockNumber + export type EpochInHeader = string + export type Difficulty = CKBComponents.Difficulty + export type Cycles = CKBComponents.Cycles + export type Size = CKBComponents.Size + export type RationalU256 = CKBComponents.RationalU256 + export type ProposalWindow = CKBComponents.ProposalWindow + export type EpochNumberWithFraction = CKBComponents.EpochNumberWithFraction + export type JsonBytes = CKBComponents.JsonBytes + export type IOType = CKBComponents.IOType + export type EpochNumber = CKBComponents.EpochNumber + type MapLike = { + [key in K]?: V + } + type Vec = T[] + export enum TransactionStatus { + Pending = 'pending', + Proposed = 'proposed', + Committed = 'committed', + } + export type DepType = 'code' | 'dep_group' + export type ScriptHashType = CKBComponents.ScriptHashType + export interface Script { + args: Bytes + code_hash: Hash256 + hash_type: ScriptHashType + } + export interface OutPoint { + tx_hash: Hash256 + index: Index + } + export interface CellInput { + previous_output: OutPoint + since: Since + } + export interface CellOutput { + capacity: Capacity + lock: Script + type?: Script | undefined + } + export type Cell = CellOutput + export interface LiveCell { + data: { + content: Hash + hash: Hash256 + } + output: CellOutput + } + export interface CellDep { + out_point: OutPoint + dep_type: DepType + } + export interface CellIncludingOutPoint { + block_hash: Hash256 + capacity: Capacity + lock: Script + out_point: OutPoint + cellbase: boolean + output_data_len: string + } + export interface RawTransaction { + version: Version + cell_deps: CellDep[] + header_deps: Hash256[] + inputs: CellInput[] + outputs: CellOutput[] + witnesses: Witness[] + outputs_data: Bytes[] + } + export interface Transaction extends RawTransaction { + hash: Hash256 + } + export interface TransactionWithStatus { + transaction: Transaction + tx_status: + | { + block_hash: Hash256 + status: TransactionStatus.Committed + } + | { + block_hash: undefined + status: TransactionStatus.Pending | TransactionStatus.Proposed + } + time_added_to_pool: Uint64 | null + cycles: Uint64 | null + } + export interface TransactionPoint { + block_number: BlockNumber + index: Index + tx_hash: Hash256 + } + export interface TransactionByLockHash { + consumed_by: undefined | TransactionPoint + created_by: TransactionPoint + } + export type TransactionsByLockHash = TransactionByLockHash[] + export interface LiveCellByLockHash { + cell_output: CellOutput + created_by: TransactionPoint + cellbase: boolean + output_data_len: string + } + export type LiveCellsByLockHash = LiveCellByLockHash[] + export interface Header { + compact_target: Hash + dao: DAO + epoch: EpochInHeader + hash: Hash256 + number: BlockNumber + parent_hash: Hash256 + proposals_hash: Hash256 + nonce: CKBComponents.Nonce + timestamp: Timestamp + transactions_root: Hash256 + extra_hash: Hash256 + version: Version + } + export interface UncleBlock { + header: Header + proposals: ProposalShortId[] + } + export interface Block { + header: Header + uncles: UncleBlock[] + transactions: Transaction[] + proposals: ProposalShortId[] + extension?: JsonBytes | undefined + } + export interface AlertMessage { + id: string + priority: string + notice_until: Timestamp + message: string + } + /** + * @deprecated please migrate to {@link ChainInfo} + */ + export type BlockchainInfo = ChainInfo + export interface LocalNodeInfo { + active: boolean + addresses: Record<'address' | 'score', string>[] + connections: string + node_id: string + protocols: { + id: string + name: string + support_versions: string[] + }[] + version: string + } + export interface RemoteNodeInfo { + addresses: Record<'address' | 'score', string>[] + connected_duration: string + is_outbound: boolean + last_ping_duration: string + node_id: string + protocols: Record<'id' | 'version', string>[] + sync_state: Record< + | 'best_known_header_hash' + | 'best_known_header_number' + | 'can_fetch_count' + | 'inflight_count' + | 'last_common_header_hash' + | 'last_common_header_number' + | 'unknown_header_list_size', + string | undefined + > + version: string + } + export interface PeersState { + last_updated: string + blocks_in_flight: string + peer: string + } + export interface TxPoolInfo { + last_txs_updated_at: Timestamp + min_fee_rate: string + orphan: Count + pending: Count + proposed: Count + tip_hash: Hash256 + tip_number: BlockNumber + total_tx_cycles: Cycles + total_tx_size: Size + } + export interface Epoch { + compact_target: Hash + length: string + number: string + start_number: string + } + export interface LockHashIndexState { + block_hash: Hash256 + block_number: BlockNumber + lock_hash: Hash256 + } + export type LockHashIndexStates = LockHashIndexState[] + export interface BannedAddress { + address: string + ban_reason: string + ban_until: Timestamp + created_at: Timestamp + } + export type BannedAddresses = BannedAddress[] + export interface CellbaseOutputCapacityDetails { + primary: string + proposal_reward: string + secondary: string + total: string + tx_fee: string + } + export interface FeeRate { + fee_rate: string + } + export interface CapacityByLockHash { + block_number: BlockNumber + capacity: Capacity + cells_count: string + } + export interface BlockEconomicState { + finalized_at: string + issuance: { + primary: string + secondary: string + } + miner_reward: { + committed: string + primary: string + proposal: string + secondary: string + } + txs_fee: string + } + export interface SyncState { + best_known_block_number: string + best_known_block_timestamp: string + fast_time: string + ibd: boolean + inflight_blocks_count: string + low_time: string + normal_time: string + orphan_blocks_count: string + } + export interface TransactionProof { + block_hash: Hash + proof: { + indices: string[] + lemmas: Hash[] + } + witnesses_root: Hash + } + export type TxPoolIds = Record<'pending' | 'proposed', Array> + export interface TxVerbosity { + cycles: Cycles + size: Size + fee: Capacity + ancestors_size: Size + ancestors_cycles: Cycles + ancestors_count: Count + } + export type TxPoolVerbosity = Record<'pending' | 'proposed', Record> + export type RawTxPool = TxPoolIds | TxPoolVerbosity + export interface Consensus { + id: string + genesis_hash: Hash256 + dao_type_hash: Hash256 | undefined + secp256k1_blake160_sighash_all_type_hash: Hash256 | undefined + secp256k1_blake160_multisig_all_type_hash: Hash256 | undefined + initial_primary_epoch_reward: Capacity + secondary_epoch_reward: Capacity + max_uncles_num: string + orphan_rate_target: RationalU256 + epoch_duration_target: string + tx_proposal_window: ProposalWindow + proposer_reward_ratio: RationalU256 + cellbase_maturity: EpochNumberWithFraction + median_time_block_count: Count + max_block_cycles: Cycles + max_block_bytes: string + block_version: Version + tx_version: Version + type_id_code_hash: Hash256 + max_block_proposals_limit: string + primary_epoch_reward_halving_interval: string + permanent_difficulty_in_dummy: boolean + hardfork_features: HardForks + softforks: { + [key in DeploymentPos]?: SoftFork + } + } + // eslint-disable-next-line @typescript-eslint/no-empty-interface + export interface HardForks extends Array {} + export interface HardforkFeature { + rfc: string + epoch_number: EpochNumber | null + } + export type SoftFork = Buried | Rfc0043 + export interface Buried { + status: SoftForkStatus + active: boolean + epoch: EpochNumber + } + export interface Rfc0043 { + status: SoftForkStatus + rfc0043: Deployment + } + export type SoftForkStatus = 'buried' | 'rfc0043' + export interface Ratio { + numer: Uint64 + denom: Uint64 + } + export interface Deployment { + bit: number + start: EpochNumber + timeout: EpochNumber + min_activation_epoch: EpochNumber + period: EpochNumber + threshold: Ratio + } + export interface Tip { + block_hash: Hash256 + block_number: BlockNumber + } + export interface IndexerCell { + block_number: BlockNumber + out_point: OutPoint + output: CellOutput + output_data: string + tx_index: string + } + export type IndexerTransaction = Grouped extends true + ? GroupedIndexerTransaction + : UngroupedIndexerTransaction + export interface UngroupedIndexerTransaction { + tx_hash: Hash256 + block_number: BlockNumber + io_index: string + io_type: IOType + tx_index: string + } + export interface GroupedIndexerTransaction { + tx_hash: Hash256 + block_number: BlockNumber + tx_index: string + cells: Array<[IOType, string]> + } + export interface GetTransactionsResult { + last_cursor: Hash256 + objects: IndexerTransaction[] + } + export interface GetLiveCellsResult { + last_cursor: Hash256 + objects: IndexerCell[] + } + export interface CellsCapacity { + capacity: Capacity + block_hash: Hash256 + block_number: BlockNumber + } + export type HexadecimalRange = [string, string] + export type ScriptType = 'type' | 'lock' + export type ScriptSearchMode = 'prefix' | 'exact' + export interface SearchFilter { + script?: Script + output_data_len_range?: HexadecimalRange + output_capacity_range?: HexadecimalRange + block_range?: HexadecimalRange + script_len_range?: HexadecimalRange + } + export interface SearchKey { + script: Script + script_type: ScriptType + filter?: SearchFilter + script_search_mode?: ScriptSearchMode + } + export interface GetCellsSearchKey extends SearchKey { + with_data?: boolean + } + export interface GetTransactionsSearchKey extends SearchKey { + group_by_transaction?: boolean + } + export interface BlockFilter { + data: HexString + hash: Hash + } + export interface TransactionAndWitnessProof { + block_hash: Hash + transactions_proof: MerkleProof + witnesses_proof: MerkleProof + } + export interface FeeRateStatistics { + mean: HexNumber + median: HexNumber + } + export type HeaderView = Header & { + hash: Hash + } + export interface UncleBlockView { + header: HeaderView + proposals: ProposalShortId[] + } + export type TransactionView = Transaction & { + hash: Hash + } + export interface BlockView { + header: HeaderView + uncles: UncleBlockView[] + transactions: TransactionView[] + proposals: ProposalShortId[] + } + export type SerializedBlock = HexString + export interface EstimateCycles { + cycles: HexNumber + } + export type DeploymentPos = 'testdummy' | 'light_client' + export type DeploymentState = 'defined' | 'started' | 'locked_in' | 'active' | 'failed' + export interface DeploymentsInfo { + hash: Hash256 + epoch: EpochNumber + deployments: MapLike + } + export interface DeploymentInfo { + bit: number + start: EpochNumber + timeout: EpochNumber + min_activation_epoch: EpochNumber + period: EpochNumber + threshold: Ratio + since: EpochNumber + state: DeploymentState + } + export interface ChainInfo { + chain: string + median_time: Timestamp + epoch: EpochNumberWithFraction + difficulty: U256 + is_initial_block_download: boolean + alerts: Vec + } + export {} } diff --git a/packages/neuron-wallet/src/utils/ckb-rpc.ts b/packages/neuron-wallet/src/utils/ckb-rpc.ts index e4eefea410..f23e2bebda 100644 --- a/packages/neuron-wallet/src/utils/ckb-rpc.ts +++ b/packages/neuron-wallet/src/utils/ckb-rpc.ts @@ -1,14 +1,14 @@ import { HexString } from '@ckb-lumos/base' -import CKBRPC from '@nervosnetwork/ckb-sdk-rpc' -import Method from '@nervosnetwork/ckb-sdk-rpc/lib/method' -import resultFormatter from '@nervosnetwork/ckb-sdk-rpc/lib/resultFormatter' -import paramsFormatter from '@nervosnetwork/ckb-sdk-rpc/lib/paramsFormatter' -import Base from '@nervosnetwork/ckb-sdk-rpc/lib/Base' +import { CKBRPC } from '@ckb-lumos/rpc' +import { Method } from '@ckb-lumos/rpc/lib/method' +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' import { MethodInBatchNotFoundException, PayloadInBatchException, IdNotMatchedInBatchException, -} from '@nervosnetwork/ckb-sdk-rpc/lib/exceptions' +} from '@ckb-lumos/rpc/lib/exceptions' import https from 'https' import http from 'http' import { request } from 'undici' @@ -137,6 +137,8 @@ export type FetchTransactionReturnType = { export class LightRPC extends Base { setScripts: (params: LightScriptFilter[]) => Promise getScripts: () => Promise + // TODO: the type is not the same as full node here + // @ts-ignore getTransactions: ( searchKey: { script: CKBComponents.Script; scriptType: CKBRPC.ScriptType; blockRange: [HexString, HexString] }, order: 'asc' | 'desc', @@ -164,7 +166,10 @@ export class LightRPC extends Base { }) Object.keys(this.rpcProperties).forEach(name => { - this.addMethod({ name, ...this.rpcProperties[name] }) + // don't add default getTransactions method + if (name !== 'getTransactions') { + this.addMethod({ name, ...this.rpcProperties[name] }) + } }) this.setScripts = new Method(this.node, { name: 'setScripts', ...lightRPCProperties['setScripts'] }).call diff --git a/packages/neuron-wallet/src/utils/signWitnesses.ts b/packages/neuron-wallet/src/utils/signWitnesses.ts new file mode 100644 index 0000000000..0efade4466 --- /dev/null +++ b/packages/neuron-wallet/src/utils/signWitnesses.ts @@ -0,0 +1,46 @@ +import { bytes, number } from '@ckb-lumos/codec' +import { serializeWitnessArgs } from './serialization' +import { CKBHasher } from '@ckb-lumos/base/lib/utils' +import { key } from '@ckb-lumos/hd' + +type StructuredWitness = CKBComponents.WitnessArgs | CKBComponents.Witness + +// https://github.com/nervosnetwork/ckb-system-scripts/wiki/How-to-sign-transaction#signing +export const signWitnesses = ({ + witnesses, + transactionHash, + privateKey, +}: { + witnesses: StructuredWitness[] + transactionHash: string + privateKey: string +}): StructuredWitness[] => { + if (witnesses.length === 0) { + throw new Error('witnesses cannot be empty') + } + if (typeof witnesses[0] !== 'object') { + throw new Error('The first witness in the group should be type of WitnessArgs') + } + + const emptyWitness = { + ...witnesses[0], + lock: `0x${'00'.repeat(65)}`, + } + const serializedEmptyWitnessBytes = bytes.bytify(serializeWitnessArgs(emptyWitness)) + const serializedEmptyWitnessSize = serializedEmptyWitnessBytes.byteLength + + const hasher = new CKBHasher() + hasher.update(transactionHash) + hasher.update(number.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(witnessBytes) + }) + const message = hasher.digestHex() + + emptyWitness.lock = key.signRecoverable(message, privateKey) + return [serializeWitnessArgs(emptyWitness), ...witnesses.slice(1)] +} diff --git a/packages/neuron-wallet/tests/services/tx-wallet.test.ts b/packages/neuron-wallet/tests/services/tx-wallet.test.ts index d9730351e1..95ebaaa9ad 100644 --- a/packages/neuron-wallet/tests/services/tx-wallet.test.ts +++ b/packages/neuron-wallet/tests/services/tx-wallet.test.ts @@ -3,8 +3,8 @@ import Keystore from '../../src/models/keys/keystore' import Keychain from '../../src/models/keys/keychain' import { mnemonicToSeedSync } from '../../src/models/keys/mnemonic' import { ExtendedPrivateKey, AccountExtendedPublicKey } from '../../src/models/keys/key' -import CKB from '@nervosnetwork/ckb-sdk-core' import TransactionSender from '../../src/services/transaction-sender' +import { signWitnesses } from '../../src/utils/signWitnesses' describe('sign witness', () => { const witness = { @@ -19,8 +19,8 @@ describe('sign witness', () => { ] it('success', () => { - const ckb = new CKB('') - const newWitness = ckb.signWitnesses(privateKey)({ + const newWitness = signWitnesses({ + privateKey, witnesses: [witness], transactionHash: txHash, }) 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 38d05acf02..d49154203d 100644 --- a/packages/neuron-wallet/tests/services/tx/transaction-sender.test.ts +++ b/packages/neuron-wallet/tests/services/tx/transaction-sender.test.ts @@ -132,11 +132,16 @@ jest.doMock('services/hardware', () => ({ }), })) -jest.doMock('@nervosnetwork/ckb-sdk-core', () => { - return function () { - return { - calculateDaoMaximumWithdraw: stubbedCalculateDaoMaximumWithdraw, - } +jest.doMock('@ckb-lumos/rpc', () => { + return { + CKBRPC: class CKBRPC { + url: string + constructor(url: string) { + this.url = url + } + + calculateDaoMaximumWithdraw = stubbedCalculateDaoMaximumWithdraw + }, } }) 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 f198f60abe..3d34af281d 100644 --- a/packages/neuron-wallet/tests/services/tx/transaction-service.test.ts +++ b/packages/neuron-wallet/tests/services/tx/transaction-service.test.ts @@ -33,18 +33,20 @@ jest.mock('../../../src/services/rpc-service', () => { }) const ckbRpcExecMock = jest.fn() +jest.mock('@ckb-lumos/rpc', () => { + return { + CKBRPC: class CKBRPC { + url: string + constructor(url: string) { + this.url = url + } -jest.mock('@nervosnetwork/ckb-sdk-core', () => { - return function () { - return { - rpc: { - createBatchRequest() { - return { - exec: ckbRpcExecMock, - } - }, - }, - } + createBatchRequest() { + return { + exec: ckbRpcExecMock, + } + } + }, } }) diff --git a/yarn.lock b/yarn.lock index 5acc5f4844..97b1acf864 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1373,7 +1373,7 @@ dependencies: regenerator-runtime "^0.13.11" -"@babel/runtime@^7.22.5": +"@babel/runtime@^7.20.6": version "7.23.2" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.23.2.tgz#062b0ac103261d68a966c4c7baf2ae3e62ec3885" integrity sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg== @@ -1449,97 +1449,101 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@ckb-lumos/base@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/base/-/base-0.20.0-alpha.3.tgz#5cc257b708e4fc894f11028ec46616fb4750fc49" - integrity sha512-O0fycJlBPZQdCAma2KrQdBAP2O0UxaTwczwPgw2lPRqSlE5wdXigJYcN8mdsnWd8YycaKr1FUb2j0hPpVwflog== +"@ckb-lumos/base@0.21.0-next.1", "@ckb-lumos/base@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/base/-/base-0.21.0-next.1.tgz#ad82d0147c479b84bc0e80c3e32ad6a39ee75285" + integrity sha512-dJL3pqa28oJcNfYLNOuWRIJCeWhUq9l7l2/SZItb9wIT4MX5pD0Z1tA8/s9qbvwmmsab+QGKaLCHXNNeOvS0hg== dependencies: - "@ckb-lumos/bi" "0.20.0-alpha.3" - "@ckb-lumos/codec" "0.20.0-alpha.3" - "@ckb-lumos/toolkit" "0.20.0-alpha.3" + "@ckb-lumos/bi" "0.21.0-next.1" + "@ckb-lumos/codec" "0.21.0-next.1" + "@ckb-lumos/toolkit" "0.21.0-next.1" "@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.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/bi/-/bi-0.20.0-alpha.3.tgz#7c20776558d33b838e54550be22ff8eed909a3e4" - integrity sha512-/sGxpnkESboLQyT17UEni4Qw5DnpXw8hjuckAfiG8Hopv2fIaDdrDup613AGzmAkaWMr2Z4DK6tP6x0qR7feSw== +"@ckb-lumos/bi@0.21.0-next.1", "@ckb-lumos/bi@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/bi/-/bi-0.21.0-next.1.tgz#357b8da31882ab5e3e3f8aca54c30dd576e4544d" + integrity sha512-FaMKBbtr826upcEVYt9/K/hutxHySD21t7ut5yv8lfj6LYcg6hWjtrbCM2INVV6/8HatfAf8YV2KsNRaluyt3A== dependencies: jsbi "^4.1.0" -"@ckb-lumos/ckb-indexer@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/ckb-indexer/-/ckb-indexer-0.20.0-alpha.3.tgz#6d20f59b197d90ff83f8c73508416019a49a4865" - integrity sha512-kjcpEEq3cWytEcTg52/8WFn5LnXu41IL0ZevTdTk2Nl8ul3VPbuyJa1dwmJZb0uahye3kNb/dtqmE7xOKXbYuA== +"@ckb-lumos/ckb-indexer@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/ckb-indexer/-/ckb-indexer-0.21.0-next.1.tgz#bc2fd6fcd2c482040565c255d7a9f8fd9269b462" + integrity sha512-ftT8Rodv/oXIOZLfsXEOLQnHy05c8Wj3h6QasXPlZlRGMdtWrThGz+XVI6lz4VSIfVMPSbwnYT+Dv7bf8fDfdw== dependencies: - "@ckb-lumos/base" "0.20.0-alpha.3" - "@ckb-lumos/bi" "0.20.0-alpha.3" - "@ckb-lumos/rpc" "0.20.0-alpha.3" - "@ckb-lumos/toolkit" "0.20.0-alpha.3" + "@ckb-lumos/base" "0.21.0-next.1" + "@ckb-lumos/bi" "0.21.0-next.1" + "@ckb-lumos/codec" "0.21.0-next.1" + "@ckb-lumos/rpc" "0.21.0-next.1" + "@ckb-lumos/toolkit" "0.21.0-next.1" cross-fetch "^3.1.5" events "^3.3.0" -"@ckb-lumos/codec@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/codec/-/codec-0.20.0-alpha.3.tgz#e177efc177cc9200c793b52281ab5bdf350b40ef" - integrity sha512-d+Au9tPjV3SKHIVJ/YG0ScpMPLrt1fCUwm16QTm0qcZuBljLdsSow8PyxmLWhHEatiQV13TuR9ZcOHxdufX7+A== +"@ckb-lumos/codec@0.21.0-next.1", "@ckb-lumos/codec@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/codec/-/codec-0.21.0-next.1.tgz#a75f5331026039799afb4f3419bea388e220d26c" + integrity sha512-b1w4wbIAbuYngNTKtu6np93EYgnmM4tb6NGdaYN0vZ3kyunlODkLWyRHyMo+FGeBdWQjBwBbmxGNyXwDxtTEGQ== dependencies: - "@ckb-lumos/bi" "0.20.0-alpha.3" + "@ckb-lumos/bi" "0.21.0-next.1" -"@ckb-lumos/config-manager@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/config-manager/-/config-manager-0.20.0-alpha.3.tgz#160b02e46074b75bfd6065b5eeb9546739649e88" - integrity sha512-NUF6p313dbqUhoxt+J/nTF3fkLb5Tg7PPu8oknBdpi3GudeSJfEX4SuenTqLh5kaely39dSRjB0adHXnDvFzpQ== +"@ckb-lumos/config-manager@0.21.0-next.1", "@ckb-lumos/config-manager@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/config-manager/-/config-manager-0.21.0-next.1.tgz#927e21a5d9450155ebf766422a707fd3b0856a14" + integrity sha512-G8CO+q1RH/Gt8ou8p/N99AUh5hIdU+MZcTZHwABOa4CLbXk2xFenRfeGhHv4u4ddYZ3SLx1zND7pSnbImmrh2A== dependencies: - "@ckb-lumos/base" "0.20.0-alpha.3" - "@ckb-lumos/bi" "0.20.0-alpha.3" - "@ckb-lumos/codec" "0.20.0-alpha.3" + "@ckb-lumos/base" "0.21.0-next.1" + "@ckb-lumos/bi" "0.21.0-next.1" + "@ckb-lumos/codec" "0.21.0-next.1" "@types/deep-freeze-strict" "^1.1.0" deep-freeze-strict "^1.1.1" -"@ckb-lumos/hd@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/hd/-/hd-0.20.0-alpha.3.tgz#608bded07aed41f71bda40e4f66af365a9ab18db" - integrity sha512-ladOBv4CPdW3q6fZorMIBpavzKII12ClAs7jvjtub8/CPziJAdTW0o62UFBvP1zt51eG0nP/NObuHzAos3pJnw== +"@ckb-lumos/hd@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/hd/-/hd-0.21.0-next.1.tgz#ffa4b80b974187982bbfa280138ca1dab0b2df0e" + integrity sha512-gISrSs4OWoBVecRnYMfjYQc83aE0Khjjs1KmAkAg1J53PWGeU3kjbUQSCHjF6poFL5ylEARX9vOKixRfm6nktg== dependencies: - "@ckb-lumos/base" "0.20.0-alpha.3" - "@ckb-lumos/bi" "0.20.0-alpha.3" + "@ckb-lumos/base" "0.21.0-next.1" + "@ckb-lumos/bi" "0.21.0-next.1" 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.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/helpers/-/helpers-0.20.0-alpha.3.tgz#17e715664b871fdb0b20cc9d146b0ccb3a7e288e" - integrity sha512-KGOwxWLP5ut+3RJ0qv974Fpy/KPWtJydlFaRPgkBlpJYfhrds809CO/27oAw8R8TZm+tg+ovu+9Qq75l2PNkwA== +"@ckb-lumos/helpers@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/helpers/-/helpers-0.21.0-next.1.tgz#f0f2d9e231f5a266d53df0c60e7b7610b87e10b5" + integrity sha512-lSvn2L97be7IlONFTdjjz+/jG6QlpEGyETyrcSfJxeOOtgjicPFaLXLnaTBIt/IElRZ2ZpclbTFvSNcbVOvKdQ== dependencies: - "@ckb-lumos/base" "0.20.0-alpha.3" - "@ckb-lumos/bi" "0.20.0-alpha.3" - "@ckb-lumos/config-manager" "0.20.0-alpha.3" - "@ckb-lumos/toolkit" "0.20.0-alpha.3" + "@ckb-lumos/base" "0.21.0-next.1" + "@ckb-lumos/bi" "0.21.0-next.1" + "@ckb-lumos/codec" "0.21.0-next.1" + "@ckb-lumos/config-manager" "0.21.0-next.1" + "@ckb-lumos/toolkit" "0.21.0-next.1" bech32 "^2.0.0" - immutable "^4.0.0-rc.12" + immutable "^4.3.0" -"@ckb-lumos/rpc@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/rpc/-/rpc-0.20.0-alpha.3.tgz#e1c7d1aaaaedfca1d7da75aac699ffd2fa060cc5" - integrity sha512-Y2tEFhPNNiPeYOknm4ymsoyz9vbXUxMeGnszIOzCckvMQ2/go/0qJCYqOLhUho+ETPC3DGqlurRRc6Y4NMk6zQ== +"@ckb-lumos/rpc@0.21.0-next.1", "@ckb-lumos/rpc@^0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/rpc/-/rpc-0.21.0-next.1.tgz#f31610fc1713ae63e25475d3653ee8cc3eeabc0f" + integrity sha512-6IjnME2wGg1rmVnajQ7CTBqbLnXkdNqRERRmnD1J9EnoHBc+onSYSfkC58ZCVCOe0xZIR2vNKmOUQ++dmlKKiQ== dependencies: - "@ckb-lumos/base" "0.20.0-alpha.3" - "@ckb-lumos/bi" "0.20.0-alpha.3" + "@ckb-lumos/base" "0.21.0-next.1" + "@ckb-lumos/bi" "0.21.0-next.1" "@vespaiach/axios-fetch-adapter" "^0.3.1" axios "0.27.2" tslib "2.3.1" -"@ckb-lumos/toolkit@0.20.0-alpha.3": - version "0.20.0-alpha.3" - resolved "https://registry.yarnpkg.com/@ckb-lumos/toolkit/-/toolkit-0.20.0-alpha.3.tgz#17ccd898abf00a601a58d4776031bc8de0df7a8e" - integrity sha512-mDwrYcu34o1rRd1YhWKW7ye0SK+9cQRyB/LnxXE7L/8iNIl9JgaIUGRjIoQr2+OPxzUxorvCEwgh1WzywNrZmQ== +"@ckb-lumos/toolkit@0.21.0-next.1": + version "0.21.0-next.1" + resolved "https://registry.yarnpkg.com/@ckb-lumos/toolkit/-/toolkit-0.21.0-next.1.tgz#f8ce7b5fa5b388f1870efd309a114f3df2e74c61" + integrity sha512-CBnRM8Y0P6TV0FjACmaAz2YcPiIlcwJlU1tXDtcpzp4fcGL4uSMTcrJwFqWB8OE2s12EfN4+d0Ie4bn8/uq1Fg== + dependencies: + "@ckb-lumos/bi" "0.21.0-next.1" "@cnakazawa/watch@^1.0.3": version "1.0.4" @@ -4563,7 +4567,7 @@ "@types/history" "^4.7.11" "@types/react" "*" -"@types/react@*", "@types/react@17.0.62", "@types/react@>=16", "@types/react@^16", "@types/react@^17": +"@types/react@*", "@types/react@17.0.62", "@types/react@>=16", "@types/react@^17": version "17.0.62" resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.62.tgz#2efe8ddf8533500ec44b1334dd1a97caa2f860e3" integrity sha512-eANCyz9DG8p/Vdhr0ZKST8JV12PhH2ACCDYlFw6DIO+D+ca+uP4jtEDEpVqXZrh/uZdXQGwk7whJa3ah5DtyLw== @@ -4572,6 +4576,15 @@ "@types/scheduler" "*" csstype "^3.0.2" +"@types/react@^16": + version "16.14.49" + resolved "https://registry.yarnpkg.com/@types/react/-/react-16.14.49.tgz#79347898927bf72b758237b2da1c11efce50894d" + integrity sha512-WHKMS4fIlDpeLVKCGDs5k1MTCyqh1tyFhGqouSFgpPsCsWNDTtiMpTYUcJnHg66kp03ubqb4BFjd5+7gS3MyHw== + dependencies: + "@types/prop-types" "*" + "@types/scheduler" "*" + csstype "^3.0.2" + "@types/resolve@1.17.1": version "1.17.1" resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-1.17.1.tgz#3afd6ad8967c77e4376c598a82ddd58f46ec45d6" @@ -10502,10 +10515,10 @@ immutable@^4.0.0: resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.0.tgz#eb1738f14ffb39fd068b1dbe1296117484dd34be" integrity sha512-0AOCmOip+xgJwEVTQj1EfiDDOkPmuyllDuTuEX+DDXUgapLAsBIfkg3sxCYyCEA8mQqZrrxPUGjcOQ2JS3WLkg== -immutable@^4.0.0-rc.12: - version "4.3.2" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.2.tgz#f89d910f8dfb6e15c03b2cae2faaf8c1f66455fe" - integrity sha512-oGXzbEDem9OOpDWZu88jGiYCvIsLHMvGw+8OXlpsvTFvIQplQbjg1B1cvKg8f7Hoch6+NGjpPsH1Fr+Mc2D1aA== +immutable@^4.3.0: + version "4.3.4" + resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.3.4.tgz#2e07b33837b4bb7662f288c244d1ced1ef65a78f" + integrity sha512-fsXeu4J4i6WNWSikpI88v/PcVflZz+6kMhUfIwc5SY+poQRPnaf5V7qds6SUyUN3cVxEzuCab7QIoLOQ+DQ1wA== import-fresh@^3.0.0, import-fresh@^3.1.0, import-fresh@^3.2.1: version "3.3.0" @@ -15262,12 +15275,12 @@ react-error-overlay@^6.0.11: resolved "https://registry.yarnpkg.com/react-error-overlay/-/react-error-overlay-6.0.11.tgz#92835de5841c5cf08ba00ddd2d677b6d17ff9adb" integrity sha512-/6UZ2qgEyH2aqzYZgQPxEnz33NJ2gNsnHA2o5+o4wW9bLM/JYQitNP9xPhsXwC08hMMovfGe/8retsdDsczPRg== -react-i18next@12.1.5, react-i18next@>=11.16.4: - version "13.2.2" - resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-13.2.2.tgz#b1e78ed66a54f4bc819616f68b98221e1b1a1936" - integrity sha512-+nFUkbRByFwnrfDcYqvzBuaeZb+nACHx+fAWN/pZMddWOCJH5hoc21+Sa/N/Lqi6ne6/9wC/qRGOoQhJa6IkEQ== +react-i18next@12.1.5: + version "12.1.5" + resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-12.1.5.tgz#b65f5733dd2f96188a9359c009b7dbe27443f009" + integrity sha512-7PQAv6DA0TcStG96fle+8RfTwxVbHVlZZJPoEszwUNvDuWpGldJmNWa3ZPesEsZQZGF6GkzwvEh6p57qpFD2gQ== dependencies: - "@babel/runtime" "^7.22.5" + "@babel/runtime" "^7.20.6" html-parse-stringify "^3.0.1" react-inspector@^6.0.0, react-inspector@^6.0.1: @@ -17817,7 +17830,7 @@ url-parse@^1.5.3: querystringify "^2.1.1" requires-port "^1.0.0" -usb@1.8.8, usb@^1.7.0: +usb@^1.7.0: version "1.8.8" resolved "https://registry.yarnpkg.com/usb/-/usb-1.8.8.tgz#54de33f9e57dc4efc1b5b5f72b6624a275775e80" integrity sha512-xpRAoek268RE3ATqK8l6LjrF4ADHn/A3V3cXEFbYo3/D83ZCLSO0A5tFKO093F4w5IbDfBVlB9VsYzoGz6EJGw==