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

Pubkey logic #451

Merged
merged 3 commits into from
Aug 18, 2023
Merged

Pubkey logic #451

merged 3 commits into from
Aug 18, 2023

Conversation

Zetazzz
Copy link
Collaborator

@Zetazzz Zetazzz commented Aug 18, 2023

use Pubkey type from cosmjs/amino when generating pubkey type in AminoType, according to the corresponding logic in cosmjs:

export interface MsgCreateValidatorAminoType extends AminoMsg {
  type: "cosmos-sdk/MsgCreateValidator";
  value: {
    ...
    pubkey: Pubkey;
  };
}

correct pubkey decode and encode logic, according to the corresponding logic in cosmjs:

export const AminoConverter = {
  "/cosmos.staking.v1beta1.MsgCreateValidator": {
    aminoType: "cosmos-sdk/MsgCreateValidator",
    toAmino: ({
      ...
      pubkey,
    }: MsgCreateValidator): MsgCreateValidatorAminoType["value"] => {
      return {
        ...
        pubkey: decodePubkey(pubkey)!,
      };
    },
    fromAmino: ({
      ...
      pubkey,
    }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => {
      return {
        ...
        pubkey: encodePubkey(pubkey.value),
      };
    }

@Zetazzz Zetazzz marked this pull request as ready for review August 18, 2023 01:07
@Zetazzz Zetazzz merged commit 078f8d1 into main Aug 18, 2023
2 checks passed
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 this pull request may close these issues.

1 participant