├── .nojekyll ├── CNAME ├── public ├── favicon.ico ├── index.html └── hicdex.css ├── babel.config.js ├── vue.config.js ├── jsconfig.json ├── src ├── components │ ├── Nav.vue │ ├── charts │ │ ├── LineChart.js │ │ ├── EarningsContainer.vue │ │ ├── EarningsPerObjkt.vue │ │ ├── ArtistVsSecondary.vue │ │ ├── ActiveUsers.vue │ │ ├── Secondary.vue │ │ ├── Cumulative.vue │ │ └── TradeAvg.vue │ ├── Tile.vue │ ├── Foot.vue │ ├── Timestamp.vue │ ├── SwapFilters.vue │ ├── BuyersList.vue │ ├── HistoryItem.vue │ ├── Subjkt.vue │ ├── SwapItem.vue │ ├── SoldItem.vue │ ├── FlipItem.vue │ ├── Gallery.vue │ └── Objkt.vue ├── main.js ├── views │ ├── Charts.vue │ ├── Docs.vue │ ├── CreatorGallery.vue │ ├── CollectorGallery.vue │ ├── PriceHistory.vue │ ├── CreatorCollectors.vue │ ├── Sold.vue │ ├── SwapsOfMyWork.vue │ ├── SwapsOfMyCollection.vue │ ├── Objkt.vue │ ├── Flip.vue │ └── Home.vue ├── App.vue ├── utils.js └── router.js ├── .gitignore ├── README.md ├── .eslintrc.js ├── LICENSE └── package.json /.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /CNAME: -------------------------------------------------------------------------------- 1 | hicdex.com 2 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hicdex/hicdex-hen-graphql-samples/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset', 4 | ], 5 | }; 6 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | pages: { 3 | index: { 4 | title: 'hicdex', 5 | entry: 'src/main.js', 6 | }, 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": [ 3 | "./src/**/*" 4 | ], 5 | "compilerOptions": { 6 | "baseUrl": ".", 7 | "paths": { 8 | "public": [ 9 | "public/*" 10 | ], 11 | "@": [ 12 | "src/*" 13 | ] 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/components/Nav.vue: -------------------------------------------------------------------------------- 1 | 10 | -------------------------------------------------------------------------------- /src/components/charts/LineChart.js: -------------------------------------------------------------------------------- 1 | import { Line, mixins } from 'vue-chartjs'; 2 | 3 | const { reactiveProp } = mixins; 4 | 5 | export default { 6 | extends: Line, 7 | mixins: [reactiveProp], 8 | props: ['options'], 9 | mounted() { 10 | this.renderChart(this.chartData, this.options); 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env.local 8 | .env.*.local 9 | 10 | # Log files 11 | npm-debug.log* 12 | yarn-debug.log* 13 | yarn-error.log* 14 | pnpm-debug.log* 15 | 16 | # Editor directories and files 17 | .idea 18 | .vscode 19 | *.suo 20 | *.ntvs* 21 | *.njsproj 22 | *.sln 23 | *.sw? 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # hicdex-hen-graphql-samples 2 | 3 | ## Project setup 4 | ``` 5 | npm install 6 | ``` 7 | 8 | ### Compiles and hot-reloads for development 9 | ``` 10 | npm run serve 11 | ``` 12 | 13 | ### Compiles and minifies for production 14 | ``` 15 | npm run build 16 | ``` 17 | 18 | ### Lints and fixes files 19 | ``` 20 | npm run lint 21 | ``` 22 | 23 | ### Customize configuration 24 | See [Configuration Reference](https://cli.vuejs.org/config/). 25 | -------------------------------------------------------------------------------- /src/components/Tile.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 22 | -------------------------------------------------------------------------------- /src/components/Foot.vue: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 12 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/components/Timestamp.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 27 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | browser: true, 6 | es6: true, 7 | }, 8 | extends: [ 9 | 'eslint:recommended', 10 | 'plugin:vue/essential', 11 | '@vue/airbnb', 12 | ], 13 | globals: {}, 14 | rules: { 15 | 'no-console': 'off', 16 | 'no-debugger': 'warn', 17 | 'prefer-template': 'off', 18 | 'no-param-reassign': 'off', 19 | 'no-nested-ternary': 'off', 20 | 'template-curly-spacing': 'off', 21 | indent: 'off', 22 | 'max-len': 'off', 23 | 'class-methods-use-this': 'off', 24 | 'no-underscore-dangle': 'off', 25 | 'prefer-destructuring': 'off', 26 | 'consistent-return': 'off', 27 | 'object-curly-newline': 'off', 28 | 'no-unused-vars': ['error', { argsIgnorePattern: '^_' }], 29 | 'import/no-cycle': 'off', 30 | }, 31 | parserOptions: { 32 | parser: 'babel-eslint', 33 | }, 34 | }; 35 | -------------------------------------------------------------------------------- /src/components/SwapFilters.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 30 | -------------------------------------------------------------------------------- /src/components/BuyersList.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 35 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import GeistUI from '@geist-ui/vue'; 3 | import Buefy from 'buefy'; 4 | import VueApollo from 'vue-apollo'; 5 | 6 | import ApolloClient from 'apollo-client'; 7 | import { InMemoryCache } from 'apollo-cache-inmemory'; 8 | import { WebSocketLink } from 'apollo-link-ws'; 9 | 10 | import App from './App.vue'; 11 | import router from './router'; 12 | 13 | import 'buefy/dist/buefy.css'; 14 | import '../public/hicdex.css'; 15 | 16 | Vue.use(VueApollo); 17 | 18 | Vue.use(Buefy); 19 | Vue.use(GeistUI); 20 | 21 | Vue.config.productionTip = false; 22 | 23 | const link = new WebSocketLink({ 24 | uri: 'wss://api.hicdex.com/v1/graphql', 25 | options: { 26 | reconnect: true, 27 | timeout: 30000, 28 | }, 29 | }); 30 | 31 | const client = new ApolloClient({ 32 | link, 33 | cache: new InMemoryCache({ 34 | addTypename: true, 35 | }), 36 | }); 37 | 38 | const apolloProvider = new VueApollo({ 39 | defaultClient: client, 40 | }); 41 | 42 | new Vue({ 43 | router, 44 | apolloProvider, 45 | render: (h) => h(App), 46 | }).$mount('#app'); 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2021 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/views/Charts.vue: -------------------------------------------------------------------------------- 1 | 31 | 32 | 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hicdex-hen-graphql-samples", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint", 9 | "deploy": "npm run build && cp dist/index.html dist/404.html && cp CNAME .nojekyll dist/ && gh-pages -t -d dist" 10 | }, 11 | "dependencies": { 12 | "@geist-ui/vue": "^3.0.0", 13 | "@taquito/beacon-wallet": "^9.1.0", 14 | "@taquito/taquito": "^9.1.0", 15 | "apollo-cache-inmemory": "1.6.6", 16 | "apollo-client": "2.6.10", 17 | "apollo-link-http": "1.5.17", 18 | "apollo-link-ws": "1.0.20", 19 | "buefy": "^0.9.7", 20 | "chart.js": "^2.9.4", 21 | "core-js": "^3.6.5", 22 | "graphql": "14.5.8", 23 | "graphql-tag": "^2.10.1", 24 | "subscriptions-transport-ws": "0.9.16", 25 | "vue": "^2.6.11", 26 | "vue-apollo": "^3.0.7", 27 | "vue-chartjs": "^3.5.1", 28 | "vue-router": "^3.5.1" 29 | }, 30 | "devDependencies": { 31 | "@vue/cli-plugin-babel": "~4.5.0", 32 | "@vue/cli-plugin-eslint": "~4.5.0", 33 | "@vue/cli-service": "~4.5.0", 34 | "@vue/eslint-config-airbnb": "^5.3.0", 35 | "babel-eslint": "^10.1.0", 36 | "eslint": "^6.7.2", 37 | "eslint-plugin-vue": "^6.2.2", 38 | "gh-pages": "^3.1.0", 39 | "vue-template-compiler": "^2.6.11" 40 | }, 41 | "browserslist": [ 42 | "> 1%", 43 | "last 2 versions", 44 | "not dead" 45 | ] 46 | } 47 | -------------------------------------------------------------------------------- /src/components/HistoryItem.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 45 | -------------------------------------------------------------------------------- /src/components/Subjkt.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 52 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 34 | -------------------------------------------------------------------------------- /src/components/charts/EarningsContainer.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 41 | -------------------------------------------------------------------------------- /src/components/charts/EarningsPerObjkt.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 78 | -------------------------------------------------------------------------------- /public/hicdex.css: -------------------------------------------------------------------------------- 1 | .navbar { 2 | width: 100px; 3 | } 4 | 5 | .footer { 6 | margin-top: 2em; 7 | padding: 2rem 1.5rem 2rem; 8 | } 9 | 10 | .root-container { 11 | min-height: calc(100vh - 216px); 12 | padding-top: 10px; 13 | } 14 | 15 | 16 | code:after, code:before { 17 | content: ""; 18 | } 19 | 20 | table tr td { 21 | font-size: 1rem; 22 | font-size: 0.9rem; 23 | font-weight: 700; 24 | } 25 | pre { 26 | font-size: 1rem; 27 | } 28 | 29 | .table-row { 30 | background: #f3f3f3; 31 | } 32 | 33 | a.primary-sale { 34 | font-weight: 300; 35 | } 36 | 37 | article.tile a { 38 | text-decoration: none !important; 39 | } 40 | 41 | .github-corner { 42 | height: 100px; 43 | display: block; 44 | position: absolute; 45 | top: 0px; 46 | right: 0px; 47 | overflow: hidden; 48 | z-index: 2; 49 | } 50 | 51 | .github-corner svg { 52 | height: 100px; 53 | width: 100px; 54 | } 55 | 56 | .github-corner:hover .octo-arm { 57 | animation: octocat-wave 560ms ease-in-out; 58 | } 59 | 60 | @media screen and (max-width: 800px) { 61 | .github-corner svg { 62 | height: 90px; 63 | width: 90px; 64 | } 65 | 66 | .github-corner:hover .octo-arm { 67 | animation: none; 68 | } 69 | 70 | .github-corner .octo-arm { 71 | animation: octocat-wave 560ms ease-in-out; 72 | } 73 | } 74 | 75 | @media screen and (max-width: 400px) { 76 | .github-corner svg { 77 | height: 70px; 78 | width: 70px; 79 | } 80 | } 81 | 82 | @keyframes octocat-wave { 83 | 0%, 100% { 84 | transform: rotate(0); 85 | } 86 | 87 | 20%, 60% { 88 | transform: rotate(-25deg); 89 | } 90 | 91 | 40%, 80% { 92 | transform: rotate(10deg); 93 | } 94 | } 95 | 96 | .text-post-field { 97 | padding-bottom: calc(0.5em - 1px); 98 | padding-left: 1em; 99 | padding-right: 1em; 100 | padding-top: calc(0.5em - 1px); 101 | } 102 | -------------------------------------------------------------------------------- /src/utils.js: -------------------------------------------------------------------------------- 1 | export function graphqlTemplate(query, params) { 2 | const type = query.definitions[0].selectionSet.selections[0].name.value; 3 | return ` 4 | const query = \`${query.loc.source.body}\`; 5 | 6 | async function fetchGraphQL(operationsDoc, operationName, variables) { 7 | const result = await fetch( 8 | "https://api.hicdex.com/v1/graphql", 9 | { 10 | method: "POST", 11 | body: JSON.stringify({ 12 | query: operationsDoc, 13 | variables: variables, 14 | operationName: operationName 15 | }) 16 | } 17 | ); 18 | 19 | return await result.json(); 20 | } 21 | 22 | async function doFetch() { 23 | const { errors, data } = await fetchGraphQL(query, "${query.definitions[0].name.value}", ${JSON.stringify(params, null, 0)}); 24 | if (errors) { 25 | console.error(errors); 26 | } 27 | const result = data.${type} 28 | console.log({ result }) 29 | return result 30 | } 31 | `; 32 | } 33 | 34 | function isTezosDomain(address) { 35 | return /\.tez$/.test(address); 36 | } 37 | 38 | async function resolveTezosDomain(domain) { 39 | try { 40 | const result = await fetch('https://api.tezos.domains/graphql', { 41 | headers: { 42 | 'content-type': 'application/json', 43 | }, 44 | method: 'POST', 45 | mode: 'cors', 46 | credentials: 'omit', 47 | body: JSON.stringify({ 48 | query: 'query resolveDomain($domain: String!) {\n domain(name: $domain) {\n address\n }\n}\n', 49 | variables: { domain }, 50 | operationName: 'resolveDomain', 51 | }), 52 | }); 53 | 54 | const response = await result.json(); 55 | return response?.data?.domain?.address || ''; 56 | } catch (err) { 57 | return ''; 58 | } 59 | } 60 | 61 | export async function getAddress(addressOrDomain) { 62 | if (isTezosDomain(addressOrDomain)) { 63 | const address = await resolveTezosDomain(addressOrDomain); 64 | if (address) { 65 | return address; 66 | } 67 | } 68 | 69 | return addressOrDomain; 70 | } 71 | -------------------------------------------------------------------------------- /src/components/charts/ArtistVsSecondary.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 86 | -------------------------------------------------------------------------------- /src/router.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Router from 'vue-router'; 3 | import Docs from '@/views/Docs.vue'; 4 | import Sold from '@/views/Sold.vue'; 5 | import Flip from '@/views/Flip.vue'; 6 | import Objkt from '@/views/Objkt.vue'; 7 | import Charts from '@/views/Charts.vue'; 8 | import Home from '@/views/Home.vue'; 9 | import SwapsOfMyWork from '@/views/SwapsOfMyWork.vue'; 10 | import SwapsOfMyCollection from '@/views/SwapsOfMyCollection.vue'; 11 | import CreatorGallery from '@/views/CreatorGallery.vue'; 12 | import CollectorGallery from '@/views/CollectorGallery.vue'; 13 | import PriceHistory from '@/views/PriceHistory.vue'; 14 | import CreatorCollectors from '@/views/CreatorCollectors.vue'; 15 | 16 | Vue.use(Router); 17 | 18 | const router = new Router({ 19 | mode: 'history', 20 | base: process.env.BASE_URL, 21 | routes: [ 22 | { 23 | path: '/', 24 | name: 'home', 25 | component: Home, 26 | }, 27 | { 28 | path: '/my-art-on-secondary-market', 29 | name: 'my-art-on-secondary-market', 30 | component: SwapsOfMyWork, 31 | }, 32 | { 33 | path: '/my-secondary-market-sales', 34 | name: 'my-secondary-market-sales', 35 | component: SwapsOfMyCollection, 36 | }, 37 | { 38 | path: '/creator-gallery', 39 | name: 'creator-gallery', 40 | component: CreatorGallery, 41 | }, 42 | { 43 | path: '/collector-gallery', 44 | name: 'collector-gallery', 45 | component: CollectorGallery, 46 | }, 47 | { 48 | path: '/price-history', 49 | name: 'price-history', 50 | component: PriceHistory, 51 | }, 52 | { 53 | path: '/creator-collectors', 54 | name: 'creator-collectors', 55 | component: CreatorCollectors, 56 | }, 57 | { 58 | path: '/sold', 59 | name: 'sold', 60 | component: Sold, 61 | }, 62 | { 63 | path: '/flip', 64 | name: 'flip', 65 | component: Flip, 66 | }, 67 | { 68 | path: '/objkt', 69 | name: 'objkt', 70 | component: Objkt, 71 | }, 72 | { 73 | path: '/docs', 74 | name: 'docs', 75 | component: Docs, 76 | }, 77 | { 78 | path: '/charts', 79 | name: 'charts', 80 | component: Charts, 81 | }, 82 | ], 83 | }); 84 | 85 | export default router; 86 | -------------------------------------------------------------------------------- /src/views/Docs.vue: -------------------------------------------------------------------------------- 1 | 66 | 67 | 72 | -------------------------------------------------------------------------------- /src/components/SwapItem.vue: -------------------------------------------------------------------------------- 1 | 45 | 46 | 73 | -------------------------------------------------------------------------------- /src/components/SoldItem.vue: -------------------------------------------------------------------------------- 1 | 44 | 45 | 75 | -------------------------------------------------------------------------------- /src/components/charts/ActiveUsers.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 106 | -------------------------------------------------------------------------------- /src/components/charts/Secondary.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 116 | -------------------------------------------------------------------------------- /src/components/charts/Cumulative.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 115 | -------------------------------------------------------------------------------- /src/views/CreatorGallery.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 112 | -------------------------------------------------------------------------------- /src/components/charts/TradeAvg.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 121 | -------------------------------------------------------------------------------- /src/views/CollectorGallery.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 117 | -------------------------------------------------------------------------------- /src/views/PriceHistory.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 122 | -------------------------------------------------------------------------------- /src/components/FlipItem.vue: -------------------------------------------------------------------------------- 1 | 58 | 59 | 86 | -------------------------------------------------------------------------------- /src/views/CreatorCollectors.vue: -------------------------------------------------------------------------------- 1 | 27 | 28 | 112 | -------------------------------------------------------------------------------- /src/views/Sold.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 125 | -------------------------------------------------------------------------------- /src/views/SwapsOfMyWork.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 129 | -------------------------------------------------------------------------------- /src/views/SwapsOfMyCollection.vue: -------------------------------------------------------------------------------- 1 | 24 | 25 | 128 | -------------------------------------------------------------------------------- /src/components/Gallery.vue: -------------------------------------------------------------------------------- 1 | 70 | 71 | 78 | 141 | -------------------------------------------------------------------------------- /src/views/Objkt.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 297 | -------------------------------------------------------------------------------- /src/views/Flip.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 225 | -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 163 | 164 | 286 | -------------------------------------------------------------------------------- /src/components/Objkt.vue: -------------------------------------------------------------------------------- 1 | 308 | 309 | 392 | --------------------------------------------------------------------------------