Skip to content

Commit d21623d

Browse files
committed
fix(integration-tests): fix collection in fund escrow script
1 parent 8467d59 commit d21623d

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

integration-tests/fund_escrow.sh

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,27 @@ fi
124124
echo ""
125125
echo "========== 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
129146
PAYER=$SENDER_ADDRESS
130-
COLLECTOR=$SENDER_ADDRESS
147+
COLLECTOR=$CURRENT_ALLOCATION_ID
131148
RECEIVER="0xf4EF6650E48d099a4972ea5B414daB86e1998Bd3" # This must be the indexer address
132149

133150
# Check current V2 escrow balance before funding

0 commit comments

Comments
 (0)