-
Notifications
You must be signed in to change notification settings - Fork 120
/
codec.go
68 lines (61 loc) · 2.29 KB
/
codec.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package cosmos
import (
"cosmossdk.io/x/upgrade"
"github.com/cosmos/ibc-go/modules/capability"
transfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer"
ibccore "github.com/cosmos/ibc-go/v8/modules/core"
ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint"
ccvprovider "github.com/cosmos/interchain-security/v5/x/ccv/provider"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
"github.com/cosmos/cosmos-sdk/x/auth"
authTx "github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/cosmos/cosmos-sdk/x/bank"
"github.com/cosmos/cosmos-sdk/x/consensus"
distr "github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/genutil"
genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
"github.com/cosmos/cosmos-sdk/x/mint"
"github.com/cosmos/cosmos-sdk/x/params"
paramsclient "github.com/cosmos/cosmos-sdk/x/params/client"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
ibcwasm "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos/08-wasm-types"
)
func DefaultEncoding() testutil.TestEncodingConfig {
return testutil.MakeTestEncodingConfig(
auth.AppModuleBasic{},
genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator),
bank.AppModuleBasic{},
capability.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distr.AppModuleBasic{},
gov.NewAppModuleBasic(
[]govclient.ProposalHandler{
paramsclient.ProposalHandler,
},
),
params.AppModuleBasic{},
slashing.AppModuleBasic{},
upgrade.AppModuleBasic{},
consensus.AppModuleBasic{},
transfer.AppModuleBasic{},
ibccore.AppModuleBasic{},
ibctm.AppModuleBasic{},
ibcwasm.AppModuleBasic{},
ccvprovider.AppModuleBasic{},
)
}
func decodeTX(interfaceRegistry codectypes.InterfaceRegistry, txbz []byte) (sdk.Tx, error) {
cdc := codec.NewProtoCodec(interfaceRegistry)
return authTx.DefaultTxDecoder(cdc)(txbz)
}
func encodeTxToJSON(interfaceRegistry codectypes.InterfaceRegistry, tx sdk.Tx) ([]byte, error) {
cdc := codec.NewProtoCodec(interfaceRegistry)
return authTx.DefaultJSONTxEncoder(cdc)(tx)
}