//@ts-nocheck
import { Timestamp, } from '../../../../google/protobuf/timestamp.js';
import { BinaryReader, BinaryWriter } from '../../../../binary.js';
import {} from '../../../../json-safe.js';
import { isSet, fromJsonTimestamp, fromTimestamp, } from '../../../../helpers.js';
import { decodeBase64 as bytesFromBase64 } from '@endo/base64';
import { encodeBase64 as base64FromBytes } from '@endo/base64';
function createBaseConfigRequest() {
    return {};
}
export const ConfigRequest = {
    typeUrl: '/cosmos.base.node.v1beta1.ConfigRequest',
    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 = createBaseConfigRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseConfigRequest();
        return message;
    },
    fromProtoMsg(message) {
        return ConfigRequest.decode(message.value);
    },
    toProto(message) {
        return ConfigRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/cosmos.base.node.v1beta1.ConfigRequest',
            value: ConfigRequest.encode(message).finish(),
        };
    },
};
function createBaseConfigResponse() {
    return {
        minimumGasPrice: '',
        pruningKeepRecent: '',
        pruningInterval: '',
        haltHeight: BigInt(0),
    };
}
export const ConfigResponse = {
    typeUrl: '/cosmos.base.node.v1beta1.ConfigResponse',
    encode(message, writer = BinaryWriter.create()) {
        if (message.minimumGasPrice !== '') {
            writer.uint32(10).string(message.minimumGasPrice);
        }
        if (message.pruningKeepRecent !== '') {
            writer.uint32(18).string(message.pruningKeepRecent);
        }
        if (message.pruningInterval !== '') {
            writer.uint32(26).string(message.pruningInterval);
        }
        if (message.haltHeight !== BigInt(0)) {
            writer.uint32(32).uint64(message.haltHeight);
        }
        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 = createBaseConfigResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.minimumGasPrice = reader.string();
                    break;
                case 2:
                    message.pruningKeepRecent = reader.string();
                    break;
                case 3:
                    message.pruningInterval = reader.string();
                    break;
                case 4:
                    message.haltHeight = reader.uint64();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            minimumGasPrice: isSet(object.minimumGasPrice)
                ? String(object.minimumGasPrice)
                : '',
            pruningKeepRecent: isSet(object.pruningKeepRecent)
                ? String(object.pruningKeepRecent)
                : '',
            pruningInterval: isSet(object.pruningInterval)
                ? String(object.pruningInterval)
                : '',
            haltHeight: isSet(object.haltHeight)
                ? BigInt(object.haltHeight.toString())
                : BigInt(0),
        };
    },
    toJSON(message) {
        const obj = {};
        message.minimumGasPrice !== undefined &&
            (obj.minimumGasPrice = message.minimumGasPrice);
        message.pruningKeepRecent !== undefined &&
            (obj.pruningKeepRecent = message.pruningKeepRecent);
        message.pruningInterval !== undefined &&
            (obj.pruningInterval = message.pruningInterval);
        message.haltHeight !== undefined &&
            (obj.haltHeight = (message.haltHeight || BigInt(0)).toString());
        return obj;
    },
    fromPartial(object) {
        const message = createBaseConfigResponse();
        message.minimumGasPrice = object.minimumGasPrice ?? '';
        message.pruningKeepRecent = object.pruningKeepRecent ?? '';
        message.pruningInterval = object.pruningInterval ?? '';
        message.haltHeight =
            object.haltHeight !== undefined && object.haltHeight !== null
                ? BigInt(object.haltHeight.toString())
                : BigInt(0);
        return message;
    },
    fromProtoMsg(message) {
        return ConfigResponse.decode(message.value);
    },
    toProto(message) {
        return ConfigResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/cosmos.base.node.v1beta1.ConfigResponse',
            value: ConfigResponse.encode(message).finish(),
        };
    },
};
function createBaseStatusRequest() {
    return {};
}
export const StatusRequest = {
    typeUrl: '/cosmos.base.node.v1beta1.StatusRequest',
    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 = createBaseStatusRequest();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseStatusRequest();
        return message;
    },
    fromProtoMsg(message) {
        return StatusRequest.decode(message.value);
    },
    toProto(message) {
        return StatusRequest.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/cosmos.base.node.v1beta1.StatusRequest',
            value: StatusRequest.encode(message).finish(),
        };
    },
};
function createBaseStatusResponse() {
    return {
        earliestStoreHeight: BigInt(0),
        height: BigInt(0),
        timestamp: undefined,
        appHash: new Uint8Array(),
        validatorHash: new Uint8Array(),
    };
}
export const StatusResponse = {
    typeUrl: '/cosmos.base.node.v1beta1.StatusResponse',
    encode(message, writer = BinaryWriter.create()) {
        if (message.earliestStoreHeight !== BigInt(0)) {
            writer.uint32(8).uint64(message.earliestStoreHeight);
        }
        if (message.height !== BigInt(0)) {
            writer.uint32(16).uint64(message.height);
        }
        if (message.timestamp !== undefined) {
            Timestamp.encode(message.timestamp, writer.uint32(26).fork()).ldelim();
        }
        if (message.appHash.length !== 0) {
            writer.uint32(34).bytes(message.appHash);
        }
        if (message.validatorHash.length !== 0) {
            writer.uint32(42).bytes(message.validatorHash);
        }
        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 = createBaseStatusResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.earliestStoreHeight = reader.uint64();
                    break;
                case 2:
                    message.height = reader.uint64();
                    break;
                case 3:
                    message.timestamp = Timestamp.decode(reader, reader.uint32());
                    break;
                case 4:
                    message.appHash = reader.bytes();
                    break;
                case 5:
                    message.validatorHash = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            earliestStoreHeight: isSet(object.earliestStoreHeight)
                ? BigInt(object.earliestStoreHeight.toString())
                : BigInt(0),
            height: isSet(object.height)
                ? BigInt(object.height.toString())
                : BigInt(0),
            timestamp: isSet(object.timestamp)
                ? fromJsonTimestamp(object.timestamp)
                : undefined,
            appHash: isSet(object.appHash)
                ? bytesFromBase64(object.appHash)
                : new Uint8Array(),
            validatorHash: isSet(object.validatorHash)
                ? bytesFromBase64(object.validatorHash)
                : new Uint8Array(),
        };
    },
    toJSON(message) {
        const obj = {};
        message.earliestStoreHeight !== undefined &&
            (obj.earliestStoreHeight = (message.earliestStoreHeight || BigInt(0)).toString());
        message.height !== undefined &&
            (obj.height = (message.height || BigInt(0)).toString());
        message.timestamp !== undefined &&
            (obj.timestamp = fromTimestamp(message.timestamp).toISOString());
        message.appHash !== undefined &&
            (obj.appHash = base64FromBytes(message.appHash !== undefined ? message.appHash : new Uint8Array()));
        message.validatorHash !== undefined &&
            (obj.validatorHash = base64FromBytes(message.validatorHash !== undefined
                ? message.validatorHash
                : new Uint8Array()));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseStatusResponse();
        message.earliestStoreHeight =
            object.earliestStoreHeight !== undefined &&
                object.earliestStoreHeight !== null
                ? BigInt(object.earliestStoreHeight.toString())
                : BigInt(0);
        message.height =
            object.height !== undefined && object.height !== null
                ? BigInt(object.height.toString())
                : BigInt(0);
        message.timestamp =
            object.timestamp !== undefined && object.timestamp !== null
                ? Timestamp.fromPartial(object.timestamp)
                : undefined;
        message.appHash = object.appHash ?? new Uint8Array();
        message.validatorHash = object.validatorHash ?? new Uint8Array();
        return message;
    },
    fromProtoMsg(message) {
        return StatusResponse.decode(message.value);
    },
    toProto(message) {
        return StatusResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/cosmos.base.node.v1beta1.StatusResponse',
            value: StatusResponse.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=query.js.map