project: init
This commit is contained in:
commit
9c2e819ebc
90
.gitignore
vendored
Normal file
90
.gitignore
vendored
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
|
### Node template
|
||||||
|
# Logs
|
||||||
|
/logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# Nuxt generate
|
||||||
|
dist
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless
|
||||||
|
|
||||||
|
# IDE / Editor
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Service worker
|
||||||
|
sw.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Vim swap files
|
||||||
|
*.swp
|
96
.prettierignore
Normal file
96
.prettierignore
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
###
|
||||||
|
# Place your Prettier ignore content here
|
||||||
|
|
||||||
|
###
|
||||||
|
# .gitignore content is duplicated here due to https://github.com/prettier/prettier/issues/8506
|
||||||
|
|
||||||
|
# Created by .ignore support plugin (hsz.mobi)
|
||||||
|
### Node template
|
||||||
|
# Logs
|
||||||
|
/logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# TypeScript v1 declaration files
|
||||||
|
typings/
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variables file
|
||||||
|
.env
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# next.js build output
|
||||||
|
.next
|
||||||
|
|
||||||
|
# nuxt.js build output
|
||||||
|
.nuxt
|
||||||
|
|
||||||
|
# Nuxt generate
|
||||||
|
dist
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless
|
||||||
|
|
||||||
|
# IDE / Editor
|
||||||
|
.idea
|
||||||
|
|
||||||
|
# Service worker
|
||||||
|
sw.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Vim swap files
|
||||||
|
*.swp
|
4
.prettierrc
Normal file
4
.prettierrc
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"semi": false,
|
||||||
|
"singleQuote": true
|
||||||
|
}
|
8
.vscode/settings.json
vendored
Normal file
8
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"typescript.format.enable": false,
|
||||||
|
"editor.formatOnSave": true,
|
||||||
|
"[vue]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
}
|
||||||
|
}
|
68
README.md
Normal file
68
README.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
# kitabu-explorer
|
||||||
|
|
||||||
|
## Build Setup
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# install dependencies
|
||||||
|
$ yarn install
|
||||||
|
|
||||||
|
# serve with hot reload at localhost:3000
|
||||||
|
$ yarn dev
|
||||||
|
|
||||||
|
# build for production and launch server
|
||||||
|
$ yarn build
|
||||||
|
$ yarn start
|
||||||
|
|
||||||
|
# generate static project
|
||||||
|
$ yarn generate
|
||||||
|
```
|
||||||
|
|
||||||
|
For detailed explanation on how things work, check out the [documentation](https://nuxtjs.org).
|
||||||
|
|
||||||
|
## Special Directories
|
||||||
|
|
||||||
|
You can create the following extra directories, some of which have special behaviors. Only `pages` is required; you can delete them if you don't want to use their functionality.
|
||||||
|
|
||||||
|
### `assets`
|
||||||
|
|
||||||
|
The assets directory contains your uncompiled assets such as Stylus or Sass files, images, or fonts.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/assets).
|
||||||
|
|
||||||
|
### `components`
|
||||||
|
|
||||||
|
The components directory contains your Vue.js components. Components make up the different parts of your page and can be reused and imported into your pages, layouts and even other components.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/components).
|
||||||
|
|
||||||
|
### `layouts`
|
||||||
|
|
||||||
|
Layouts are a great help when you want to change the look and feel of your Nuxt app, whether you want to include a sidebar or have distinct layouts for mobile and desktop.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/layouts).
|
||||||
|
|
||||||
|
### `pages`
|
||||||
|
|
||||||
|
This directory contains your application views and routes. Nuxt will read all the `*.vue` files inside this directory and setup Vue Router automatically.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/get-started/routing).
|
||||||
|
|
||||||
|
### `plugins`
|
||||||
|
|
||||||
|
The plugins directory contains JavaScript plugins that you want to run before instantiating the root Vue.js Application. This is the place to add Vue plugins and to inject functions or constants. Every time you need to use `Vue.use()`, you should create a file in `plugins/` and add its path to plugins in `nuxt.config.js`.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/plugins).
|
||||||
|
|
||||||
|
### `static`
|
||||||
|
|
||||||
|
This directory contains your static files. Each file inside this directory is mapped to `/`.
|
||||||
|
|
||||||
|
Example: `/static/robots.txt` is mapped as `/robots.txt`.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/static).
|
||||||
|
|
||||||
|
### `store`
|
||||||
|
|
||||||
|
This directory contains your Vuex store files. Creating a file in this directory automatically activates Vuex.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/docs/2.x/directory-structure/store).
|
4
assets/variables.scss
Normal file
4
assets/variables.scss
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
// Ref: https://github.com/nuxt-community/vuetify-module#customvariables
|
||||||
|
//
|
||||||
|
// The variables you want to modify
|
||||||
|
// $font-size-root: 20px;
|
19
components/InfoCard.vue
Normal file
19
components/InfoCard.vue
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<template>
|
||||||
|
<v-alert prominent dark :color="color" :icon="icon">
|
||||||
|
<div class="title">
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
<div>{{ subTitle }}</div>
|
||||||
|
</v-alert>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
icon: String,
|
||||||
|
title: String,
|
||||||
|
subTitle: Number,
|
||||||
|
color: String,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
12
jsconfig.json
Normal file
12
jsconfig.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"~/*": ["./*"],
|
||||||
|
"@/*": ["./*"],
|
||||||
|
"~~/*": ["./*"],
|
||||||
|
"@@/*": ["./*"]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules", ".nuxt", "dist"]
|
||||||
|
}
|
81
layouts/default.vue
Normal file
81
layouts/default.vue
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<template>
|
||||||
|
<v-app>
|
||||||
|
<v-app-bar color="primary" dark flat app>
|
||||||
|
<v-container class="d-flex justify-space-between align-center">
|
||||||
|
<v-btn text rounded>Kitabu Chain Explorer</v-btn>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<div>
|
||||||
|
<v-btn
|
||||||
|
v-for="link in internalLinks"
|
||||||
|
:key="link.title"
|
||||||
|
text
|
||||||
|
:href="link.link"
|
||||||
|
target="_blank"
|
||||||
|
rounded
|
||||||
|
class="my-2"
|
||||||
|
>
|
||||||
|
{{ link.title }}
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</v-container>
|
||||||
|
</v-app-bar>
|
||||||
|
<v-main class="grey lighten-3">
|
||||||
|
<v-container>
|
||||||
|
<Nuxt />
|
||||||
|
</v-container>
|
||||||
|
</v-main>
|
||||||
|
<v-footer dark color="primary" padless>
|
||||||
|
<v-container class="d-flex justify-space-between align-center">
|
||||||
|
<div>
|
||||||
|
<v-btn
|
||||||
|
small
|
||||||
|
v-for="link in externalLinks"
|
||||||
|
:key="link.title"
|
||||||
|
text
|
||||||
|
:href="link.link"
|
||||||
|
target="_blank"
|
||||||
|
rounded
|
||||||
|
class="my-2"
|
||||||
|
>
|
||||||
|
{{ link.title }}
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<v-btn
|
||||||
|
v-for="item in social"
|
||||||
|
:href="item.link"
|
||||||
|
:key="item.icon"
|
||||||
|
class="mx-4 white--text"
|
||||||
|
icon
|
||||||
|
>
|
||||||
|
<v-icon>
|
||||||
|
{{ item.icon }}
|
||||||
|
</v-icon>
|
||||||
|
</v-btn>
|
||||||
|
</div>
|
||||||
|
</v-container>
|
||||||
|
</v-footer>
|
||||||
|
</v-app>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data: () => ({
|
||||||
|
externalLinks: [
|
||||||
|
{ title: 'About', link: '/about' },
|
||||||
|
{ title: 'Docs', link: '/docs' },
|
||||||
|
],
|
||||||
|
internalLinks: [
|
||||||
|
{ title: 'Transactions', link: '/about' },
|
||||||
|
{ title: 'Validators', link: '/about' },
|
||||||
|
{ title: 'Tokens', link: '/docs' },
|
||||||
|
{ title: 'Blocks', link: '/docs' },
|
||||||
|
{ title: 'Stats', link: '/about' },
|
||||||
|
],
|
||||||
|
social: [
|
||||||
|
{ icon: 'mdi-discord', link: 'https://grassrootseconomics.org' },
|
||||||
|
{ icon: 'mdi-gitlab', link: 'https://gitlab.com/grassrootseconomics' },
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
</script>
|
43
layouts/error.vue
Normal file
43
layouts/error.vue
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<template>
|
||||||
|
<v-app>
|
||||||
|
<h1 v-if="error.statusCode === 404">
|
||||||
|
{{ pageNotFound }}
|
||||||
|
</h1>
|
||||||
|
<h1 v-else>
|
||||||
|
{{ otherError }}
|
||||||
|
</h1>
|
||||||
|
<NuxtLink to="/"> Home page </NuxtLink>
|
||||||
|
</v-app>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'EmptyLayout',
|
||||||
|
layout: 'empty',
|
||||||
|
props: {
|
||||||
|
error: {
|
||||||
|
type: Object,
|
||||||
|
default: null,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
pageNotFound: '404 Not Found',
|
||||||
|
otherError: 'An error occurred',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
head() {
|
||||||
|
const title =
|
||||||
|
this.error.statusCode === 404 ? this.pageNotFound : this.otherError
|
||||||
|
return {
|
||||||
|
title,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
h1 {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
</style>
|
74
nuxt.config.js
Normal file
74
nuxt.config.js
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
import colors from 'vuetify/es5/util/colors'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
// Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
|
||||||
|
ssr: false,
|
||||||
|
|
||||||
|
// Target: https://go.nuxtjs.dev/config-target
|
||||||
|
target: 'static',
|
||||||
|
|
||||||
|
// Global page headers: https://go.nuxtjs.dev/config-head
|
||||||
|
head: {
|
||||||
|
titleTemplate: '%s - kitabu-explorer',
|
||||||
|
title: 'kitabu-explorer',
|
||||||
|
htmlAttrs: {
|
||||||
|
lang: 'en',
|
||||||
|
},
|
||||||
|
meta: [
|
||||||
|
{ charset: 'utf-8' },
|
||||||
|
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
||||||
|
{ hid: 'description', name: 'description', content: '' },
|
||||||
|
{ name: 'format-detection', content: 'telephone=no' },
|
||||||
|
],
|
||||||
|
link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
|
||||||
|
},
|
||||||
|
|
||||||
|
// Global CSS: https://go.nuxtjs.dev/config-css
|
||||||
|
css: [],
|
||||||
|
|
||||||
|
// Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
|
||||||
|
plugins: [],
|
||||||
|
|
||||||
|
// Auto import components: https://go.nuxtjs.dev/config-components
|
||||||
|
components: true,
|
||||||
|
|
||||||
|
// Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
|
||||||
|
buildModules: [
|
||||||
|
// https://go.nuxtjs.dev/vuetify
|
||||||
|
'@nuxtjs/vuetify',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Modules: https://go.nuxtjs.dev/config-modules
|
||||||
|
modules: [
|
||||||
|
// https://go.nuxtjs.dev/axios
|
||||||
|
'@nuxtjs/axios',
|
||||||
|
],
|
||||||
|
|
||||||
|
// Axios module configuration: https://go.nuxtjs.dev/config-axios
|
||||||
|
axios: {
|
||||||
|
// Workaround to avoid enforcing hard-coded localhost:3000: https://github.com/nuxt-community/axios-module/issues/308
|
||||||
|
baseURL: '/',
|
||||||
|
},
|
||||||
|
|
||||||
|
// Vuetify module configuration: https://go.nuxtjs.dev/config-vuetify
|
||||||
|
vuetify: {
|
||||||
|
customVariables: ['~/assets/variables.scss'],
|
||||||
|
theme: {
|
||||||
|
dark: false,
|
||||||
|
themes: {
|
||||||
|
dark: {
|
||||||
|
primary: colors.blue.darken2,
|
||||||
|
accent: colors.grey.darken3,
|
||||||
|
secondary: colors.amber.darken3,
|
||||||
|
info: colors.teal.lighten1,
|
||||||
|
warning: colors.amber.base,
|
||||||
|
error: colors.deepOrange.accent4,
|
||||||
|
success: colors.green.accent3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
// Build Configuration: https://go.nuxtjs.dev/config-build
|
||||||
|
build: {},
|
||||||
|
}
|
29
package.json
Normal file
29
package.json
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
{
|
||||||
|
"name": "kitabu-explorer",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"dev": "nuxt",
|
||||||
|
"build": "nuxt build",
|
||||||
|
"start": "nuxt start",
|
||||||
|
"generate": "nuxt generate",
|
||||||
|
"lint:prettier": "prettier --check .",
|
||||||
|
"lint": "yarn lint:prettier",
|
||||||
|
"lintfix": "prettier --write --list-different ."
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@nuxtjs/axios": "^5.13.6",
|
||||||
|
"core-js": "^3.19.3",
|
||||||
|
"nuxt": "^2.15.8",
|
||||||
|
"vue": "^2.6.14",
|
||||||
|
"vue-server-renderer": "^2.6.14",
|
||||||
|
"vue-template-compiler": "^2.6.14",
|
||||||
|
"vuetify": "^2.6.1",
|
||||||
|
"webpack": "^4.46.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@nuxtjs/vuetify": "^1.12.3",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
"prettier": "^2.5.1"
|
||||||
|
}
|
||||||
|
}
|
136
pages/index.vue
Normal file
136
pages/index.vue
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
<template>
|
||||||
|
<v-container>
|
||||||
|
<v-row class="d-flex justify-space-beetween">
|
||||||
|
<v-col cols="12">
|
||||||
|
<v-form>
|
||||||
|
<v-text-field
|
||||||
|
background-color="white"
|
||||||
|
append-icon="mdi-magnify"
|
||||||
|
label="Search by Address / Txn Hash / Block"
|
||||||
|
outlined
|
||||||
|
clearable
|
||||||
|
></v-text-field>
|
||||||
|
</v-form>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-row class="d-flex justify-space-beetween">
|
||||||
|
<v-col cols="12" sm="6" lg="4">
|
||||||
|
<info-card
|
||||||
|
icon="mdi-cube-scan"
|
||||||
|
title="Block Height"
|
||||||
|
:sub-title="latestBlock"
|
||||||
|
color="blue"
|
||||||
|
>
|
||||||
|
</info-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="6" lg="4">
|
||||||
|
<info-card
|
||||||
|
icon="mdi-pickaxe"
|
||||||
|
title="Active Validators"
|
||||||
|
:sub-title="12"
|
||||||
|
color="red"
|
||||||
|
>
|
||||||
|
</info-card>
|
||||||
|
</v-col>
|
||||||
|
<v-col cols="12" sm="6" lg="4">
|
||||||
|
<info-card
|
||||||
|
icon="mdi-wallet"
|
||||||
|
title="Wallet Addresses"
|
||||||
|
:sub-title="25466"
|
||||||
|
color="green"
|
||||||
|
>
|
||||||
|
</info-card>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
<v-row class="d-flex justify-space-between">
|
||||||
|
<v-col cols="12" lg="7">
|
||||||
|
<v-data-table
|
||||||
|
calculate-widths
|
||||||
|
:headers="blocksTable"
|
||||||
|
:items="latestBlocks"
|
||||||
|
>
|
||||||
|
<template v-slot:item="{ item }">
|
||||||
|
<tr>
|
||||||
|
<td>{{ item.height }}</td>
|
||||||
|
<td class="truncate">{{ item.hash }}</td>
|
||||||
|
<td class="truncate">{{ item.miner }}</td>
|
||||||
|
</tr>
|
||||||
|
</template></v-data-table
|
||||||
|
>
|
||||||
|
</v-col>
|
||||||
|
</v-row>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
mounted() {
|
||||||
|
let nuxtCtx = this
|
||||||
|
if (process.client) {
|
||||||
|
const wsConnection = new WebSocket('wss://ws.rpc.grassecon.net')
|
||||||
|
|
||||||
|
wsConnection.onmessage = function (event) {
|
||||||
|
const blockData = JSON.parse(event.data)
|
||||||
|
if (blockData?.params) {
|
||||||
|
nuxtCtx.queueBlock({
|
||||||
|
height: blockData.params.result.number,
|
||||||
|
hash: blockData.params.result.hash,
|
||||||
|
miner: blockData.params.result.author,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wsConnection.onopen = function (event) {
|
||||||
|
this.send(
|
||||||
|
JSON.stringify({
|
||||||
|
method: 'eth_subscribe',
|
||||||
|
params: ['newHeads'],
|
||||||
|
id: 1,
|
||||||
|
jsonrpc: '2.0',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
latestBlock: '0x1',
|
||||||
|
blocksTable: [
|
||||||
|
{
|
||||||
|
text: 'Height',
|
||||||
|
value: 'height',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Hash',
|
||||||
|
value: 'hash',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: 'Miner',
|
||||||
|
value: 'miner',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
latestBlocks: [],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
queueBlock(opts) {
|
||||||
|
this.latestBlocks.push(opts)
|
||||||
|
this.latestBlock = opts.height
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.container {
|
||||||
|
max-width: 1250px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.truncate {
|
||||||
|
max-width: 200px;
|
||||||
|
white-space: nowrap;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
</style>
|
BIN
static/favicon.ico
Normal file
BIN
static/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.4 KiB |
10
store/README.md
Normal file
10
store/README.md
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# STORE
|
||||||
|
|
||||||
|
**This directory is not required, you can delete it if you don't want to use it.**
|
||||||
|
|
||||||
|
This directory contains your Vuex Store files.
|
||||||
|
Vuex Store option is implemented in the Nuxt.js framework.
|
||||||
|
|
||||||
|
Creating a file in this directory automatically activates the option in the framework.
|
||||||
|
|
||||||
|
More information about the usage of this directory in [the documentation](https://nuxtjs.org/guide/vuex-store).
|
Loading…
Reference in New Issue
Block a user