Skip to content

Commit

Permalink
Merge pull request #1 from bcdevtools/imp/add-msg-signer-to-involver-…
Browse files Browse the repository at this point in the history
…list

imp(parser): add message signer into involvers list
  • Loading branch information
0xbcdev authored Apr 5, 2024
2 parents 48393f1 + 1957070 commit af0a5fe
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 3 deletions.
60 changes: 60 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<!--
Guiding Principles:
Changelogs are for humans, not machines.
There should be an entry for every single version.
The same types of changes should be grouped.
Versions and sections should be linkable.
The latest version comes first.
The release date of each version is displayed.
Mention whether you follow Semantic Versioning.
Usage:
Change log entries are to be added to the Unreleased section under the
appropriate stanza (see below). Each entry should ideally include a tag and
the GitHub issue reference in the following format:
* (<tag>) \#<issue-number> message
Tag must include `sql` if having any changes relate to schema
The issue numbers will later be link-ified during the release process,
so you do not have to worry about including a link manually, but you can if you wish.
Types of changes (Stanzas):
"Features" for new features.
"Improvements" for changes in existing functionality.
"Deprecated" for soon-to-be removed features.
"Bug Fixes" for any bug fixes.
"Schema Breaking" for breaking SQL Schema.
"API Breaking" for breaking API.
If any PR belong to multiple types of change, reference it into all types with only ticket id, no need description (convention)
Ref: https://keepachangelog.com/en/1.0.0/
-->

<!--
Templates for Unreleased:
## Unreleased
#### Features
#### Improvements
#### Bug Fixes
#### Schema Breaking
#### API Breaking
-->

# Changelog

## Unreleased

#### Improvements
- (parser) [#1](https://github.com/bcdevtools/block-explorer-rpc-cosmos/pull/1) Add message signer into involvers list
11 changes: 11 additions & 0 deletions be_rpc/backend/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,17 @@ func (m *Backend) GetTransactionsInBlockRange(fromHeightIncluded, toHeightInclud

resInvolvers, err := messageInvolversExtractor(cosmosMsg, tx, tmTx, m.clientCtx)
if err == nil {
if _, found := resInvolvers[berpctypes.MessageSenderSigner]; !found {
// if no signer found, try to get it from the signers
func() {
defer func() {
_ = recover() // omit any error
}()
if len(cosmosMsg.GetSigners()) > 0 {
resInvolvers.Add(berpctypes.MessageSenderSigner, cosmosMsg.GetSigners()[0].String())
}
}()
}
involvers = resInvolvers.Finalize()
}
}
Expand Down
7 changes: 4 additions & 3 deletions be_rpc/types/msg_involvers_extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ type MessageInvolversExtractor func(msg sdk.Msg, tx *tx.Tx, tmTx tmtypes.Tx, cli
type InvolversType string

const (
MessageInvolvers InvolversType = "0"
Erc20Involvers InvolversType = "erc20"
NftInvolvers InvolversType = "nft"
MessageSenderSigner InvolversType = "s"
MessageInvolvers InvolversType = "0"
Erc20Involvers InvolversType = "erc20"
NftInvolvers InvolversType = "nft"
)

type MessageInvolversResult map[InvolversType][]string
Expand Down

0 comments on commit af0a5fe

Please sign in to comment.