@@ -10,14 +10,10 @@ use thegraph_core::alloy::{primitives::Address, signers::local::PrivateKeySigner
1010
1111use crate :: {
1212 constants:: {
13- ACCOUNT0_SECRET , CHAIN_ID , GATEWAY_API_KEY , GATEWAY_URL , GRAPH_TALLY_COLLECTOR_CONTRACT ,
14- GRAPH_URL , INDEXER_URL , MAX_RECEIPT_VALUE , SUBGRAPH_ID , TAP_AGENT_METRICS_URL ,
15- TAP_VERIFIER_CONTRACT ,
16- } ,
17- utils:: {
18- create_request, create_tap_receipt, create_tap_receipt_v2, encode_v2_receipt,
19- find_allocation,
13+ ACCOUNT0_SECRET , CHAIN_ID , GATEWAY_API_KEY , GATEWAY_URL , GRAPH_URL , INDEXER_URL ,
14+ MAX_RECEIPT_VALUE , SUBGRAPH_ID , TAP_AGENT_METRICS_URL , TAP_VERIFIER_CONTRACT ,
2015 } ,
16+ utils:: { create_request, create_tap_receipt, find_allocation} ,
2117 MetricsChecker ,
2218} ;
2319
@@ -217,16 +213,11 @@ pub async fn test_invalid_chain_id() -> Result<()> {
217213pub async fn test_tap_rav_v2 ( ) -> Result < ( ) > {
218214 // Setup HTTP client
219215 let http_client = Arc :: new ( Client :: new ( ) ) ;
220- let wallet: PrivateKeySigner = ACCOUNT0_SECRET . parse ( ) . unwrap ( ) ;
221216
222217 // Query the network subgraph to find active allocations
223218 let allocation_id = find_allocation ( http_client. clone ( ) , GRAPH_URL ) . await ?;
224219 let allocation_id = Address :: from_str ( & allocation_id) ?;
225220
226- // For V2, we need payer and service provider addresses
227- let payer = wallet. address ( ) ;
228- let service_provider = allocation_id; // Using allocation_id as service provider for simplicity
229-
230221 // Create a metrics checker
231222 let metrics_checker =
232223 MetricsChecker :: new ( http_client. clone ( ) , TAP_AGENT_METRICS_URL . to_string ( ) ) ;
@@ -261,24 +252,11 @@ pub async fn test_tap_rav_v2() -> Result<()> {
261252 println ! ( "Sending V2 batch {batch} of {BATCHES} with {NUM_RECEIPTS} receipts each..." , ) ;
262253
263254 for i in 0 ..NUM_RECEIPTS {
264- // Create V2 receipt
265- let receipt = create_tap_receipt_v2 (
266- MAX_RECEIPT_VALUE ,
267- & allocation_id,
268- GRAPH_TALLY_COLLECTOR_CONTRACT ,
269- CHAIN_ID ,
270- & wallet,
271- & payer,
272- & service_provider,
273- ) ?;
274-
275- let receipt_encoded = encode_v2_receipt ( & receipt) ?;
276-
255+ // Send plain GraphQL query to gateway - let gateway generate V2 receipt
277256 let response = http_client
278257 . post ( format ! ( "{GATEWAY_URL}/api/subgraphs/id/{SUBGRAPH_ID}" ) )
279258 . header ( "Content-Type" , "application/json" )
280259 . header ( "Authorization" , format ! ( "Bearer {GATEWAY_API_KEY}" ) )
281- . header ( "Tap-Receipt" , receipt_encoded)
282260 . json ( & json ! ( {
283261 "query" : "{ _meta { block { number } } }"
284262 } ) )
@@ -333,24 +311,11 @@ pub async fn test_tap_rav_v2() -> Result<()> {
333311 for i in 0 ..MAX_TRIGGERS {
334312 println ! ( "Sending V2 trigger query {}/{}..." , i + 1 , MAX_TRIGGERS ) ;
335313
336- // Create V2 receipt
337- let receipt = create_tap_receipt_v2 (
338- MAX_RECEIPT_VALUE / 10 , // Smaller value for trigger receipts
339- & allocation_id,
340- GRAPH_TALLY_COLLECTOR_CONTRACT ,
341- CHAIN_ID ,
342- & wallet,
343- & payer,
344- & service_provider,
345- ) ?;
346-
347- let receipt_encoded = encode_v2_receipt ( & receipt) ?;
348-
314+ // Send plain GraphQL query to gateway - let gateway generate V2 receipt
349315 let response = http_client
350316 . post ( format ! ( "{GATEWAY_URL}/api/subgraphs/id/{SUBGRAPH_ID}" ) )
351317 . header ( "Content-Type" , "application/json" )
352318 . header ( "Authorization" , format ! ( "Bearer {GATEWAY_API_KEY}" ) )
353- . header ( "Tap-Receipt" , receipt_encoded)
354319 . json ( & json ! ( {
355320 "query" : "{ _meta { block { number } } }"
356321 } ) )
0 commit comments