-
Notifications
You must be signed in to change notification settings - Fork 127
/
app.go
59 lines (50 loc) · 1.38 KB
/
app.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
package testutil
import (
"encoding/json"
dbm "github.com/cometbft/cometbft-db"
"github.com/cometbft/cometbft/libs/log"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/runtime"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/irisnet/irishub/v3/app"
"github.com/irisnet/irishub/v3/app/params"
)
var (
_ runtime.AppI = (*AppWrapper)(nil)
_ servertypes.Application = (*AppWrapper)(nil)
)
// AppWrapper extends an ABCI application, but with most of its parameters exported.
// They are exported for convenience in creating helper functions, as object
// capabilities aren't needed for testing.
type AppWrapper struct {
*app.IrisApp
}
func setup(
appOpts servertypes.AppOptions,
baseAppOptions ...func(*baseapp.BaseApp),
) *AppWrapper {
db := dbm.NewMemDB()
encCdc := app.RegisterEncodingConfig()
if appOpts == nil {
appOpts = EmptyAppOptions{}
}
app := app.NewIrisApp(
log.NewNopLogger(),
db,
nil,
true,
encCdc,
appOpts,
baseAppOptions...,
)
return &AppWrapper{app}
}
// MakeCodecs returns the application codec and tx codec
func MakeCodecs() params.EncodingConfig {
return app.RegisterEncodingConfig()
}
// DefaultGenesis returns default genesis state as raw bytes
func DefaultGenesis(cdc codec.JSONCodec) map[string]json.RawMessage {
return app.ModuleBasics.DefaultGenesis(cdc)
}