From 388e99491664782c226ba24dc622479f23fac769 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 19 Apr 2023 09:41:31 +0200 Subject: [PATCH] docs(depinject): explain need `appmodule.Module` interface (#15880) --- docs/docs/building-modules/15-depinject.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/docs/building-modules/15-depinject.md b/docs/docs/building-modules/15-depinject.md index fc8405abf7f4e..fc793f04b7805 100644 --- a/docs/docs/building-modules/15-depinject.md +++ b/docs/docs/building-modules/15-depinject.md @@ -79,7 +79,13 @@ All methods, structs and their fields must be public for `depinject`. https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L199-L204 ``` -2. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies): +2. Ensure that the module implements the `appmodule.AppModule` interface: + + ```go reference + https://github.com/cosmos/cosmos-sdk/blob/v0.47.0/x/group/module/module.go#L58-L64 + ``` + +3. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies): * `depinject` provides the right dependencies to the module. * `depinject` also checks that all dependencies are provided. @@ -91,14 +97,14 @@ All methods, structs and their fields must be public for `depinject`. https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L206-L216 ``` -3. Define the module outputs with a public struct that inherits `depinject.Out`: +4. Define the module outputs with a public struct that inherits `depinject.Out`: The module outputs are the dependencies that the module provides to other modules. It is usually the module itself and its keeper. ```go reference https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L218-L223 ``` -4. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs. +5. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs. ```go reference https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L225-L235