Skip to content

Commit

Permalink
make example work
Browse files Browse the repository at this point in the history
  • Loading branch information
yornaath committed May 29, 2024
1 parent b608745 commit 6480497
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@yornaath/batshit": "*",
"@yornaath/batshit-devtools": "*",
"@yornaath/batshit-devtools-react": "*",
"@zeitgeistpm/indexer": "^3.11.0",
"@zeitgeistpm/indexer": "^4.4.2",
"delay": "^5.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
8 changes: 7 additions & 1 deletion packages/example/src/components/Market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ export const Market = (props: { market: Ztg.FullMarketFragment }) => {
)}
{pool && (
<div style={{ marginRight: 8 }}>
{Number(pool.volume / 10 ** 10).toFixed(2)} VOL
{Number(
pool.account.balances.reduce((acc, balance) => {
return acc + Number(balance.balance);
}, 0) /
10 ** 10
).toFixed(2)}{" "}
VOL
{assets && ","}
</div>
)}
Expand Down
9 changes: 6 additions & 3 deletions packages/example/src/hooks/useAssetsForPool.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ const assetsBatcher = batshit.create({
await delay(200);
const { assets } = await zeitgeist.assets({
where: {
pool: {
poolId_in: ids,
market: {
pool: {
poolId_in: ids,
},
},
},
});
return assets;
},
resolver: (assets, query) => assets.filter((a) => a.pool?.poolId === query),
resolver: (assets, query) =>
assets.filter((a) => a.market.pool?.poolId === query),
scheduler: batshit.bufferScheduler(1000),
name: "assets",
});
Expand Down
10 changes: 5 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1097,14 +1097,14 @@ __metadata:
languageName: unknown
linkType: soft

"@zeitgeistpm/indexer@npm:^3.11.0":
version: 3.11.0
resolution: "@zeitgeistpm/indexer@npm:3.11.0"
"@zeitgeistpm/indexer@npm:^4.4.2":
version: 4.8.0
resolution: "@zeitgeistpm/indexer@npm:4.8.0"
dependencies:
graphql: ^16.6.0
graphql-request: ^5.0.0
graphql-tag: ^2.12.6
checksum: 66aa8c07e27bad809b6e729d2bdd59bc73d243492e36ad0498d96780f29eb25532616eb9ccdfd44751b18764718efac5987a70224ce4ba38f452da3c59e6647d
checksum: 20040980e15c9564231e851e64ad71e5febf931b97a520a416f98d4705fca4f04628b4ccaee14ba6182ac456c028eb6482d686cb0bb08b0d4606bf96b87c18c7
languageName: node
linkType: hard

Expand Down Expand Up @@ -2065,7 +2065,7 @@ __metadata:
"@yornaath/batshit": "*"
"@yornaath/batshit-devtools": "*"
"@yornaath/batshit-devtools-react": "*"
"@zeitgeistpm/indexer": ^3.11.0
"@zeitgeistpm/indexer": ^4.4.2
delay: ^5.0.0
react: ^18.2.0
react-dom: ^18.2.0
Expand Down

0 comments on commit 6480497

Please sign in to comment.