* Update genutil collect and gentx to use TxGenerator * Remove print statement * Use Tx in genutil DeliverGenTxs * Use Tx in genutil genesis_state * Use Tx in ValidateGenesis * Use amino txJSONDecoder and txBinaryEncoder in genutil InitGenesis * Use TxConfig in place of TxGenerator * Add gentx tests * Remove commented line * Test fixes * Apply suggestions from code review Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> * Fixes * Fixes * Fixes * Fixes * Remove unneeded test case (doesn't apply to proto marshaling) * linting * Refactor to use new TxEncodingConfig interface in genutil module * Replace golang/protobuf with gogo/protobuf package * Use TxEncodingConfig in InitTestnet * Remove old amino.go file * Use TxJSONDecoder in genutil ValidateGenesis * Add parameter to ValidateGenesis to resolve the tx JSON decoder issue * Address review feedback Co-authored-by: Jack Zampolin <jack.zampolin@gmail.com> Co-authored-by: Aaron Craelius <aaronc@users.noreply.github.com> Co-authored-by: Aaron Craelius <aaron@regen.network> Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package client
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
signingtypes "github.com/cosmos/cosmos-sdk/types/tx/signing"
|
|
"github.com/cosmos/cosmos-sdk/x/auth/signing"
|
|
)
|
|
|
|
type (
|
|
// TxEncodingConfig defines an interface that contains transaction
|
|
// encoders and decoders
|
|
TxEncodingConfig interface {
|
|
TxEncoder() sdk.TxEncoder
|
|
TxDecoder() sdk.TxDecoder
|
|
TxJSONEncoder() sdk.TxEncoder
|
|
TxJSONDecoder() sdk.TxDecoder
|
|
}
|
|
|
|
// TxConfig defines an interface a client can utilize to generate an
|
|
// application-defined concrete transaction type. The type returned must
|
|
// implement TxBuilder.
|
|
TxConfig interface {
|
|
TxEncodingConfig
|
|
|
|
NewTxBuilder() TxBuilder
|
|
WrapTxBuilder(sdk.Tx) (TxBuilder, error)
|
|
SignModeHandler() signing.SignModeHandler
|
|
}
|
|
|
|
// 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() signing.SigFeeMemoTx
|
|
|
|
SetMsgs(msgs ...sdk.Msg) error
|
|
SetSignatures(signatures ...signingtypes.SignatureV2) error
|
|
SetMemo(memo string)
|
|
SetFeeAmount(amount sdk.Coins)
|
|
SetGasLimit(limit uint64)
|
|
}
|
|
)
|