Todas as lições · CCC (TypeScript SDK) · Começa aqui · Glossário
Use findCellsOnChain, not findCells, for block range queries in CCCPráticoVerificada pelo dono
Verificada pelo dono · Verificação: certa · Verificada em 2026-11-19
In CCC, client.findCells merges the client's local cache of cells it has sent, and its search key takes no blockRange filter. To list live cells created in a block range, call client.findCellsOnChain with filter.blockRange set to [from, to), where the end is exclusive. This queries the indexer directly.
Porque importa: With findCells, cells from the client's own sent transactions can show up in a block range query even though they were not created in that range, which corrupts an incremental view built from block ranges.
Padrão
client.findCellsOnChain({ ...search(from, to), withData: true }, 'asc', 100)Tirado do commit, encurtado.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- LusoCryptoLabs/cells-resolver:
test/livenames.test.ts
- Conceitos
- Indexer queries and cell collection
- Evidência
- Verificada pelo dono: verificada pelo dono do projeto de onde veio, que também publica estas lições
- Vista pela primeira vez
- 2026-09-25
- Última mudança
- 2026-09-25
- Última verificação
- 2026-11-19
- Verificação contra o commit
- certa: a lição sai do commit e continua a valer no código de hoje
Fontes (1)
- 2026-09-25 · LusoCryptoLabs/cells-resolver · mais deste projeto
Mais sobre CCC (TypeScript SDK)
- CCC EVM signer exposes several lock addresses via getAddressObjs
- Clear the CCC client cache after a sent transaction loses a double spend race
- Use findCellsOnChain for shared live state
Verificada por @LusoCryptoLabs (dono do projeto), 2026-11-19.
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Use findCellsOnChain, not findCells, for block range queries in CCC", CKB lessons, https://pulse.lusocryptolabs.com/learned/ccc/use-findcellsonchain-not-findcells-for-block-range-queries-i, CC BY 4.0, last changed 2026-09-25.