From af9f1cac45d3c20c0aea462bf20b3ceaba231ec0 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Wed, 22 Dec 2021 14:21:23 +0800 Subject: [PATCH] refactor --- src/layouts/components/Navbar.vue | 11 +++++++++-- src/libs/data/index.js | 1 - src/libs/data/proposal-tally.js | 2 +- src/libs/data/proposal.js | 2 +- src/libs/data/staking-pool.js | 2 +- src/libs/fetch.js | 2 +- src/libs/osmos.js | 2 +- src/libs/{data/data.js => utils.js} | 3 ++- src/navigation/vertical/index.js | 2 +- src/router/index.js | 10 +++++----- src/store/chains/index.js | 2 +- src/views/ArrayFieldComponent.vue | 2 +- src/views/Block.vue | 2 +- src/views/Blocks.vue | 2 +- src/views/ChartComponentDoughnut.vue | 2 +- src/views/GovernanceProposalView.vue | 2 +- src/views/GravityPool.vue | 2 +- src/views/Home.vue | 2 +- src/views/ObjectFieldComponent.vue | 2 +- src/views/OperationDelegateComponent.vue | 2 +- src/views/OperationGovDepositComponent.vue | 2 +- src/views/OperationRedelegateComponent.vue | 2 +- src/views/OperationTransfer2Component.vue | 2 +- src/views/OperationTransferComponent.vue | 2 +- src/views/OperationUnbondComponent.vue | 2 +- src/views/OperationVoteComponent.vue | 2 +- src/views/OperationWithdrawCommissionComponent.vue | 2 +- src/views/OperationWithdrawComponent.vue | 2 +- src/views/OsmosisTrade.vue | 2 +- src/views/Staking.vue | 2 +- src/views/StakingCommissionComponent.vue | 2 +- src/views/StakingValidator.vue | 2 +- src/views/Summary.vue | 2 +- src/views/SummaryAssetsComponent.vue | 2 +- src/views/Transaction.vue | 2 +- src/views/Uptime.vue | 2 +- src/views/UptimeMyChainBlocks.vue | 2 +- src/views/UptimeMyValidators.vue | 2 +- src/views/WalletAccountDetail.vue | 2 +- src/views/WalletAccountImportAddress.vue | 2 +- src/views/WalletAccounts.vue | 2 +- src/views/WalletDelegations.vue | 2 +- .../{WalletHelping.vue => WalletTransactions.vue} | 3 +++ src/views/components/KlineTrade/DepositeWindow.vue | 2 +- src/views/components/KlineTrade/PlaceForm.vue | 2 +- 45 files changed, 59 insertions(+), 49 deletions(-) rename src/libs/{data/data.js => utils.js} (99%) rename src/views/{WalletHelping.vue => WalletTransactions.vue} (98%) diff --git a/src/layouts/components/Navbar.vue b/src/layouts/components/Navbar.vue index e0862722..1433c1d3 100644 --- a/src/layouts/components/Navbar.vue +++ b/src/layouts/components/Navbar.vue @@ -110,11 +110,18 @@ My Validators + + + My Transactions + @@ -131,7 +138,7 @@ import Locale from '@core/layouts/components/app-navbar/components/Locale.vue' import SearchBar from '@core/layouts/components/app-navbar/components/SearchBar.vue' // import CartDropdown from '@core/layouts/components/app-navbar/components/CartDropdown.vue' import store from '@/store' -import { getLocalAccounts, timeIn, toDay } from '@/libs/data' +import { getLocalAccounts, timeIn, toDay } from '@/libs/utils' // import UserDropdown from '@core/layouts/components/app-navbar/components/UserDropdown.vue' export default { diff --git a/src/libs/data/index.js b/src/libs/data/index.js index 4fb61bfd..0caab351 100644 --- a/src/libs/data/index.js +++ b/src/libs/data/index.js @@ -10,6 +10,5 @@ export { default as Block } from './block' export { default as ValidatorDistribution } from './validator-distribution' export { default as StakingDelegation } from './staking-delegation' export { default as WrapStdTx } from './wrapstdtx' -export * from './data' export default class Test {} diff --git a/src/libs/data/proposal-tally.js b/src/libs/data/proposal-tally.js index d194e343..a7cb76aa 100644 --- a/src/libs/data/proposal-tally.js +++ b/src/libs/data/proposal-tally.js @@ -1,4 +1,4 @@ -import { percent } from './data' +import { percent } from '../utils' export default class ProposalTally { constructor() { diff --git a/src/libs/data/proposal.js b/src/libs/data/proposal.js index 306ad077..a1747eb3 100644 --- a/src/libs/data/proposal.js +++ b/src/libs/data/proposal.js @@ -1,5 +1,5 @@ import compareVersions from 'compare-versions' -import { toDay, formatToken } from './data' +import { toDay, formatToken } from '../utils' import ProposalTally from './proposal-tally' export default class Proposal { diff --git a/src/libs/data/staking-pool.js b/src/libs/data/staking-pool.js index 3ccbd8f3..8972b84f 100644 --- a/src/libs/data/staking-pool.js +++ b/src/libs/data/staking-pool.js @@ -1,4 +1,4 @@ -import { percent } from './data' +import { percent } from '../utils' export default class StakingPool { constructor() { diff --git a/src/libs/fetch.js b/src/libs/fetch.js index f06872af..c5198dd1 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -7,7 +7,7 @@ import { toBase64 } from '@cosmjs/encoding' import { Proposal, ProposalTally, Proposer, StakingPool, Votes, Deposit, Validator, StakingParameters, Block, ValidatorDistribution, StakingDelegation, WrapStdTx, getUserCurrency, -} from './data' +} from './utils' import OsmosAPI from './osmos' function commonProcess(res) { diff --git a/src/libs/osmos.js b/src/libs/osmos.js index c5bd64ce..a59d883c 100644 --- a/src/libs/osmos.js +++ b/src/libs/osmos.js @@ -8,7 +8,7 @@ import { sha256 } from '@cosmjs/crypto' import { toHex } from '@cosmjs/encoding' import fetch from 'node-fetch' -import { formatTokenDenom, getLocalChains } from './data/data' +import { formatTokenDenom, getLocalChains } from './utils' export const poolIds = { 1: true, diff --git a/src/libs/data/data.js b/src/libs/utils.js similarity index 99% rename from src/libs/data/data.js rename to src/libs/utils.js index e09d3a89..2b99f584 100644 --- a/src/libs/data/data.js +++ b/src/libs/utils.js @@ -16,7 +16,7 @@ import RIPEMD160 from 'ripemd160' import localeData from 'dayjs/plugin/localeData' import { $themeColors } from '@themeConfig' // import { SigningStargateClient } from '@cosmjs/stargate' -import PingWalletClient from './signing' +import PingWalletClient from './data/signing' dayjs.extend(localeData) dayjs.extend(duration) @@ -415,6 +415,7 @@ export function getStakingValidatorOperator(chainName, addr, length = -1) { export * from 'compare-versions' +export * from './data' export class Data { } diff --git a/src/navigation/vertical/index.js b/src/navigation/vertical/index.js index 1bc636cb..c9c90fd5 100644 --- a/src/navigation/vertical/index.js +++ b/src/navigation/vertical/index.js @@ -1,5 +1,5 @@ import store from '@/store' -import { isTestnet } from '../../libs/data/data' +import { isTestnet } from '../../libs/utils' const modules = [ { diff --git a/src/router/index.js b/src/router/index.js index d7dacacf..cc00a45b 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -114,17 +114,17 @@ const router = new VueRouter({ }, }, { - path: '/wallet/helping', - name: 'helping', - component: () => import('@/views/WalletHelping.vue'), + path: '/wallet/transactions', + name: 'mytransactions', + component: () => import('@/views/WalletTransactions.vue'), meta: { - pageTitle: 'Help Ping.pub', + pageTitle: 'Transaction History', breadcrumb: [ { text: 'Wallet', }, { - text: 'Help Ping.pub', + text: 'Transaction History', }, ], }, diff --git a/src/store/chains/index.js b/src/store/chains/index.js index bf20bfb7..0ab1e733 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -5,7 +5,7 @@ * @LastEditors: dingyiming * @LastEditTime: 2021-11-20 15:33:07 */ -import { isTestnet } from '@/libs/data/data' +import { isTestnet } from '@/libs/utils' let chains = {} diff --git a/src/views/ArrayFieldComponent.vue b/src/views/ArrayFieldComponent.vue index a2fb3cca..860eb750 100644 --- a/src/views/ArrayFieldComponent.vue +++ b/src/views/ArrayFieldComponent.vue @@ -27,7 +27,7 @@ import { BTable } from 'bootstrap-vue' import { getStakingValidatorByHex, isHexAddress, isToken, percent, toDay, tokenFormatter, -} from '@/libs/data/data' +} from '@/libs/utils' export default { name: 'ArrayFieldComponent', diff --git a/src/views/Block.vue b/src/views/Block.vue index 1ded7792..cac32212 100644 --- a/src/views/Block.vue +++ b/src/views/Block.vue @@ -46,7 +46,7 @@ import { BCard, BTable } from 'bootstrap-vue' import { fromBase64 } from '@cosmjs/encoding' import { decodeTxRaw } from '@cosmjs/proto-signing' import Tx from '@/libs/data/tx' -import { abbrMessage, tokenFormatter } from '@/libs/data' +import { abbrMessage, tokenFormatter } from '@/libs/utils' import ObjectFieldComponent from './ObjectFieldComponent.vue' import ArrayFieldComponent from './ArrayFieldComponent.vue' diff --git a/src/views/Blocks.vue b/src/views/Blocks.vue index a2abd07b..0116f043 100644 --- a/src/views/Blocks.vue +++ b/src/views/Blocks.vue @@ -50,7 +50,7 @@ import { getCachedValidators, getStakingValidatorByHex, toDay, -} from '@/libs/data' +} from '@/libs/utils' // import fetch from 'node-fetch' export default { diff --git a/src/views/ChartComponentDoughnut.vue b/src/views/ChartComponentDoughnut.vue index 29500004..d2680cfd 100644 --- a/src/views/ChartComponentDoughnut.vue +++ b/src/views/ChartComponentDoughnut.vue @@ -9,7 +9,7 @@ diff --git a/src/views/components/KlineTrade/DepositeWindow.vue b/src/views/components/KlineTrade/DepositeWindow.vue index e166279c..33e06c4a 100644 --- a/src/views/components/KlineTrade/DepositeWindow.vue +++ b/src/views/components/KlineTrade/DepositeWindow.vue @@ -240,7 +240,7 @@ import { } from '@validations' import { formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, setLocalTxHistory, sign, timeIn, -} from '@/libs/data' +} from '@/libs/utils' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' import { coin } from '@cosmjs/amino' import { getChainConfigForSymbol } from '@/libs/osmos' diff --git a/src/views/components/KlineTrade/PlaceForm.vue b/src/views/components/KlineTrade/PlaceForm.vue index 0df6d46a..6cf7f46f 100644 --- a/src/views/components/KlineTrade/PlaceForm.vue +++ b/src/views/components/KlineTrade/PlaceForm.vue @@ -227,7 +227,7 @@ import { import FeatherIcon from '@core/components/feather-icon/FeatherIcon.vue' import { formatTokenAmount, getLocalAccounts, percent, setLocalTxHistory, sign, -} from '@/libs/data' +} from '@/libs/utils' import { getPairName } from '@/libs/osmos' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' import DepositeWindow from './DepositeWindow.vue'