GetRecentlySold params seem to have no effect?
JClutch opened this issue · 3 comments
Hey was playing around with this end point to see if I could get more results of recently sold axies to look/search through but I noticed no matter how much I changed the parameters I could only get back 20 at a time and the "from" parameter I thought was a pointer for pagination but seem to have no effect at all
iterator = 0
axies_list = []
while iterator < 100:
print(iterator)
body = {
"operationName": "GetRecentlyAxiesSold",
"variables": {
"from": iterator,
"size": 100
},
"query": "query GetRecentlyAxiesSold($from: Int, $size: Int) {\n settledAuctions {\n axies(from: $from, size: $size) {\n total\n results {\n ...AxieSettledBrief\n transferHistory {\n ...TransferHistoryInSettledAuction\n __typename\n }\n __typename\n }\n __typename\n }\n __typename\n }\n}\n\nfragment AxieSettledBrief on Axie {\n id\n name\n image\n class\n breedCount\n __typename\n}\n\nfragment TransferHistoryInSettledAuction on TransferRecords {\n total\n results {\n ...TransferRecordInSettledAuction\n __typename\n }\n __typename\n}\n\nfragment TransferRecordInSettledAuction on TransferRecord {\n from\n to\n txHash\n timestamp\n withPrice\n withPriceUsd\n fromProfile {\n name\n __typename\n }\n toProfile {\n name\n __typename\n }\n __typename\n}\n"
}
r = requests.post('https://axieinfinity.com/graphql-server-v2/graphql', data=body)
iterator += 20
axies_list.extend(r.json()['data']['settledAuctions']['axies']['results'])
count = {}
for axie in axies_list:
if axie['id'] in count:
count[axie['id']] = count[axie['id']] + 1
else:
count[axie['id']] = 1
return count
Attached the results and as you can see despite iterating it just gets the same 20 back. Am I missing something or do they seem to be disabled?
I've just tested this on different languages and the query is working fine.
Your issue comes from your use of the data
parameter in your request. Try using the json
parameter instead.
Interesting. Yea I see what you are saying as I can see the full results if i postman the request, but switching the param in the request to json=body didn't seem to have any effect. Alright I'll take a deeper dive - thank you!
You can try this one out to bypass the cap on the size. There's really no point in paginating this query as it only returns 100 recent transactions at most.
import requests
import itertools
body = {
"query": "query {\n settledAuctions {\n a1: axies(from: 0, size: 20) { results { ...AxieSettledBrief transferHistory { ...TransferHistoryInSettledAuction } } }\n a2: axies(from: 20, size: 20) { results { ...AxieSettledBrief transferHistory { ...TransferHistoryInSettledAuction } } }\n a3: axies(from: 40, size: 20) { results { ...AxieSettledBrief transferHistory { ...TransferHistoryInSettledAuction } } }\n a4: axies(from: 60, size: 20) { results { ...AxieSettledBrief transferHistory { ...TransferHistoryInSettledAuction } } }\n a5: axies(from: 80, size: 20) { results { ...AxieSettledBrief transferHistory { ...TransferHistoryInSettledAuction } } }\n }\n}\n\nfragment AxieSettledBrief on Axie {\n id\n name\n image\n class\n breedCount\n}\n\nfragment TransferHistoryInSettledAuction on TransferRecords {\n total\n results {\n ...TransferRecordInSettledAuction\n }\n}\n\nfragment TransferRecordInSettledAuction on TransferRecord {\n from\n to\n txHash\n timestamp\n withPrice\n withPriceUsd\n fromProfile {\n name\n }\n toProfile {\n name\n }\n}\n"
}
r = requests.post('https://axieinfinity.com/graphql-server-v2/graphql', data=body)
aliases = [a for a in r.json()['data']['settledAuctions']]
results = list(itertools.chain.from_iterable([r.json()['data']['settledAuctions'][a]['results'] for a in aliases]))
# Check how many unique ids are included
ids = list(set([res["id"] for res in results]))
print(len(ids), ":", ids)
You can even tweak this to artificially paginate the results on the client by using the aliases as pages.