Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jiqiang90 committed Jun 25, 2024
1 parent feccd59 commit 7348854
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
20 changes: 13 additions & 7 deletions packages/common-cosmos/src/codegen/codegen-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ export async function generateProto(
projectPath: string,
prepareDirPath: (path: string, recreate: boolean) => Promise<void>,
renderTemplate: (templatePath: string, outputPath: string, templateData: Data) => Promise<void>,
upperFirst: (string?: string) => string,
/** @deprecated */
mkdirProto?: (projectPath: string) => Promise<string>
upperFirst: (string?: string) => string
): Promise<void> {
let tmpPath: string;
try {
Expand Down Expand Up @@ -280,7 +278,16 @@ export async function generateProto(
}
}

export async function networkCliCodegen(
/**
* Generates typescript interfaces from proto files and cosmwasm abis
* @param manifest
* @param projectPath
* @param prepareDirPath
* @param renderTemplate
* @param upperFirst
* @param datasources
*/
export async function projectCodegen(
manifest: ProjectManifestV1_0_0[],
projectPath: string,
prepareDirPath: (path: string, recreate: boolean) => Promise<void>,
Expand All @@ -290,13 +297,12 @@ export async function networkCliCodegen(
): Promise<void> {
const chainTypes = getChaintypes(manifest);
if (chainTypes.length) {
await generateProto(chainTypes, projectPath, prepareDirPath, renderTemplate, upperFirst, tempProtoDir);
await generateProto(chainTypes, projectPath, prepareDirPath, renderTemplate, upperFirst);
}
await generateCosmwasm(datasources, projectPath, prepareDirPath, upperFirst, renderTemplate);
}

//Deprecated export in future version
export function getChaintypes(manifest: ProjectManifestV1_0_0[]): Map<string, CustomModule>[] {
function getChaintypes(manifest: ProjectManifestV1_0_0[]): Map<string, CustomModule>[] {
return manifest
.filter((m) => validateCosmosManifest(m))
.map((m) => (m as CosmosProjectManifestV1_0_0).network.chaintypes)
Expand Down
7 changes: 4 additions & 3 deletions packages/types/src/modular.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

import {INetworkCommonModule, ProjectManifestV1_0_0} from '@subql/types-core';
import {Data} from 'ejs';
import {CosmosRuntimeDatasource} from './project';
import {CosmosCustomDatasource, CosmosDatasource, CosmosRuntimeDatasource} from './project';

export interface CosmosNetworkModule extends INetworkCommonModule {
networkCliCodegen(
export interface CosmosNetworkModule
extends INetworkCommonModule<CosmosDatasource, CosmosRuntimeDatasource, CosmosCustomDatasource> {
projectCodegen(
manifest: ProjectManifestV1_0_0[],
projectPath: string,
prepareDirPath: (path: string, recreate: boolean) => Promise<void>,
Expand Down

0 comments on commit 7348854

Please sign in to comment.