diff --git a/client/src/App.tsx b/client/src/App.tsx index 7ac7cb0..8acfb5a 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -1,13 +1,15 @@ import Game from 'components/GameLayout/'; import Web3 from 'components/web3/App'; import BuildMapLayout from 'components/BuildMap/BuildMapLayout'; +import SuperGraph from 'components/SuperfluidGraph/SuperGraph'; function App() { return (
- + {/* */} {/* */} {/* */} +
); } diff --git a/client/src/components/SuperfluidGraph/StreamComponent.tsx b/client/src/components/SuperfluidGraph/StreamComponent.tsx new file mode 100644 index 0000000..47b8e1b --- /dev/null +++ b/client/src/components/SuperfluidGraph/StreamComponent.tsx @@ -0,0 +1,78 @@ +import LinearProgress from '@material-ui/core/LinearProgress'; + +const getAddress = (s: string) => { + const lenght = s.length - 1; + const ss = s.substring(0, 7) + '....' + s.substring(lenght - 7, lenght); + return ss; +}; + +const Box = ({acc1}: {acc1: string}) => { + return ( +
+
+ {getAddress(acc1)} +
+
+ ); +}; + +const App = ({ + title, + inflow, + rate, + acc1, + acc2, +}: { + title: String; + inflow: boolean; + rate: number; + acc1: string; + acc2: string; +}) => { + return ( +
+
+

{title}

+
+
+ +
+

+ {rate} tokens per second +

+ +
+ +
+
+ +
+
+ ); +}; +export default App; diff --git a/client/src/components/SuperfluidGraph/SuperGraph.tsx b/client/src/components/SuperfluidGraph/SuperGraph.tsx new file mode 100644 index 0000000..1ec3d27 --- /dev/null +++ b/client/src/components/SuperfluidGraph/SuperGraph.tsx @@ -0,0 +1,83 @@ +import axios from 'axios'; +import {useEffect} from 'react'; +import StreamComponent from './StreamComponent'; +const myAcc = '0xb651D9b48020fa9C02Aa722c3ADb3cF0c4bb5146'; + +const App = () => { + const start = async () => { + // GrapgQL + const QUERY_URL = + 'https://thegraph.com/explorer/subgraph/superfluid-finance/superfluid-mumbai'; + const query = `{ + account(id: "0xafe0DA2BDBc38A2376C7b775e784075523d3C1AC") { + flowOwned { + flowRate + sum + lastUpdated + token { + id + symbol + } + } + } + } + `; + const result = await axios.post(QUERY_URL, {query}); + console.log('result ', result); + }; + + useEffect(() => { + (() => { + // start(); + })(); + }, []); + + return ( +
+
+

+ Contract Flow on the MapContract + 0xafe0DA2BDBc38A2376C7b775e784075523d3C1AC +

+ + + + +
+
+ ); +}; + +export default App; diff --git a/package.json b/package.json new file mode 100644 index 0000000..8d2ee63 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "axios": "^0.21.1" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..bcbe1bd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,15 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +axios@^0.21.1: + version "0.21.1" + resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" + integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== + dependencies: + follow-redirects "^1.10.0" + +follow-redirects@^1.10.0: + version "1.14.1" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43" + integrity sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==