@@ -18,7 +18,7 @@ import { RemoteFlags } from '../../../flags'
18
18
import * as ui from '../../../ui'
19
19
import { getAssetsByIDs , useAccount } from '../../../utils'
20
20
import { extractChainportDataFromTransaction } from '../../../utils/chainport'
21
- import { Format , TableCols } from '../../../utils/table'
21
+ import { TableCols , TableOutput } from '../../../utils/table'
22
22
23
23
const { sort : _ , ...tableFlags } = ui . TableFlags
24
24
@@ -57,7 +57,7 @@ export class TransactionsCommand extends IronfishCommand {
57
57
description : 'Include data from transaction output notes' ,
58
58
} ) ,
59
59
format : Flags . string ( {
60
- description : 'output in a more machine friendly format ' ,
60
+ description : 'show the data in a specified view ' ,
61
61
exclusive : [ 'notes' ] ,
62
62
options : [ 'notes' , 'transactions' , 'transfers' ] ,
63
63
helpGroup : 'OUTPUT' ,
@@ -67,14 +67,14 @@ export class TransactionsCommand extends IronfishCommand {
67
67
async start ( ) : Promise < void > {
68
68
const { flags } = await this . parse ( TransactionsCommand )
69
69
70
- const format : Format =
70
+ const output : TableOutput =
71
71
flags . csv || flags . output === 'csv'
72
- ? Format . csv
72
+ ? TableOutput . csv
73
73
: flags . output === 'json'
74
- ? Format . json
75
- : Format . cli
74
+ ? TableOutput . json
75
+ : TableOutput . cli
76
76
77
- const output =
77
+ const format =
78
78
flags . notes || flags . format === 'notes'
79
79
? 'notes'
80
80
: flags . format === 'transactions'
@@ -115,7 +115,7 @@ export class TransactionsCommand extends IronfishCommand {
115
115
flags . limit ,
116
116
flags . offset ,
117
117
flags . confirmations ,
118
- output === 'notes' || output === 'transfers' ,
118
+ format === 'notes' || format === 'transfers' ,
119
119
)
120
120
121
121
let hasTransactions = false
@@ -126,7 +126,7 @@ export class TransactionsCommand extends IronfishCommand {
126
126
break
127
127
}
128
128
129
- if ( output === 'notes' || output === 'transfers' ) {
129
+ if ( format === 'notes' || format === 'transfers' ) {
130
130
Assert . isNotUndefined ( transaction . notes )
131
131
132
132
const assetLookup = await getAssetsByIDs (
@@ -148,8 +148,8 @@ export class TransactionsCommand extends IronfishCommand {
148
148
assetLookup ,
149
149
accountsByAddress ,
150
150
transaction ,
151
- format ,
152
151
output ,
152
+ format ,
153
153
) ,
154
154
)
155
155
} else {
@@ -160,13 +160,13 @@ export class TransactionsCommand extends IronfishCommand {
160
160
flags . confirmations ,
161
161
)
162
162
transactionRows = transactionRows . concat (
163
- this . getTransactionRows ( assetLookup , transaction , format ) ,
163
+ this . getTransactionRows ( assetLookup , transaction , output ) ,
164
164
)
165
165
}
166
166
hasTransactions = true
167
167
}
168
168
169
- const columns = this . getColumns ( flags . extended , output , format )
169
+ const columns = this . getColumns ( flags . extended , format , output )
170
170
171
171
ui . table ( transactionRows , columns , {
172
172
printLine : this . log . bind ( this ) ,
@@ -208,7 +208,7 @@ export class TransactionsCommand extends IronfishCommand {
208
208
getTransactionRows (
209
209
assetLookup : { [ key : string ] : RpcAsset } ,
210
210
transaction : GetAccountTransactionsResponse ,
211
- format : Format ,
211
+ output : TableOutput ,
212
212
) : PartialRecursive < TransactionRow > [ ] {
213
213
const nativeAssetId = Asset . nativeId ( ) . toString ( 'hex' )
214
214
@@ -233,7 +233,7 @@ export class TransactionsCommand extends IronfishCommand {
233
233
234
234
// exclude the native asset in cli output if no amount was sent/received
235
235
// and it was not the only asset exchanged
236
- if ( format === Format . cli && amount === 0n && assetCount > 1 ) {
236
+ if ( output === TableOutput . cli && amount === 0n && assetCount > 1 ) {
237
237
assetCount -= 1
238
238
continue
239
239
}
@@ -251,7 +251,7 @@ export class TransactionsCommand extends IronfishCommand {
251
251
}
252
252
253
253
// include full transaction details in first row or non-cli-formatted output
254
- if ( transactionRows . length === 0 || format !== Format . cli ) {
254
+ if ( transactionRows . length === 0 || output !== TableOutput . cli ) {
255
255
transactionRows . push ( {
256
256
...transaction ,
257
257
...transactionRow ,
@@ -269,8 +269,8 @@ export class TransactionsCommand extends IronfishCommand {
269
269
assetLookup : { [ key : string ] : RpcAsset } ,
270
270
accountLookup : Map < string , string > ,
271
271
transaction : GetAccountTransactionsResponse ,
272
- format : Format ,
273
- output : 'notes' | 'transactions' | 'transfers' ,
272
+ output : TableOutput ,
273
+ format : 'notes' | 'transactions' | 'transfers' ,
274
274
) : PartialRecursive < TransactionRow > [ ] {
275
275
Assert . isNotUndefined ( transaction . notes )
276
276
const transactionRows = [ ]
@@ -297,7 +297,7 @@ export class TransactionsCommand extends IronfishCommand {
297
297
298
298
let group = this . getRowGroup ( index , noteCount , transactionRows . length )
299
299
300
- if ( output === 'transfers' ) {
300
+ if ( format === 'transfers' ) {
301
301
if ( note . sender === note . owner && ! transaction . mints . length ) {
302
302
continue
303
303
} else {
@@ -306,7 +306,7 @@ export class TransactionsCommand extends IronfishCommand {
306
306
}
307
307
308
308
// include full transaction details in first row or non-cli-formatted output
309
- if ( transactionRows . length === 0 || format !== Format . cli ) {
309
+ if ( transactionRows . length === 0 || output !== TableOutput . cli ) {
310
310
transactionRows . push ( {
311
311
...transaction ,
312
312
group,
@@ -345,7 +345,7 @@ export class TransactionsCommand extends IronfishCommand {
345
345
getColumns (
346
346
extended : boolean ,
347
347
output : 'notes' | 'transactions' | 'transfers' ,
348
- format : Format ,
348
+ format : TableOutput ,
349
349
) : ui . TableColumns < PartialRecursive < TransactionRow > > {
350
350
let columns : ui . TableColumns < PartialRecursive < TransactionRow > > = {
351
351
timestamp : TableCols . timestamp ( {
@@ -443,7 +443,7 @@ export class TransactionsCommand extends IronfishCommand {
443
443
}
444
444
}
445
445
446
- if ( format === Format . cli ) {
446
+ if ( format === TableOutput . cli ) {
447
447
columns = {
448
448
group : {
449
449
header : '' ,
0 commit comments