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

[Extra/rest] Add sender account in case use bank keeper to send coins #524

Merged
merged 4 commits into from
Dec 17, 2024
Merged
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
14 changes: 13 additions & 1 deletion hooks/emitter/bank.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,18 @@ func (h *Hook) handleMsgMultiSend(msg *types.MsgMultiSend) {
}
}

// handleMsgEventTypeTransfer implements emitter handler for Msg that has EventTypeTransfer.
func (h *Hook) handleMsgEventTypeTransfer(evMap common.EvMap) {
h.AddAccountsInTx(
evMap[types.EventTypeTransfer+"."+types.AttributeKeyRecipient][0],
evMap[types.EventTypeTransfer+"."+types.AttributeKeySender][0],
)
}

// handleEventTypeTransfer implements emitter handler for Event that has EventTypeTransfer.
func (h *Hook) handleEventTypeTransfer(evMap common.EvMap) {
h.AddAccountsInBlock(evMap[types.EventTypeTransfer+"."+types.AttributeKeyRecipient][0])
h.AddAccountsInBlock(
evMap[types.EventTypeTransfer+"."+types.AttributeKeyRecipient][0],
evMap[types.EventTypeTransfer+"."+types.AttributeKeySender][0],
)
}
2 changes: 2 additions & 0 deletions hooks/emitter/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ func (h *Hook) handleMsg(ctx sdk.Context, txHash []byte, msg sdk.Msg, events []a
func (h *Hook) handleMsgEvent(ctx sdk.Context, txHash []byte, event abci.Event) {
evMap := parseEvents([]abci.Event{event})
switch event.Type {
case banktypes.EventTypeTransfer:
h.handleMsgEventTypeTransfer(evMap)
case restaketypes.EventTypeCreateVault:
h.handleRestakeEventCreateVault(ctx, evMap)
case restaketypes.EventTypeLockPower:
Expand Down
Loading