Skip to content

Commit 764c54e

Browse files
committed
feat: return all underlying transaction for explorer transaction-details endpoints
1 parent ae2ca26 commit 764c54e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/fasset-indexer-api/src/analytics/explorer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ export class ExplorerAnalytics extends SharedAnalytics {
570570
fasset: core.FAssetType,
571571
reference: string,
572572
filters: FilterQuery<Entities.UnderlyingVoutReference> = {}
573-
): Promise<Entities.UnderlyingVoutReference | null> {
573+
): Promise<Entities.UnderlyingVoutReference | Entities.UnderlyingVoutReference[] | null> {
574574
const transactions = await em.find(Entities.UnderlyingVoutReference,
575575
{ fasset, reference, ...filters as object },
576576
{
@@ -580,8 +580,8 @@ export class ExplorerAnalytics extends SharedAnalytics {
580580
)
581581
if (transactions.length == 0) return null
582582
const successful = transactions.filter(x => x.transaction.result == XRP_TRANSACTION_SUCCESS_CODE)
583-
if (successful.length > 0) return successful[0]
584-
return transactions[0]
583+
if (successful.length > 0) return successful.length > 1 ? successful : successful[0]
584+
return transactions.length > 1 ? transactions : transactions[0]
585585
}
586586

587587
protected eventNameToTransactionType(name: string): ExplorerType.TransactionType {

packages/fasset-indexer-api/src/analytics/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ interface TransactionDetails<T,U> {
127127
}
128128

129129
interface EventDetails<T,U> {
130-
underlyingTransaction?: Entities.UnderlyingVoutReference
130+
underlyingTransaction?: Entities.UnderlyingVoutReference | Entities.UnderlyingVoutReference[]
131131
events: {
132132
original: T
133133
resolution?: U

0 commit comments

Comments
 (0)