File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change 124124echo " "
125125echo " ========== FUNDING V2 ESCROW =========="
126126
127+ # Query the network subgraph to find the current allocation ID
128+ echo " Querying network subgraph for current allocation ID..."
129+ ALLOCATION_QUERY_RESULT=$( curl -s -X POST http://localhost:8000/subgraphs/name/graph-network \
130+ -H " Content-Type: application/json" \
131+ -d ' {"query": "{ allocations(where: { status: Active }) { id indexer { id } subgraphDeployment { id } } }"}' )
132+
133+ # Extract allocation ID from the JSON response
134+ CURRENT_ALLOCATION_ID=$( echo " $ALLOCATION_QUERY_RESULT " | jq -r ' .data.allocations[0].id' )
135+
136+ if [ " $CURRENT_ALLOCATION_ID " == " null" ] || [ -z " $CURRENT_ALLOCATION_ID " ]; then
137+ echo " ❌ Failed to find current allocation ID from network subgraph"
138+ echo " Response: $ALLOCATION_QUERY_RESULT "
139+ exit 1
140+ fi
141+
142+ echo " ✅ Found current allocation ID: $CURRENT_ALLOCATION_ID "
143+
127144# For V2, we need to specify payer, collector, and receiver
128- # Payer is the test account, but receiver must be the indexer address
145+ # Payer is the test account, collector is the allocation ID, receiver is the indexer
129146PAYER=$SENDER_ADDRESS
130- COLLECTOR=$SENDER_ADDRESS
147+ COLLECTOR=$CURRENT_ALLOCATION_ID
131148RECEIVER=" 0xf4EF6650E48d099a4972ea5B414daB86e1998Bd3" # This must be the indexer address
132149
133150# Check current V2 escrow balance before funding
You can’t perform that action at this time.
0 commit comments