8 Active Allocations Data From Subgraph
# get list of current allocations (again)
query = '{
allocations(where: {indexer:"0x74dbb201ecc0b16934e68377bc13013883d9417b", status: Active}, first:1000) {
id
status
allocatedTokens
createdAtEpoch
subgraphDeployment {
ipfsHash
}
}
}'
# Send POST request to the GraphQL API
response = POST(url, body = list(query = query), encode = "json")
# Parse the JSON response
content = content(response, "text", encoding='UTF-8')
json_data = fromJSON(content, flatten = TRUE)
# get list of current allocations
current_allocations = as_tibble(as.data.frame(json_data$data$allocations))
if (nrow(current_allocations) ){
# add ipfs hash
current_allocations$deployment = json_data$data$allocations$subgraphDeployment.ipfsHash
# remove old nested column
current_allocations %<>% select(-subgraphDeployment.ipfsHash)
# adjust allocatedTokens (just to avoid any confusion or issues)
current_allocations$allocatedTokens = as.numeric(current_allocations$allocatedTokens)/10^18
}
Would be better to change this where we do a before and after and decide which ones to not close: