diff --git a/.eslintrc.js b/eslint.config.js similarity index 66% rename from .eslintrc.js rename to eslint.config.js index 213757099..7b939dc58 100644 --- a/.eslintrc.js +++ b/eslint.config.js @@ -1,28 +1,28 @@ module.exports = { - root: true, - parser: 'vue-eslint-parser', - parserOptions: { - ecmaVersion: 2020, - extraFileExtensions: ['.vue'], - ecmaFeatures: { - jsx: false, - }, - }, - globals: { - defineProps: 'readonly', - defineEmits: 'readonly', - defineExpose: 'readonly', - withDefaults: 'readonly', - }, - extends: [ - 'standard', - 'plugin:vue/base', - 'plugin:vue/vue3-recommended', - 'plugin:import/recommended', - 'eslint:recommended', - '@nuxtjs/eslint-config-typescript', - ], - plugins: ['prettier'], + files: ["src/*.ts", "src/*.js", "src/*.vue"], + // parser: 'vue-eslint-parser', + // parserOptions: { + // ecmaVersion: 2020, + // extraFileExtensions: ['.vue'], + // ecmaFeatures: { + // jsx: false, + // }, + // }, + // globals: { + // defineProps: 'readonly', + // defineEmits: 'readonly', + // defineExpose: 'readonly', + // withDefaults: 'readonly', + // }, + // extends: [ + // 'standard', + // 'plugin:vue/base', + // 'plugin:vue/vue3-recommended', + // 'plugin:import/recommended', + // 'eslint:recommended', + // '@nuxtjs/eslint-config-typescript', + // ], + // plugins: ['prettier'], rules: { 'no-console': 'off', quotes: ['error', 'single'], @@ -64,7 +64,7 @@ module.exports = { }], 'vue/max-attributes-per-line': ['error', { singleline: 1, - multiline: { max: 1 }, + multiline: {max: 1}, }], 'vue/require-v-for-key': 'error', 'vue/no-v-html': 0, @@ -72,6 +72,6 @@ module.exports = { camelcase: ['error', { properties: 'never', }], - 'max-len': ['error', { code: 120, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true }], + 'max-len': ['error', {code: 120, ignoreUrls: true, ignoreStrings: true, ignoreTemplateLiterals: true}], }, } diff --git a/nuxt.config.ts b/nuxt.config.ts index 649101c20..7b2f2a0ec 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -1,113 +1,113 @@ import fs from 'fs/promises' -import { compileTemplate } from 'vue/compiler-sfc' -import { sentryVitePlugin } from '@sentry/vite-plugin' +import {compileTemplate} from 'vue/compiler-sfc' +import {sentryVitePlugin} from '@sentry/vite-plugin' // https://nuxt.com/docs/api/configuration/nuxt-config export default defineNuxtConfig({ - srcDir: './src', - css: ['@/assets/styles/main.css'], - devServer: { - port: 8080, - }, - nitro: { - routeRules: { - '/proxy/nodes': { proxy: 'http://138.68.22.27:3113/v2/debug/network', cors: true }, - '/proxy/gate': { proxy: 'https://api.gateio.ws/api/v4/spot/tickers?currency_pair=AE_USDT', cors: true }, - '/proxy/mexc': { proxy: 'https://api.mexc.com/api/v3/ticker/24hr?symbol=AEUSDT', cors: true }, - '/proxy/coinw': { proxy: 'https://api.coinw.com/api/v1/public?command=returnTicker', cors: true }, + srcDir: './src', + css: ['@/assets/styles/main.css'], + devServer: { + port: 8080, }, - }, - modules: [ - '@pinia/nuxt', - '@nuxtjs/plausible', - 'nuxt-monaco-editor', - 'nuxt-booster', - ], - imports: { - dirs: ['./stores'], - }, - plausible: { - apiHost: 'https://plausible.dev.service.aepps.com', - trackLocalhost: false, - }, - appConfig: { - APP_VERSION: process.env.APP_VERSION, - }, - runtimeConfig: { - public: { - SENTRY_AUTH_TOKEN: undefined, - SENTRY_DSN: undefined, - APP_DOMAIN: undefined, - MIDDLEWARE_URL: undefined, - NODE_URL: undefined, - WEBSOCKET_URL: undefined, - DEX_BACKEND_URL: undefined, - NETWORK_NAME: undefined, - ALTERNATIVE_NETWORK_URL: undefined, - ALTERNATIVE_NETWORK_NAME: undefined, - AE_TOKEN_ID: undefined, - DEBUG_MODE: undefined, - CONTRACT_VERIFICATION_SERVICE_URL: undefined, - SH_DEX_CONTRACTS: undefined, + nitro: { + routeRules: { + '/proxy/nodes': {proxy: 'http://138.68.22.27:3113/v2/debug/network', cors: true}, + '/proxy/gate': {proxy: 'https://api.gateio.ws/api/v4/spot/tickers?currency_pair=AE_USDT', cors: true}, + '/proxy/mexc': {proxy: 'https://api.mexc.com/api/v3/ticker/24hr?symbol=AEUSDT', cors: true}, + '/proxy/coinw': {proxy: 'https://api.coinw.com/api/v1/public?command=returnTicker', cors: true}, + }, + }, + modules: [ + '@pinia/nuxt', + '@nuxtjs/plausible', + 'nuxt-monaco-editor', + 'nuxt-booster', + ], + imports: { + dirs: ['./stores'], }, - }, - postcss: { - plugins: { - autoprefixer: {}, - '@csstools/postcss-global-data': { - files: ['src/assets/styles/settings/_variables.css'], - }, - 'postcss-custom-media': {}, - 'postcss-import': {}, - 'postcss-nested': {}, + plausible: { + apiHost: 'https://plausible.dev.service.aepps.com', + trackLocalhost: false, }, - }, - sourcemap: true, - vite: { - build: { target: 'es2020' }, - optimizeDeps: { - esbuildOptions: { target: 'es2020' }, + appConfig: { + APP_VERSION: process.env.APP_VERSION, + }, + runtimeConfig: { + public: { + SENTRY_AUTH_TOKEN: process.env.SENTRY_AUTH_TOKEN, + SENTRY_DSN: process.env.SENTRY_DSN, + APP_DOMAIN: process.env.APP_DOMAIN, + MIDDLEWARE_URL: process.env.MIDDLEWARE_URL, + NODE_URL: process.env.NODE_URL, + WEBSOCKET_URL: process.env.WEBSOCKET_URL, + DEX_BACKEND_URL: process.env.DEX_BACKEND_URL, + NETWORK_NAME: process.env.NETWORK_NAME, + ALTERNATIVE_NETWORK_URL: process.env.ALTERNATIVE_NETWORK_URL, + ALTERNATIVE_NETWORK_NAME: process.env.ALTERNATIVE_NETWORK_NAME, + AE_TOKEN_ID: process.env.AE_TOKEN_ID, + DEBUG_MODE: process.env.DEBUG_MODE, + CONTRACT_VERIFICATION_SERVICE_URL: process.env.CONTRACT_VERIFICATION_SERVICE_URL, + SH_DEX_CONTRACTS: process.env.SH_DEX_CONTRACTS?.split(';'), + }, }, - define: { - __VUE_PROD_DEVTOOLS__: process.env.MODE !== 'production', + postcss: { + plugins: { + autoprefixer: {}, + '@csstools/postcss-global-data': { + files: ['src/assets/styles/settings/_variables.css'], + }, + 'postcss-custom-media': {}, + 'postcss-import': {}, + 'postcss-nested': {}, + }, }, - plugins: [ - { - name: 'icon-svg-loader', - enforce: 'pre', - async load(path) { - if (!path.match(/icons\/.*.svg$/)) { - return - } + sourcemap: true, + vite: { + build: {target: 'es2020'}, + optimizeDeps: { + esbuildOptions: {target: 'es2020'}, + }, + define: { + __VUE_PROD_DEVTOOLS__: process.env.MODE !== 'production', + }, + plugins: [ + { + name: 'icon-svg-loader', + enforce: 'pre', + async load(path) { + if (!path.match(/icons\/.*.svg$/)) { + return + } - const { code } = compileTemplate({ - id: JSON.stringify(path), - filename: path, - source: await fs.readFile(path, 'utf-8'), - transformAssetUrls: false, - }) + const {code} = compileTemplate({ + id: JSON.stringify(path), + filename: path, + source: await fs.readFile(path, 'utf-8'), + transformAssetUrls: false, + }) - return `${code}\nexport default { render: render }` + return `${code}\nexport default { render: render }` + }, + }, + sentryVitePlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: 'sentry', + project: 'aescan-develop', + url: 'https://sentry.dev.service.aepps.com/', + }), + sentryVitePlugin({ + authToken: process.env.SENTRY_AUTH_TOKEN, + org: 'sentry', + project: 'aescan-production', + url: 'https://sentry.dev.service.aepps.com/', + }), + ], + }, + monacoEditor: { + locale: 'en', + componentName: { + codeEditor: 'MonacoEditor', }, - }, - sentryVitePlugin({ - authToken: process.env.SENTRY_AUTH_TOKEN, - org: 'sentry', - project: 'aescan-develop', - url: 'https://sentry.dev.service.aepps.com/', - }), - sentryVitePlugin({ - authToken: process.env.SENTRY_AUTH_TOKEN, - org: 'sentry', - project: 'aescan-production', - url: 'https://sentry.dev.service.aepps.com/', - }), - ], - }, - monacoEditor: { - locale: 'en', - componentName: { - codeEditor: 'MonacoEditor', }, - }, }) diff --git a/package.json b/package.json index 5a70fcaac..bdf6f24cf 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,7 @@ "lint": "yarn lint:js && yarn lint:style", "lint:ci": "yarn lint:js --max-warnings=0 && yarn lint:style --mw 0", "lint:fix": "yarn lint:js --fix && yarn lint:style --fix", - "lint:js": "eslint --ext .ts,.js,.vue src", + "lint:js": "eslint", "lint:style": "stylelint \"./src/**/*.vue\" \"src/**/*.css\"", "reinstall": "rm -rf node_modules/ && yarn cache clean && yarn install", "reset": "yarn reinstall && yarn dev", diff --git a/src/components/TransactionsPanel.vue b/src/components/TransactionsPanel.vue index 3b7910421..c35dbe575 100644 --- a/src/components/TransactionsPanel.vue +++ b/src/components/TransactionsPanel.vue @@ -22,7 +22,7 @@ diff --git a/src/stores/transactions.js b/src/stores/transactions.js index 1454ef8ac..8668718d4 100644 --- a/src/stores/transactions.js +++ b/src/stores/transactions.js @@ -1,8 +1,10 @@ import { defineStore } from 'pinia' import { useRuntimeConfig } from 'nuxt/app' +import { ref } from 'vue' import useAxios from '@/composables/useAxios' import { adaptTransactions } from '@/utils/adapters' import { formatAePrice, formatAettosToAe } from '@/utils/format' +import { TX_TYPES_OPTIONS } from '~/utils/constants' export const useTransactionsStore = defineStore('transactions', () => { const { MIDDLEWARE_URL } = useRuntimeConfig().public @@ -15,6 +17,9 @@ export const useTransactionsStore = defineStore('transactions', () => { const last24hsTransactionsTrend = ref(null) const last24hsAverageTransactionFees = ref(null) const feesTrend = ref(null) + const isHydrated = ref(null) + const pageIndex = ref(1) + const selectedTxType = ref(TX_TYPES_OPTIONS[0]) const transactions = computed(() => rawTransactions.value @@ -25,6 +30,7 @@ export const useTransactionsStore = defineStore('transactions', () => { async function fetchTransactions(queryParameters = null) { rawTransactions.value = null const { data } = await axios.get(`${MIDDLEWARE_URL}${queryParameters || '/v3/transactions?limit=10'}`) + isHydrated.value = true rawTransactions.value = data } @@ -44,6 +50,14 @@ export const useTransactionsStore = defineStore('transactions', () => { feesTrend.value = data.feesTrend } + function setPageIndex(index) { + pageIndex.value = index + } + + function setSelectedTxType(txType) { + selectedTxType.value = txType + } + return { transactionsCount, transactions, @@ -55,5 +69,10 @@ export const useTransactionsStore = defineStore('transactions', () => { last24hsTransactionsTrend, last24hsAverageTransactionFees, feesTrend, + isHydrated, + pageIndex, + selectedTxType, + setPageIndex, + setSelectedTxType, } })