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

allow GlobalRegistry decode/encode to return types #687

Open
pyramation opened this issue Nov 2, 2024 · 1 comment
Open

allow GlobalRegistry decode/encode to return types #687

pyramation opened this issue Nov 2, 2024 · 1 comment

Comments

@pyramation
Copy link
Collaborator

From discord:

I'm no TS expert but is there a way for the GlobalRegistry to return concrete type instead of generic Object?

maybe we can solve using template style like Object<SomeThing> potentially could help? Or is this a non-issue and already something that can be done?

cc @Zetazzz

@pyramation
Copy link
Collaborator Author

pyramation commented Nov 2, 2024

I'm not sure it's necessary because the encoders/decoders are typed:

https://github.com/osmosis-labs/osmojs/blob/72a55404a8d5cf4f14786016337b47e82d0e5338/packages/osmojs/src/cosmos/gov/v1beta1/tx.ts#L307

looking here I see the function is typed

fromAmino(object: MsgSubmitProposalAmino): MsgSubmitProposal {
    const message = createBaseMsgSubmitProposal();
    if (object.content !== undefined && object.content !== null) {
      message.content = GlobalDecoderRegistry.fromAminoMsg(object.content);
    }
    message.initialDeposit = object.initial_deposit?.map(e => Coin.fromAmino(e)) || [];
    if (object.proposer !== undefined && object.proposer !== null) {
      message.proposer = object.proposer;
    }
    return message;
  },

what is the issue here if we have MsgSubmitProposal

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

No branches or pull requests

1 participant