Skip to content

Commit

Permalink
feat: add MsgExec support for modules
Browse files Browse the repository at this point in the history
(cherry picked from commit 31ae8b5)
  • Loading branch information
RiccardoM committed Sep 11, 2023
1 parent 41adad3 commit d370615
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
6 changes: 6 additions & 0 deletions modules/auth/handle_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
"github.com/cosmos/gogoproto/proto"
juno "github.com/forbole/juno/v5/types"
"github.com/rs/zerolog/log"
Expand All @@ -16,6 +17,11 @@ import (
"github.com/forbole/bdjuno/v4/types"
)

// HandleMsgExec implements modules.AuthzMessageModule
func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error {
return m.HandleMsg(index, executedMsg, tx)
}

// HandleMsg implements modules.MessageModule
func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error {
addresses, err := m.messagesParser(tx)
Expand Down
6 changes: 6 additions & 0 deletions modules/distribution/handle_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ package distribution

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
juno "github.com/forbole/juno/v5/types"

distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
)

// HandleMsgExec implements modules.AuthzMessageModule
func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error {
return m.HandleMsg(index, executedMsg, tx)
}

// HandleMsg implements modules.MessageModule
func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error {
if len(tx.Logs) == 0 {
Expand Down
6 changes: 6 additions & 0 deletions modules/feegrant/handle_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ import (
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/authz"
feegranttypes "github.com/cosmos/cosmos-sdk/x/feegrant"
juno "github.com/forbole/juno/v5/types"

"github.com/forbole/bdjuno/v4/types"
)

// HandleMsgExec implements modules.AuthzMessageModule
func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error {
return m.HandleMsg(index, executedMsg, tx)
}

// HandleMsg implements modules.MessageModule
func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error {
if len(tx.Logs) == 0 {
Expand Down
7 changes: 7 additions & 0 deletions modules/gov/handle_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"strconv"
"time"

"github.com/cosmos/cosmos-sdk/x/authz"

"github.com/forbole/bdjuno/v4/types"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -14,6 +16,11 @@ import (
juno "github.com/forbole/juno/v5/types"
)

// HandleMsgExec implements modules.AuthzMessageModule
func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error {
return m.HandleMsg(index, executedMsg, tx)
}

// HandleMsg implements modules.MessageModule
func (m *Module) HandleMsg(index int, msg sdk.Msg, tx *juno.Tx) error {
if len(tx.Logs) == 0 {
Expand Down
8 changes: 7 additions & 1 deletion modules/staking/handle_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,20 @@ package staking
import (
"fmt"

"github.com/cosmos/cosmos-sdk/x/authz"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

sdk "github.com/cosmos/cosmos-sdk/types"
juno "github.com/forbole/juno/v5/types"
)

// HandleMsgExec implements modules.AuthzMessageModule
func (m *Module) HandleMsgExec(index int, _ *authz.MsgExec, _ int, executedMsg sdk.Msg, tx *juno.Tx) error {
return m.HandleMsg(index, executedMsg, tx)
}

// HandleMsg implements MessageModule
func (m *Module) HandleMsg(index int, msg sdk.Msg, tx *juno.Tx) error {
func (m *Module) HandleMsg(_ int, msg sdk.Msg, tx *juno.Tx) error {
if len(tx.Logs) == 0 {
return nil
}
Expand Down

0 comments on commit d370615

Please sign in to comment.