Skip to content

Commit

Permalink
Fix groups proposal error (#504)
Browse files Browse the repository at this point in the history
* use index of message before making new list

* add change log
  • Loading branch information
nullpointer0x00 authored Nov 14, 2023
1 parent 781d36c commit f9f94c4
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 155 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Bug Fixes
* Fix parsing of ibc json packet [#501](https://github.com/provenance-io/explorer-service/issues/501)
* Fix groups proposal error [#499](https://github.com/provenance-io/explorer-service/issues/499)

## [v5.6.0](https://github.com/provenance-io/explorer-service/releases/tag/v5.6.0) - 2023-07-05
### Release Name: Niels Peter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -911,12 +911,12 @@ fun getGroupPolicyEventByEvent(event: String) = GroupPolicyEvents.values().first

enum class GroupGovMsgType { PROPOSAL, VOTE, EXEC, WITHDRAW }

fun Any.getAssociatedGroupProposals() =
fun Any.getAssociatedGroupProposals(index: Int): Triple<Int, GroupGovMsgType, Any>? =
when {
typeUrl.endsWith("group.v1.MsgSubmitProposal") -> GroupGovMsgType.PROPOSAL to this
typeUrl.endsWith("group.v1.MsgVote") -> GroupGovMsgType.VOTE to this
typeUrl.endsWith("group.v1.MsgExec") -> GroupGovMsgType.EXEC to this
typeUrl.endsWith("group.v1.MsgWithdrawProposal") -> GroupGovMsgType.WITHDRAW to this
typeUrl.endsWith("group.v1.MsgSubmitProposal") -> Triple(index, GroupGovMsgType.PROPOSAL, this)
typeUrl.endsWith("group.v1.MsgVote") -> Triple(index, GroupGovMsgType.VOTE, this)
typeUrl.endsWith("group.v1.MsgExec") -> Triple(index, GroupGovMsgType.EXEC, this)
typeUrl.endsWith("group.v1.MsgWithdrawProposal") -> Triple(index, GroupGovMsgType.WITHDRAW, this)
else -> null.also { logger().debug("This typeUrl is not a group-governance-based msg: $typeUrl") }
}

Expand Down
Loading

0 comments on commit f9f94c4

Please sign in to comment.