Skip to content

Commit

Permalink
feat(update dependencies): polkadot-js/api version update to 10.1.4, …
Browse files Browse the repository at this point in the history
…and hydra-typegen fix to work-a

affects: @joystream/hydra-cli, @joystream/hydra-e2e-tests, @joystream/hydra-indexer,
@joystream/hydra-processor, @joystream/hydra-typegen, sample, sample-mappings
  • Loading branch information
mnaamani committed Mar 1, 2024
1 parent c92a495 commit cbce70f
Show file tree
Hide file tree
Showing 14 changed files with 593 additions and 1,368 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"prettier": "^2.7.1"
},
"resolutions": {
"@polkadot/types": "8.9.1",
"@polkadot/types": "10.1.4",
"node-gyp": "^9.4.0"
},
"lint-staged": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"@joystream/hydra-common": "{{{hydraCommonVersion}}}",
"@polkadot/types": "8.9.1",
"@polkadot/types": "10.1.4",
"@joystream/warthog": "{{{hydraWarthogVersion}}}"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions packages/hydra-e2e-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
"e2e-test": "bash run-tests.sh"
},
"dependencies": {
"@polkadot/api": "8.9.1",
"@polkadot/keyring": "9.5.1",
"@polkadot/api": "10.1.4",
"@polkadot/keyring": "11.1.1",
"@types/node-fetch": "^2.6.11",
"fetch": "^1.1.0",
"graphql-request": "^3.3.0",
"graphql-subscriptions-client": "^0.16.0",
"node-fetch": "^2.6.1",
"node-fetch": "^3.3.2",
"p-wait-for": "^3.2.0",
"typedi": "^0.8.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-indexer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"@joystream/bn-typeorm": "^5.0.0-alpha.7",
"@joystream/hydra-common": "^5.0.0-alpha.7",
"@joystream/hydra-db-utils": "^5.0.0-alpha.7",
"@polkadot/api": "8.9.1",
"@polkadot/api": "10.1.4",
"@types/express": "^4.17.8",
"@types/ioredis": "^4.17.4",
"@types/lodash": "^4.14.161",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-processor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
},
"devDependencies": {
"@joystream/hydra-cli": "^5.0.0-alpha.7",
"@polkadot/api": "8.9.1",
"@polkadot/api": "10.1.4",
"@types/async-lock": "^1.1.3",
"@types/bn.js": "^5.1.0",
"@types/chai": "^4.2.19",
Expand Down
4 changes: 2 additions & 2 deletions packages/hydra-typegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"@oclif/command": "^1.8.0",
"@oclif/config": "^1",
"@oclif/errors": "^1.3.3",
"@polkadot/api": "8.9.1",
"@polkadot/typegen": "8.9.1",
"@polkadot/api": "10.1.4",
"@polkadot/typegen": "10.1.4",
"debug": "^4.3.1",
"figlet": "^1.5.2",
"handlebars": "^4.7.6",
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-typegen/src/generators/gen-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function generateIndex({ modules, dest }: GeneratorConfig): void {
writeFile(path.join(dest, `index.ts`), () =>
formatWithPrettier(
generateIndexTemplate({
modules: modules.map((m) => m.module),
moduleNames: modules.map((m) => m.module.name.toString()),
})
)
)
Expand Down
2 changes: 2 additions & 0 deletions packages/hydra-typegen/src/generators/gen-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type ModuleTemplateProps = {
validateArgs: boolean
imports: ImportsDef
specVersion: number
moduleName: string
} & ExtractedModuleMeta

export function generateModuleTypes(config: GeneratorConfig): void {
Expand Down Expand Up @@ -42,6 +43,7 @@ export function buildModuleProps(
validateArgs,
specVersion,
imports,
moduleName: meta.module.name.toString(),
...meta,
}
}
4 changes: 3 additions & 1 deletion packages/hydra-typegen/src/generators/gen-typesLookup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ export async function generateTypesLookup(
'utf8'
)

// remove module augmentation from the file
// remove module augmentation from the file, and export all types and interfaces
const outFile = file
.replace(`declare module '@polkadot/types/lookup' {`, '')
.replace('} // declare module', '')
.replaceAll(' interface ', 'export interface ')
.replaceAll(' type ', 'export type ')

// save the file
writeFile(path.join(dest, TYPES_LOOKUP_FILE_NAME), () =>
Expand Down
4 changes: 2 additions & 2 deletions packages/hydra-typegen/src/templates/index.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable */

{{#each modules}}
export * from './{{kebabCase name}}'
{{#each moduleNames}}
export * from './{{kebabCase this}}'
{{/each}}
2 changes: 1 addition & 1 deletion packages/hydra-typegen/src/templates/module.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { typeRegistry } from "./typeRegistry";
* Event parameters: [{{#each args}}{{{this}}}, {{/each}}]
*/
{{/if}}
export class {{@root.module.name}}_{{name}}Event_V{{@root.specVersion}} {
export class {{@root.moduleName}}_{{name}}Event_V{{@root.specVersion}} {
public readonly expectedParamTypes = [{{#each args}}'{{{this}}}', {{/each}}]

constructor(public readonly ctx: SubstrateEvent) {}
Expand Down
2 changes: 1 addition & 1 deletion packages/hydra-typegen/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"outDir": "lib",
"rootDirs": ["./src"],
"strict": true,
"target": "es2017",
"target": "es2021",
"noImplicitAny": false,
"esModuleInterop": true,
"experimentalDecorators": true,
Expand Down
2 changes: 1 addition & 1 deletion packages/sample/mappings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@joystream/hydra-common": "^5.0.0-alpha.7",
"@polkadot/types": "8.9.1"
"@polkadot/types": "10.1.4"
},
"devDependencies": {
"copyfiles": "^2.4.1",
Expand Down
Loading

0 comments on commit cbce70f

Please sign in to comment.