"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.QueryLegacyAccountResponse = exports.QueryLegacyAccount = void 0;
const any_1 = require("../../../google/protobuf/any");
const auth_1 = require("./auth");
const binary_1 = require("../../../binary");
const registry_1 = require("../../../registry");
function createBaseQueryLegacyAccount() {
    return {};
}
exports.QueryLegacyAccount = {
    typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccount",
    aminoType: "cosmos-sdk/QueryLegacyAccount",
    is(o) {
        return o && o.$typeUrl === exports.QueryLegacyAccount.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryLegacyAccount.typeUrl;
    },
    encode(_, writer = binary_1.BinaryWriter.create()) {
        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 = createBaseQueryLegacyAccount();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(_) {
        const message = createBaseQueryLegacyAccount();
        return message;
    },
    fromAmino(_) {
        const message = createBaseQueryLegacyAccount();
        return message;
    },
    toAmino(_) {
        const obj = {};
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryLegacyAccount.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryLegacyAccount",
            value: exports.QueryLegacyAccount.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryLegacyAccount.decode(message.value);
    },
    toProto(message) {
        return exports.QueryLegacyAccount.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccount",
            value: exports.QueryLegacyAccount.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.QueryLegacyAccount.typeUrl, exports.QueryLegacyAccount);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.QueryLegacyAccount.aminoType, exports.QueryLegacyAccount.typeUrl);
function createBaseQueryLegacyAccountResponse() {
    return {
        account: undefined,
        base: undefined
    };
}
exports.QueryLegacyAccountResponse = {
    typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccountResponse",
    aminoType: "cosmos-sdk/QueryLegacyAccountResponse",
    is(o) {
        return o && o.$typeUrl === exports.QueryLegacyAccountResponse.typeUrl;
    },
    isAmino(o) {
        return o && o.$typeUrl === exports.QueryLegacyAccountResponse.typeUrl;
    },
    encode(message, writer = binary_1.BinaryWriter.create()) {
        if (message.account !== undefined) {
            any_1.Any.encode(message.account, writer.uint32(10).fork()).ldelim();
        }
        if (message.base !== undefined) {
            auth_1.BaseAccount.encode(message.base, 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 = createBaseQueryLegacyAccountResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.account = any_1.Any.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.base = auth_1.BaseAccount.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        const message = createBaseQueryLegacyAccountResponse();
        message.account = object.account !== undefined && object.account !== null ? any_1.Any.fromPartial(object.account) : undefined;
        message.base = object.base !== undefined && object.base !== null ? auth_1.BaseAccount.fromPartial(object.base) : undefined;
        return message;
    },
    fromAmino(object) {
        const message = createBaseQueryLegacyAccountResponse();
        if (object.account !== undefined && object.account !== null) {
            message.account = any_1.Any.fromAmino(object.account);
        }
        if (object.base !== undefined && object.base !== null) {
            message.base = auth_1.BaseAccount.fromAmino(object.base);
        }
        return message;
    },
    toAmino(message) {
        const obj = {};
        obj.account = message.account ? any_1.Any.toAmino(message.account) : undefined;
        obj.base = message.base ? auth_1.BaseAccount.toAmino(message.base) : undefined;
        return obj;
    },
    fromAminoMsg(object) {
        return exports.QueryLegacyAccountResponse.fromAmino(object.value);
    },
    toAminoMsg(message) {
        return {
            type: "cosmos-sdk/QueryLegacyAccountResponse",
            value: exports.QueryLegacyAccountResponse.toAmino(message)
        };
    },
    fromProtoMsg(message) {
        return exports.QueryLegacyAccountResponse.decode(message.value);
    },
    toProto(message) {
        return exports.QueryLegacyAccountResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: "/cosmos.auth.v1beta1.QueryLegacyAccountResponse",
            value: exports.QueryLegacyAccountResponse.encode(message).finish()
        };
    }
};
registry_1.GlobalDecoderRegistry.register(exports.QueryLegacyAccountResponse.typeUrl, exports.QueryLegacyAccountResponse);
registry_1.GlobalDecoderRegistry.registerAminoProtoMapping(exports.QueryLegacyAccountResponse.aminoType, exports.QueryLegacyAccountResponse.typeUrl);
