You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, x/gov, x/staking, (etc..) and (soon: #19697) x/epochs support hooks. However, we have no demonstration on how to define hooks the depinject way.
The easiest way to do it is to inject the keeper and then call SetHooks on it, like done in app.go (works on a runtime/depinject app too):
Currently, x/gov, x/staking, (etc..) and (soon: #19697) x/epochs support hooks. However, we have no demonstration on how to define hooks the depinject way.
The easiest way to do it is to inject the keeper and then call
SetHooks
on it, like done inapp.go
(works on a runtime/depinject app too):cosmos-sdk/simapp/app.go
Lines 397 to 401 in d54e940
However, there is wiring in each module to do it the depinject way:
cosmos-sdk/x/gov/depinject.go
Lines 118 to 140 in d54e940
cosmos-sdk/x/staking/depinject.go
Lines 82 to 119 in d54e940
Basically, a module should provide / output its hooks' definition (
IsOnePerModuleType
) and depinject will create a map of all defined hooks.We should demonstrate how a module can provide a hook. Let's use the testing
counter
module for that and demonstrate a hook definition.The text was updated successfully, but these errors were encountered: