evmosjs icon indicating copy to clipboard operation
evmosjs copied to clipboard

Question regarding proposal submitions

Open juansalvatore opened this issue 2 years ago • 3 comments

What helper do we need to use to format the content for createTxMsgSubmitProposal image

I'm trying to do this:

  const content = createMsgSubmitProposal(
      {
        type: "cosmos-sdk/TextProposal",
        value: {
          title: "title",
          description: "description",
        },
      },
      "azeta",
      "100",
      address
    );

And I'm then passing these params to createTxMsgSubmitProposal:

{
        content,
        initialDepositDenom: "azeta",
        initialDepositAmount: "100",
        proposer: address,
      }

With this I get this error: image

And if I add the toArray and serialize functions manually to the content (because I'm not sure what helper to use to format the content) I get: image

juansalvatore avatar Jun 09 '23 14:06 juansalvatore

I'm now passing the following value createMsgSubmitProposal(...).message.content to createTxMsgSubmitProposal but still get the missing value error for field proposal_id of type uint64. I still have the toArray and serialize in createMsgSubmitProposal

    const content = createMsgSubmitProposal(
      {
        type: "cosmos-sdk/TextProposal",
        value: {
          title: "title",
          description: "description",
        },
        toArray: () => [],
        serialize: () => {},
      },
      "azeta",
      "100",
      address
    );
image

juansalvatore avatar Jun 09 '23 14:06 juansalvatore

@hanchon @GAtom22 any ideas? It would be helpful to get an example of how you convert the content to a google.protobuf.Any

juansalvatore avatar Jun 22 '23 19:06 juansalvatore

@juansalvatore you can try to create content directly from protobuf

import {
  createTxMsgSubmitProposal,
  MessageMsgSubmitProposal,
} from "@evmos/transactions";
import * as govProto from "@evmos/proto/dist/proto/cosmos/gov/v1beta1/gov";

const { TextProposal } = govProto.cosmos.gov.v1beta1;

const proposalParams: MessageMsgSubmitProposal = {
  content: TextProposal.fromObject({
    title: "",
    description,
  }),
  proposer: senderhaqqAddress,
  initialDepositAmount: depositAmount,
  initialDepositDenom: depositDenom,
};

const msg = createTxMsgSubmitProposal(
  chain,
  sender,
  DEFAULT_FEE,
  "memo",
  proposalParams
);

olegshilov avatar Aug 22 '23 11:08 olegshilov