//@ts-nocheck
import { Params, QueryRequest, } from './host.js';
import { BinaryReader, BinaryWriter } from '../../../../../binary.js';
import { isSet } from '../../../../../helpers.js';
import {} from '../../../../../json-safe.js';
import { decodeBase64 as bytesFromBase64 } from '@endo/base64';
import { encodeBase64 as base64FromBytes } from '@endo/base64';
function createBaseMsgUpdateParams() {
    return {
        signer: '',
        params: Params.fromPartial({}),
    };
}
export const MsgUpdateParams = {
    typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams',
    encode(message, writer = BinaryWriter.create()) {
        if (message.signer !== '') {
            writer.uint32(10).string(message.signer);
        }
        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.signer = reader.string();
                    break;
                case 2:
                    message.params = Params.decode(reader, reader.uint32());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            signer: isSet(object.signer) ? String(object.signer) : '',
            params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
        };
    },
    toJSON(message) {
        const obj = {};
        message.signer !== undefined && (obj.signer = message.signer);
        message.params !== undefined &&
            (obj.params = message.params ? Params.toJSON(message.params) : undefined);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgUpdateParams();
        message.signer = object.signer ?? '';
        message.params =
            object.params !== undefined && object.params !== null
                ? Params.fromPartial(object.params)
                : undefined;
        return message;
    },
    fromProtoMsg(message) {
        return MsgUpdateParams.decode(message.value);
    },
    toProto(message) {
        return MsgUpdateParams.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgUpdateParams',
            value: MsgUpdateParams.encode(message).finish(),
        };
    },
};
function createBaseMsgUpdateParamsResponse() {
    return {};
}
export const MsgUpdateParamsResponse = {
    typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse',
    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;
    },
    fromJSON(_) {
        return {};
    },
    toJSON(_) {
        const obj = {};
        return obj;
    },
    fromPartial(_) {
        const message = createBaseMsgUpdateParamsResponse();
        return message;
    },
    fromProtoMsg(message) {
        return MsgUpdateParamsResponse.decode(message.value);
    },
    toProto(message) {
        return MsgUpdateParamsResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgUpdateParamsResponse',
            value: MsgUpdateParamsResponse.encode(message).finish(),
        };
    },
};
function createBaseMsgModuleQuerySafe() {
    return {
        signer: '',
        requests: [],
    };
}
export const MsgModuleQuerySafe = {
    typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe',
    encode(message, writer = BinaryWriter.create()) {
        if (message.signer !== '') {
            writer.uint32(10).string(message.signer);
        }
        for (const v of message.requests) {
            QueryRequest.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 = createBaseMsgModuleQuerySafe();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.signer = reader.string();
                    break;
                case 2:
                    message.requests.push(QueryRequest.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            signer: isSet(object.signer) ? String(object.signer) : '',
            requests: Array.isArray(object?.requests)
                ? object.requests.map((e) => QueryRequest.fromJSON(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        message.signer !== undefined && (obj.signer = message.signer);
        if (message.requests) {
            obj.requests = message.requests.map(e => e ? QueryRequest.toJSON(e) : undefined);
        }
        else {
            obj.requests = [];
        }
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgModuleQuerySafe();
        message.signer = object.signer ?? '';
        message.requests =
            object.requests?.map(e => QueryRequest.fromPartial(e)) || [];
        return message;
    },
    fromProtoMsg(message) {
        return MsgModuleQuerySafe.decode(message.value);
    },
    toProto(message) {
        return MsgModuleQuerySafe.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe',
            value: MsgModuleQuerySafe.encode(message).finish(),
        };
    },
};
function createBaseMsgModuleQuerySafeResponse() {
    return {
        height: BigInt(0),
        responses: [],
    };
}
export const MsgModuleQuerySafeResponse = {
    typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafeResponse',
    encode(message, writer = BinaryWriter.create()) {
        if (message.height !== BigInt(0)) {
            writer.uint32(8).uint64(message.height);
        }
        for (const v of message.responses) {
            writer.uint32(18).bytes(v);
        }
        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 = createBaseMsgModuleQuerySafeResponse();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.height = reader.uint64();
                    break;
                case 2:
                    message.responses.push(reader.bytes());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            height: isSet(object.height)
                ? BigInt(object.height.toString())
                : BigInt(0),
            responses: Array.isArray(object?.responses)
                ? object.responses.map((e) => bytesFromBase64(e))
                : [],
        };
    },
    toJSON(message) {
        const obj = {};
        message.height !== undefined &&
            (obj.height = (message.height || BigInt(0)).toString());
        if (message.responses) {
            obj.responses = message.responses.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array()));
        }
        else {
            obj.responses = [];
        }
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgModuleQuerySafeResponse();
        message.height =
            object.height !== undefined && object.height !== null
                ? BigInt(object.height.toString())
                : BigInt(0);
        message.responses = object.responses?.map(e => e) || [];
        return message;
    },
    fromProtoMsg(message) {
        return MsgModuleQuerySafeResponse.decode(message.value);
    },
    toProto(message) {
        return MsgModuleQuerySafeResponse.encode(message).finish();
    },
    toProtoMsg(message) {
        return {
            typeUrl: '/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafeResponse',
            value: MsgModuleQuerySafeResponse.encode(message).finish(),
        };
    },
};
//# sourceMappingURL=tx.js.map