UNPKG

interchainjs

Version:

InterchainJS is a JavaScript library for interacting with Cosmos SDK based blockchains.

180 lines (179 loc) 6.23 kB
import { BinaryReader, BinaryWriter } from "../../../binary"; function createBaseMsgIncreaseCounter() { return { signer: "", count: BigInt(0) }; } /** * MsgIncreaseCounter defines a count Msg service counter. * @name MsgIncreaseCounter * @package cosmos.counter.v1 * @see proto type: cosmos.counter.v1.MsgIncreaseCounter */ export const MsgIncreaseCounter = { typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", aminoType: "cosmos-sdk/increase_counter", is(o) { return o && (o.$typeUrl === MsgIncreaseCounter.typeUrl || typeof o.signer === "string" && typeof o.count === "bigint"); }, isAmino(o) { return o && (o.$typeUrl === MsgIncreaseCounter.typeUrl || typeof o.signer === "string" && typeof o.count === "bigint"); }, encode(message, writer = BinaryWriter.create()) { if (message.signer !== "") { writer.uint32(10).string(message.signer); } if (message.count !== BigInt(0)) { writer.uint32(16).int64(message.count); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgIncreaseCounter(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.signer = reader.string(); break; case 2: message.count = reader.int64(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgIncreaseCounter(); message.signer = object.signer ?? ""; message.count = object.count !== undefined && object.count !== null ? BigInt(object.count.toString()) : BigInt(0); return message; }, fromAmino(object) { const message = createBaseMsgIncreaseCounter(); if (object.signer !== undefined && object.signer !== null) { message.signer = object.signer; } if (object.count !== undefined && object.count !== null) { message.count = BigInt(object.count); } return message; }, toAmino(message) { const obj = {}; obj.signer = message.signer === "" ? undefined : message.signer; obj.count = message.count !== BigInt(0) ? message.count?.toString() : undefined; return obj; }, fromAminoMsg(object) { return MsgIncreaseCounter.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/increase_counter", value: MsgIncreaseCounter.toAmino(message) }; }, fromProtoMsg(message) { return MsgIncreaseCounter.decode(message.value); }, toProto(message) { return MsgIncreaseCounter.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", value: MsgIncreaseCounter.encode(message).finish() }; }, registerTypeUrl() { } }; function createBaseMsgIncreaseCountResponse() { return { newCount: BigInt(0) }; } /** * MsgIncreaseCountResponse is the Msg/Counter response type. * @name MsgIncreaseCountResponse * @package cosmos.counter.v1 * @see proto type: cosmos.counter.v1.MsgIncreaseCountResponse */ export const MsgIncreaseCountResponse = { typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse", aminoType: "cosmos-sdk/MsgIncreaseCountResponse", is(o) { return o && (o.$typeUrl === MsgIncreaseCountResponse.typeUrl || typeof o.newCount === "bigint"); }, isAmino(o) { return o && (o.$typeUrl === MsgIncreaseCountResponse.typeUrl || typeof o.new_count === "bigint"); }, encode(message, writer = BinaryWriter.create()) { if (message.newCount !== BigInt(0)) { writer.uint32(8).int64(message.newCount); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseMsgIncreaseCountResponse(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: message.newCount = reader.int64(); break; default: reader.skipType(tag & 7); break; } } return message; }, fromPartial(object) { const message = createBaseMsgIncreaseCountResponse(); message.newCount = object.newCount !== undefined && object.newCount !== null ? BigInt(object.newCount.toString()) : BigInt(0); return message; }, fromAmino(object) { const message = createBaseMsgIncreaseCountResponse(); if (object.new_count !== undefined && object.new_count !== null) { message.newCount = BigInt(object.new_count); } return message; }, toAmino(message) { const obj = {}; obj.new_count = message.newCount !== BigInt(0) ? message.newCount?.toString() : undefined; return obj; }, fromAminoMsg(object) { return MsgIncreaseCountResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgIncreaseCountResponse", value: MsgIncreaseCountResponse.toAmino(message) }; }, fromProtoMsg(message) { return MsgIncreaseCountResponse.decode(message.value); }, toProto(message) { return MsgIncreaseCountResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse", value: MsgIncreaseCountResponse.encode(message).finish() }; }, registerTypeUrl() { } };