cosmos-sdk/client/tx/tx.go

39 lines
1.2 KiB
Go
Raw Normal View History

2020-03-13 10:59:14 -07:00
package tx
2020-03-12 12:35:22 -07:00
import (
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
)
type (
2020-03-15 11:10:15 -07:00
// Generator defines an interface a client can utilize to generate an
2020-03-12 12:35:22 -07:00
// application-defined concrete transaction type. The type returned must
// implement ClientTx.
2020-03-15 11:10:15 -07:00
Generator interface {
2020-03-12 12:35:22 -07:00
NewTx() ClientTx
}
// ClientTx defines an interface which an application-defined concrete transaction
// type must implement. Namely, it must be able to set messages, generate
// signatures, and provide canonical bytes to sign over. The transaction must
// also know how to encode itself.
ClientTx interface {
sdk.Tx
codec.ProtoMarshaler
SetMsgs(...sdk.Msg) error
GetSignatures() []sdk.Signature
SetSignatures(...sdk.Signature)
GetFee() sdk.Fee
SetFee(sdk.Fee)
GetMemo() string
SetMemo(string)
2020-03-16 08:52:07 -07:00
// CanonicalSignBytes returns the canonical JSON bytes to sign over, given a
// chain ID, along with an account and sequence number. The JSON encoding
// ensures all field names adhere to their proto definition, default values
// are omitted, and follows the JSON Canonical Form.
2020-03-12 12:35:22 -07:00
CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error)
}
)