Skip to content

Commit

Permalink
extract map<string. cosmosCustomModuleImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
bz888 committed Oct 3, 2023
1 parent 00eaee3 commit ebbc211
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 4 additions & 2 deletions packages/common-cosmos/src/project/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class CosmosRuntimeDataSourceBase<M extends SubqlCosmosMapping<SubqlCosmo
startBlock: number;
@Type(() => CosmosCustomModuleImpl)
@ValidateNested({each: true})
chainTypes: Map<string, CosmosCustomModuleImpl>;
chainTypes: CosmosChainTypes;
@IsOptional()
@Validate(FileReferenceImp)
assets?: Map<string, FileReference>;
Expand All @@ -193,6 +193,8 @@ export class CosmosFileReferenceImpl implements FileReference {
file: string;
}

export type CosmosChainTypes = Map<string, CosmosCustomModuleImpl>;

export class CosmosCustomModuleImpl implements CustomModule {
@IsString()
file: string;
Expand Down Expand Up @@ -223,5 +225,5 @@ export class CosmosCustomDataSourceBase<
processor: Processor<O>;
@Type(() => CosmosCustomModuleImpl)
@ValidateNested({each: true})
chainTypes: Map<string, CosmosCustomModuleImpl>;
chainTypes: CosmosChainTypes;
}
1 change: 0 additions & 1 deletion packages/common-cosmos/src/project/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export {
SubqlCosmosHandler,
SubqlCosmosHandlerKind,
SubqlCosmosDatasource as SubqlCosmosDataSource,
SubqlCosmosCustomDatasource as SubqlCosmosCustomDataSource,
SubqlCosmosBlockFilter,
SubqlCosmosMessageFilter,
SubqlCosmosEventFilter,
Expand Down
14 changes: 9 additions & 5 deletions packages/common-cosmos/src/project/versioned/v1_0_0/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from '@subql/common';
import {NodeSpec, ParentProject, QuerySpec, RunnerSpecs} from '@subql/types-core';
import {
CustomModule,
SubqlCosmosCustomDatasource,
SubqlCosmosCustomHandler,
SubqlCosmosMapping,
Expand All @@ -25,7 +24,12 @@ import {
} from '@subql/types-cosmos';
import {Transform, TransformFnParams, Type} from 'class-transformer';
import {Equals, IsObject, IsString, ValidateNested, IsOptional, IsArray, IsNotEmpty} from 'class-validator';
import {CosmosCustomDataSourceBase, CosmosCustomModuleImpl, CosmosRuntimeDataSourceBase} from '../../models';
import {
CosmosChainTypes,
CosmosCustomDataSourceBase,
CosmosCustomModuleImpl,
CosmosRuntimeDataSourceBase,
} from '../../models';

const COSMOS_NODE_NAME = `@subql/node-cosmos`;

Expand Down Expand Up @@ -66,14 +70,14 @@ export class CosmosProjectNetworkDeployment {
@IsOptional()
@Type(() => CosmosCustomModuleImpl)
@ValidateNested({each: true})
chainTypes?: Map<string, CosmosCustomModuleImpl>;
chainTypes?: CosmosChainTypes;
}

export class CosmosProjectNetwork extends CommonProjectNetworkV1_0_0<Map<string, CosmosCustomModuleImpl>> {
export class CosmosProjectNetwork extends CommonProjectNetworkV1_0_0<CosmosChainTypes> {
@Type(() => CosmosCustomModuleImpl)
@IsOptional()
@ValidateNested({each: true})
chainTypes?: Map<string, CosmosCustomModuleImpl>;
chainTypes?: CosmosChainTypes;
}

export class RuntimeDatasourceTemplateImpl extends CosmosRuntimeDataSourceImpl implements RuntimeDatasourceTemplate {
Expand Down

0 comments on commit ebbc211

Please sign in to comment.