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

remove group module message #58

Merged
merged 6 commits into from
Jan 2, 2025
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
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@
path = proto/chain
url = https://github.com/bandprotocol/chain.git
branch = master
[submodule "proto/ics23"]
path = proto/ics23
url = https://github.com/cosmos/ics23.git
[submodule "proto/gogoproto"]
path = proto/gogoproto
url = https://github.com/cosmos/gogoproto.git
[submodule "proto/cosmos-sdk"]
path = proto/cosmos-sdk
url = https://github.com/cosmos/cosmos-sdk.git
[submodule "proto/ibc-go"]
path = proto/ibc-go
url = https://github.com/cosmos/ibc-go.git
2 changes: 1 addition & 1 deletion proto/cosmos-sdk
Submodule cosmos-sdk updated 3824 files
1 change: 1 addition & 0 deletions proto/gogoproto
Submodule gogoproto added at 28b2fa
2 changes: 1 addition & 1 deletion proto/ibc-go
Submodule ibc-go updated 1860 files
64 changes: 0 additions & 64 deletions src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ import {
VoteOptionMap,
} from '../codegen/cosmos/gov/v1beta1/gov_pb'

import {
MsgVote as MsgVoteGroupProto,
ExecMap as GroupExecMap,
} from '../codegen/cosmos/group/v1/tx_pb'

import {
VoteOption as VoteOptionGroup,
VoteOptionMap as VoteOptionGroupMap,
} from '../codegen/cosmos/group/v1/types_pb'

import {
MsgBeginRedelegate as MsgBeginRedelegateProto,
MsgDelegate as MsgDelegateProto,
Expand Down Expand Up @@ -815,60 +805,6 @@ export class MsgDeposit extends MsgDepositProto implements BaseMsg {
}
}

export class MsgVoteGroup extends MsgVoteGroupProto implements BaseMsg {
constructor(
proposalId: number,
voter: string,
option: VoteOptionGroupMap[keyof VoteOptionGroupMap],
metadata: string,
exec: GroupExecMap[keyof GroupExecMap],
) {
super()
this.setProposalId(proposalId)
this.setVoter(voter)
this.setOption(option)
this.setMetadata(metadata)
this.setExec(exec)
}

toAny(): Any {
this.validate()

const anyMsg = new Any()
const name = 'cosmos.group.v1.MsgVote'
anyMsg.pack(this.serializeBinary(), name, '/')
return anyMsg
}

toJSON(): object {
return {
type: 'cosmos-sdk/group/MsgVote',
value: {
proposal_id: this.getProposalId().toString(),
voter: this.getVoter(),
option: this.getOption(),
metadata: this.getMetadata(),
exec: this.getExec(),
},
}
}

validate() {
if (this.getProposalId() <= 0) {
throw new NegativeIntegerError('proposalId cannot be less than zero')
}
if (this.getVoter() === '') {
throw new ValueError('Address should not be an empty string')
}
if (this.getOption() === VoteOptionGroup.VOTE_OPTION_UNSPECIFIED) {
throw new ValueError('VoteOption should not be VOTE_OPTION_UNSPECIFIED')
}
if (this.getMetadata() === '') {
throw new ValueError('metadata should not be an empty string')
}
}
}

export class MsgVoteSignals extends MsgVoteSignalProto implements BaseMsg {
constructor(voter: string, signals: Signal[]) {
super()
Expand Down
Loading