List data NFTs
The result of following GraphQL query returns the information about data nfts.
Copy the query in the graphiQL interface to fetch the results from the mainnet. For other networks, change the domain name with appropriate subgraph domain as mentioned in this page.
{
nfts (skip:0, first: 10, subgraphError:deny){
id
name
symbol
owner
address
assetState
tx
block
transferable
}
}
The python script below can be used to run the the query. If you wish to change the network, then replace the value of variable base_url as needed.
Python
list_dataNFTs.py
import requests
import json
query = """
{
nfts (skip:0, first: 10, subgraphError:deny){
id
name
symbol
owner
address
assetState
tx
block
transferable
}
}"""
base_url = "https://v4.subgraph.mainnet.oceanprotocol.com"
route = "/subgraphs/name/oceanprotocol/ocean-subgraph"
url = base_url + route
headers = {"Content-Type": "application/json"}
payload = json.dumps({"query": query})
response = requests.request("POST", url, headers=headers, data=payload)
result = json.loads(response.text)
print(json.dumps(result, indent=4, sort_keys=True))
Execute script
python list_dataNFTs.py
Sample response
Export as PDF
Copy link
Edit on GitHub