import { Rpc } from "../../../helpers"; import { BinaryReader } from "../../../binary"; import { MsgSend, MsgSendResponse, MsgMultiSend, MsgMultiSendResponse } from "./tx"; /** Msg defines the bank Msg service. */ export interface Msg { /** Send defines a method for sending coins from one account to another account. */ send(request: MsgSend): Promise; /** MultiSend defines a method for sending coins from some accounts to other accounts. */ multiSend(request: MsgMultiSend): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.send = this.send.bind(this); this.multiSend = this.multiSend.bind(this); } send(request: MsgSend): Promise { const data = MsgSend.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data); return promise.then(data => MsgSendResponse.decode(new BinaryReader(data))); } multiSend(request: MsgMultiSend): Promise { const data = MsgMultiSend.encode(request).finish(); const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data); return promise.then(data => MsgMultiSendResponse.decode(new BinaryReader(data))); } }