@@ -183,7 +183,8 @@ export async function fetchTransactionsByAddressListWithPagination (
183183 pageSize : number ,
184184 orderBy ?: string ,
185185 orderDesc = true ,
186- networkIdsListFilter ?: number [ ]
186+ networkIdsListFilter ?: number [ ] ,
187+ includeInputs = false
187188) : Promise < TransactionsWithPaybuttonsAndPrices [ ] > {
188189 const orderDescString : Prisma . SortOrder = orderDesc ? 'desc' : 'asc'
189190
@@ -209,6 +210,14 @@ export async function fetchTransactionsByAddressListWithPagination (
209210 }
210211 }
211212
213+ // Build include conditionally - exclude inputs by default unless explicitly requested
214+ const include = includeInputs
215+ ? includePaybuttonsAndPricesAndInvoices
216+ : ( ( ) => {
217+ const { inputs, ...rest } = includePaybuttonsAndPricesAndInvoices
218+ return rest
219+ } ) ( )
220+
212221 return await prisma . transaction . findMany ( {
213222 where : {
214223 addressId : {
@@ -220,11 +229,11 @@ export async function fetchTransactionsByAddressListWithPagination (
220229 }
221230 }
222231 } ,
223- include : includePaybuttonsAndPricesAndInvoices ,
232+ include,
224233 orderBy : orderByQuery ,
225234 skip : page * pageSize ,
226235 take : pageSize
227- } )
236+ } ) as unknown as TransactionsWithPaybuttonsAndPrices [ ]
228237}
229238
230239export async function fetchTxCountByAddressString ( addressString : string ) : Promise < number > {
@@ -823,15 +832,19 @@ export async function fetchTransactionsByPaybuttonIdWithPagination (
823832 pageSize : number ,
824833 orderDesc : boolean ,
825834 orderBy ?: string ,
826- networkIds ?: number [ ] ) : Promise < TransactionsWithPaybuttonsAndPrices [ ] > {
835+ networkIds ?: number [ ] ,
836+ includeInputs = false
837+ ) : Promise < TransactionsWithPaybuttonsAndPrices [ ] > {
827838 const addressIdList = await fetchAddressesByPaybuttonId ( paybuttonId )
828839 const transactions = await fetchTransactionsByAddressListWithPagination (
829840 addressIdList ,
830841 page ,
831842 pageSize ,
832843 orderBy ,
833844 orderDesc ,
834- networkIds )
845+ networkIds ,
846+ includeInputs
847+ )
835848
836849 return transactions
837850}
@@ -1005,7 +1018,8 @@ export async function fetchAllPaymentsByUserIdWithPagination (
10051018 buttonIds ?: string [ ] ,
10061019 years ?: string [ ] ,
10071020 startDate ?: string ,
1008- endDate ?: string
1021+ endDate ?: string ,
1022+ includeInputs = false
10091023) : Promise < Payment [ ] > {
10101024 const orderDescString : Prisma . SortOrder = orderDesc ? 'desc' : 'asc'
10111025
@@ -1061,9 +1075,17 @@ export async function fetchAllPaymentsByUserIdWithPagination (
10611075 }
10621076 }
10631077
1078+ // Build include conditionally - exclude inputs by default unless explicitly requested
1079+ const include = includeInputs
1080+ ? includePaybuttonsAndPricesAndInvoices
1081+ : ( ( ) => {
1082+ const { inputs, ...rest } = includePaybuttonsAndPricesAndInvoices
1083+ return rest
1084+ } ) ( )
1085+
10641086 const transactions = await prisma . transaction . findMany ( {
10651087 where,
1066- include : includePaybuttonsAndPricesAndInvoices ,
1088+ include,
10671089 orderBy : orderByQuery ,
10681090 skip : page * Number ( pageSize ) ,
10691091 take : Number ( pageSize )
@@ -1073,7 +1095,7 @@ export async function fetchAllPaymentsByUserIdWithPagination (
10731095 for ( let index = 0 ; index < transactions . length ; index ++ ) {
10741096 const tx = transactions [ index ]
10751097 if ( Number ( tx . amount ) > 0 ) {
1076- const payment = await generatePaymentFromTxWithInvoices ( tx , userId )
1098+ const payment = await generatePaymentFromTxWithInvoices ( tx as unknown as TransactionWithAddressAndPricesAndInvoices , userId )
10771099 transformedData . push ( payment )
10781100 }
10791101 }
0 commit comments