Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions building-with-ocean/using-ocean-subgraph/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
---
description: >-
Ocean subgraph is an off-chain service which provides information about
datatokens, users, balances using the GraphQL. Ocean subgraph provides a
faster way to fetch data rather than on-chain query.
---

# Using Ocean Subgraph

For each supported network, an individual Ocean subgraph is deployed. The information about supported networks and the subgraph URL is available on [this page](../../core-concepts/networks.md).
Ocean subgraph is an off-chain service that provides information about datatokens, users, and balances using GraphQL. The Ocean subgraph provides a faster way to fetch data rather than an on-chain query. The data from Ocean subgraph can be queried using [GraphQL](https://graphql.org/learn/).

You can use the Subgraph instances hosted by Ocean Protocol or host your instance. The page on Deploying Ocean Subgraph provides a guide on hosting your own Ocean Subgraph instance.

For each supported network, an individual Ocean subgraph is deployed. The information about supported networks are available on this [page](../../core-concepts/networks.md).

#### Ocean Subgraph GraphiQL

The below table provides the link to GraphiQL for the support networks. The Graphql queries can be directly executed using the GraphiQL interface without the need of any setup.

| Network and link |
| ----------------------------------------------------------------------------------------------------------------------- |
| [Ethereum Mainnet](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Polygon Mainnet](https://v4.subgraph.polygon.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Binance Smart Chain](https://v4.subgraph.bsc.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Energy Web Chain](https://v4.subgraph.energyweb.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Moonriver](https://v4.subgraph.moonriver.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Mumbai](https://v4.subgraph.mumbai.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Rinkeby](https://v4.subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Ropsten](https://v4.subgraph.ropsten.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
| [Moonbase](https://v4.subgraph.moonbase.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql) |
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# 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, change the domain name with appropriate subgraph domain as mentioned in [this page](../../core-concepts/networks.md).
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-graphiql).
{% endhint %}

```graphql
Expand Down Expand Up @@ -83,7 +83,7 @@ print(json.dumps(result, indent=4, sort_keys=True))
```
{% endcode %}

#### Execute script
**Execute script**

```
python dataNFT_information.py
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

# Get Datatoken Information

The result of following GraphQL query returns the information about a particular datatoken. Here, `0x122d10d543bc600967b4db0f45f80cb1ddee43eb` is the address of the datatoken.  

{% 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, change the domain name with appropriate subgraph domain as mentioned in [this page](../../core-concepts/networks.md).
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-graphiql).
{% endhint %}

```graphql
Expand Down Expand Up @@ -48,7 +49,7 @@ The python script below can be used to run the the query. If you wish to change

{% tabs %}
{% tab title="Python" %}
#### Create script
**Create script**

{% code title="datatoken_information.py" %}
```python
Expand Down Expand Up @@ -106,11 +107,10 @@ response = requests.request("POST", url, headers=headers, data=payload)
result = json.loads(response.text)

print(json.dumps(result, indent=4, sort_keys=True))

```
{% endcode %}

#### Execute script
**Execute script**

```
python datatoken_information.py
Expand Down
6 changes: 3 additions & 3 deletions building-with-ocean/using-ocean-subgraph/list-data-nfts.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# List data NFTs

The result of following GraphQL query returns the information about data nfts. 
The result of following GraphQL query returns the information about data nfts.

{% 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, change the domain name with appropriate subgraph domain as mentioned in [this page](../../core-concepts/networks.md).
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-graphiql).
{% endhint %}

```graphql
Expand Down Expand Up @@ -62,7 +62,7 @@ print(json.dumps(result, indent=4, sort_keys=True))
```
{% endcode %}

#### Execute script
**Execute script**

```
python list_dataNFTs.py
Expand Down
10 changes: 4 additions & 6 deletions building-with-ocean/using-ocean-subgraph/list-datatokens.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# List all Tokens

The result of following GraphQL query returns the information about datatokens.  
The result of following GraphQL query returns the information about datatokens.

{% 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, change the domain name with appropriate subgraph domain as mentioned in [this page](../../core-concepts/networks.md).
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-graphiql).
{% endhint %}

```graphql
Expand Down Expand Up @@ -43,7 +43,7 @@ The python script below can be used to run the the query. If you wish to change

{% tabs %}
{% tab title="Python" %}
#### Create script
**Create script**

{% code title="list_all_tokens.py" %}
```python
Expand Down Expand Up @@ -95,11 +95,10 @@ response = requests.request("POST", url, headers=headers, data=payload)
result = json.loads(response.text)

print(json.dumps(result, indent=4, sort_keys=True))

```
{% endcode %}

#### Execute script
**Execute script**

```
python list_all_tokens.py
Expand Down Expand Up @@ -147,4 +146,3 @@ python list_all_tokens.py
```

</details>

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# List Fixed Rate Exchanges

The result of following GraphQL query returns the information about the Fixed Rate Exchanges. &#x20;
The result of following GraphQL query returns the information about the Fixed Rate Exchanges.

{% 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, change the domain name with appropriate subgraph domain as mentioned in [this page](../../core-concepts/networks.md).
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-graphiql).
{% endhint %}

```graphql
Expand Down Expand Up @@ -42,11 +42,11 @@ Copy the query in the [graphiQL interface](https://v4.subgraph.mainnet.oceanprot
}
```

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.&#x20;
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.

{% tabs %}
{% tab title="Python" %}
#### Create script
**Create script**

{% code title="list_fixed_rate_exchanges.py" %}
```python
Expand Down Expand Up @@ -104,7 +104,7 @@ print(json.dumps(result, indent=4, sort_keys=True))
```
{% endcode %}

#### Execute script
**Execute script**

```
python list_fixed_rate_exchanges.py
Expand Down