Todas as lições · Wallets and signing · Começa aqui · Glossário
Count only empty, typeless lock cells as spendable balancePráticoDe uma correção
De uma correção · Verificação: em parte certa · Verificada em 2026-11-19
When computing a wallet's spendable balance from indexer cells under a lock, count only cells with empty output data and no type script as available. A cell with data or any type script (UDT, DOB, profile or attachment cells, not just your own type) holds state, so its capacity stays in the total but is reported as reserved, because spending it would destroy that state. In cemp-mobile this is `const hasData = cell.data !== "0x" && cell.data !== ""; const isProtocol = hasData || type !== null;`.
Porque importa: Without it, data-bearing or typed cells under the wallet's lock are counted as free capacity, so the available balance is overstated and spends or capacity checks can pick cells that hold protocol state.
Um teste mudou no mesmo commit
Está ao lado da correcção. Nós não o corremos.
- toastmanAu/cemp-mobile:
packages/cemp-ckb/src/wallet.test.ts,packages/cemp-database/src/lifecycle.test.ts
- Conceitos
- Indexer queries and cell collection, Capacity and cell size
- Evidência
- De uma correção: de um projeto, verificada contra o commit
- Vista pela primeira vez
- 2026-10-31
- Última mudança
- 2026-10-31
- Última verificação
- 2026-11-19
- Verificação contra o commit
- em parte certa: um núcleo verdadeiro, com uma parte solta ou demasiado larga
Fontes (1)
- 2026-10-31 · toastmanAu/cemp-mobile · mais deste projeto
Mais sobre Wallets and signing
- Address balance via get_cells_capacity with snake_case lock script
- DAO compensation must use the deposit cell's occupied capacity (102 CKB), not 61
- Devnet tests need a real secp256k1 lock to exercise signing
Manténs um projeto de onde esta lição veio? Confirma ou corrige
Citar esta lição
LusoCryptoLabs, "Count only empty, typeless lock cells as spendable balance", CKB lessons, https://pulse.lusocryptolabs.com/learned/wallets/count-only-empty-typeless-lock-cells-as-spendable-balance, CC BY 4.0, last changed 2026-10-31.