-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
tx_config.go
46 lines (40 loc) · 1.4 KB
/
tx_config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
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
SetMsgs(msgs ...sdk.Msg) error
SetSignatures(signatures ...signingtypes.SignatureV2) error
SetMemo(memo string)
SetFeeAmount(amount sdk.Coins)
SetGasLimit(limit uint64)
SetTimeoutHeight(height uint64)
}
)