Skip to content

Commit a8c33bf

Browse files
authored
fix: remove redundant isApiAssetHub specName check (#1753)
* fix: remove redundant isApiAssetHub specName check * lint
1 parent d385b12 commit a8c33bf

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/services/pallets/PalletsStakingProgressService.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@ export class PalletsStakingProgressService extends AbstractService {
3434
* @param hash `BlockHash` to make call at
3535
*/
3636
async derivePalletStakingProgress(hash: BlockHash): Promise<IPalletStakingProgress> {
37-
const { api, specName } = this;
38-
const apiType = ApiPromiseRegistry.getTypeBySpecName(specName);
39-
const isApiAssetHub = apiType === 'assethub';
37+
const { api } = this;
4038
const RCApiPromise = this.assetHubInfo.isAssetHub ? ApiPromiseRegistry.getApiByType('relay') : null;
4139

4240
if (this.assetHubInfo.isAssetHub && !RCApiPromise?.length) {
@@ -48,10 +46,9 @@ export class PalletsStakingProgressService extends AbstractService {
4846
if (historicApi.query.staking === undefined) {
4947
throw new Error('Staking pallet not found for queried runtime');
5048
}
51-
const sessionValidators =
52-
this.assetHubInfo.isAssetHub && isApiAssetHub
53-
? RCApiPromise![0].api.query.session.validators
54-
: historicApi.query.session.validators;
49+
const sessionValidators = this.assetHubInfo.isAssetHub
50+
? RCApiPromise![0].api.query.session.validators
51+
: historicApi.query.session.validators;
5552

5653
if (!sessionValidators) {
5754
throw new Error('Session pallet not found for queried runtime');
@@ -75,7 +72,7 @@ export class PalletsStakingProgressService extends AbstractService {
7572
}
7673

7774
let deriveSessionAndEra;
78-
if (this.assetHubInfo.isAssetHub && this.assetHubInfo.isAssetHubMigrated && isApiAssetHub) {
75+
if (this.assetHubInfo.isAssetHub && this.assetHubInfo.isAssetHubMigrated) {
7976
deriveSessionAndEra = this.deriveSessionAndEraProgressAssetHub(historicApi, RCApiPromise?.[0].api);
8077
} else {
8178
deriveSessionAndEra = this.deriveSessionAndEraProgress(historicApi);

0 commit comments

Comments
 (0)