@@ -137,12 +137,17 @@ const explorerQueryTransactions = new Map([
137137] )
138138
139139// psql specific query
140- export const EXPLORER_TRANSACTIONS = ( user : boolean , agent : boolean , asc : boolean , window : boolean , methods : TransactionType [ ] ) => `
140+ export const EXPLORER_TRANSACTIONS = (
141+ user : boolean , agent : boolean ,
142+ asc : boolean , window : boolean ,
143+ status : boolean ,
144+ methods : TransactionType [ ]
145+ ) => `
141146SELECT
142147 et.hash, el.name, eb.timestamp, eaa.hex as agent_vault,
143148 am.name as agent_name, eau.hex as user, eao.hex as source,
144149 t.value_uba, t.resolution, ur.id as underlying_payment, COUNT(*) OVER() as count
145- FROM (${ Array . from ( explorerQueryTransactions . entries ( ) ) . filter ( ( [ k , _ ] ) => methods . includes ( k ) ) . map ( ( [ _ , v ] ) => v ) . join ( ' UNION ALL ' ) } ) t
150+ FROM (${ Array . from ( explorerQueryTransactions . entries ( ) ) . filter ( ( [ k , _ ] ) => methods . includes ( k ) ) . map ( ( [ _ , v ] ) => v ) . join ( ' UNION ALL ' ) } ) t
146151FULL JOIN evm_address eau ON eau.id = t.user_id
147152FULL JOIN underlying_reference ur ON ur.reference = t.payment_reference
148153JOIN evm_log el ON el.id = t.evm_log_id
@@ -153,9 +158,11 @@ JOIN evm_address eao ON eao.id = et.source_id
153158JOIN agent_vault av ON av.address_id = t.agent_vault_address_id
154159JOIN agent_owner ao ON av.vaults = ao.id
155160JOIN agent_manager am ON am.address_id = ao.agents
156- ${ user ? 'WHERE eau.hex = ?' : '' }
157- ${ agent ? 'WHERE eaa.hex = ?' : '' }
158- ${ window ? ( ( agent || user ? 'AND' : 'WHERE' ) + ' eb.timestamp BETWEEN ? AND ?' ) : '' }
161+ WHERE 1=1
162+ ${ user ? 'AND eau.hex = ?' : '' }
163+ ${ agent ? 'AND eaa.hex = ?' : '' }
164+ ${ window ? 'AND eb.timestamp BETWEEN ? AND ?' : '' }
165+ ${ status ? 'AND t.resolution = ?' : '' }
159166ORDER BY el.block_index ${ asc ? 'ASC' : 'DESC' }
160167LIMIT ? OFFSET ?
161168`
0 commit comments