@@ -9,9 +9,6 @@ use std::{
99
1010use anyhow:: anyhow;
1111use indexer_query:: escrow_account:: { self , EscrowAccountQuery } ;
12- use indexer_query:: escrow_account_v2:: {
13- self as escrow_account_v2, EscrowAccountQuery as EscrowAccountQueryV2 ,
14- } ;
1512use thegraph_core:: alloy:: primitives:: { Address , U256 } ;
1613use thiserror:: Error ;
1714use tokio:: sync:: watch:: Receiver ;
@@ -120,22 +117,16 @@ async fn get_escrow_accounts_v2(
120117 indexer_address : Address ,
121118 reject_thawing_signers : bool ,
122119) -> anyhow:: Result < EscrowAccounts > {
123- // V2 TAP receipts use different field names (payer/service_provider) but the underlying
124- // escrow account model is identical to V1. Both V1 and V2 receipts reference the same
125- // sender addresses and the same escrow relationships.
126- //
127- // The separation of V1/V2 escrow account watchers allows for potential future differences
128- // in escrow models, but currently both query the same subgraph data with identical logic.
129- //
130- // V2 receipt flow:
131- // 1. V2 receipt contains payer address (equivalent to V1 sender)
132- // 2. Receipt is signed by a signer authorized by the payer
133- // 3. Escrow accounts map: signer -> payer (sender) -> balance
134- // 4. Service provider (indexer) receives payments from payer's escrow
120+ // Query V2 escrow accounts from the network subgraph which tracks PaymentsEscrow
121+ // and GraphTallyCollector contract events.
122+
123+ use indexer_query:: network_escrow_account_v2:: {
124+ self as network_escrow_account_v2, NetworkEscrowAccountQueryV2 ,
125+ } ;
135126
136127 let response = escrow_subgraph
137- . query :: < EscrowAccountQueryV2 , _ > ( escrow_account_v2 :: Variables {
138- indexer : format ! ( "{:x?}" , indexer_address) ,
128+ . query :: < NetworkEscrowAccountQueryV2 , _ > ( network_escrow_account_v2 :: Variables {
129+ receiver : format ! ( "{:x?}" , indexer_address) ,
139130 thaw_end_timestamp : if reject_thawing_signers {
140131 U256 :: ZERO . to_string ( )
141132 } else {
@@ -146,7 +137,20 @@ async fn get_escrow_accounts_v2(
146137
147138 let response = response?;
148139
149- tracing:: trace!( "V2 Escrow accounts response: {:?}" , response) ;
140+ tracing:: trace!( "Network V2 Escrow accounts response: {:?}" , response) ;
141+
142+ // V2 TAP receipts use different field names (payer/service_provider) but the underlying
143+ // escrow account model is identical to V1. Both V1 and V2 receipts reference the same
144+ // sender addresses and the same escrow relationships.
145+ //
146+ // V1 queries the TAP subgraph while V2 queries the network subgraph, but both return
147+ // the same escrow account structure for processing.
148+ //
149+ // V2 receipt flow:
150+ // 1. V2 receipt contains payer address (equivalent to V1 sender)
151+ // 2. Receipt is signed by a signer authorized by the payer
152+ // 3. Escrow accounts map: signer -> payer (sender) -> balance
153+ // 4. Service provider (indexer) receives payments from payer's escrow
150154
151155 let senders_balances: HashMap < Address , U256 > = response
152156 . escrow_accounts
0 commit comments