@@ -9,9 +9,6 @@ use std::{
9
9
10
10
use anyhow:: anyhow;
11
11
use indexer_query:: escrow_account:: { self , EscrowAccountQuery } ;
12
- use indexer_query:: escrow_account_v2:: {
13
- self as escrow_account_v2, EscrowAccountQuery as EscrowAccountQueryV2 ,
14
- } ;
15
12
use thegraph_core:: alloy:: primitives:: { Address , U256 } ;
16
13
use thiserror:: Error ;
17
14
use tokio:: sync:: watch:: Receiver ;
@@ -120,22 +117,16 @@ async fn get_escrow_accounts_v2(
120
117
indexer_address : Address ,
121
118
reject_thawing_signers : bool ,
122
119
) -> 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
+ } ;
135
126
136
127
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) ,
139
130
thaw_end_timestamp : if reject_thawing_signers {
140
131
U256 :: ZERO . to_string ( )
141
132
} else {
@@ -146,7 +137,20 @@ async fn get_escrow_accounts_v2(
146
137
147
138
let response = response?;
148
139
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
150
154
151
155
let senders_balances: HashMap < Address , U256 > = response
152
156
. escrow_accounts
0 commit comments