UNPKG

interchainjs

Version:

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

183 lines (182 loc) 6.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MsgIncreaseCountResponse = exports.MsgIncreaseCounter = void 0; const binary_1 = require("../../../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 */ exports.MsgIncreaseCounter = { typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", aminoType: "cosmos-sdk/increase_counter", is(o) { return o && (o.$typeUrl === exports.MsgIncreaseCounter.typeUrl || typeof o.signer === "string" && typeof o.count === "bigint"); }, isAmino(o) { return o && (o.$typeUrl === exports.MsgIncreaseCounter.typeUrl || typeof o.signer === "string" && typeof o.count === "bigint"); }, encode(message, writer = binary_1.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 binary_1.BinaryReader ? input : new binary_1.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 exports.MsgIncreaseCounter.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/increase_counter", value: exports.MsgIncreaseCounter.toAmino(message) }; }, fromProtoMsg(message) { return exports.MsgIncreaseCounter.decode(message.value); }, toProto(message) { return exports.MsgIncreaseCounter.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/cosmos.counter.v1.MsgIncreaseCounter", value: exports.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 */ exports.MsgIncreaseCountResponse = { typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse", aminoType: "cosmos-sdk/MsgIncreaseCountResponse", is(o) { return o && (o.$typeUrl === exports.MsgIncreaseCountResponse.typeUrl || typeof o.newCount === "bigint"); }, isAmino(o) { return o && (o.$typeUrl === exports.MsgIncreaseCountResponse.typeUrl || typeof o.new_count === "bigint"); }, encode(message, writer = binary_1.BinaryWriter.create()) { if (message.newCount !== BigInt(0)) { writer.uint32(8).int64(message.newCount); } return writer; }, decode(input, length) { const reader = input instanceof binary_1.BinaryReader ? input : new binary_1.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 exports.MsgIncreaseCountResponse.fromAmino(object.value); }, toAminoMsg(message) { return { type: "cosmos-sdk/MsgIncreaseCountResponse", value: exports.MsgIncreaseCountResponse.toAmino(message) }; }, fromProtoMsg(message) { return exports.MsgIncreaseCountResponse.decode(message.value); }, toProto(message) { return exports.MsgIncreaseCountResponse.encode(message).finish(); }, toProtoMsg(message) { return { typeUrl: "/cosmos.counter.v1.MsgIncreaseCountResponse", value: exports.MsgIncreaseCountResponse.encode(message).finish() }; }, registerTypeUrl() { } };