1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00

GITBOOK-239: Updates on the get data nft info

This commit is contained in:
Ana Loznianu 2023-05-23 15:54:03 +00:00 committed by gitbook-bot
parent b5a3dea19b
commit 77602f9ff8
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
2 changed files with 10 additions and 19 deletions

View File

@ -43,7 +43,7 @@
* [Deploying a Market](developers/build-a-marketplace/deploying-market.md) * [Deploying a Market](developers/build-a-marketplace/deploying-market.md)
* [Ocean Subgraph](developers/ocean-subgraph/README.md) * [Ocean Subgraph](developers/ocean-subgraph/README.md)
* [Get data NFTs](developers/using-ocean-subgraph/list-data-nfts.md) * [Get data NFTs](developers/using-ocean-subgraph/list-data-nfts.md)
* [Get data NFT Details](developers/using-ocean-subgraph/get-data-nft-information.md) * [Get data NFT Information](developers/using-ocean-subgraph/get-data-nft-information.md)
* [Get datatokens](developers/using-ocean-subgraph/list-datatokens.md) * [Get datatokens](developers/using-ocean-subgraph/list-datatokens.md)
* [Get Datatoken Information](developers/using-ocean-subgraph/get-datatoken-information.md) * [Get Datatoken Information](developers/using-ocean-subgraph/get-datatoken-information.md)
* [List Fixed Rate Exchanges](developers/using-ocean-subgraph/list-fixed-rate-exchanges.md) * [List Fixed Rate Exchanges](developers/using-ocean-subgraph/list-fixed-rate-exchanges.md)

View File

@ -1,17 +1,15 @@
# Get data NFT Details # 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. The result of following GraphQL query returns the information about a particular datatoken. Here, `0x1c161d721e6d99f58d47f709cdc77025056c544c` is the address of the dataNFT.
{% hint style="info" %}
Copy the query in the [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) to fetch the results from the mainnet. For other networks use [this table](../ocean-subgraph/#ocean-subgraph-graphiql).
{% endhint %}
####
#### Code PS: In this example, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to [this table](../ocean-subgraph/#ocean-subgraph-deployments).
{% tabs %} {% tabs %}
{% tab title="Query" %} {% tab title="Query" %}
Copy the query to fetch a list of data NFTs in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) to fetch the results.
```graphql ```graphql
{ {
nft (id:"0x1c161d721e6d99f58d47f709cdc77025056c544c", subgraphError:deny){ nft (id:"0x1c161d721e6d99f58d47f709cdc77025056c544c", subgraphError:deny){
@ -40,7 +38,7 @@ Copy the query in the [GraphiQL interface](https://v4.subgraph.mainnet.oceanprot
{% endtab %} {% endtab %}
{% tab title="Python" %} {% tab title="Python" %}
The Python script below can be used to run the query. If you wish to change the network, replace the variable's value `base_url` as needed. Change the value of the variable dataNFT\_address with the address of the datatoken of your choice. The Python script below can be used to run the query and fetch the details about an NFT. If you wish to change the network, replace the variable's value `base_url` as needed. Change the value of the variable dataNFT\_address with the address of the datatoken of your choice.
**Create script** **Create script**
@ -98,12 +96,9 @@ print(json.dumps(result, indent=4, sort_keys=True))
{% endtab %} {% endtab %}
{% tab title="Javascript" %} {% tab title="Javascript" %}
The javascript below can be used to run the the query. If you wish to change the network, then replace the value of variable `baseUrl` as needed. Change the value of the variable `datanftAddress` with the address of the datatoken of your choice. The javascript below can be used to run the query. If you wish to change the network, replace the variable's value `baseUrl` as needed. Change the value of the variable `datanftAddress` with the address of the datatoken of your choice.
**Create script** ```runkit nodeVersion="18.x.x"
{% code title="dataNFTInfo.js" %}
```javascript
var axios = require('axios'); var axios = require('axios');
const datanftAddress = "0x1c161d721e6d99f58d47f709cdc77025056c544c"; const datanftAddress = "0x1c161d721e6d99f58d47f709cdc77025056c544c";
@ -146,20 +141,16 @@ var config = {
axios(config) axios(config)
.then(function (response) { .then(function (response) {
console.log(JSON.stringify(response.data)); let result = JSON.stringify(response.data)
console.log(result)
}) })
.catch(function (error) { .catch(function (error) {
console.log(error); console.log(error);
}); });
``` ```
{% endcode %}
**Execute script**
```bash
node dataNFTInfo.js
```
{% endtab %} {% endtab %}
{% endtabs %} {% endtabs %}