Skip to content

Commit cedd082

Browse files
Removing Pool example queries and adding new examples (#493)
1 parent 1289a08 commit cedd082

File tree

1 file changed

+40
-103
lines changed

1 file changed

+40
-103
lines changed

README.md

+40-103
Original file line numberDiff line numberDiff line change
@@ -37,145 +37,82 @@ This subgraph is deployed under `/subgraphs/name/oceanprotocol/ocean-subgraph/`
3737

3838
## ⛵ Example Queries
3939

40-
**All pools**
40+
**All Data NFTs**
4141

4242
```graphql
4343
{
44-
pools(orderBy: baseTokenLiquidity, orderDirection: desc) {
44+
nfts(orderBy: createdTimestamp, orderDirection: desc, first: 1000) {
4545
id
46-
datatoken {
47-
address
48-
}
49-
baseToken {
50-
symbol
51-
}
52-
baseTokenLiquidity
53-
datatokenLiquidity
46+
symbol
47+
name
48+
creator
49+
createdTimestamp
5450
}
5551
}
5652
```
5753

58-
**Pools with the highest liquidity**
54+
> Note: 1000 is the maximum number of items the subgraph can return.
55+
56+
**Total Orders for Each User**
5957

6058
```graphql
6159
{
62-
pools(where: {datatokenLiquidity_gte: 1}, orderBy: baseTokenLiquidity, orderDirection: desc, first: 15) {
60+
users(first: 1000) {
6361
id
64-
datatoken {
65-
address
66-
}
67-
baseToken {
68-
symbol
69-
}
70-
baseTokenLiquidity
71-
datatokenLiquidity
62+
totalOrders
7263
}
7364
}
7465
```
7566

76-
**All Data NFTs**
67+
**Total Orders for All Users**
7768

7869
```graphql
7970
{
80-
nfts(orderBy: createdTimestamp, orderDirection: desc, first: 1000){
81-
id,
82-
symbol,
83-
name,
84-
creator,
85-
createdTimestamp
71+
users(first: 1000) {
72+
id
73+
totalOrders
8674
}
8775
}
8876
```
8977

9078
> Note: 1000 is the maximum number of items the subgraph can return.
9179
92-
**All Datatokens**
80+
**Total Orders for a Specific User**
9381

9482
```graphql
9583
{
96-
tokens(where: {isDatatoken: true}, orderBy: createdTimestamp, orderDirection: desc, first: 1000) {
84+
user(id: $user) {
9785
id
98-
symbol
99-
name
100-
address
101-
holderCount
86+
totalOrders
10287
}
10388
}
10489
```
10590

106-
**All pool transactions for a given user**
107-
108-
```graphql
109-
{
110-
poolTransactions(
111-
orderBy: timestamp
112-
orderDirection: desc
113-
where: { user: $user }
114-
first: 1000
115-
) {
116-
baseToken {
117-
symbol
118-
address
119-
}
120-
baseTokenValue
121-
datatoken {
122-
symbol
123-
address
124-
}
125-
datatokenValue
126-
type
127-
tx
128-
timestamp
129-
pool {
130-
datatoken {
131-
id
132-
}
133-
id
134-
}
135-
}
136-
}
137-
```
138-
13991
> Note: all ETH addresses like `$user` in above example need to be passed as a lowercase string.
14092
141-
**All pool transactions for a given user in an individual pool**
93+
**All Orders**
14294

143-
```graphql
95+
```
14496
{
145-
poolTransactions(
146-
orderBy: timestamp
147-
orderDirection: desc
148-
where: { pool: $pool, user: $user }
149-
first: 1000
150-
) {
151-
baseToken {
152-
symbol
153-
address
154-
}
155-
baseTokenValue
156-
datatoken {
157-
symbol
158-
address
159-
}
160-
datatokenValue
161-
type
162-
tx
163-
timestamp
164-
pool {
165-
datatoken {
166-
id
167-
}
168-
id
169-
}
97+
orders(orderBy: createdTimestamp, orderDirection: desc, first: 1000){
98+
amount
99+
datatoken {
100+
id
101+
}
102+
consumer {
103+
id
104+
}
105+
payer {
106+
id
170107
}
171108
}
109+
}
172110
```
173111

174-
> Note: all ETH addresses like `$pool` and `$user` in above example need to be passed as a lowercase string.
112+
> Note: 1000 is the maximum number of items the subgraph can return.
175113
176114
## 🏊 Development on Barge
177115

178-
179116
1. Clone [barge](https://github.com/oceanprotocol/barge) and run it in another terminal:
180117

181118
```bash
@@ -194,12 +131,14 @@ cd ocean-subgraph
194131
npm i
195132
```
196133

197-
3. Let the components know where to pickup the smart contract addresses.
134+
3. Let the components know where to pickup the smart contract addresses.
135+
198136
```
199137
export ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"
200138
```
201139

202140
4. Generate the subgraphs
141+
203142
```bash
204143
node ./scripts/generatenetworkssubgraphs.js barge
205144
npm run codegen
@@ -219,10 +158,8 @@ npm run deploy:local
219158

220159
You now have a local graph-node running on http://127.0.0.1:9000/subgraphs/name/oceanprotocol/ocean-subgraph/graphql
221160

222-
223161
## 🏊 Deploying graphs for live networks
224162

225-
226163
1. Clone the repo and install dependencies:
227164

228165
```bash
@@ -232,16 +169,16 @@ npm i
232169
```
233170

234171
2. Generate & deploy on rinkeby
172+
235173
```bash
236174
npm run quickstart:rinkeby
237175
```
238176

239-
240177
## 🔍 Testing
241178

242179
- Please note: the `npm run test` command is currently not working due to [this issue](https://github.com/graphprotocol/graph-ts/issues/113).
243180

244-
To run the integration tests locally, first start up barge by following the instructions above, then run the following terminal commands from the ocean-subgraph folder:
181+
To run the integration tests locally, first start up barge by following the instructions above, then run the following terminal commands from the ocean-subgraph folder:
245182

246183
```Bash
247184
export ADDRESS_FILE="${HOME}/.ocean/ocean-contracts/artifacts/address.json"
@@ -262,8 +199,8 @@ npm run format
262199

263200
## 🛳 Releases
264201

265-
Releases are managed semi-automatically. They are always manually triggered from a developer's
266-
machine with release scripts. From a clean `main` branch you can run the release task bumping
202+
Releases are managed semi-automatically. They are always manually triggered from a developer's
203+
machine with release scripts. From a clean `main` branch you can run the release task bumping
267204
the version accordingly based on semantic versioning:
268205

269206
```bash
@@ -310,7 +247,7 @@ You can edit the event handler code and then run `npm run deploy:local`, with so
310247
- Running deploy will fail if the code has no changes
311248
- Sometimes deploy will fail no matter what, in this case:
312249
- Stop the docker-compose run (`docker-compose down` or Ctrl+C)
313-
This should stop the graph-node, ipfs and postgres containers
250+
This should stop the graph-node, ipfs and postgres containers
314251
- Delete the `ipfs` and `postgres` folders in `/docker/data` (`rm -rf ./docker/data/*`)
315252
- Run `docker-compose up` to restart graph-node, ipfs and postgres
316253
- Run `npm run create:local` to create the ocean-subgraph

0 commit comments

Comments
 (0)