"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryCodeResponse = exports.QueryCodeRequest = exports.QueryChecksumsResponse = exports.QueryChecksumsRequest = void 0;
const pagination_1 = require("../../../../cosmos/base/query/v1beta1/pagination");
const binary_1 = require("../../../../binary");
const registry_1 = require("../../../../registry");
const helpers_1 = require("../../../../helpers");
function createBaseQueryChecksumsRequest() {
    return {
        pagination: undefined
    };
}
/**
 * QueryChecksumsRequest is the request type for the Query/Checksums RPC method.
 * @name QueryChecksumsRequest
 * @package ibc.lightclients.wasm.v1
 * @see proto type: ibc.lightclients.wasm.v1.QueryChecksumsRequest
 */
exports.QueryChecksumsRequest = {
    typeUrl: "/ibc.lightclients.wasm.v1.QueryChecksumsRequest",
    aminoType: "cosmos-sdk/QueryChecksumsRequest",
    is(o) {
        return o && o.$typeUrl === exports.QueryChecksumsRequest.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryChecksumsRequest.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.pagination !== undefined) {
            pagination_1.PageRequest.encode(message.pagination, writer.uint32(10).fork()).ldelim();
        }
        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 = createBaseQueryChecksumsRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.pagination = pagination_1.PageRequest.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryChecksumsRequest();
        message.pagination = object.pagination !== undefined && object.pagination !== null ? pagination_1.PageRequest.fromPartial(object.pagination) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryChecksumsRequest();
        if (object.pagination !== undefined && object.pagination !== null) {
            message.pagination = pagination_1.PageRequest.fromAmino(object.pagination);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.pagination = message.pagination ? pagination_1.PageRequest.toAmino(message.pagination) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryChecksumsRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryChecksumsRequest",
            value: exports.QueryChecksumsRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryChecksumsRequest.decode(message.value);
    },
    toProto(message) {
        return exports.QueryChecksumsRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.lightclients.wasm.v1.QueryChecksumsRequest",
            value: exports.QueryChecksumsRequest.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.QueryChecksumsRequest.typeUrl)) {
            return;
        }
        pagination_1.PageRequest.registerTypeUrl();
    }
};
function createBaseQueryChecksumsResponse() {
    return {
        checksums: [],
        pagination: undefined
    };
}
/**
 * QueryChecksumsResponse is the response type for the Query/Checksums RPC method.
 * @name QueryChecksumsResponse
 * @package ibc.lightclients.wasm.v1
 * @see proto type: ibc.lightclients.wasm.v1.QueryChecksumsResponse
 */
exports.QueryChecksumsResponse = {
    typeUrl: "/ibc.lightclients.wasm.v1.QueryChecksumsResponse",
    aminoType: "cosmos-sdk/QueryChecksumsResponse",
    is(o) {
        return o && (o.$typeUrl === exports.QueryChecksumsResponse.typeUrl || Array.isArray(o.checksums) && (!o.checksums.length || typeof o.checksums[0] === "string"));
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryChecksumsResponse.typeUrl || Array.isArray(o.checksums) && (!o.checksums.length || typeof o.checksums[0] === "string"));
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        for (const v of message.checksums) {
            writer.uint32(10).string(v);
        }
        if (message.pagination !== undefined) {
            pagination_1.PageResponse.encode(message.pagination, writer.uint32(18).fork()).ldelim();
        }
        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 = createBaseQueryChecksumsResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.checksums.push(reader.string());
                    break;
                case 2:
                    message.pagination = pagination_1.PageResponse.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryChecksumsResponse();
        message.checksums = object.checksums?.map(e => e) || [];
        message.pagination = object.pagination !== undefined && object.pagination !== null ? pagination_1.PageResponse.fromPartial(object.pagination) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryChecksumsResponse();
        message.checksums = object.checksums?.map(e => e) || [];
        if (object.pagination !== undefined && object.pagination !== null) {
            message.pagination = pagination_1.PageResponse.fromAmino(object.pagination);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        if (message.checksums) {
            obj.checksums = message.checksums.map(e => e);
        }
        else {
            obj.checksums = message.checksums;
        }
        obj.pagination = message.pagination ? pagination_1.PageResponse.toAmino(message.pagination) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryChecksumsResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryChecksumsResponse",
            value: exports.QueryChecksumsResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryChecksumsResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryChecksumsResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.lightclients.wasm.v1.QueryChecksumsResponse",
            value: exports.QueryChecksumsResponse.encode(message).finish()
        };
    },
    registerTypeUrl() {
        if (!registry_1.GlobalDecoderRegistry.registerExistingTypeUrl(exports.QueryChecksumsResponse.typeUrl)) {
            return;
        }
        pagination_1.PageResponse.registerTypeUrl();
    }
};
function createBaseQueryCodeRequest() {
    return {
        checksum: ""
    };
}
/**
 * QueryCodeRequest is the request type for the Query/Code RPC method.
 * @name QueryCodeRequest
 * @package ibc.lightclients.wasm.v1
 * @see proto type: ibc.lightclients.wasm.v1.QueryCodeRequest
 */
exports.QueryCodeRequest = {
    typeUrl: "/ibc.lightclients.wasm.v1.QueryCodeRequest",
    aminoType: "cosmos-sdk/QueryCodeRequest",
    is(o) {
        return o && (o.$typeUrl === exports.QueryCodeRequest.typeUrl || typeof o.checksum === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryCodeRequest.typeUrl || typeof o.checksum === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.checksum !== "") {
            writer.uint32(10).string(message.checksum);
        }
        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 = createBaseQueryCodeRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.checksum = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryCodeRequest();
        message.checksum = object.checksum ?? "";
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryCodeRequest();
        if (object.checksum !== undefined && object.checksum !== null) {
            message.checksum = object.checksum;
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.checksum = message.checksum === "" ? undefined : message.checksum;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryCodeRequest.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCodeRequest",
            value: exports.QueryCodeRequest.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryCodeRequest.decode(message.value);
    },
    toProto(message) {
        return exports.QueryCodeRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.lightclients.wasm.v1.QueryCodeRequest",
            value: exports.QueryCodeRequest.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
function createBaseQueryCodeResponse() {
    return {
        data: new Uint8Array()
    };
}
/**
 * QueryCodeResponse is the response type for the Query/Code RPC method.
 * @name QueryCodeResponse
 * @package ibc.lightclients.wasm.v1
 * @see proto type: ibc.lightclients.wasm.v1.QueryCodeResponse
 */
exports.QueryCodeResponse = {
    typeUrl: "/ibc.lightclients.wasm.v1.QueryCodeResponse",
    aminoType: "cosmos-sdk/QueryCodeResponse",
    is(o) {
        return o && (o.$typeUrl === exports.QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string");
    },
    isAmino(o) {
        return o && (o.$typeUrl === exports.QueryCodeResponse.typeUrl || o.data instanceof Uint8Array || typeof o.data === "string");
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.data.length !== 0) {
            writer.uint32(10).bytes(message.data);
        }
        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 = createBaseQueryCodeResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.data = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryCodeResponse();
        message.data = object.data ?? new Uint8Array();
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryCodeResponse();
        if (object.data !== undefined && object.data !== null) {
            message.data = (0, helpers_1.bytesFromBase64)(object.data);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.data = message.data ? (0, helpers_1.base64FromBytes)(message.data) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryCodeResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryCodeResponse",
            value: exports.QueryCodeResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryCodeResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryCodeResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/ibc.lightclients.wasm.v1.QueryCodeResponse",
            value: exports.QueryCodeResponse.encode(message).finish()
        };
    },
    registerTypeUrl() { }
};
