/
utils.go
73 lines (68 loc) · 2.37 KB
/
utils.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
69
70
71
72
73
package utils
import (
"github.com/arkeonetwork/arkeo/common/cosmos"
"github.com/arkeonetwork/arkeo/x/arkeo/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/std"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/auth/vesting"
"github.com/cosmos/cosmos-sdk/x/bank"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/capability"
"github.com/cosmos/cosmos-sdk/x/crisis"
"github.com/cosmos/cosmos-sdk/x/distribution"
"github.com/cosmos/cosmos-sdk/x/evidence"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/params"
"github.com/cosmos/cosmos-sdk/x/slashing"
"github.com/cosmos/cosmos-sdk/x/staking"
"github.com/cosmos/cosmos-sdk/x/upgrade"
"github.com/ignite/modules/x/mint"
"github.com/tendermint/tendermint/crypto/secp256k1"
)
// ModuleBasics is a mock module basic manager for testing
var ModuleBasics = module.NewBasicManager(
auth.AppModuleBasic{},
genutil.AppModuleBasic{},
bank.AppModuleBasic{},
capability.AppModuleBasic{},
staking.AppModuleBasic{},
mint.AppModuleBasic{},
distribution.AppModuleBasic{},
/*
gov.NewAppModuleBasic(
paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.ProposalHandler, upgradeclient.CancelProposalHandler,
),
*/
params.AppModuleBasic{},
crisis.AppModuleBasic{},
slashing.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
vesting.AppModuleBasic{},
)
// create a codec used only for testing
func MakeTestCodec() *codec.LegacyAmino {
cdc := codec.NewLegacyAmino()
banktypes.RegisterLegacyAminoCodec(cdc)
authtypes.RegisterLegacyAminoCodec(cdc)
types.RegisterCodec(cdc)
cosmos.RegisterCodec(cdc)
// codec.RegisterCrypto(cdc)
return cdc
}
func MakeTestMarshaler() codec.Codec {
interfaceRegistry := codectypes.NewInterfaceRegistry()
std.RegisterInterfaces(interfaceRegistry)
ModuleBasics.RegisterInterfaces(interfaceRegistry)
types.RegisterInterfaces(interfaceRegistry)
return codec.NewProtoCodec(interfaceRegistry)
}
// GetRandomArkeoAddress returns a random arkeo address for testing
func GetRandomArkeoAddress() sdk.AccAddress {
return sdk.AccAddress(secp256k1.GenPrivKey().PubKey().Address())
}