Skip to content

Commit

Permalink
remove group module message
Browse files Browse the repository at this point in the history
  • Loading branch information
babybunn committed Dec 3, 2024
1 parent 5beaab0 commit 6875a3e
Showing 1 changed file with 0 additions and 64 deletions.
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

0 comments on commit 6875a3e

Please sign in to comment.