import { Coin } from "../../base/v1beta1/coin";
import { ContinuousFund, Params } from "./types";
import { BinaryReader, BinaryWriter } from "../../../binary";
import { GlobalDecoderRegistry } from "../../../registry";
function createBaseQueryCommunityPoolRequest() {
    return {};
}
/**
 * QueryCommunityPoolRequest is the request type for the Query/CommunityPool RPC
 * method.
 * @name QueryCommunityPoolRequest
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryCommunityPoolRequest
 */
export const QueryCommunityPoolRequest = {
    typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolRequest",
    aminoType: "cosmos-sdk/QueryCommunityPoolRequest",
    is(o) {
        return o && o.$typeUrl === QueryCommunityPoolRequest.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryCommunityPoolRequest.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 = createBaseQueryCommunityPoolRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseQueryCommunityPoolRequest();
        return message;
    },
    fromAmino(_) {
        const message = createBaseQueryCommunityPoolRequest();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return QueryCommunityPoolRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCommunityPoolRequest",
            value: QueryCommunityPoolRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryCommunityPoolRequest.decode(message.value);
    },
    toProto(message) {
        return QueryCommunityPoolRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolRequest",
            value: QueryCommunityPoolRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryCommunityPoolResponse() {
    return {
        pool: []
    };
}
/**
 * QueryCommunityPoolResponse is the response type for the Query/CommunityPool
 * RPC method.
 * @name QueryCommunityPoolResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryCommunityPoolResponse
 */
export const QueryCommunityPoolResponse = {
    typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolResponse",
    aminoType: "cosmos-sdk/QueryCommunityPoolResponse",
    is(o) {
        return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || Coin.is(o.pool[0])));
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryCommunityPoolResponse.typeUrl || Array.isArray(o.pool) && (!o.pool.length || Coin.isAmino(o.pool[0])));
    },
    encode(message, writer = BinaryWriter.create()) {
        for (const v of message.pool) {
            Coin.encode(v, writer.uint32(10).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 = createBaseQueryCommunityPoolResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pool.push(Coin.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryCommunityPoolResponse();
        message.pool = object.pool?.map(e => Coin.fromPartial(e)) || [];
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryCommunityPoolResponse();
        message.pool = object.pool?.map(e => Coin.fromAmino(e)) || [];
        return message;
    },
    toAmino(message) {
        const obj = {};
        if (message.pool) {
            obj.pool = message.pool.map(e => e ? Coin.toAmino(e) : undefined);
        }
        else {
            obj.pool = message.pool;
        }
        return obj;
    },
    fromAminoMsg(object) {
        return QueryCommunityPoolResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCommunityPoolResponse",
            value: QueryCommunityPoolResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryCommunityPoolResponse.decode(message.value);
    },
    toProto(message) {
        return QueryCommunityPoolResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryCommunityPoolResponse",
            value: QueryCommunityPoolResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryCommunityPoolResponse.typeUrl)) {
            return;
        }
        Coin.registerTypeUrl();
    }
};
function createBaseQueryContinuousFundRequest() {
    return {
        recipient: ""
    };
}
/**
 * QueryContinuousFundRequest is the request type for the Query/ContinuousFund
 * RPC method.
 * @name QueryContinuousFundRequest
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryContinuousFundRequest
 */
export const QueryContinuousFundRequest = {
    typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundRequest",
    aminoType: "cosmos-sdk/QueryContinuousFundRequest",
    is(o) {
        return o && (o.$typeUrl === QueryContinuousFundRequest.typeUrl || typeof o.recipient === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryContinuousFundRequest.typeUrl || typeof o.recipient === "string");
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.recipient !== "") {
            writer.uint32(10).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 = createBaseQueryContinuousFundRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.recipient = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryContinuousFundRequest();
        message.recipient = object.recipient ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryContinuousFundRequest();
        if (object.recipient !== undefined && object.recipient !== null) {
            message.recipient = object.recipient;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.recipient = message.recipient === "" ? undefined : message.recipient;
        return obj;
    },
    fromAminoMsg(object) {
        return QueryContinuousFundRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryContinuousFundRequest",
            value: QueryContinuousFundRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryContinuousFundRequest.decode(message.value);
    },
    toProto(message) {
        return QueryContinuousFundRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundRequest",
            value: QueryContinuousFundRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryContinuousFundResponse() {
    return {
        continuousFund: ContinuousFund.fromPartial({})
    };
}
/**
 * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFund
 * RPC method.
 * @name QueryContinuousFundResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryContinuousFundResponse
 */
export const QueryContinuousFundResponse = {
    typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundResponse",
    aminoType: "cosmos-sdk/QueryContinuousFundResponse",
    is(o) {
        return o && (o.$typeUrl === QueryContinuousFundResponse.typeUrl || ContinuousFund.is(o.continuousFund));
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryContinuousFundResponse.typeUrl || ContinuousFund.isAmino(o.continuous_fund));
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.continuousFund !== undefined) {
            ContinuousFund.encode(message.continuousFund, writer.uint32(10).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 = createBaseQueryContinuousFundResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.continuousFund = ContinuousFund.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryContinuousFundResponse();
        message.continuousFund = object.continuousFund !== undefined && object.continuousFund !== null ? ContinuousFund.fromPartial(object.continuousFund) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryContinuousFundResponse();
        if (object.continuous_fund !== undefined && object.continuous_fund !== null) {
            message.continuousFund = ContinuousFund.fromAmino(object.continuous_fund);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.continuous_fund = message.continuousFund ? ContinuousFund.toAmino(message.continuousFund) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return QueryContinuousFundResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryContinuousFundResponse",
            value: QueryContinuousFundResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryContinuousFundResponse.decode(message.value);
    },
    toProto(message) {
        return QueryContinuousFundResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundResponse",
            value: QueryContinuousFundResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContinuousFundResponse.typeUrl)) {
            return;
        }
        ContinuousFund.registerTypeUrl();
    }
};
function createBaseQueryContinuousFundsRequest() {
    return {};
}
/**
 * QueryContinuousFundRequest is the request type for the Query/ContinuousFunds
 * RPC method.
 * @name QueryContinuousFundsRequest
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryContinuousFundsRequest
 */
export const QueryContinuousFundsRequest = {
    typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsRequest",
    aminoType: "cosmos-sdk/QueryContinuousFundsRequest",
    is(o) {
        return o && o.$typeUrl === QueryContinuousFundsRequest.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryContinuousFundsRequest.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 = createBaseQueryContinuousFundsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseQueryContinuousFundsRequest();
        return message;
    },
    fromAmino(_) {
        const message = createBaseQueryContinuousFundsRequest();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return QueryContinuousFundsRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryContinuousFundsRequest",
            value: QueryContinuousFundsRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryContinuousFundsRequest.decode(message.value);
    },
    toProto(message) {
        return QueryContinuousFundsRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsRequest",
            value: QueryContinuousFundsRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryContinuousFundsResponse() {
    return {
        continuousFunds: []
    };
}
/**
 * QueryUnclaimedBudgetResponse is the response type for the Query/ContinuousFunds
 * RPC method.
 * @name QueryContinuousFundsResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryContinuousFundsResponse
 */
export const QueryContinuousFundsResponse = {
    typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsResponse",
    aminoType: "cosmos-sdk/QueryContinuousFundsResponse",
    is(o) {
        return o && (o.$typeUrl === QueryContinuousFundsResponse.typeUrl || Array.isArray(o.continuousFunds) && (!o.continuousFunds.length || ContinuousFund.is(o.continuousFunds[0])));
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryContinuousFundsResponse.typeUrl || Array.isArray(o.continuous_funds) && (!o.continuous_funds.length || ContinuousFund.isAmino(o.continuous_funds[0])));
    },
    encode(message, writer = BinaryWriter.create()) {
        for (const v of message.continuousFunds) {
            ContinuousFund.encode(v, writer.uint32(10).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 = createBaseQueryContinuousFundsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.continuousFunds.push(ContinuousFund.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryContinuousFundsResponse();
        message.continuousFunds = object.continuousFunds?.map(e => ContinuousFund.fromPartial(e)) || [];
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryContinuousFundsResponse();
        message.continuousFunds = object.continuous_funds?.map(e => ContinuousFund.fromAmino(e)) || [];
        return message;
    },
    toAmino(message) {
        const obj = {};
        if (message.continuousFunds) {
            obj.continuous_funds = message.continuousFunds.map(e => e ? ContinuousFund.toAmino(e) : undefined);
        }
        else {
            obj.continuous_funds = message.continuousFunds;
        }
        return obj;
    },
    fromAminoMsg(object) {
        return QueryContinuousFundsResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryContinuousFundsResponse",
            value: QueryContinuousFundsResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryContinuousFundsResponse.decode(message.value);
    },
    toProto(message) {
        return QueryContinuousFundsResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryContinuousFundsResponse",
            value: QueryContinuousFundsResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryContinuousFundsResponse.typeUrl)) {
            return;
        }
        ContinuousFund.registerTypeUrl();
    }
};
function createBaseQueryParamsRequest() {
    return {};
}
/**
 * QueryParamsRequest is the response type for the Query/Params RPC method.
 * @name QueryParamsRequest
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryParamsRequest
 */
export const QueryParamsRequest = {
    typeUrl: "/cosmos.protocolpool.v1.QueryParamsRequest",
    aminoType: "cosmos-sdk/QueryParamsRequest",
    is(o) {
        return o && o.$typeUrl === QueryParamsRequest.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === QueryParamsRequest.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 = createBaseQueryParamsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseQueryParamsRequest();
        return message;
    },
    fromAmino(_) {
        const message = createBaseQueryParamsRequest();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return QueryParamsRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryParamsRequest",
            value: QueryParamsRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryParamsRequest.decode(message.value);
    },
    toProto(message) {
        return QueryParamsRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryParamsRequest",
            value: QueryParamsRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryParamsResponse() {
    return {
        params: Params.fromPartial({})
    };
}
/**
 * QueryParamsResponse is the response type for the Query/Params RPC method.
 * @name QueryParamsResponse
 * @package cosmos.protocolpool.v1
 * @see proto type: cosmos.protocolpool.v1.QueryParamsResponse
 */
export const QueryParamsResponse = {
    typeUrl: "/cosmos.protocolpool.v1.QueryParamsResponse",
    aminoType: "cosmos-sdk/QueryParamsResponse",
    is(o) {
        return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.is(o.params));
    },
    isAmino(o) {
        return o && (o.$typeUrl === QueryParamsResponse.typeUrl || Params.isAmino(o.params));
    },
    encode(message, writer = BinaryWriter.create()) {
        if (message.params !== undefined) {
            Params.encode(message.params, writer.uint32(10).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 = createBaseQueryParamsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.params = Params.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryParamsResponse();
        message.params = object.params !== undefined && object.params !== null ? Params.fromPartial(object.params) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryParamsResponse();
        if (object.params !== undefined && object.params !== null) {
            message.params = Params.fromAmino(object.params);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.params = message.params ? Params.toAmino(message.params) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return QueryParamsResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryParamsResponse",
            value: QueryParamsResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return QueryParamsResponse.decode(message.value);
    },
    toProto(message) {
        return QueryParamsResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.protocolpool.v1.QueryParamsResponse",
            value: QueryParamsResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!GlobalDecoderRegistry.registerExistingTypeUrl(QueryParamsResponse.typeUrl)) {
            return;
        }
        Params.registerTypeUrl();
    }
};
