/* eslint-disable */ import Long from 'long'; import _m0 from 'protobufjs/minimal'; import { Coin } from '../../../cosmos/base/v1beta1/coin'; export const protobufPackage = 'cosmos.vesting.v1beta1'; /** * MsgCreateVestingAccount defines a message that enables creating a vesting * account. */ export interface MsgCreateVestingAccount { fromAddress: string; toAddress: string; amount: Coin[]; endTime: Long; delayed: boolean; } /** MsgCreateVestingAccountResponse defines the Msg/CreateVestingAccount response type. */ export interface MsgCreateVestingAccountResponse {} const baseMsgCreateVestingAccount: object = { fromAddress: '', toAddress: '', endTime: Long.ZERO, delayed: false }; export const MsgCreateVestingAccount = { encode(message: MsgCreateVestingAccount, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { if (message.fromAddress !== '') { writer.uint32(10).string(message.fromAddress); } if (message.toAddress !== '') { writer.uint32(18).string(message.toAddress); } for (const v of message.amount) { Coin.encode(v!, writer.uint32(26).fork()).ldelim(); } if (!message.endTime.isZero()) { writer.uint32(32).int64(message.endTime); } if (message.delayed === true) { writer.uint32(40).bool(message.delayed); } return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccount { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMsgCreateVestingAccount } as MsgCreateVestingAccount; message.amount = []; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.fromAddress = reader.string(); break; case 2: message.toAddress = reader.string(); break; case 3: message.amount.push(Coin.decode(reader, reader.uint32())); break; case 4: message.endTime = reader.int64() as Long; break; case 5: message.delayed = reader.bool(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(object: any): MsgCreateVestingAccount { const message = { ...baseMsgCreateVestingAccount } as MsgCreateVestingAccount; message.amount = []; if (object.fromAddress !== undefined && object.fromAddress !== null) { message.fromAddress = String(object.fromAddress); } else { message.fromAddress = ''; } if (object.toAddress !== undefined && object.toAddress !== null) { message.toAddress = String(object.toAddress); } else { message.toAddress = ''; } if (object.amount !== undefined && object.amount !== null) { for (const e of object.amount) { message.amount.push(Coin.fromJSON(e)); } } if (object.endTime !== undefined && object.endTime !== null) { message.endTime = Long.fromString(object.endTime); } else { message.endTime = Long.ZERO; } if (object.delayed !== undefined && object.delayed !== null) { message.delayed = Boolean(object.delayed); } else { message.delayed = false; } return message; }, toJSON(message: MsgCreateVestingAccount): unknown { const obj: any = {}; message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress); message.toAddress !== undefined && (obj.toAddress = message.toAddress); if (message.amount) { obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined)); } else { obj.amount = []; } message.endTime !== undefined && (obj.endTime = (message.endTime || Long.ZERO).toString()); message.delayed !== undefined && (obj.delayed = message.delayed); return obj; }, fromPartial(object: DeepPartial): MsgCreateVestingAccount { const message = { ...baseMsgCreateVestingAccount } as MsgCreateVestingAccount; message.amount = []; if (object.fromAddress !== undefined && object.fromAddress !== null) { message.fromAddress = object.fromAddress; } else { message.fromAddress = ''; } if (object.toAddress !== undefined && object.toAddress !== null) { message.toAddress = object.toAddress; } else { message.toAddress = ''; } if (object.amount !== undefined && object.amount !== null) { for (const e of object.amount) { message.amount.push(Coin.fromPartial(e)); } } if (object.endTime !== undefined && object.endTime !== null) { message.endTime = object.endTime as Long; } else { message.endTime = Long.ZERO; } if (object.delayed !== undefined && object.delayed !== null) { message.delayed = object.delayed; } else { message.delayed = false; } return message; }, }; const baseMsgCreateVestingAccountResponse: object = {}; export const MsgCreateVestingAccountResponse = { encode(_: MsgCreateVestingAccountResponse, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { return writer; }, decode(input: _m0.Reader | Uint8Array, length?: number): MsgCreateVestingAccountResponse { const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = { ...baseMsgCreateVestingAccountResponse } as MsgCreateVestingAccountResponse; while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { default: reader.skipType(tag & 7); break; } } return message; }, fromJSON(_: any): MsgCreateVestingAccountResponse { const message = { ...baseMsgCreateVestingAccountResponse } as MsgCreateVestingAccountResponse; return message; }, toJSON(_: MsgCreateVestingAccountResponse): unknown { const obj: any = {}; return obj; }, fromPartial(_: DeepPartial): MsgCreateVestingAccountResponse { const message = { ...baseMsgCreateVestingAccountResponse } as MsgCreateVestingAccountResponse; return message; }, }; /** Msg defines the bank Msg service. */ export interface Msg { /** * CreateVestingAccount defines a method that enables creating a vesting * account. */ CreateVestingAccount(request: MsgCreateVestingAccount): Promise; } export class MsgClientImpl implements Msg { private readonly rpc: Rpc; constructor(rpc: Rpc) { this.rpc = rpc; this.CreateVestingAccount = this.CreateVestingAccount.bind(this); } CreateVestingAccount(request: MsgCreateVestingAccount): Promise { const data = MsgCreateVestingAccount.encode(request).finish(); const promise = this.rpc.request('cosmos.vesting.v1beta1.Msg', 'CreateVestingAccount', data); return promise.then((data) => MsgCreateVestingAccountResponse.decode(new _m0.Reader(data))); } } interface Rpc { request(service: string, method: string, data: Uint8Array): Promise; } type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined | Long; export type DeepPartial = T extends Builtin ? T : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray> : T extends {} ? { [K in keyof T]?: DeepPartial } : Partial; if (_m0.util.Long !== Long) { _m0.util.Long = Long as any; _m0.configure(); }