Skip to content

Commit 967efc6

Browse files
docs(depinject): explain need appmodule.Module interface (backport #15880) (#15881)
Co-authored-by: Julien Robert <julien@rbrt.fr>
1 parent 48d3d99 commit 967efc6

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/docs/building-modules/15-depinject.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ All methods, structs and their fields must be public for `depinject`.
7979
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L199-L204
8080
```
8181

82-
2. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies):
82+
2. Ensure that the module implements the `appmodule.AppModule` interface:
83+
84+
```go reference
85+
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0/x/group/module/module.go#L58-L64
86+
```
87+
88+
3. Define a struct that inherits `depinject.In` and define the module inputs (i.e. module dependencies):
8389
* `depinject` provides the right dependencies to the module.
8490
* `depinject` also checks that all dependencies are provided.
8591

@@ -91,14 +97,14 @@ All methods, structs and their fields must be public for `depinject`.
9197
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L206-L216
9298
```
9399

94-
3. Define the module outputs with a public struct that inherits `depinject.Out`:
100+
4. Define the module outputs with a public struct that inherits `depinject.Out`:
95101
The module outputs are the dependencies that the module provides to other modules. It is usually the module itself and its keeper.
96102

97103
```go reference
98104
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L218-L223
99105
```
100106

101-
4. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs.
107+
5. Create a function named `ProvideModule` (as called in 1.) and use the inputs for instantiating the module outputs.
102108

103109
```go reference
104110
https://github.com/cosmos/cosmos-sdk/blob/v0.47.0-rc1/x/group/module/module.go#L225-L235

0 commit comments

Comments
 (0)