Joystream / hydra

A Substrate indexing framework
49 stars 44 forks source link

fix: remove 'Codec' import from template files in generated/types dir #513

Closed zeeshanakram3 closed 1 year ago

zeeshanakram3 commented 1 year ago

Problem

In module.hbs file in hydra-typegen package, there is an unused Codex import as: import { Codec } from "@polkadot/types/types";. This template file is being used to generate Events classes for each module inside query-node/mappings/generated/types/. The problem is if any event contains a param which is of codex type, then Codec is imported again, which leads to duplicate imports error while building the QN.

For example, in https://github.com/Joystream/joystream/pull/4517 the type of optional payment parameter in the MemberRemarked event is Option<[AccountId32, u128] & Codec>

Solution

Remove unused Codec import from the template file.

affects: @joystream/hydra-typegen