11<script lang="ts">
22import { Token , GetTableRowsParams , RexbalRows , RexPoolRows } from ' src/types' ;
33import { defineComponent , computed , ref , onMounted , watch } from ' vue' ;
4- import { useAntelopeStore } from ' src/store/antelope.store' ;
54import PercentCircle from ' src/components/PercentCircle.vue' ;
65import SendDialog from ' src/components/SendDialog.vue' ;
76import ResourcesDialog from ' src/components/resources/ResourcesDialog.vue' ;
87import StakingDialog from ' src/components/staking/StakingDialog.vue' ;
98import DateField from ' src/components/DateField.vue' ;
10- import { date , useQuasar } from ' quasar' ;
11- import { copyToClipboard } from ' quasar' ;
9+ import { date , useQuasar , copyToClipboard } from ' quasar' ;
1210import { getChain } from ' src/config/ConfigManager' ;
1311import { api } from ' src/api' ;
1412import { useRouter } from ' vue-router' ;
@@ -17,6 +15,9 @@ import { API, UInt64 } from '@greymass/eosio';
1715import { formatCurrency } from ' src/utils/string-utils' ;
1816import ConfigManager from ' src/config/ConfigManager' ;
1917import { isSystemAccount } from ' src/utils/systemAccount' ;
18+ import { useResourceStore } from ' src/stores/resources' ;
19+ import { useChainStore } from ' src/stores/chain' ;
20+ import { useAccountStore } from ' src/stores/account' ;
2021
2122const chain = getChain ();
2223export default defineComponent ({
@@ -37,7 +38,9 @@ export default defineComponent({
3738 setup(props ) {
3839 const $q = useQuasar ();
3940 const router = useRouter ();
40- const store = useAntelopeStore ();
41+ const resourceStore = useResourceStore ();
42+ const chainStore = useChainStore ();
43+ const accountStore = useAccountStore ();
4144
4245 const accountPageSettings = computed (() => ConfigManager .get ().getCurrentChain ().getUiCustomization ().accountPageSettings );
4346
@@ -55,9 +58,7 @@ export default defineComponent({
5558 const ramUnit = ref <string >(' kb' );
5659 const resources = ref <number >(0 );
5760 const delegatedByOthers = ref <number >(0.0 );
58- const delegatedToOthers = computed (
59- (): number => store .resources .getDelegatedToOthersAggregated (),
60- );
61+ const delegatedToOthers = computed (() => resourceStore .getDelegatedToOthersAggregated );
6162 const rexStaked = ref <number >(0 );
6263 const rexProfits = ref <number >(0 );
6364 const rexDeposits = ref <number >(0 );
@@ -93,7 +94,7 @@ export default defineComponent({
9394
9495 const staked = computed ((): number => stakedRefund .value + stakedNET .value + stakedCPU .value );
9596
96- const token = computed ((): Token => store . state . chain .token );
97+ const token = computed ((): Token => chainStore .token );
9798
9899 const liquidNative = computed ((): number => accountData .value ?.core_liquid_balance ?.value
99100 ? accountData .value .core_liquid_balance .value
@@ -118,14 +119,14 @@ export default defineComponent({
118119 return result ;
119120 });
120121
121- const isAccount = computed ((): boolean => store . state . account .accountName === props .account );
122+ const isAccount = computed ((): boolean => accountStore .accountName === props .account );
122123
123124 const createTimeFormat = computed ((): string =>
124125 date .formatDate (createTime .value , ' DD MMMM YYYY @ hh:mm A' ),
125126 );
126127
127128 const setToken = (value : Token ) => {
128- void store . commit ( ' chain/ setToken' , value );
129+ void chainStore . setToken ( value );
129130 };
130131
131132 const loadAccountData = async (): Promise <void > => {
@@ -258,8 +259,7 @@ export default defineComponent({
258259 }
259260 };
260261
261- const updateResources = (payload : {account: string , force: boolean }) =>
262- store .resources .updateResources (payload );
262+ const updateResources = (payload : {account: string , force: boolean }) => resourceStore .updateResources (payload );
263263
264264 const getRexFund = async () => {
265265 const paramsrexfund = {
@@ -393,26 +393,25 @@ export default defineComponent({
393393 onMounted (async () => {
394394 usdPrice .value = await chain .getUsdPrice ();
395395 await loadAccountData ();
396- await store . dispatch ( ' account/ updateRexData' , {
396+ await accountStore . updateRexData ( {
397397 account: props .account ,
398398 });
399399 loadSystemToken ();
400- void store . dispatch ( ' chain/ updateRamPrice' );
400+ void chainStore . updateRamPrice ( );
401401 });
402402
403403 watch (
404404 () => props .account ,
405405 async () => {
406406 resetBalances ();
407407 await loadAccountData ();
408- await store . dispatch ( ' account/ updateRexData' , {
408+ await accountStore . updateRexData ( {
409409 account: props .account ,
410410 });
411411 },
412412 );
413-
414413 watch (
415- () => store . resources . getDelegatedToOthersAggregated () ,
414+ (): number => resourceStore . getDelegatedToOthersAggregated ,
416415 () => {
417416 setTotalBalance ();
418417 },
0 commit comments