@@ -72,15 +72,25 @@ export class TransactionsCommand extends IronfishCommand {
72
72
const client = await this . connectRpc ( )
73
73
await ui . checkWalletUnlocked ( client )
74
74
75
+ const allAccounts = ( await client . wallet . getAccounts ( ) ) . content . accounts
76
+
75
77
let accounts = flags . account
76
78
if ( flags [ 'no-account' ] ) {
77
- const response = await client . wallet . getAccounts ( )
78
- accounts = response . content . accounts
79
+ accounts = allAccounts
79
80
} else if ( ! accounts ) {
80
81
const account = await useAccount ( client , undefined )
81
82
accounts = [ account ]
82
83
}
83
84
85
+ const accountsByAddress = new Map < string , string > (
86
+ await Promise . all (
87
+ allAccounts . map < Promise < [ string , string ] > > ( async ( account ) => {
88
+ const response = await client . wallet . getAccountPublicKey ( { account } )
89
+ return [ response . content . publicKey , response . content . account ]
90
+ } ) ,
91
+ ) ,
92
+ )
93
+
84
94
const networkId = ( await client . chain . getNetworkInfo ( ) ) . content . networkId
85
95
86
96
const transactions = this . getTransactions (
@@ -120,7 +130,7 @@ export class TransactionsCommand extends IronfishCommand {
120
130
}
121
131
122
132
transactionRows = transactionRows . concat (
123
- this . getTransactionRowsByNote ( assetLookup , transaction , format ) ,
133
+ this . getTransactionRowsByNote ( assetLookup , accountsByAddress , transaction , format ) ,
124
134
)
125
135
} else {
126
136
const assetLookup = await getAssetsByIDs (
@@ -235,6 +245,7 @@ export class TransactionsCommand extends IronfishCommand {
235
245
236
246
getTransactionRowsByNote (
237
247
assetLookup : { [ key : string ] : RpcAsset } ,
248
+ accountLookup : Map < string , string > ,
238
249
transaction : GetAccountTransactionsResponse ,
239
250
format : Format ,
240
251
) : PartialRecursive < TransactionRow > [ ] {
@@ -258,6 +269,8 @@ export class TransactionsCommand extends IronfishCommand {
258
269
const sender = note . sender
259
270
const recipient = note . owner
260
271
const memo = note . memo
272
+ const senderName = accountLookup . get ( note . sender )
273
+ const recipientName = accountLookup . get ( note . owner )
261
274
262
275
const group = this . getRowGroup ( index , noteCount , transactionRows . length )
263
276
@@ -273,7 +286,9 @@ export class TransactionsCommand extends IronfishCommand {
273
286
amount,
274
287
feePaid,
275
288
sender,
289
+ senderName,
276
290
recipient,
291
+ recipientName,
277
292
memo,
278
293
} )
279
294
} else {
@@ -285,7 +300,9 @@ export class TransactionsCommand extends IronfishCommand {
285
300
assetSymbol,
286
301
amount,
287
302
sender,
303
+ senderName,
288
304
recipient,
305
+ recipientName,
289
306
memo,
290
307
} )
291
308
}
@@ -372,10 +389,18 @@ export class TransactionsCommand extends IronfishCommand {
372
389
if ( notes ) {
373
390
columns = {
374
391
...columns ,
392
+ senderName : {
393
+ header : 'Sender' ,
394
+ get : ( row ) => row . senderName ?? '' ,
395
+ } ,
375
396
sender : {
376
397
header : 'Sender Address' ,
377
398
get : ( row ) => row . sender ?? '' ,
378
399
} ,
400
+ recipientName : {
401
+ header : 'Recipient' ,
402
+ get : ( row ) => row . recipientName ?? '' ,
403
+ } ,
379
404
recipient : {
380
405
header : 'Recipient Address' ,
381
406
get : ( row ) => row . recipient ?? '' ,
@@ -435,6 +460,8 @@ type TransactionRow = {
435
460
expiration : number
436
461
submittedSequence : number
437
462
sender : string
463
+ senderName ?: string
438
464
recipient : string
465
+ recipientName ?: string
439
466
memo ?: string
440
467
}
0 commit comments