import { Rpc } from "../../../helpers"; import * as _m0 from "protobufjs/minimal"; import { MsgSubmitProposal, MsgSubmitProposalResponse, MsgVote, MsgVoteResponse, MsgVoteWeighted, MsgVoteWeightedResponse, MsgDeposit, MsgDepositResponse } from "./tx"; /** Msg defines the gov Msg service. */ export interface Msg { /** SubmitProposal defines a method to create new proposal given a content. */ submitProposal(request: MsgSubmitProposal): Promise; /** Vote defines a method to add a vote on a specific proposal. */ vote(request: MsgVote): Promise; /** * VoteWeighted defines a method to add a weighted vote on a specific proposal. * * Since: cosmos-sdk 0.43 */ voteWeighted(request: MsgVoteWeighted): Promise; /** Deposit defines a method to add deposit on a specific proposal. */ deposit(request: MsgDeposit): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.submitProposal = this.submitProposal.bind(this); this.vote = this.vote.bind(this); this.voteWeighted = this.voteWeighted.bind(this); this.deposit = this.deposit.bind(this); } submitProposal(request: MsgSubmitProposal): Promise { const data = MsgSubmitProposal.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "SubmitProposal", data); return promise.then(data => MsgSubmitProposalResponse.decode(new _m0.Reader(data))); } vote(request: MsgVote): Promise { const data = MsgVote.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Vote", data); return promise.then(data => MsgVoteResponse.decode(new _m0.Reader(data))); } voteWeighted(request: MsgVoteWeighted): Promise { const data = MsgVoteWeighted.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "VoteWeighted", data); return promise.then(data => MsgVoteWeightedResponse.decode(new _m0.Reader(data))); } deposit(request: MsgDeposit): Promise { const data = MsgDeposit.encode(request).finish(); const promise = this.rpc.request("cosmos.gov.v1beta1.Msg", "Deposit", data); return promise.then(data => MsgDepositResponse.decode(new _m0.Reader(data))); } }