github.com/cosmos/cosmos-sdk@v0.50.10/x/group/proposal.go (about)

     1  package group
     2  
     3  import (
     4  	"github.com/cosmos/cosmos-sdk/codec/types"
     5  	sdk "github.com/cosmos/cosmos-sdk/types"
     6  	"github.com/cosmos/cosmos-sdk/types/tx"
     7  )
     8  
     9  // GetMsgs unpacks p.Messages Any's into sdk.Msg's
    10  func (p *Proposal) GetMsgs() ([]sdk.Msg, error) {
    11  	return tx.GetMsgs(p.Messages, "proposal")
    12  }
    13  
    14  // SetMsgs packs msgs into Any's
    15  func (p *Proposal) SetMsgs(msgs []sdk.Msg) error {
    16  	anys, err := tx.SetMsgs(msgs)
    17  	if err != nil {
    18  		return err
    19  	}
    20  	p.Messages = anys
    21  	return nil
    22  }
    23  
    24  // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces
    25  func (p Proposal) UnpackInterfaces(unpacker types.AnyUnpacker) error {
    26  	return tx.UnpackInterfaces(unpacker, p.Messages)
    27  }