cosmos-sdk/client/tx_generator.go
SaReN 39f53ac22f
client: rename CliContext to Context (#6290)
* Refactor CliContext as Context

* Fix lint issues

* Fix goimports

* Fix gov tests

* Resolved ci-lint issues

* Add changelog

* Rename cliCtx to clientCtx

* Fix mocks and routes

* Add changelog

* Update changelog

* Apply suggestions from code review

Co-authored-by: Alessio Treglia <alessio@tendermint.com>

* merge client/rpc/ro{ot,utes}.go

* Update docs

* client/rpc: remove redundant client/rpc.RegisterRPCRoutes

* regenerate mocks

* Update ADRs

Co-authored-by: Alessio Treglia <alessio@tendermint.com>
Co-authored-by: Federico Kunze <31522760+fedekunze@users.noreply.github.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2020-06-01 12:46:03 +00:00

52 lines
1.3 KiB
Go

package client
import (
"github.com/tendermint/tendermint/crypto"
"github.com/cosmos/cosmos-sdk/types"
)
type (
// TxGenerator defines an interface a client can utilize to generate an
// application-defined concrete transaction type. The type returned must
// implement TxBuilder.
TxGenerator interface {
NewTx() TxBuilder
NewFee() Fee
NewSignature() Signature
MarshalTx(tx types.Tx) ([]byte, error)
}
Fee interface {
types.Fee
SetGas(uint64)
SetAmount(types.Coins)
}
Signature interface {
types.Signature
SetPubKey(crypto.PubKey) error
SetSignature([]byte)
}
// TxBuilder 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.
TxBuilder interface {
GetTx() types.Tx
SetMsgs(...types.Msg) error
GetSignatures() []types.Signature
SetSignatures(...Signature) error
GetFee() types.Fee
SetFee(Fee) error
GetMemo() string
SetMemo(string)
// CanonicalSignBytes returns the canonical sign bytes to sign over, given a
// chain ID, along with an account and sequence number.
CanonicalSignBytes(cid string, num, seq uint64) ([]byte, error)
}
)