import { Coin } from "../../base/v1beta1/coin";
import { Timestamp } from "../../../google/protobuf/timestamp";
import { Params } from "./types";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { toTimestamp, fromTimestamp } from "../../../helpers";
import { GlobalDecoderRegistry } from "../../../registry";
import { Decimal } from "@interchainjs/math";
function createBaseMsgFundCommunityPool() {
    return {
        depositor: "",
        amount: []
    };
}
/**
 * MsgFundCommunityPool allows an account to directly
 * fund the community pool.
 * @name MsgFundCommunityPool
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgFundCommunityPool
 */
export const MsgFundCommunityPool = {
    typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool",
    aminoType: "cosmos-sdk/MsgFundCommunityPool",
    is(o) {
        return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])));
    },
    isAmino(o) {
        return o && (o.$typeUrl === MsgFundCommunityPool.typeUrl || typeof o.depositor === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])));
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.depositor !== "") {
            writer.uint32(10).string(message.depositor);
        }
        for (const v of message.amount) {
            Coin.encode(v, writer.uint32(18).fork()).ldelim();
        }
        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 = createBaseMsgFundCommunityPool();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.depositor = reader.string();
                    break;
                case 2:
                    message.amount.push(Coin.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMsgFundCommunityPool();
        message.depositor = object.depositor ?? "";
        message.amount = object.amount?.map(e => Coin.fromPartial(e)) || [];
        return message;
    },
    fromAmino(object) {
        const message = createBaseMsgFundCommunityPool();
        if (object.depositor !== undefined && object.depositor !== null) {
            message.depositor = object.depositor;
        }
        message.amount = object.amount?.map(e => Coin.fromAmino(e)) || [];
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.depositor = message.depositor === "" ? undefined : message.depositor;
        if (message.amount) {
            obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined);
        }
        else {
            obj.amount = message.amount;
        }
        return obj;
    },
    fromAminoMsg(object) {
        return MsgFundCommunityPool.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgFundCommunityPool",
            value: MsgFundCommunityPool.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgFundCommunityPool.decode(message.value);
    },
    toProto(message) {
        return MsgFundCommunityPool.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPool",
            value: MsgFundCommunityPool.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgFundCommunityPool.typeUrl)) {
            return;
        }
        Coin.registerTypeUrl();
    }
};
function createBaseMsgFundCommunityPoolResponse() {
    return {};
}
/**
 * MsgFundCommunityPoolResponse defines the Msg/FundCommunityPool response type.
 * @name MsgFundCommunityPoolResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgFundCommunityPoolResponse
 */
export const MsgFundCommunityPoolResponse = {
    typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPoolResponse",
    aminoType: "cosmos-sdk/MsgFundCommunityPoolResponse",
    is(o) {
        return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === MsgFundCommunityPoolResponse.typeUrl;
    },
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseMsgFundCommunityPoolResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseMsgFundCommunityPoolResponse();
        return message;
    },
    fromAmino(_) {
        const message = createBaseMsgFundCommunityPoolResponse();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return MsgFundCommunityPoolResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgFundCommunityPoolResponse",
            value: MsgFundCommunityPoolResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgFundCommunityPoolResponse.decode(message.value);
    },
    toProto(message) {
        return MsgFundCommunityPoolResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgFundCommunityPoolResponse",
            value: MsgFundCommunityPoolResponse.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseMsgCommunityPoolSpend() {
    return {
        authority: "",
        recipient: "",
        amount: []
    };
}
/**
 * MsgCommunityPoolSpend defines a message for sending tokens from the community
 * pool to another account. This message is typically executed via a governance
 * proposal with the governance module being the executing authority.
 * @name MsgCommunityPoolSpend
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgCommunityPoolSpend
 */
export const MsgCommunityPoolSpend = {
    typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend",
    aminoType: "cosmos-sdk/MsgCommunityPoolSpend",
    is(o) {
        return o && (o.$typeUrl === MsgCommunityPoolSpend.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.is(o.amount[0])));
    },
    isAmino(o) {
        return o && (o.$typeUrl === MsgCommunityPoolSpend.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string" && Array.isArray(o.amount) && (!o.amount.length || Coin.isAmino(o.amount[0])));
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.authority !== "") {
            writer.uint32(10).string(message.authority);
        }
        if (message.recipient !== "") {
            writer.uint32(18).string(message.recipient);
        }
        for (const v of message.amount) {
            Coin.encode(v, writer.uint32(26).fork()).ldelim();
        }
        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 = createBaseMsgCommunityPoolSpend();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.authority = reader.string();
                    break;
                case 2:
                    message.recipient = reader.string();
                    break;
                case 3:
                    message.amount.push(Coin.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMsgCommunityPoolSpend();
        message.authority = object.authority ?? "";
        message.recipient = object.recipient ?? "";
        message.amount = object.amount?.map(e => Coin.fromPartial(e)) || [];
        return message;
    },
    fromAmino(object) {
        const message = createBaseMsgCommunityPoolSpend();
        if (object.authority !== undefined && object.authority !== null) {
            message.authority = object.authority;
        }
        if (object.recipient !== undefined && object.recipient !== null) {
            message.recipient = object.recipient;
        }
        message.amount = object.amount?.map(e => Coin.fromAmino(e)) || [];
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.authority = message.authority === "" ? undefined : message.authority;
        obj.recipient = message.recipient === "" ? undefined : message.recipient;
        if (message.amount) {
            obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined);
        }
        else {
            obj.amount = message.amount;
        }
        return obj;
    },
    fromAminoMsg(object) {
        return MsgCommunityPoolSpend.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgCommunityPoolSpend",
            value: MsgCommunityPoolSpend.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgCommunityPoolSpend.decode(message.value);
    },
    toProto(message) {
        return MsgCommunityPoolSpend.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpend",
            value: MsgCommunityPoolSpend.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgCommunityPoolSpend.typeUrl)) {
            return;
        }
        Coin.registerTypeUrl();
    }
};
function createBaseMsgCommunityPoolSpendResponse() {
    return {};
}
/**
 * MsgCommunityPoolSpendResponse defines the response to executing a
 * MsgCommunityPoolSpend message.
 * @name MsgCommunityPoolSpendResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgCommunityPoolSpendResponse
 */
export const MsgCommunityPoolSpendResponse = {
    typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpendResponse",
    aminoType: "cosmos-sdk/MsgCommunityPoolSpendResponse",
    is(o) {
        return o && o.$typeUrl === MsgCommunityPoolSpendResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === MsgCommunityPoolSpendResponse.typeUrl;
    },
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseMsgCommunityPoolSpendResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseMsgCommunityPoolSpendResponse();
        return message;
    },
    fromAmino(_) {
        const message = createBaseMsgCommunityPoolSpendResponse();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return MsgCommunityPoolSpendResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgCommunityPoolSpendResponse",
            value: MsgCommunityPoolSpendResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgCommunityPoolSpendResponse.decode(message.value);
    },
    toProto(message) {
        return MsgCommunityPoolSpendResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgCommunityPoolSpendResponse",
            value: MsgCommunityPoolSpendResponse.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseMsgCreateContinuousFund() {
    return {
        authority: "",
        recipient: "",
        percentage: "",
        expiry: undefined
    };
}
/**
 * MsgCreateContinuousFund defines a message for adding continuous funds.
 * @name MsgCreateContinuousFund
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgCreateContinuousFund
 */
export const MsgCreateContinuousFund = {
    typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund",
    aminoType: "cosmos-sdk/MsgCreateContinuousFund",
    is(o) {
        return o && (o.$typeUrl === MsgCreateContinuousFund.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string" && typeof o.percentage === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === MsgCreateContinuousFund.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string" && typeof o.percentage === "string");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.authority !== "") {
            writer.uint32(10).string(message.authority);
        }
        if (message.recipient !== "") {
            writer.uint32(18).string(message.recipient);
        }
        if (message.percentage !== "") {
            writer.uint32(26).string(Decimal.fromUserInput(message.percentage, 18).atomics);
        }
        if (message.expiry !== undefined) {
            Timestamp.encode(toTimestamp(message.expiry), writer.uint32(34).fork()).ldelim();
        }
        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 = createBaseMsgCreateContinuousFund();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.authority = reader.string();
                    break;
                case 2:
                    message.recipient = reader.string();
                    break;
                case 3:
                    message.percentage = Decimal.fromAtomics(reader.string(), 18).toString();
                    break;
                case 4:
                    message.expiry = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMsgCreateContinuousFund();
        message.authority = object.authority ?? "";
        message.recipient = object.recipient ?? "";
        message.percentage = object.percentage ?? "";
        message.expiry = object.expiry ?? undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseMsgCreateContinuousFund();
        if (object.authority !== undefined && object.authority !== null) {
            message.authority = object.authority;
        }
        if (object.recipient !== undefined && object.recipient !== null) {
            message.recipient = object.recipient;
        }
        if (object.percentage !== undefined && object.percentage !== null) {
            message.percentage = object.percentage;
        }
        if (object.expiry !== undefined && object.expiry !== null) {
            message.expiry = fromTimestamp(Timestamp.fromAmino(object.expiry));
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.authority = message.authority === "" ? undefined : message.authority;
        obj.recipient = message.recipient === "" ? undefined : message.recipient;
        obj.percentage = message.percentage === "" ? undefined : Decimal.fromUserInput(message.percentage, 18).atomics;
        obj.expiry = message.expiry ? Timestamp.toAmino(toTimestamp(message.expiry)) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return MsgCreateContinuousFund.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgCreateContinuousFund",
            value: MsgCreateContinuousFund.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgCreateContinuousFund.decode(message.value);
    },
    toProto(message) {
        return MsgCreateContinuousFund.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFund",
            value: MsgCreateContinuousFund.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseMsgCreateContinuousFundResponse() {
    return {};
}
/**
 * MsgCreateContinuousFundResponse defines the response to executing a
 * MsgCreateContinuousFund message.
 * @name MsgCreateContinuousFundResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgCreateContinuousFundResponse
 */
export const MsgCreateContinuousFundResponse = {
    typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFundResponse",
    aminoType: "cosmos-sdk/MsgCreateContinuousFundResponse",
    is(o) {
        return o && o.$typeUrl === MsgCreateContinuousFundResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === MsgCreateContinuousFundResponse.typeUrl;
    },
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseMsgCreateContinuousFundResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseMsgCreateContinuousFundResponse();
        return message;
    },
    fromAmino(_) {
        const message = createBaseMsgCreateContinuousFundResponse();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return MsgCreateContinuousFundResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgCreateContinuousFundResponse",
            value: MsgCreateContinuousFundResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgCreateContinuousFundResponse.decode(message.value);
    },
    toProto(message) {
        return MsgCreateContinuousFundResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgCreateContinuousFundResponse",
            value: MsgCreateContinuousFundResponse.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseMsgCancelContinuousFund() {
    return {
        authority: "",
        recipient: ""
    };
}
/**
 * MsgCancelContinuousFund defines a message to cancel continuous funds for a specific recipient.
 * @name MsgCancelContinuousFund
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgCancelContinuousFund
 */
export const MsgCancelContinuousFund = {
    typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund",
    aminoType: "cosmos-sdk/MsgCancelContinuousFund",
    is(o) {
        return o && (o.$typeUrl === MsgCancelContinuousFund.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === MsgCancelContinuousFund.typeUrl || typeof o.authority === "string" && typeof o.recipient === "string");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.authority !== "") {
            writer.uint32(10).string(message.authority);
        }
        if (message.recipient !== "") {
            writer.uint32(18).string(message.recipient);
        }
        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 = createBaseMsgCancelContinuousFund();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.authority = reader.string();
                    break;
                case 2:
                    message.recipient = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMsgCancelContinuousFund();
        message.authority = object.authority ?? "";
        message.recipient = object.recipient ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseMsgCancelContinuousFund();
        if (object.authority !== undefined && object.authority !== null) {
            message.authority = object.authority;
        }
        if (object.recipient !== undefined && object.recipient !== null) {
            message.recipient = object.recipient;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.authority = message.authority === "" ? undefined : message.authority;
        obj.recipient = message.recipient === "" ? undefined : message.recipient;
        return obj;
    },
    fromAminoMsg(object) {
        return MsgCancelContinuousFund.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgCancelContinuousFund",
            value: MsgCancelContinuousFund.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgCancelContinuousFund.decode(message.value);
    },
    toProto(message) {
        return MsgCancelContinuousFund.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFund",
            value: MsgCancelContinuousFund.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseMsgCancelContinuousFundResponse() {
    return {
        canceledTime: new Date(),
        canceledHeight: BigInt(0),
        recipient: ""
    };
}
/**
 * MsgCancelContinuousFundResponse defines the response to executing a
 * MsgCancelContinuousFund message.
 * @name MsgCancelContinuousFundResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgCancelContinuousFundResponse
 */
export const MsgCancelContinuousFundResponse = {
    typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFundResponse",
    aminoType: "cosmos-sdk/MsgCancelContinuousFundResponse",
    is(o) {
        return o && (o.$typeUrl === MsgCancelContinuousFundResponse.typeUrl || Timestamp.is(o.canceledTime) && typeof o.canceledHeight === "bigint" && typeof o.recipient === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === MsgCancelContinuousFundResponse.typeUrl || Timestamp.isAmino(o.canceled_time) && typeof o.canceled_height === "bigint" && typeof o.recipient === "string");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.canceledTime !== undefined) {
            Timestamp.encode(toTimestamp(message.canceledTime), writer.uint32(10).fork()).ldelim();
        }
        if (message.canceledHeight !== BigInt(0)) {
            writer.uint32(16).uint64(message.canceledHeight);
        }
        if (message.recipient !== "") {
            writer.uint32(26).string(message.recipient);
        }
        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 = createBaseMsgCancelContinuousFundResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.canceledTime = fromTimestamp(Timestamp.decode(reader, reader.uint32()));
                    break;
                case 2:
                    message.canceledHeight = reader.uint64();
                    break;
                case 3:
                    message.recipient = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMsgCancelContinuousFundResponse();
        message.canceledTime = object.canceledTime ?? undefined;
        message.canceledHeight = object.canceledHeight !== undefined && object.canceledHeight !== null ? BigInt(object.canceledHeight.toString()) : BigInt(0);
        message.recipient = object.recipient ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseMsgCancelContinuousFundResponse();
        if (object.canceled_time !== undefined && object.canceled_time !== null) {
            message.canceledTime = fromTimestamp(Timestamp.fromAmino(object.canceled_time));
        }
        if (object.canceled_height !== undefined && object.canceled_height !== null) {
            message.canceledHeight = BigInt(object.canceled_height);
        }
        if (object.recipient !== undefined && object.recipient !== null) {
            message.recipient = object.recipient;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.canceled_time = message.canceledTime ? Timestamp.toAmino(toTimestamp(message.canceledTime)) : undefined;
        obj.canceled_height = message.canceledHeight !== BigInt(0) ? message.canceledHeight?.toString() : undefined;
        obj.recipient = message.recipient === "" ? undefined : message.recipient;
        return obj;
    },
    fromAminoMsg(object) {
        return MsgCancelContinuousFundResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgCancelContinuousFundResponse",
            value: MsgCancelContinuousFundResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgCancelContinuousFundResponse.decode(message.value);
    },
    toProto(message) {
        return MsgCancelContinuousFundResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgCancelContinuousFundResponse",
            value: MsgCancelContinuousFundResponse.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseMsgUpdateParams() {
    return {
        authority: "",
        params: Params.fromPartial({})
    };
}
/**
 * MsgUpdateParams is the Msg/UpdateParams request type.
 * @name MsgUpdateParams
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgUpdateParams
 */
export const MsgUpdateParams = {
    typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams",
    aminoType: "cosmos-sdk/MsgUpdateParams",
    is(o) {
        return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.is(o.params));
    },
    isAmino(o) {
        return o && (o.$typeUrl === MsgUpdateParams.typeUrl || typeof o.authority === "string" && Params.isAmino(o.params));
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.authority !== "") {
            writer.uint32(10).string(message.authority);
        }
        if (message.params !== undefined) {
            Params.encode(message.params, writer.uint32(18).fork()).ldelim();
        }
        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 = createBaseMsgUpdateParams();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.authority = reader.string();
                    break;
                case 2:
                    message.params = Params.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseMsgUpdateParams();
        message.authority = object.authority ?? "";
        message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseMsgUpdateParams();
        if (object.authority !== undefined && object.authority !== null) {
            message.authority = object.authority;
        }
        if (object.params !== undefined && object.params !== null) {
            message.params = Params.fromAmino(object.params);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.authority = message.authority === "" ? undefined : message.authority;
        obj.params = message.params ? Params.toAmino(message.params) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return MsgUpdateParams.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgUpdateParams",
            value: MsgUpdateParams.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgUpdateParams.decode(message.value);
    },
    toProto(message) {
        return MsgUpdateParams.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParams",
            value: MsgUpdateParams.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(MsgUpdateParams.typeUrl)) {
            return;
        }
        Params.registerTypeUrl();
    }
};
function createBaseMsgUpdateParamsResponse() {
    return {};
}
/**
 * MsgUpdateParamsResponse defines the response structure for executing a
 * MsgUpdateParams message.
 * @name MsgUpdateParamsResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.MsgUpdateParamsResponse
 */
export const MsgUpdateParamsResponse = {
    typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParamsResponse",
    aminoType: "cosmos-sdk/MsgUpdateParamsResponse",
    is(o) {
        return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === MsgUpdateParamsResponse.typeUrl;
    },
    encode(_, writer = BinaryWriter.create()) {
        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 = createBaseMsgUpdateParamsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseMsgUpdateParamsResponse();
        return message;
    },
    fromAmino(_) {
        const message = createBaseMsgUpdateParamsResponse();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return MsgUpdateParamsResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/MsgUpdateParamsResponse",
            value: MsgUpdateParamsResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return MsgUpdateParamsResponse.decode(message.value);
    },
    toProto(message) {
        return MsgUpdateParamsResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.MsgUpdateParamsResponse",
            value: MsgUpdateParamsResponse.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
