Files
sonr/x/did/depinject.go
T

72 lines
1.6 KiB
Go
Raw Normal View History

2024-07-05 22:20:13 -04:00
package module
import (
"os"
2024-09-05 18:37:38 -04:00
"github.com/cosmos/cosmos-sdk/codec"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
2025-10-03 14:45:52 -04:00
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
2024-09-05 18:37:38 -04:00
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
2024-07-05 22:20:13 -04:00
2025-10-03 14:45:52 -04:00
"cosmossdk.io/core/address"
"cosmossdk.io/core/appmodule"
"cosmossdk.io/core/store"
"cosmossdk.io/depinject"
"cosmossdk.io/log"
modulev1 "github.com/sonr-io/sonr/api/did/module/v1"
"github.com/sonr-io/sonr/x/did/keeper"
2024-07-05 22:20:13 -04:00
)
var _ appmodule.AppModule = AppModule{}
// IsOnePerModuleType implements the depinject.OnePerModuleType interface.
func (am AppModule) IsOnePerModuleType() {}
// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
func init() {
appmodule.Register(
&modulev1.Module{},
appmodule.Provide(ProvideModule),
)
}
type ModuleInputs struct {
depinject.In
Cdc codec.Codec
StoreService store.KVStoreService
AddressCodec address.Codec
AccountKeeper authkeeper.AccountKeeper
StakingKeeper stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
}
type ModuleOutputs struct {
depinject.Out
Module appmodule.AppModule
Keeper keeper.Keeper
}
func ProvideModule(in ModuleInputs) ModuleOutputs {
govAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String()
2025-10-03 14:45:52 -04:00
k := keeper.NewKeeper(
in.Cdc,
in.StoreService,
log.NewLogger(os.Stderr),
govAddr,
in.AccountKeeper,
)
m := NewAppModule(in.Cdc, k)
2024-07-05 22:20:13 -04:00
return ModuleOutputs{Module: m, Keeper: k, Out: depinject.Out{}}
}