Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove default types from AminoTypes #1079

Closed
7 tasks done
webmaster128 opened this issue Mar 9, 2022 · 2 comments · Fixed by #1081
Closed
7 tasks done

Remove default types from AminoTypes #1079

webmaster128 opened this issue Mar 9, 2022 · 2 comments · Fixed by #1081
Assignees
Milestone

Comments

@webmaster128
Copy link
Member

webmaster128 commented Mar 9, 2022

Right now, AminoTypes works by having a set of default types and additions.

However, that conflicts with the idea of having independent modules and very different client configurations for each chain. It also makes testing hard.

  • Let The AminoTypes class take a AminoConverters (same as Record<string, AminoConverter | "not_supported_by_chain">) argument in the constructor
  • Move function createDefaultTypes(prefix: string): AminoConverters to the SigningStargateClient
  • Export all create*AminoConverters in @cosmjs/stargate
  • Use only auth, bank and wasm Amino converter types in the AminoTypes instance of the SigningCosmWasmClient
  • Split test from packages/stargate/src/aminotypes.spec.ts and move them to src/modules/*/aminomessages.spec.ts
  • Move AminoConverter/AminoConverters into packages/stargate/src/aminotypes.ts
  • CHANGELOG
@webmaster128 webmaster128 added this to the 0.28.0 milestone Mar 9, 2022
@msteiner96 msteiner96 self-assigned this Mar 9, 2022
@msteiner96
Copy link
Member

@webmaster128 Regarding backward compatibility: should AminoConverters replace or complement the old parameters?

@webmaster128
Copy link
Member Author

webmaster128 commented Mar 9, 2022

should AminoConverters replace or complement the old parameters?

Replace. You then create an instance with

const a = new AminoTypes(createDefaultTypes("mychain"));

// or

const a = new AminoTypes({
    ...createAuthzAminoConverters(),
    ...createBankAminoConverters(),
    ...createDistributionAminoConverters(),
    ...createGovAminoConverters(),
    ...createStakingAminoConverters("mychain"),
    ...createIbcAminoConverters(),
    ...createFreegrantAminoConverters(),
   // customize me here
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants