2020-09-22 07:35:18 -07:00
|
|
|
package legacytx
|
2019-06-05 16:26:17 -07:00
|
|
|
|
|
|
|
import (
|
2020-05-19 13:17:29 -07:00
|
|
|
"github.com/cosmos/cosmos-sdk/codec/types"
|
2019-06-05 16:26:17 -07:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
|
|
)
|
|
|
|
|
2020-08-07 16:32:22 -07:00
|
|
|
var _ types.UnpackInterfacesMessage = StdSignMsg{}
|
|
|
|
|
|
|
|
// StdSignMsg is a convenience structure for passing along a Msg with the other
|
|
|
|
// requirements for a StdSignDoc before it is signed. For use in the CLI.
|
2019-06-05 16:26:17 -07:00
|
|
|
type StdSignMsg struct {
|
2019-07-05 16:25:56 -07:00
|
|
|
ChainID string `json:"chain_id" yaml:"chain_id"`
|
|
|
|
AccountNumber uint64 `json:"account_number" yaml:"account_number"`
|
|
|
|
Sequence uint64 `json:"sequence" yaml:"sequence"`
|
2020-08-07 16:32:22 -07:00
|
|
|
TimeoutHeight uint64 `json:"timeout_height" yaml:"timeout_height"`
|
2019-07-05 16:25:56 -07:00
|
|
|
Fee StdFee `json:"fee" yaml:"fee"`
|
|
|
|
Msgs []sdk.Msg `json:"msgs" yaml:"msgs"`
|
|
|
|
Memo string `json:"memo" yaml:"memo"`
|
2019-06-05 16:26:17 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
// get message bytes
|
|
|
|
func (msg StdSignMsg) Bytes() []byte {
|
2020-08-07 16:32:22 -07:00
|
|
|
return StdSignBytes(msg.ChainID, msg.AccountNumber, msg.Sequence, msg.TimeoutHeight, msg.Fee, msg.Msgs, msg.Memo)
|
2019-06-05 16:26:17 -07:00
|
|
|
}
|
2020-05-19 13:17:29 -07:00
|
|
|
|
|
|
|
func (msg StdSignMsg) UnpackInterfaces(unpacker types.AnyUnpacker) error {
|
|
|
|
for _, m := range msg.Msgs {
|
|
|
|
err := types.UnpackInterfaces(m, unpacker)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
2020-08-07 16:32:22 -07:00
|
|
|
|
2020-05-19 13:17:29 -07:00
|
|
|
return nil
|
|
|
|
}
|