From 9cd1fca71683fac9848180eaa4f5e0df171037a4 Mon Sep 17 00:00:00 2001 From: impelcrypto Date: Thu, 16 Nov 2023 13:54:41 +0800 Subject: [PATCH] fix: display the staking list for EVM accounts --- src/hooks/dapps-staking/useDispatchGetDapps.ts | 14 +++++++------- src/store/dapp-staking/actions.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/hooks/dapps-staking/useDispatchGetDapps.ts b/src/hooks/dapps-staking/useDispatchGetDapps.ts index f05c9e0b9..f5c7479c3 100644 --- a/src/hooks/dapps-staking/useDispatchGetDapps.ts +++ b/src/hooks/dapps-staking/useDispatchGetDapps.ts @@ -6,7 +6,7 @@ import { computed, watch } from 'vue'; export function useDispatchGetDapps() { const store = useStore(); const { isZkEvm, networkNameSubstrate } = useNetworkInfo(); - const { currentAccount } = useAccount(); + const { senderSs58Account } = useAccount(); const dapps = computed(() => store.getters['dapps/getAllDapps']); // Memo: invoke this function whenever the users haven't connect to wallets @@ -17,30 +17,30 @@ export function useDispatchGetDapps() { const isBrowsingOnly = !!( dapps.value.length === 0 && - !currentAccount.value && + !senderSs58Account.value && networkNameSubstrate.value ); if (isBrowsingOnly || isZkEvm.value) { store.dispatch('dapps/getDapps', { network: networkNameSubstrate.value.toLowerCase(), - currentAccount: '', + senderSs58Account: '', }); } }; const getDapps = async (): Promise => { - const isConnectedWallet = networkNameSubstrate.value && currentAccount.value; + const isConnectedWallet = networkNameSubstrate.value && senderSs58Account.value; if (isConnectedWallet && !isZkEvm.value) { - const address = !currentAccount.value ? '' : currentAccount.value; + const address = !senderSs58Account.value ? '' : senderSs58Account.value; store.dispatch('dapps/getDapps', { network: networkNameSubstrate.value.toLowerCase(), - currentAccount: address, + senderSs58Account: address, }); } else { getDappsForBrowser(); } }; - watch([currentAccount, networkNameSubstrate], getDapps, { immediate: true }); + watch([senderSs58Account, networkNameSubstrate], getDapps, { immediate: true }); } diff --git a/src/store/dapp-staking/actions.ts b/src/store/dapp-staking/actions.ts index 1b0ee8dc9..1fa7c4389 100644 --- a/src/store/dapp-staking/actions.ts +++ b/src/store/dapp-staking/actions.ts @@ -88,7 +88,7 @@ export const hasExtrinsicFailedEvent = ( const actions: ActionTree = { async getDapps( { commit, dispatch }, - { network, currentAccount }: { network: string; currentAccount: string } + { network, senderSs58Account }: { network: string; senderSs58Account: string } ) { const accountUnificationService = container.get( Symbols.AccountUnificationService @@ -98,9 +98,9 @@ const actions: ActionTree = { // Fetch dapps const dappsUrl = `${TOKEN_API_URL}/v1/${network.toLowerCase()}/dapps-staking/dappssimple`; const service = container.get(Symbols.DappStakingService); - const address = isValidEvmAddress(currentAccount) - ? await accountUnificationService.getMappedNativeAddress(currentAccount) - : currentAccount; + const address = isValidEvmAddress(senderSs58Account) + ? await accountUnificationService.getMappedNativeAddress(senderSs58Account) + : senderSs58Account; const [dapps, combinedInfo] = await Promise.all([ axios.get(dappsUrl), service.getCombinedInfo(address),