mirror of
https://github.com/oceanprotocol/docs.git
synced 2024-11-26 19:49:26 +01:00
GITBOOK-491: custom-market
This commit is contained in:
parent
4f012d1793
commit
22479e6259
BIN
.gitbook/assets/Screenshot 2023-06-13 at 14.39.17.png
Normal file
BIN
.gitbook/assets/Screenshot 2023-06-13 at 14.39.17.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 152 KiB |
BIN
.gitbook/assets/Screenshot 2023-06-13 at 14.43.25.png
Normal file
BIN
.gitbook/assets/Screenshot 2023-06-13 at 14.43.25.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 935 KiB |
BIN
.gitbook/assets/Screenshot 2023-06-14 at 14.30.59.png
Normal file
BIN
.gitbook/assets/Screenshot 2023-06-14 at 14.30.59.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 94 KiB |
14
SUMMARY.md
14
SUMMARY.md
@ -31,7 +31,7 @@
|
||||
* [Claim Rewards Data Farming](user-guides/claim-ocean-rewards.md)
|
||||
* [Liquidity Pools \[deprecated\]](user-guides/remove-liquidity-using-etherscan.md)
|
||||
* [👨💻 Developers](developers/README.md)
|
||||
* [Architecture Overview](developers/architecture.md)
|
||||
* [Architecture Overview](developers/contracts/architecture.md)
|
||||
* [Contracts](developers/contracts/README.md)
|
||||
* [Data NFTs](developers/contracts/data-nfts.md)
|
||||
* [Datatokens](developers/contracts/datatokens.md)
|
||||
@ -53,13 +53,13 @@
|
||||
* [Build a Marketplace](developers/build-a-marketplace/README.md)
|
||||
* [Forking Ocean Market](developers/build-a-marketplace/forking-ocean-market.md)
|
||||
* [Customising a Market](developers/build-a-marketplace/customising-your-market.md)
|
||||
* [Deploying a Market](developers/build-a-marketplace/deploying-market.md)
|
||||
* [Build and host your Data Marketplace](developers/build-a-marketplace/deploying-market.md)
|
||||
* [Subgraph](developers/subgraph/README.md)
|
||||
* [Get data NFTs](developers/using-ocean-subgraph/list-data-nfts.md)
|
||||
* [Get data NFT information](developers/using-ocean-subgraph/get-data-nft-information.md)
|
||||
* [Get datatokens](developers/using-ocean-subgraph/list-datatokens.md)
|
||||
* [Get datatoken information](developers/using-ocean-subgraph/get-datatoken-information.md)
|
||||
* [Get fixed-rate exchanges](developers/using-ocean-subgraph/list-fixed-rate-exchanges.md)
|
||||
* [Get data NFTs](developers/subgraph/list-data-nfts.md)
|
||||
* [Get data NFT information](developers/subgraph/get-data-nft-information.md)
|
||||
* [Get datatokens](developers/subgraph/list-datatokens.md)
|
||||
* [Get datatoken information](developers/subgraph/get-datatoken-information.md)
|
||||
* [Get fixed-rate exchanges](developers/subgraph/list-fixed-rate-exchanges.md)
|
||||
* [Get veOCEAN stats](developers/subgraph/get-veocean-stats.md)
|
||||
* [List datatoken buyers](developers/subgraph/list-datatoken-buyers.md)
|
||||
* [Ocean.py](developers/ocean.py/README.md)
|
||||
|
@ -1,52 +0,0 @@
|
||||
---
|
||||
description: Ocean Protocol Architecture Adventure!
|
||||
---
|
||||
|
||||
# Architecture Overview
|
||||
|
||||
Embark on an exploration of the innovative realm of Ocean Protocol, where data flows seamlessly and AI achieves new heights. Dive into the intricately layered architecture that converges data and services, fostering a harmonious collaboration. Let us delve deep and uncover the profound design of Ocean Protocol.🐬
|
||||
|
||||
<figure><img src="../.gitbook/assets/OP High Level Architecture.jpg" alt=""><figcaption><p>Overview of the Ocean Protocol Architecture</p></figcaption></figure>
|
||||
|
||||
### Layer 1: The Foundational Blockchain Layer
|
||||
|
||||
At the core of Ocean Protocol lies the robust [Blockchain Layer](contracts/). Powered by blockchain technology, this layer ensures secure and transparent transactions. It forms the bedrock of decentralized trust, where data providers and consumers come together to trade valuable assets. 
|
||||
|
||||
The [smart contracts](contracts/) are deployed on the Ethereum mainnet and other compatible [networks](../discover/networks/). The libraries encapsulate the calls to these smart contracts and provide features like publishing new assets, facilitating consumption, managing pricing, and much more. To explore the contracts in more depth, go ahead to the [contracts](contracts/) section.
|
||||
|
||||
### Layer 2: The Empowering Middle Layer
|
||||
|
||||
Above the smart contracts, you'll find essential [libraries](architecture.md#libraries) employed by applications within the Ocean Protocol ecosystem, the [middleware components](architecture.md#middleware-components), and [Compute-to-Data](architecture.md#compute-to-data).
|
||||
|
||||
#### Libraries
|
||||
|
||||
These libraries include [Ocean.js](broken-reference), a JavaScript library, and [Ocean.py](ocean.py/), a Python library. They serve as powerful tools for developers, enabling integration and interaction with the protocol.
|
||||
|
||||
1. [Ocean.js](broken-reference): Ocean.js is a JavaScript library that serves as a powerful tool for developers looking to integrate their applications with the Ocean Protocol ecosystem. Designed to facilitate interaction with the protocol, Ocean.js provides a comprehensive set of functionalities, including data tokenization, asset management, and smart contract interaction. Ocean.js simplifies the process of implementing data access controls, building dApps, and exploring data sets within a decentralized environment. 
|
||||
2. [Ocean.py](ocean.py/): Ocean.py is a Python library that empowers developers to integrate their applications with the Ocean Protocol ecosystem. With its rich set of functionalities, Ocean.py provides a comprehensive toolkit for interacting with the protocol. Developers and [data scientists](../data-science/) can leverage Ocean.py to perform a wide range of tasks, including data tokenization, asset management, and smart contract interactions. This library serves as a bridge between Python and the decentralized world of Ocean Protocol, enabling you to harness the power of decentralized data.
|
||||
|
||||
#### Middleware components
|
||||
|
||||
Additionally, in supporting the discovery process, middleware components come into play:
|
||||
|
||||
1. [Aquarius](aquarius/): Aquarius acts as a metadata cache, enhancing search efficiency by caching on-chain data into Elasticsearch. By accelerating metadata retrieval, Aquarius enables faster and more efficient data discovery.
|
||||
2. [Provider](provider/): The Provider component plays a crucial role in facilitating various operations within the ecosystem. It assists in asset downloading, handles [DDO](ddo-specification.md) (Decentralized Data Object) encryption, and establishes communication with the operator-service for Compute-to-Data jobs. This ensures secure and streamlined interactions between different participants.
|
||||
3. [Subgraph](subgraph/): The Subgraph is an off-chain service that utilizes GraphQL to offer efficient access to information related to datatokens, users, and balances. By leveraging the subgraph, data retrieval becomes faster compared to an on-chain query. This enhances the overall performance and responsiveness of applications that rely on accessing this information.
|
||||
|
||||
#### Compute-to-Data
|
||||
|
||||
[Compute-to-Data](compute-to-data/) (C2D) represents a groundbreaking paradigm within the Ocean Protocol ecosystem, revolutionizing the way data is processed and analyzed. With C2D, the traditional approach of moving data to the computation is inverted, ensuring privacy and security. Instead, algorithms are securely transported to the data sources, enabling computation to be performed locally, without the need to expose sensitive data. This innovative framework facilitates collaborative data analysis while preserving data privacy, making it ideal for scenarios where data owners want to retain control over their valuable assets. C2D provides a powerful tool for enabling secure and privacy-preserving data analysis and encourages collaboration among data providers, ensuring the utilization of valuable data resources while maintaining strict privacy protocols.
|
||||
|
||||
### Layer 3: The Accessible Application Layer
|
||||
|
||||
Here, the ocean comes alive with a vibrant ecosystem of dApps, marketplaces, and more. This layer hosts a variety of user-friendly interfaces, applications, and tools, inviting data scientists and curious explorers alike to access, explore, and contribute to the ocean's treasures. 
|
||||
|
||||
Prominently featured within this layer is [Ocean Market](../user-guides/using-ocean-market.md), a hub where data enthusiasts and industry stakeholders converge to discover, trade, and unlock the inherent value of data assets. Beyond Ocean Market, the Application Layer hosts a diverse ecosystem of specialized applications and marketplaces, each catering to unique use cases and industries. Empowered by the capabilities of Ocean Protocol, these applications facilitate advanced data exploration, analytics, and collaborative ventures, revolutionizing the way data is accessed, shared, and monetized. 
|
||||
|
||||
### Layer 4: The Friendly Wallets
|
||||
|
||||
At the top of the Ocean Protocol ecosystem, we find the esteemed [Web 3 Wallets](../discover/wallets/), the gateway for users to immerse themselves in the world of decentralized data transactions. These wallets serve as trusted companions, enabling users to seamlessly transact within the ecosystem, purchase and sell data NFTs, and acquire valuable datatokens. For a more detailed exploration of Web 3 Wallets and their capabilities, you can refer to the [wallet intro page](../discover/wallets/).
|
||||
|
||||
|
||||
|
||||
With the layers of the architecture clearly delineated, the stage is set for a comprehensive exploration of their underlying logic and intricate design. By examining each individually, we can gain a deeper understanding of their unique characteristics and functionalities.
|
@ -37,6 +37,6 @@ If you’re completely unfamiliar with Ocean Market or web3 applications in gene
|
||||
**Required Prerequisites**
|
||||
|
||||
* Git. Instructions for installing Git can be found [here](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
|
||||
* Node.js can be downloaded from [here](https://nodejs.org/en/download/) (we’re using version 16 in this guide)
|
||||
* Node.js can be downloaded from [here](https://nodejs.org/en/download/) (we’re using version 18 in this guide)
|
||||
* A decent code editor, such as [Visual Studio Code](https://code.visualstudio.com/).
|
||||
* You’ll need a Github account to fork Ocean market via [Github](https://github.com/).
|
||||
|
@ -3,21 +3,15 @@ title: Customising Market
|
||||
description: Step by step guide to customizing your fork of Ocean market
|
||||
---
|
||||
|
||||
# Customizing your fork of Ocean market
|
||||
# Customising a Market
|
||||
|
||||
So you’ve got a fully functioning data marketplace at this point, which is pretty cool. But it doesn’t really look like your data marketplace. Right now, it’s still just a clone of Ocean Market — the same branding, name, logo, etc. The next few steps focus on personalizing your data marketplace.
|
||||
|
||||
- Change your Market Name
|
||||
|
||||
- Change the Logo
|
||||
|
||||
- Change the Styling
|
||||
|
||||
- Edit the Publish Form
|
||||
|
||||
- Change the Fee Address
|
||||
|
||||
- Build and host your Data Marketplace
|
||||
* Change your Market Name
|
||||
* Change the Logo
|
||||
* Change the Styling
|
||||
* Edit the Publish Form
|
||||
* Advanced customisation
|
||||
|
||||
## Change your Market Name
|
||||
|
||||
@ -79,8 +73,7 @@ You’ll notice in the screenshot above that we are setting our “wave” backg
|
||||
|
||||
If we save this file and view the site at this point, we get a white section at the top (see image below). And you’ll also notice that the background doesn’t fill all the way down to the bottom of the screen.
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-10.1.png)
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-10.2.png)
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-10.1.png) ![Market Customisation](../../.gitbook/assets/market/market-customisation-10.2.png)
|
||||
|
||||
To fix this, we need to change the starting position of the background image and change it from no-repeat to repeat. We can do this on line 3.
|
||||
|
||||
@ -88,7 +81,7 @@ When we view our marketplace, we can see that the new background starts at the t
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-11.1.png)
|
||||
|
||||
## Brand Colors
|
||||
### Brand Colors
|
||||
|
||||
Next up, let’s change the background colors to match your individual style. Open up the following file: src/global/\_variables.css. Here you’ll see the global style colors that are set. Now is the time to get creative, or consult your brand handbook (if you already have one).
|
||||
|
||||
@ -96,7 +89,7 @@ You can change these colors as much as you wish until you’re happy with how ev
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-12.png)
|
||||
|
||||
## Change Fonts
|
||||
### Change Fonts
|
||||
|
||||
The final part of the styling that we’ll alter in this guide is the fonts. This is an important step because the font used in Ocean Market is one of the few elements of the market that are copyright protected. If you want to use the same font you’ll need to purchase a license. The other copyrighted elements are the logo and the name — which we have already changed.
|
||||
|
||||
@ -116,13 +109,13 @@ Let’s head to the publish page to see what it looks like with our new styling
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-14.png)
|
||||
|
||||
Open up the index.json file from content/publish/index.json - here we change the text to explain that this form is for publishing photos.
|
||||
Open up the index.json file from `content/publish/index.json` - here we change the text to explain that this form is for publishing photos.
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-15.png)
|
||||
|
||||
Additionally, the asset type current says dataset, and we need to change this so that it says photo. The simplest way to do this is to change the title of the asset type without changing anything else. Ocean can handle selling any digital asset that can be accessed via a URL, so no further changes are needed to accommodate selling photos.
|
||||
|
||||
Open up src/components/Publish/Metadata/index.tsx and change line 28 so that it says ‘Photo’
|
||||
Open up `src/components/Publish/Metadata/index.tsx` and change line 33 so that it says ‘Photo’
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-18.png)
|
||||
|
||||
@ -132,7 +125,7 @@ Great, now our publish page explains that users should be publishing photos and
|
||||
|
||||
There is one more thing that is fun to change before we move away from the publish form. You’ll notice that Ocean Market V4 now has a cool SVG generation feature that creates the images for the Data NFT. It creates a series of pink waves. Let’s change this so that it uses our brand colors in the waves!
|
||||
|
||||
Open up /src/@utils/SvgWaves.ts and have a look at lines 27 to 30 where the colors are specified. Currently, the pink color is the one used in the svg generator. You can replace this with your own brand color:
|
||||
Open up `/src/@utils/SvgWaves.ts` and have a look at lines 27 to 30 where the colors are specified. Currently, the pink color is the one used in the svg generator. You can replace this with your own brand color:
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-21.png)
|
||||
|
||||
@ -144,15 +137,11 @@ And now your customized publish page is ready for your customers:
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-20.png)
|
||||
|
||||
## Change the Fee Address
|
||||
## Advanced customisation
|
||||
|
||||
At this point, we have made a lot of changes and hopefully you’re happy with the way that your marketplace is looking. Given that you now have your own awesome photo marketplace, it’s about time we talked about monetizing it. Yup, that’s right - you will earn a commission when people buy and sell photos in your marketplace. In Ocean V4, there are a whole host of new fees and customization options that you can use (read more about that here).
|
||||
This important step is the last thing that we will change in this guide. To set the marketplace fees and address, you’ll need to save them as environmental variables. You'll also need to set the environmental variables if you customized services like Aquarius, Provider or Subgraph. 
|
||||
|
||||
When someone sets the pricing for their photos in your marketplace, they are informed that a commission will be sent to the owner of the marketplace. You see that at the moment this fee is set to zero, so you’ll want to increase that. And in order to receive the fees you’ll you need to set the address that you want to recieve these fees in.
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-23.png)
|
||||
|
||||
This important step is the last thing that we will change in this guide. To set the marketplace fees and address, you’ll need to save them as environmental variables. Create a new file called .env in the root of your repository.
|
||||
First we are going to create a new file called .env in the root of your repository.
|
||||
|
||||
Copy and paste the following into the file:
|
||||
|
||||
@ -164,12 +153,41 @@ NEXT_PUBLIC_PUBLISHER_MARKET_FIXED_SWAP_FEE="0.01"
|
||||
NEXT_PUBLIC_CONSUME_MARKET_ORDER_FEE="0.01"
|
||||
NEXT_PUBLIC_CONSUME_MARKET_FIXED_SWAP_FEE="0.01"
|
||||
|
||||
#
|
||||
# ADVANCED SETTINGS
|
||||
#
|
||||
|
||||
# Toggle pricing options presented during price creation
|
||||
#NEXT_PUBLIC_ALLOW_FIXED_PRICING="true"
|
||||
#NEXT_PUBLIC_ALLOW_FREE_PRICING="true"
|
||||
|
||||
# Privacy Preference Center
|
||||
#NEXT_PUBLIC_PRIVACY_PREFERENCE_CENTER="true"
|
||||
|
||||
# Development Preference Center
|
||||
#NEXT_PUBLIC_PROVIDER_URL="http://xxx:xxx"
|
||||
#NEXT_PUBLIC_SUBGRAPH_URI="http://xxx:xxx"
|
||||
#NEXT_PUBLIC_METADATACACHE_URI="http://xxx:xxx"
|
||||
#NEXT_PUBLIC_RPC_URI="http://xxx:xxx"
|
||||
|
||||
```
|
||||
|
||||
You need to replace “0x123abc” with your ethereum address (this is where the fees will be sent) and alter the fees to the levels that you intend them to be at. If you change you mind, these fees can always be altered later.
|
||||
### Change the Fee Address
|
||||
|
||||
At this point, we have made a lot of changes and hopefully you’re happy with the way that your marketplace is looking. Given that you now have your own awesome photo marketplace, it’s about time we talked about monetizing it. Yup, that’s right - you will earn a commission when people buy and sell photos in your marketplace. In Ocean V4, there are a whole host of new fees and customization options that you can use (read more about that here). In order to receive the fees you’ll you need to set the address that you want to recieve these fees in.
|
||||
|
||||
When someone sets the pricing for their photos in your marketplace, they are informed that a commission will be sent to the owner of the marketplace. You see that at the moment this fee is set to zero, so you’ll want to increase that. 
|
||||
|
||||
You need to replace “0x123abc” with your ethereum address (this is where the fees will be sent).
|
||||
|
||||
### Change the Fees Values
|
||||
|
||||
You can also alter the fees to the levels that you intend them to be at. If you change you mind, these fees can always be altered later.
|
||||
|
||||
Go to [Fees page](https://docs.oceanprotocol.com/concepts/fees/) to know more details about each type of fee and its relevance.
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-23.png)
|
||||
|
||||
It is important that the file is saved in the right place at the root of your repository, your file structure should look the same as below.
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-24.png)
|
||||
@ -177,3 +195,19 @@ It is important that the file is saved in the right place at the root of your re
|
||||
Now that’s it; you now have a fully functioning photo marketplace that operates over the blockchain. Everytime someone uses it, you will receive revenue.
|
||||
|
||||
![Market Customisation](../../.gitbook/assets/market/market-customisation-25.png)
|
||||
|
||||
### Using a custom Provider
|
||||
|
||||
You have the flexibility to tailor the ocean market according to your preferences by directing it to a predetermined custom [provider](https://github.com/oceanprotocol/provider/) deployment. This customization option allows you to choose a specific default provider, in addition to the option of manually specifying it when publishing an asset. To make use of this feature, you need to uncomment the designated line and modify the URL for your custom provider in the previously generated `.env` file. Look for the key labeled `NEXT_PUBLIC_PROVIDER_URL` and update its associated URL accordingly.
|
||||
|
||||
### Using a custom MetadataCache
|
||||
|
||||
If you intend to utilize the ocean market with a custom Aquarius deployment, you can also make set a custom MetadataCache flag. To do this, you will need to update the same file mentioned earlier. However, instead of modifying the `NEXT_PUBLIC_PROVIDER_URL` key, you should update the `NEXT_PUBLIC_METADATACACHE_URI` key. By updating this key, you can specify the URI for your custom Aquarius deployment, enabling you to take advantage of the ocean market with your preferred metadata cache setup.
|
||||
|
||||
### Using a custom subgraph
|
||||
|
||||
Using a custom subgraph with the ocean market requires additional steps due to the differences in deployment. Unlike the multi-network deployment of the provider and Aquarius services, each network supported by the ocean market has a separate subgraph deployment. This means that while the provider and Aquarius services can be handled by a single deployment across all networks, the subgraph requires specific handling for each network.
|
||||
|
||||
To utilize a custom subgraph, you will need to implement additional logic within the `getOceanConfig` function located in the `src/utils/ocean.ts` file. By modifying this function, you can ensure that the market uses the desired custom subgraph for the selected network. This is particularly relevant if your market aims to support multiple networks and you do not want to enforce the use of the same subgraph across all networks. By incorporating the necessary logic within `getOceanConfig`, you can ensure the market utilizes the appropriate custom subgraph for each network, enabling the desired level of customization. If the mentioned scenario doesn't apply to your situation, there is another approach you can take. Similar to the previously mentioned examples, you can modify the `.env` file by updating the key labeled `NEXT_PUBLIC_SUBGRAPH_URI`. By making changes to this key, you can configure the ocean market to utilize your preferred subgraph deployment. This alternative method allows you to customize the market's behavior and ensure it utilizes the desired subgraph, even if you don't require different subgraph deployments for each network.
|
||||
|
||||
\
|
||||
|
@ -3,11 +3,11 @@ title: Deployment of Ocean Market
|
||||
description: Step by step guide to a quick deployment of Ocean Market
|
||||
---
|
||||
|
||||
# Deploying Market
|
||||
# Build and host your Data Marketplace
|
||||
|
||||
All that’s left is for you to host your data marketplace and start sharing it with your future users.
|
||||
|
||||
## **Build and host your Data Marketplace**
|
||||
## **Build and host your marketplace using surge**
|
||||
|
||||
To host your data marketplace, you need to run the build command:
|
||||
|
||||
@ -15,7 +15,7 @@ To host your data marketplace, you need to run the build command:
|
||||
npm run build:static
|
||||
```
|
||||
|
||||
This takes a few minutes to run. While this is running, you can get prepared to host your new data marketplace. You have many options for hosting your data marketplace (including AWS S3, Vercel, Netlify and many more). In this guide, we will demonstrate how to host it with surge, which is completely free and very easy to use.
|
||||
This takes a few minutes to run. While this is running, you can get prepared to host your new data marketplace. You have many options for hosting your data marketplace (including AWS S3, Vercel, Netlify and many more). In this guide, we will demonstrate how to host it with surge, which is completely free and very easy to use. You can also refer to this [tutorial](../../infrastructure/deploying-marketplace.md) from the infrastructuree section as well if you want to deploy your market in you own infrastructure using docker.
|
||||
|
||||
Open up a new terminal window and run the following command to install surge:
|
||||
|
||||
@ -33,6 +33,10 @@ cd out
|
||||
surge
|
||||
```
|
||||
|
||||
If this is your first time using surge, you will be prompted to enter an email address and password to create a free account. It will ask you to confirm the directory that it is about to publish, check that you are in the market/public/ directory and press enter to proceed. Now it gives you the option to choose the domain that you want your project to be available on. We have chosen https://crypto-photos.surge.sh which is a free option. You can also set a CNAME value in your DNS to make use of your own custom domain.
|
||||
If this is your first time using surge, you will be prompted to enter an email address and password to create a free account. It will ask you to confirm the directory that it is about to publish, check that you are in the market/public/ directory and press enter to proceed. Now it gives you the option to choose the domain that you want your project to be available on.
|
||||
|
||||
<figure><img src="../../.gitbook/assets/Screenshot 2023-06-14 at 14.30.59.png" alt=""><figcaption><p>surge interaction</p></figcaption></figure>
|
||||
|
||||
 We have chosen https://crypto-photos.surge.sh which is a free option. You can also set a CNAME value in your DNS to make use of your own custom domain.
|
||||
|
||||
After a few minutes, your upload will be complete, and you’re ready to share your data marketplace. You can view the version we created in this guide [here](https://crypto-photos.surge.sh/).
|
||||
|
@ -9,10 +9,10 @@ One of the best use cases for Ocean is running your own marketplace and monetizi
|
||||
|
||||
Using Ocean Market is already a big improvement on the alternatives that are out there, but it gets even better. Ocean Market is completely open-source and made freely available under the Apache 2 license. This means that you can fork Ocean Market and set up your own data marketplace in just a few steps. This guide will walk you through the process, you’ll be surprised how easy it is. No prior blockchain knowledge is required!
|
||||
|
||||
- Fork Ocean Market
|
||||
- Clone the market locally
|
||||
- Install the dependencies
|
||||
- Run your Market fork for the first time
|
||||
* Fork Ocean Market
|
||||
* Clone the market locally
|
||||
* Install the dependencies
|
||||
* Run your Market fork for the first time
|
||||
|
||||
## Fork Ocean Market
|
||||
|
||||
@ -44,12 +44,12 @@ npm start
|
||||
|
||||
The above command will build the development bundle and run it locally.
|
||||
|
||||
![Forking Ocean Market](../../.gitbook/assets/market/market-forking-1.png)
|
||||
<figure><img src="../../.gitbook/assets/Screenshot 2023-06-13 at 14.39.17.png" alt=""><figcaption><p>Forking Ocean Market</p></figcaption></figure>
|
||||
|
||||
Great news - your marketplace has successfully been built and is now running locally. Let’s check it out! Open your browser and navigate to http://localhost:8000/. You’ll see that you have a full-on clone of Ocean Market running locally. Give it a go and test out publishing and consuming assets - everything works!
|
||||
|
||||
That’s all that’s required to get a clone of Ocean market working. The whole process is made simple because your clone can happily use all the smart contracts and backend components that are maintained by Ocean Protocol Foundation.
|
||||
|
||||
![Forking Ocean Market](../../.gitbook/assets/market/market-forking-2.png)
|
||||
<figure><img src="../../.gitbook/assets/Screenshot 2023-06-13 at 14.43.25.png" alt=""><figcaption><p>Forking Ocean Market</p></figcaption></figure>
|
||||
|
||||
So you’ve got a fully functioning marketplace at this point, which is pretty cool. But it doesn’t really look like your marketplace. Right now, it’s still just a clone of Ocean Market - the same branding, name, logo, etc. The next few steps focus on personalizing your marketplace.
|
||||
|
@ -1,195 +0,0 @@
|
||||
---
|
||||
description: >-
|
||||
Explore the Power of Querying: Unveiling In-Depth Details of Individual Data
|
||||
NFTs
|
||||
---
|
||||
|
||||
# Get data NFT information
|
||||
|
||||
Now that you are familiar with the process of retrieving a list of data NFTs 😎, let's explore how to obtain more specific details about a particular NFT through querying. By utilizing the knowledge you have gained, you can customize your GraphQL query to include additional parameters such as the NFT's metadata, creator information, template, or any other relevant data points. This will enable you to delve deeper into the intricacies of a specific NFT and gain a comprehensive understanding of its attributes. With this newfound capability, you can unlock valuable insights and make informed decisions based on the specific details retrieved. So, let's dive into the fascinating world of querying and unravel the unique characteristics of individual data NFTs.
|
||||
|
||||
|
||||
|
||||
The result of the following GraphQL query returns the information about a particular data NFT. In this example, `0x1c161d721e6d99f58d47f709cdc77025056c544c`.
|
||||
|
||||
_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_](broken-reference)_._
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Javascript" %}
|
||||
The javascript below can be used to run the query and fetch the information of a data NFT. If you wish to change the network, replace the variable's value `network` as needed. Change the value of the variable `datanftAddress` with the address of your choice.
|
||||
|
||||
```runkit nodeVersion="18.x.x"
|
||||
var axios = require('axios');
|
||||
|
||||
const datanftAddress = "0x1c161d721e6d99f58d47f709cdc77025056c544c";
|
||||
|
||||
const query = `{
|
||||
nft (id:"${datanftAddress}", subgraphError:deny){
|
||||
id
|
||||
name
|
||||
symbol
|
||||
owner
|
||||
address
|
||||
assetState
|
||||
tx
|
||||
block
|
||||
transferable
|
||||
creator
|
||||
createdTimestamp
|
||||
providerUrl
|
||||
managerRole
|
||||
erc20DeployerRole
|
||||
storeUpdateRole
|
||||
metadataRole
|
||||
tokenUri
|
||||
template
|
||||
orderCount
|
||||
}
|
||||
}`
|
||||
|
||||
const network = "mainnet"
|
||||
var config = {
|
||||
method: 'post',
|
||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: JSON.stringify({ "query": query })
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then(function (response) {
|
||||
let result = JSON.stringify(response.data)
|
||||
console.log(result)
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Python" %}
|
||||
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**
|
||||
|
||||
{% code title="dataNFT_information.py" %}
|
||||
```python
|
||||
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))
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
**Execute script**
|
||||
|
||||
<pre class="language-bash"><code class="lang-bash"><strong>python dataNFT_information.py
|
||||
</strong></code></pre>
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Query" %}
|
||||
Copy the query to fetch the information about a data NFT in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). If you want to fetch the information about another NFT, replace the `id` with the address of your choice.
|
||||
|
||||
```graphql
|
||||
{
|
||||
nft (id:"0x1c161d721e6d99f58d47f709cdc77025056c544c", subgraphError:deny){
|
||||
id
|
||||
name
|
||||
symbol
|
||||
owner
|
||||
address
|
||||
assetState
|
||||
tx
|
||||
block
|
||||
transferable
|
||||
creator
|
||||
createdTimestamp
|
||||
providerUrl
|
||||
managerRole
|
||||
erc20DeployerRole
|
||||
storeUpdateRole
|
||||
metadataRole
|
||||
tokenUri
|
||||
template
|
||||
orderCount
|
||||
}
|
||||
}
|
||||
```
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Sample response</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"nft": {
|
||||
"address": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
||||
"assetState": 0,
|
||||
"block": 15185270,
|
||||
"createdTimestamp": 1658397870,
|
||||
"creator": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"erc20DeployerRole": [
|
||||
"0x1706df1f2d93558d1d77bed49ccdb8b88fafc306"
|
||||
],
|
||||
"id": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
||||
"managerRole": [
|
||||
"0xd30dd83132f2227f114db8b90f565bca2832afbd"
|
||||
],
|
||||
"metadataRole": null,
|
||||
"name": "Ocean Data NFT",
|
||||
"orderCount": "1",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"providerUrl": "https://v4.provider.mainnet.oceanprotocol.com",
|
||||
"storeUpdateRole": null,
|
||||
"symbol": "OCEAN-NFT",
|
||||
"template": "",
|
||||
"tokenUri": "<removed>",
|
||||
"transferable": true,
|
||||
"tx": "0x327a9da0d2e9df945fd2f8e10b1caa77acf98e803c5a2f588597172a0bcbb93a"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
@ -1,238 +0,0 @@
|
||||
---
|
||||
description: >-
|
||||
Explore the Power of Querying: Unveiling In-Depth Details of Individual
|
||||
Datatokens
|
||||
---
|
||||
|
||||
# Get datatoken information
|
||||
|
||||
To fetch detailed information about a specific datatoken, you can utilize the power of GraphQL queries. By constructing a query tailored to your needs, you can access key parameters such as the datatoken's ID, name, symbol, total supply, creator, and associated dataTokenAddress. This allows you to gain a deeper understanding of the datatoken's characteristics and properties. With this information at your disposal, you can make informed decisions, analyze market trends, and explore the vast potential of datatokens within the Ocean ecosystem. Harness the capabilities of GraphQL and unlock a wealth of datatoken insights.
|
||||
|
||||
|
||||
|
||||
The result of the following GraphQL query returns the information about a particular datatoken. Here, `0x122d10d543bc600967b4db0f45f80cb1ddee43eb` is the address of the datatoken.
|
||||
|
||||
_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_](broken-reference)_._
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Javascript" %}
|
||||
The javascript below can be used to run the query and fetch the information of a datatoken. If you wish to change the network, replace the variable's value `network` as needed. Change the value of the variable `datatokenAddress` with the address of your choice.
|
||||
|
||||
```runkit nodeVersion="18.x.x"
|
||||
var axios = require('axios');
|
||||
|
||||
const datatokenAddress = "0x122d10d543bc600967b4db0f45f80cb1ddee43eb";
|
||||
|
||||
const query = `{
|
||||
token(id:"${datatokenAddress}", subgraphError: deny){
|
||||
id
|
||||
symbol
|
||||
nft {
|
||||
name
|
||||
symbol
|
||||
address
|
||||
}
|
||||
name
|
||||
symbol
|
||||
cap
|
||||
isDatatoken
|
||||
holderCount
|
||||
orderCount
|
||||
orders(skip:0,first:1){
|
||||
amount
|
||||
serviceIndex
|
||||
payer {
|
||||
id
|
||||
}
|
||||
consumer{
|
||||
id
|
||||
}
|
||||
estimatedUSDValue
|
||||
lastPriceToken
|
||||
lastPriceValue
|
||||
}
|
||||
}
|
||||
fixedRateExchanges(subgraphError:deny){
|
||||
id
|
||||
price
|
||||
active
|
||||
}
|
||||
}`
|
||||
|
||||
const network = "mainnet"
|
||||
var config = {
|
||||
method: 'post',
|
||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: JSON.stringify({ "query": query })
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then(function (response) {
|
||||
let result = JSON.stringify(response.data)
|
||||
console.log(result);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Python" %}
|
||||
The Python script below can be used to run the query and fetch a datatoken information. If you wish to change the network, replace the variable's value `base_url` as needed. Change the value of the variable `datatoken_address` with the address of the datatoken of your choice.
|
||||
|
||||
**Create script**
|
||||
|
||||
{% code title="datatoken_information.py" %}
|
||||
```python
|
||||
import requests
|
||||
import json
|
||||
|
||||
datatoken_address = "0x122d10d543bc600967b4db0f45f80cb1ddee43eb"
|
||||
query = """
|
||||
{{
|
||||
token(id:"{0}", subgraphError: deny){{
|
||||
id
|
||||
symbol
|
||||
nft {{
|
||||
name
|
||||
symbol
|
||||
address
|
||||
}}
|
||||
name
|
||||
symbol
|
||||
cap
|
||||
isDatatoken
|
||||
holderCount
|
||||
orderCount
|
||||
orders(skip:0,first:1){{
|
||||
amount
|
||||
serviceIndex
|
||||
payer {{
|
||||
id
|
||||
}}
|
||||
consumer{{
|
||||
id
|
||||
}}
|
||||
estimatedUSDValue
|
||||
lastPriceToken
|
||||
lastPriceValue
|
||||
}}
|
||||
}}
|
||||
fixedRateExchanges(subgraphError:deny){{
|
||||
id
|
||||
price
|
||||
active
|
||||
}}
|
||||
}}""".format(
|
||||
datatoken_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))
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
**Execute script**
|
||||
|
||||
<pre class="language-bash"><code class="lang-bash"><strong>python datatoken_information.py
|
||||
</strong></code></pre>
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Query" %}
|
||||
Copy the query to fetch the information of a datatoken in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). 
|
||||
|
||||
```
|
||||
{
|
||||
token(id:"0x122d10d543bc600967b4db0f45f80cb1ddee43eb", subgraphError: deny){
|
||||
id
|
||||
symbol
|
||||
nft {
|
||||
name
|
||||
symbol
|
||||
address
|
||||
}
|
||||
name
|
||||
symbol
|
||||
cap
|
||||
isDatatoken
|
||||
holderCount
|
||||
orderCount
|
||||
orders(skip:0,first:1){
|
||||
amount
|
||||
serviceIndex
|
||||
payer {
|
||||
id
|
||||
}
|
||||
consumer{
|
||||
id
|
||||
}
|
||||
estimatedUSDValue
|
||||
lastPriceToken
|
||||
lastPriceValue
|
||||
}
|
||||
}
|
||||
fixedRateExchanges(subgraphError:deny){
|
||||
id
|
||||
price
|
||||
active
|
||||
}
|
||||
}
|
||||
```
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Sample response</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"fixedRateExchanges": [
|
||||
{
|
||||
"active": true,
|
||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x06284c39b48afe5f01a04d56f1aae45dbb29793b190ee11e93a4a77215383d44",
|
||||
"price": "33"
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x2719862ebc4ed253f09088c878e00ef8ee2a792e1c5c765fac35dc18d7ef4deb",
|
||||
"price": "35"
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x2dccaa373e4b65d5ec153c150270e989d1bda1efd3794c851e45314c40809f9c",
|
||||
"price": "33"
|
||||
}
|
||||
],
|
||||
"token": {
|
||||
"cap": "115792089237316195423570985008687900000000000000000000000000",
|
||||
"holderCount": "0",
|
||||
"id": "0x122d10d543bc600967b4db0f45f80cb1ddee43eb",
|
||||
"isDatatoken": true,
|
||||
"name": "Brave Lobster Token",
|
||||
"nft": {
|
||||
"address": "0xea615374949a2405c3ee555053eca4d74ec4c2f0",
|
||||
"name": "Ocean Data NFT",
|
||||
"symbol": "OCEAN-NFT"
|
||||
},
|
||||
"orderCount": "0",
|
||||
"orders": [],
|
||||
"symbol": "BRALOB-11"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
@ -1,250 +0,0 @@
|
||||
---
|
||||
description: 'Discover the World of NFTs: Retrieving a List of Data NFTs'
|
||||
---
|
||||
|
||||
# Get data NFTs
|
||||
|
||||
If you are already familiarized with the concept of NFTs, you're off to a great start. However, if you require a refresher, we recommend visiting the [data NFTs and datatokens page](../contracts/datanft-and-datatoken.md) for a quick overview. 
|
||||
|
||||
Now, let us delve into the realm of utilizing the subgraph to extract a list of data NFTs that have been published using the Ocean contracts. By employing GraphQL queries, we can seamlessly retrieve the desired information from the subgraph. You'll see how simple it is :sunglasses:
|
||||
|
||||
You'll find below an example of a GraphQL query that retrieves the first 10 data NFTs from the subgraph. The GraphQL query is structured to access the "nfts" route, extracting the first 10 elements. For each item retrieved, it retrieves the "id," "name," "symbol," "owner," "address," "assetState," "tx," "block," and "transferable" parameters.
|
||||
|
||||
There are several options available to see this query in action. Below, you will find three:
|
||||
|
||||
1. Run the GraphQL query in the GraphiQL interface.
|
||||
2. Execute the query in Python by following the code snippet.
|
||||
3. Execute the query in JavaScript by clicking on the "Run" button of the Javascript tab.
|
||||
|
||||
_PS: In these examples, the query is executed on the Ocean subgraph deployed on the mainnet. If you want to change the network, please refer to_ [_this table_](broken-reference)_._
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Javascript" %}
|
||||
The javascript below can be used to run the query and retrieve a list of NFTs. If you wish to change the network, then replace the value of `network` variable as needed.
|
||||
|
||||
```runkit nodeVersion="18.x.x"
|
||||
const axios = require('axios')
|
||||
|
||||
const query = `{
|
||||
nfts (skip:0, first: 10, subgraphError:deny){
|
||||
id
|
||||
name
|
||||
symbol
|
||||
owner
|
||||
address
|
||||
assetState
|
||||
tx
|
||||
block
|
||||
transferable
|
||||
}
|
||||
}`
|
||||
|
||||
const network = "mainnet"
|
||||
const config = {
|
||||
method: 'post',
|
||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
data: JSON.stringify({ query: query })
|
||||
}
|
||||
|
||||
const response = await axios(config)
|
||||
for (let nft of response.data.data.nfts) {
|
||||
console.log(' id:' + nft.id + ' name: ' + nft.name + ' address: ' + nft.address)
|
||||
}
|
||||
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Python" %}
|
||||
The Python script below can be used to run the query to fetch a list of data NFTs from the subgraph. If you wish to change the network, replace the value of the variable `base_url` as needed.
|
||||
|
||||
**Create script**
|
||||
|
||||
{% code title="list_dataNFTs.py" %}
|
||||
```python
|
||||
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))
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
**Execute script**
|
||||
|
||||
```
|
||||
python list_dataNFTs.py
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% 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).
|
||||
|
||||
```graphql
|
||||
{
|
||||
nfts (skip:0, first: 10, subgraphError:deny){
|
||||
id
|
||||
name
|
||||
symbol
|
||||
owner
|
||||
address
|
||||
assetState
|
||||
tx
|
||||
block
|
||||
transferable
|
||||
}
|
||||
}
|
||||
```
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Sample response</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"nfts": [
|
||||
{
|
||||
"address": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
||||
"assetState": 0,
|
||||
"block": 15185270,
|
||||
"id": "0x1c161d721e6d99f58d47f709cdc77025056c544c",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0x327a9da0d2e9df945fd2f8e10b1caa77acf98e803c5a2f588597172a0bcbb93a"
|
||||
},
|
||||
{
|
||||
"address": "0x1e06501660623aa973474e3c59efb8ba542cb083",
|
||||
"assetState": 0,
|
||||
"block": 15185119,
|
||||
"id": "0x1e06501660623aa973474e3c59efb8ba542cb083",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0xd351ccee22b505d811c29fa524db920815936672b20b8f3a09485e389902fd27"
|
||||
},
|
||||
{
|
||||
"address": "0x2eaa55236f799c6ebec72e77a1a6296ea2e704b1",
|
||||
"assetState": 0,
|
||||
"block": 15185009,
|
||||
"id": "0x2eaa55236f799c6ebec72e77a1a6296ea2e704b1",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0xf6d55306ab4dc339dc1655a2d119af468a79a70fa62ea11de78879da61e89e7b"
|
||||
},
|
||||
{
|
||||
"address": "0x2fbe924f6c92825929dc7785fe05d15e35f2612b",
|
||||
"assetState": 0,
|
||||
"block": 15185235,
|
||||
"id": "0x2fbe924f6c92825929dc7785fe05d15e35f2612b",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0xa9ff9d461b4b7344ea181de32fa6412c7ea8e21f485ab4d8a7b9cfcdb68d9d51"
|
||||
},
|
||||
{
|
||||
"address": "0x4c04433bb1760a66be7713884bb6370e9c567cef",
|
||||
"assetState": 0,
|
||||
"block": 15185169,
|
||||
"id": "0x4c04433bb1760a66be7713884bb6370e9c567cef",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0x54c5463e8988b5fa4e4cfe71ee391505801931abe9e94bf1588dd538ec3aa4c9"
|
||||
},
|
||||
{
|
||||
"address": "0x619c500dcb0251b31cd480030db2dcc19866c0c3",
|
||||
"assetState": 0,
|
||||
"block": 15236619,
|
||||
"id": "0x619c500dcb0251b31cd480030db2dcc19866c0c3",
|
||||
"name": "abc",
|
||||
"owner": "0x12fe650c86cd4346933ef1bcab21a1979d4c6786",
|
||||
"symbol": "GOAL-9956",
|
||||
"transferable": true,
|
||||
"tx": "0x6178b03589cda98573ff52a1afbcc07b14a2fddacc0132595949e9d8a0ed1b32"
|
||||
},
|
||||
{
|
||||
"address": "0x6d45a5b38a122a6dbc042601236d6ecc5c8e343e",
|
||||
"assetState": 0,
|
||||
"block": 15109853,
|
||||
"id": "0x6d45a5b38a122a6dbc042601236d6ecc5c8e343e",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xbbd33afa85539fa65cc08a2e61a001876d2f13fe",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0x27aa77a0bf3f7878910dc7bfe2116d9271138c222b3d898381a5c72eefefe624"
|
||||
},
|
||||
{
|
||||
"address": "0x7400078c5d4fd7704afca45a928d9fc97cbea744",
|
||||
"assetState": 0,
|
||||
"block": 15185056,
|
||||
"id": "0x7400078c5d4fd7704afca45a928d9fc97cbea744",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0x2025374cd347e25e2651feec2f2faa2feb26664698eaea42b5dad1a31eda57f8"
|
||||
},
|
||||
{
|
||||
"address": "0x81decdb59dce5b4323e683a76f8fa8dd0eabc560",
|
||||
"assetState": 0,
|
||||
"block": 15185003,
|
||||
"id": "0x81decdb59dce5b4323e683a76f8fa8dd0eabc560",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0xd30dd83132f2227f114db8b90f565bca2832afbd",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0x6ad6ec2ce86bb70e077590a64c886d72975374bd2e993f143d9da8edcaace82b"
|
||||
},
|
||||
{
|
||||
"address": "0x8684119ecf77c5be41f01760ad466725ffd9b960",
|
||||
"assetState": 0,
|
||||
"block": 14933034,
|
||||
"id": "0x8684119ecf77c5be41f01760ad466725ffd9b960",
|
||||
"name": "Ocean Data NFT",
|
||||
"owner": "0x87b5606fba13529e1812319d25c6c2cd5c3f3cbc",
|
||||
"symbol": "OCEAN-NFT",
|
||||
"transferable": true,
|
||||
"tx": "0x55ba746cd8e8fb4c739b8544a9034848082b627500b854cb8db0802dd7beb172"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
@ -1,213 +0,0 @@
|
||||
---
|
||||
description: 'Discover the World of datatokens: Retrieving a List of datatokens'
|
||||
---
|
||||
|
||||
# Get datatokens
|
||||
|
||||
With your newfound knowledge of fetching data NFTs and retrieving the associated information, fetching a list of datatokens will be a breeze :ocean:. Building upon your understanding, let's now delve into the process of retrieving a list of datatokens. By applying similar techniques and leveraging the power of GraphQL queries, you'll be able to effortlessly navigate the landscape of datatokens and access the wealth of information they hold. So, let's dive right in and unlock the potential of exploring datatokens with ease and efficiency.
|
||||
|
||||
|
||||
|
||||
_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_](broken-reference)_._
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Javascript" %}
|
||||
The javascript below can be used to run the query. If you wish to change the network, replace the variable's value `network` as needed. 
|
||||
|
||||
```runkit nodeVersion="18.x.x"
|
||||
var axios = require('axios');
|
||||
|
||||
const query = `{
|
||||
tokens(skip:0, first: 2, subgraphError: deny){
|
||||
id
|
||||
symbol
|
||||
nft {
|
||||
name
|
||||
symbol
|
||||
address
|
||||
}
|
||||
name
|
||||
symbol
|
||||
cap
|
||||
isDatatoken
|
||||
holderCount
|
||||
orderCount
|
||||
orders(skip:0,first:1){
|
||||
amount
|
||||
serviceIndex
|
||||
payer {
|
||||
id
|
||||
}
|
||||
consumer{
|
||||
id
|
||||
}
|
||||
estimatedUSDValue
|
||||
lastPriceToken
|
||||
lastPriceValue
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
const network = "mainnet"
|
||||
var config = {
|
||||
method: 'post',
|
||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: JSON.stringify({ "query": query })
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then(function (response) {
|
||||
let result = JSON.stringify(response.data)
|
||||
console.log(result);
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Python" %}
|
||||
The Python script below can be used to run the query and fetch a list of datatokens. If you wish to change the network, then replace the value of the variable `base_url` as needed.
|
||||
|
||||
**Create script**
|
||||
|
||||
{% code title="list_all_tokens.py" %}
|
||||
```python
|
||||
import requests
|
||||
import json
|
||||
|
||||
query = """
|
||||
{{
|
||||
tokens(skip:0, first: 2, subgraphError: deny){{
|
||||
id
|
||||
symbol
|
||||
nft {{
|
||||
name
|
||||
symbol
|
||||
address
|
||||
}}
|
||||
name
|
||||
symbol
|
||||
cap
|
||||
isDatatoken
|
||||
holderCount
|
||||
orderCount
|
||||
orders(skip:0,first:1){{
|
||||
amount
|
||||
serviceIndex
|
||||
payer {{
|
||||
id
|
||||
}}
|
||||
consumer{{
|
||||
id
|
||||
}}
|
||||
estimatedUSDValue
|
||||
lastPriceToken
|
||||
lastPriceValue
|
||||
}}
|
||||
|
||||
|
||||
}}
|
||||
}}"""
|
||||
|
||||
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))
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
**Execute script**
|
||||
|
||||
```
|
||||
python list_all_tokens.py
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Query" %}
|
||||
Copy the query to fetch a list of datatokens in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). 
|
||||
|
||||
```graphql
|
||||
{
|
||||
tokens(skip:0, first: 2, subgraphError: deny){
|
||||
id
|
||||
symbol
|
||||
nft {
|
||||
name
|
||||
symbol
|
||||
address
|
||||
}
|
||||
name
|
||||
symbol
|
||||
cap
|
||||
isDatatoken
|
||||
holderCount
|
||||
orderCount
|
||||
orders(skip:0,first:1){
|
||||
amount
|
||||
serviceIndex
|
||||
payer {
|
||||
id
|
||||
}
|
||||
consumer{
|
||||
id
|
||||
}
|
||||
estimatedUSDValue
|
||||
lastPriceToken
|
||||
lastPriceValue
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Sample Response</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"tokens": [
|
||||
{
|
||||
"cap": null,
|
||||
"holderCount": "0",
|
||||
"id": "0x0642026e7f0b6ccac5925b4e7fa61384250e1701",
|
||||
"isDatatoken": false,
|
||||
"name": "H2O",
|
||||
"nft": null,
|
||||
"orderCount": "0",
|
||||
"orders": [],
|
||||
"symbol": "H2O"
|
||||
},
|
||||
{
|
||||
"cap": "115792089237316195423570985008687900000000000000000000000000",
|
||||
"holderCount": "0",
|
||||
"id": "0x122d10d543bc600967b4db0f45f80cb1ddee43eb",
|
||||
"isDatatoken": true,
|
||||
"name": "Brave Lobster Token",
|
||||
"nft": {
|
||||
"address": "0xea615374949a2405c3ee555053eca4d74ec4c2f0",
|
||||
"name": "Ocean Data NFT",
|
||||
"symbol": "OCEAN-NFT"
|
||||
},
|
||||
"orderCount": "0",
|
||||
"orders": [],
|
||||
"symbol": "BRALOB-11"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
@ -1,244 +0,0 @@
|
||||
---
|
||||
description: 'Discover the World of NFTs: Retrieving a List of Fixed-rate exchanges'
|
||||
---
|
||||
|
||||
# Get fixed-rate exchanges
|
||||
|
||||
Having gained knowledge about fetching lists of data NFTs and datatokens and extracting specific information about each, let's now explore the process of retrieving the information of fixed-rate exchanges. A fixed-rate exchange refers to a mechanism where data assets can be traded at a predetermined rate or price. These exchanges offer stability and predictability in data transactions, enabling users to securely and reliably exchange data assets based on fixed rates. If you need a refresher on fixed-rate exchanges, visit the [asset pricing](../contracts/pricing-schemas.md#fixed-pricing) page.
|
||||
|
||||
|
||||
|
||||
_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_](broken-reference)_._
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="Javascript" %}
|
||||
The javascript below can be used to run the query and fetch a list of fixed-rate exchanges. If you wish to change the network, replace the variable's value `network` as needed. 
|
||||
|
||||
```runkit nodeVersion="18.x.x"
|
||||
var axios = require('axios');
|
||||
|
||||
const query = `{
|
||||
fixedRateExchanges(skip:0, first:2, subgraphError:deny){
|
||||
id
|
||||
contract
|
||||
exchangeId
|
||||
owner{id}
|
||||
datatoken{
|
||||
id
|
||||
name
|
||||
symbol
|
||||
}
|
||||
price
|
||||
datatokenBalance
|
||||
active
|
||||
totalSwapValue
|
||||
swaps(skip:0, first:1){
|
||||
tx
|
||||
by {
|
||||
id
|
||||
}
|
||||
baseTokenAmount
|
||||
dataTokenAmount
|
||||
createdTimestamp
|
||||
}
|
||||
updates(skip:0, first:1){
|
||||
oldPrice
|
||||
newPrice
|
||||
newActive
|
||||
createdTimestamp
|
||||
tx
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
const network = "mainnet"
|
||||
var config = {
|
||||
method: 'post',
|
||||
url: `https://v4.subgraph.${network}.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph`,
|
||||
headers: { "Content-Type": "application/json" },
|
||||
data: JSON.stringify({ "query": query })
|
||||
};
|
||||
|
||||
axios(config)
|
||||
.then(function (response) {
|
||||
let result = JSON.stringify(response.data)
|
||||
console.log(result)
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Python" %}
|
||||
The Python script below can be used to run the query and retrieve a list of fixed-rate exchanges. If you wish to change the network, then replace the value of the variable `base_url` as needed.
|
||||
|
||||
**Create script**
|
||||
|
||||
{% code title="list_fixed_rate_exchanges.py" %}
|
||||
```python
|
||||
import requests
|
||||
import json
|
||||
|
||||
|
||||
query = """
|
||||
{
|
||||
fixedRateExchanges(skip:0, first:2, subgraphError:deny){
|
||||
id
|
||||
contract
|
||||
exchangeId
|
||||
owner{id}
|
||||
datatoken{
|
||||
id
|
||||
name
|
||||
symbol
|
||||
}
|
||||
price
|
||||
datatokenBalance
|
||||
active
|
||||
totalSwapValue
|
||||
swaps(skip:0, first:1){
|
||||
tx
|
||||
by {
|
||||
id
|
||||
}
|
||||
baseTokenAmount
|
||||
dataTokenAmount
|
||||
createdTimestamp
|
||||
}
|
||||
updates(skip:0, first:1){
|
||||
oldPrice
|
||||
newPrice
|
||||
newActive
|
||||
createdTimestamp
|
||||
tx
|
||||
}
|
||||
}
|
||||
}"""
|
||||
|
||||
|
||||
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))
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
**Execute script**
|
||||
|
||||
```
|
||||
python list_fixed_rate_exchanges.py
|
||||
```
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Query" %}
|
||||
Copy the query to fetch a list of fixed-rate exchanges in the Ocean Subgraph [GraphiQL interface](https://v4.subgraph.mainnet.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph/graphql). 
|
||||
|
||||
```
|
||||
{
|
||||
fixedRateExchanges(skip:0, first:2, subgraphError:deny){
|
||||
id
|
||||
contract
|
||||
exchangeId
|
||||
owner{id}
|
||||
datatoken{
|
||||
id
|
||||
name
|
||||
symbol
|
||||
}
|
||||
price
|
||||
datatokenBalance
|
||||
active
|
||||
totalSwapValue
|
||||
swaps(skip:0, first:1){
|
||||
tx
|
||||
by {
|
||||
id
|
||||
}
|
||||
baseTokenAmount
|
||||
dataTokenAmount
|
||||
createdTimestamp
|
||||
}
|
||||
updates(skip:0, first:1){
|
||||
oldPrice
|
||||
newPrice
|
||||
newActive
|
||||
createdTimestamp
|
||||
tx
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Sample response</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"fixedRateExchanges": [
|
||||
{
|
||||
"active": true,
|
||||
"contract": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02",
|
||||
"datatoken": {
|
||||
"id": "0x9b39a17cc72c8be4813d890172eff746470994ac",
|
||||
"name": "Delightful Pelican Token",
|
||||
"symbol": "DELPEL-79"
|
||||
},
|
||||
"datatokenBalance": "0",
|
||||
"exchangeId": "0x06284c39b48afe5f01a04d56f1aae45dbb29793b190ee11e93a4a77215383d44",
|
||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x06284c39b48afe5f01a04d56f1aae45dbb29793b190ee11e93a4a77215383d44",
|
||||
"owner": {
|
||||
"id": "0x03ef3f422d429bcbd4ee5f77da2917a699f237ed"
|
||||
},
|
||||
"price": "33",
|
||||
"swaps": [
|
||||
{
|
||||
"baseTokenAmount": "33.033",
|
||||
"by": {
|
||||
"id": "0x9b39a17cc72c8be4813d890172eff746470994ac"
|
||||
},
|
||||
"createdTimestamp": 1656563684,
|
||||
"dataTokenAmount": "1",
|
||||
"tx": "0x0b55482f69169c103563062e109f9d71afa01d18f201c425b24b1c74d3c282a3"
|
||||
}
|
||||
],
|
||||
"totalSwapValue": "0",
|
||||
"updates": []
|
||||
},
|
||||
{
|
||||
"active": true,
|
||||
"contract": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02",
|
||||
"datatoken": {
|
||||
"id": "0x2cf074e36a802241f2f8ddb35f4a4557b8f1179b",
|
||||
"name": "Arcadian Eel Token",
|
||||
"symbol": "ARCEEL-17"
|
||||
},
|
||||
"datatokenBalance": "0",
|
||||
"exchangeId": "0x2719862ebc4ed253f09088c878e00ef8ee2a792e1c5c765fac35dc18d7ef4deb",
|
||||
"id": "0xfa48673a7c36a2a768f89ac1ee8c355d5c367b02-0x2719862ebc4ed253f09088c878e00ef8ee2a792e1c5c765fac35dc18d7ef4deb",
|
||||
"owner": {
|
||||
"id": "0x87b5606fba13529e1812319d25c6c2cd5c3f3cbc"
|
||||
},
|
||||
"price": "35",
|
||||
"swaps": [],
|
||||
"totalSwapValue": "0",
|
||||
"updates": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
Loading…
Reference in New Issue
Block a user