-
Notifications
You must be signed in to change notification settings - Fork 3
/
tx_config.go
44 lines (38 loc) · 1.28 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
package types
import (
signingtypes "github.com/irisnet/service-sdk-go/types/tx/signing"
)
type (
// 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() Tx
SetMsgs(msgs ...Msg) error
SetSignatures(signatures ...signingtypes.SignatureV2) error
SetMemo(memo string)
SetFeeAmount(amount Coins)
SetGasLimit(limit uint64)
SetTimeoutHeight(height uint64)
}
// TxEncodingConfig defines an interface that contains transaction
// encoders and decoders
TxEncodingConfig interface {
TxEncoder() TxEncoder
TxDecoder() TxDecoder
TxJSONEncoder() TxEncoder
TxJSONDecoder() 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(Tx) (TxBuilder, error)
SignModeHandler() SignModeHandler
}
)