Skip to content

Commit

Permalink
fix: Better way to create QueryOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
yanguoyu committed Dec 3, 2023
1 parent daffc24 commit ff4b013
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 4 additions & 7 deletions packages/neuron-wallet/src/block-sync-renderer/sync/connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,11 @@ export abstract class Connector {
throw new Error('at least one parameter is required')
}

const queries: QueryOptions = {}
if (lock) {
queries.lock = lock
const queries: QueryOptions = {
...(lock ? { lock } : {}),
...(type ? { type } : {}),
data: data || 'any',
}
if (type) {
queries.type = type
}
queries.data = data || 'any'

const collector = new CellCollector(this.indexer, queries)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Tip } from '@ckb-lumos/base'
import { Indexer as CkbIndexer } from '@ckb-lumos/ckb-indexer'
import logger from '../../utils/logger'
import CommonUtils from '../../utils/common'
import RpcService from '../../services/rpc-service'
Expand All @@ -13,7 +12,6 @@ export default class IndexerConnector extends Connector {

constructor(addresses: Address[], nodeUrl: string, indexerUrl: string, nodeType: NetworkType) {
super({ addresses, nodeUrl, indexerUrl })
this.indexer = new CkbIndexer(nodeUrl, indexerUrl)
this.rpcService = new RpcService(nodeUrl, nodeType)
}

Expand Down

0 comments on commit ff4b013

Please sign in to comment.