Skip to content

Commit 108d5b1

Browse files
committed
feat: add depositTimestamp
1 parent 98ba68d commit 108d5b1

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

packages/neuron-wallet/src/services/cells.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CapacityNotEnough, CapacityNotEnoughForChange } from 'exceptions'
55
import { OutputStatus } from './tx/params'
66
import FeeMode from 'models/fee-mode'
77
import { TransactionStatus } from 'types/cell-types'
8+
import TransactionEntity from 'database/chain/entities/transaction'
89

910
export const MIN_CELL_CAPACITY = '6100000000'
1011

@@ -55,6 +56,25 @@ export default class CellsService {
5556

5657
const cells = outputs.map(o => o.toInterface())
5758

59+
const txHashes = outputs.map(output => output.depositTxHash).filter(hash => !!hash)
60+
61+
const txs = await getConnection()
62+
.getRepository(TransactionEntity)
63+
.createQueryBuilder('tx')
64+
.where({
65+
hash: In(txHashes)
66+
})
67+
.getMany()
68+
69+
for (const output of cells) {
70+
if (output.depositOutPoint) {
71+
const tx = txs.filter(t => t.hash === output.depositOutPoint!.txHash)[0]
72+
if (tx) {
73+
output.depositTimestamp = tx.timestamp
74+
}
75+
}
76+
}
77+
5878
return cells
5979
}
6080

packages/neuron-wallet/src/types/cell-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export interface Cell {
105105
blockNumber?: string | null
106106
blockHash?: string | null
107107
depositOutPoint?: OutPoint
108+
depositTimestamp?: string
108109
}
109110

110111
export interface OutPoint {

0 commit comments

Comments
 (0)