Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(app): set up post handler for tx tips #1454

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
#### Added

- [#1340](https://github.com/regen-network/regen-ledger/pull/1340) Add Cosmos SDK group module to app configuration
- [#1454](https://github.com/regen-network/regen-ledger/pull/1454) Add transaction tips to the application post handler.

#### Changed

Expand Down
1 change: 1 addition & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ func NewRegenApp(logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest
panic(err)
}
app.SetAnteHandler(anteHandler)
app.setPostHandler()

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
Expand Down
11 changes: 11 additions & 0 deletions app/stable_appconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/posthandler"
"github.com/cosmos/cosmos-sdk/x/group"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

Expand Down Expand Up @@ -55,3 +56,13 @@ func (app *RegenApp) setCustomAnteHandler(cfg client.TxConfig) (sdk.AnteHandler,
},
)
}

func (app *RegenApp) setPostHandler() {
if app.BankKeeper == nil {
panic("cannot instantiate app post handler when app.BankKeeper is nil")
}
postDecorators := []sdk.AnteDecorator{
posthandler.NewTipDecorator(app.BankKeeper),
}
app.SetPostHandler(sdk.ChainAnteDecorators(postDecorators...))
}