Get data NFT information
The result of following GraphQL query returns the information about a particular datatoken. Here, 0x1c161d721e6d99f58d47f709cdc77025056c544c is the address of the dataNFT.
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.
{
nft (id:"0x1c161d721e6d99f58d47f709cdc77025056c544c", subgraphError:deny){
id
name
symbol
owner
address
assetState
tx
block
transferable
creator
createdTimestamp
providerUrl
managerRole
erc20DeployerRole
storeUpdateRole
metadataRole
tokenUri
template
orderCount
}
}b
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. Change the value of the variable dataNFT_address with the address of the datatoken of your choice.
Python
dataNFT_information.py
import requests
import json
dataNFT_address = "0x1c161d721e6d99f58d47f709cdc77025056c544c"
query = """
{{
nft (id:"{0}", subgraphError:deny){{
id
name
symbol
owner
address
assetState
tx
block
transferable
creator
createdTimestamp
providerUrl
managerRole
erc20DeployerRole
storeUpdateRole
metadataRole
tokenUri
template
orderCount
}}
}}""".format(
dataNFT_address
)
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 dataNFT_information.py
Sample response
Export as PDF
Copy link
Edit on GitHub