diff --git a/src/staking-v3/hooks/useDapps.ts b/src/staking-v3/hooks/useDapps.ts index 0c4211139..ec973d901 100644 --- a/src/staking-v3/hooks/useDapps.ts +++ b/src/staking-v3/hooks/useDapps.ts @@ -45,7 +45,7 @@ export function useDapps() { try { aggregator.publish(new BusyMessage(true)); - const dApps = await service.getDapps(currentNetworkName.value.toLowerCase()); + const dApps = await service.getDapps(); store.commit('stakingV3/addDapps', dApps.fullInfo); store.commit('stakingV3/addNewDapps', dApps.chainInfo); // Memo: this can a heavy operations since we are querying all dapps stakes for a chain. diff --git a/src/staking-v3/logic/services/DappStakingService.ts b/src/staking-v3/logic/services/DappStakingService.ts index 89bf6b27d..552a40867 100644 --- a/src/staking-v3/logic/services/DappStakingService.ts +++ b/src/staking-v3/logic/services/DappStakingService.ts @@ -48,15 +48,13 @@ export class DappStakingService extends SignerService implements IDappStakingSer } // @inheritdoc - public async getDapps( - network: string - ): Promise<{ fullInfo: CombinedDappInfo[]; chainInfo: DappInfo[] }> { - Guard.ThrowIfUndefined(network, 'network'); - + public async getDapps(): Promise<{ fullInfo: CombinedDappInfo[]; chainInfo: DappInfo[] }> { + const metadata = await this.metadataRepository.getChainMetadata(); + const chain = metadata.chain.toLowerCase(); const [storeDapps, chainDapps, tokenApiDapps] = await Promise.all([ - this.dappStakingRepository.getDapps(network.toLowerCase()), + this.dappStakingRepository.getDapps(chain), this.dappStakingRepository.getChainDapps(), - this.tokenApiRepository.getDapps(network.toLowerCase()), + this.tokenApiRepository.getDapps(chain), ]); // Map on chain and in store dApps (registered only) diff --git a/src/staking-v3/logic/services/IDappStakingService.ts b/src/staking-v3/logic/services/IDappStakingService.ts index 80469e18c..d128bba0d 100644 --- a/src/staking-v3/logic/services/IDappStakingService.ts +++ b/src/staking-v3/logic/services/IDappStakingService.ts @@ -15,10 +15,9 @@ import { export interface IDappStakingService { /** * Gets the dapps for the given network. - * @param network Name of the network to get dapps for. * @returns A map containing full dapps info (chain and firebase data) and chain info (only for new dapps not stored in firebase yet). */ - getDapps(network: string): Promise<{ fullInfo: CombinedDappInfo[]; chainInfo: DappInfo[] }>; + getDapps(): Promise<{ fullInfo: CombinedDappInfo[]; chainInfo: DappInfo[] }>; /** * Invokes claim staker rewards, unstake and unlock calls.