diff --git a/packages/neuron-wallet/src/services/cells.ts b/packages/neuron-wallet/src/services/cells.ts index 47cd4c9529..fe6d5b2b61 100644 --- a/packages/neuron-wallet/src/services/cells.ts +++ b/packages/neuron-wallet/src/services/cells.ts @@ -52,9 +52,9 @@ export default class CellsService { .getRepository(OutputEntity) .createQueryBuilder('output') .leftJoinAndSelect('output.transaction', 'tx') - .where(`output.status = :status AND output.daoData IS NOT NULL AND output.lockHash in (:...lockHashes) AND tx.blockNumber IS NOT NULL`, { + .where(`output.status <> :deadStatus AND output.daoData IS NOT NULL AND output.lockHash in (:...lockHashes) AND tx.blockNumber IS NOT NULL`, { lockHashes, - status: OutputStatus.Live, + deadStatus: OutputStatus.Dead, }) .orderBy(`CASE output.daoData WHEN '0x0000000000000000' THEN 1 ELSE 0 END`, 'ASC') .addOrderBy('tx.timestamp', 'ASC') @@ -62,21 +62,23 @@ export default class CellsService { const cells = outputs.map(o => o.toInterface()) for (const o of cells) { - const output = await getConnection() - .getRepository(OutputEntity) - .createQueryBuilder('output') - .leftJoinAndSelect('output.transaction', 'tx') - .where(`(output.outPointTxHash, output.outPointIndex) IN (select outPointTxHash, outPointIndex from input where input.transactionHash = :transactionHash)`, { - transactionHash: o.outPoint!.txHash, - }) - .getOne() - - if (output) { - o.depositOutPoint = output.outPoint() + if (o.daoData !== '0x0000000000000000') { + const output = await getConnection() + .getRepository(OutputEntity) + .createQueryBuilder('output') + .leftJoinAndSelect('output.transaction', 'tx') + .where(`(output.outPointTxHash, output.outPointIndex) IN (select outPointTxHash, outPointIndex from input where input.transactionHash = :transactionHash)`, { + transactionHash: o.outPoint!.txHash, + }) + .getOne() + + if (output) { + o.depositOutPoint = output.outPoint() + } } } - return outputs.map(o => o.toInterface()) + return cells } public static getLiveCell = async (outPoint: OutPoint): Promise => {