* Implement simulate endpoint * Add GetProtoTx() * Add signing in test * Add txBuilderFromProto * Remove stray println * Update to master * Merge master * Fix tests * Make tests pass * Integrate in router * Make proto-gen * Fix lint * Really fix lint * Refactor to fix import cycles * Rename builder -> wrapper * Update proto/cosmos/base/reflection/v1beta1/reflection.proto * Fix after merge * t->w Co-authored-by: Alexander Bezobchuk <alexanderbez@users.noreply.github.com>
50 lines
1.5 KiB
Go
50 lines
1.5 KiB
Go
package client
|
|
|
|
import (
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
|
"github.com/cosmos/cosmos-sdk/types/tx"
|
|
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
|
|
MarshalSignatureJSON([]signingtypes.SignatureV2) ([]byte, error)
|
|
UnmarshalSignatureJSON([]byte) ([]signingtypes.SignatureV2, error)
|
|
}
|
|
|
|
// 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.Tx
|
|
// GetProtoTx returns the tx as a proto.Message.
|
|
GetProtoTx() *tx.Tx
|
|
|
|
SetMsgs(msgs ...sdk.Msg) error
|
|
SetSignatures(signatures ...signingtypes.SignatureV2) error
|
|
SetMemo(memo string)
|
|
SetFeeAmount(amount sdk.Coins)
|
|
SetGasLimit(limit uint64)
|
|
SetTimeoutHeight(height uint64)
|
|
}
|
|
)
|