Skip to content

Commit

Permalink
Use cosmos event manager like default cosmos module are doing
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasMahe committed Jan 28, 2020
1 parent c5654e1 commit d01d06b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions cosmos/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,25 +113,24 @@ func (m AppModule) NewHandler() cosmostypes.Handler {
return cosmostypes.ErrInternal(err.Error()).Result()
}

events := request.EventManager().Events()
events = events.AppendEvent(
request.EventManager().EmitEvents(cosmostypes.Events{
cosmostypes.NewEvent(
cosmostypes.EventTypeMessage,
cosmostypes.NewAttribute(cosmostypes.AttributeKeyModule, m.name),
),
)
})

if hash != nil {
events = events.AppendEvent(
request.EventManager().EmitEvents(cosmostypes.Events{
cosmostypes.NewEvent(
cosmostypes.EventTypeMessage,
cosmostypes.NewAttribute(AttributeKeyHash, hash.String()),
),
)
})
}
return cosmostypes.Result{
Data: hash,
Events: events,
Events: request.EventManager().Events(),
}
}
}
Expand Down

0 comments on commit d01d06b

Please sign in to comment.