Skip to content

Commit ded6b47

Browse files
authored
feat(x/gov): add MsgSubmitProposal SetMsgs method (#17387)
1 parent 6d5a17d commit ded6b47

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
3939

4040
### Improvements
4141

42+
* (x/gov) [#17387](https://github.com/cosmos/cosmos-sdk/pull/17387) Add `MsgSubmitProposal` `SetMsgs` method.
4243
* (x/gov) [#17354](https://github.com/cosmos/cosmos-sdk/issues/17354) Emit `VoterAddr` in `proposal_vote` event.
4344
* (x/group, x/gov) [#17220](https://github.com/cosmos/cosmos-sdk/pull/17220) Add `--skip-metadata` flag in `draft-proposal` to skip metadata prompt.
4445
* (x/genutil) [#17296](https://github.com/cosmos/cosmos-sdk/pull/17296) Add `MigrateHandler` to allow reuse migrate genesis related function.

x/gov/types/v1/msgs.go

+12
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ func (m *MsgSubmitProposal) GetMsgs() ([]sdk.Msg, error) {
4646
return sdktx.GetMsgs(m.Messages, "sdk.MsgProposal")
4747
}
4848

49+
// SetMsgs packs sdk.Msg's into m.Messages Any's
50+
// NOTE: this will overwrite any existing messages
51+
func (m *MsgSubmitProposal) SetMsgs(msgs []sdk.Msg) error {
52+
anys, err := sdktx.SetMsgs(msgs)
53+
if err != nil {
54+
return err
55+
}
56+
57+
m.Messages = anys
58+
return nil
59+
}
60+
4961
// Route implements the sdk.Msg interface.
5062
func (m MsgSubmitProposal) Route() string { return types.RouterKey }
5163

0 commit comments

Comments
 (0)