@@ -14,7 +14,7 @@ import {
14
14
} from '@ironfish/sdk'
15
15
import { Flags } from '@oclif/core'
16
16
import { IronfishCommand } from '../../../command'
17
- import { RemoteFlags } from '../../../flags'
17
+ import { DateFlag , RemoteFlags } from '../../../flags'
18
18
import * as ui from '../../../ui'
19
19
import { getAssetsByIDs , useAccount } from '../../../utils'
20
20
import { extractChainportDataFromTransaction } from '../../../utils/chainport'
@@ -75,13 +75,11 @@ export class TransactionsCommand extends IronfishCommand {
75
75
options : [ 'notes' , 'transactions' , 'transfers' ] ,
76
76
helpGroup : 'OUTPUT' ,
77
77
} ) ,
78
- 'filter.start' : Flags . string ( {
78
+ 'filter.start' : DateFlag ( {
79
79
description : 'include transactions after this date (inclusive). Example: 2023-04-01' ,
80
- parse : ( input ) => Promise . resolve ( new Date ( input ) . toISOString ( ) ) ,
81
80
} ) ,
82
- 'filter.end' : Flags . string ( {
81
+ 'filter.end' : DateFlag ( {
83
82
description : 'include transactions before this date (exclusive). Example: 2023-05-01' ,
84
- parse : ( input ) => Promise . resolve ( new Date ( input ) . toISOString ( ) ) ,
85
83
} ) ,
86
84
}
87
85
@@ -142,19 +140,16 @@ export class TransactionsCommand extends IronfishCommand {
142
140
let hasTransactions = false
143
141
let transactionRows : PartialRecursive < TransactionRow > [ ] = [ ]
144
142
145
- const filterStart = flags [ 'filter.start' ] && new Date ( flags [ 'filter.start' ] ) . valueOf ( )
146
- const filterEnd = flags [ 'filter.end' ] && new Date ( flags [ 'filter.end' ] ) . valueOf ( )
147
-
148
143
for await ( const { account, transaction } of transactions ) {
149
144
if ( transactionRows . length >= flags . limit ) {
150
145
break
151
146
}
152
147
153
- if ( filterStart && transaction . timestamp < filterStart . valueOf ( ) ) {
148
+ if ( flags [ 'filter.start' ] && transaction . timestamp < flags [ 'filter.start' ] . valueOf ( ) ) {
154
149
continue
155
150
}
156
151
157
- if ( filterEnd && transaction . timestamp >= filterEnd . valueOf ( ) ) {
152
+ if ( flags [ 'filter.end' ] && transaction . timestamp >= flags [ 'filter.end' ] . valueOf ( ) ) {
158
153
continue
159
154
}
160
155
0 commit comments