/* eslint-disable */
import _m0 from "protobufjs/minimal";
import { typeFromJSON, typeToJSON } from "../tokenmanager/item";
export const protobufPackage = "rarifyprotocol.rarimocore.rarimocore";
function createBaseMsgCreateTransferOp() {
    return { creator: "", tx: "", eventId: "", fromChain: "", tokenType: 0 };
}
export const MsgCreateTransferOp = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.creator !== "") {
            writer.uint32(10).string(message.creator);
        }
        if (message.tx !== "") {
            writer.uint32(18).string(message.tx);
        }
        if (message.eventId !== "") {
            writer.uint32(26).string(message.eventId);
        }
        if (message.fromChain !== "") {
            writer.uint32(34).string(message.fromChain);
        }
        if (message.tokenType !== 0) {
            writer.uint32(40).int32(message.tokenType);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMsgCreateTransferOp();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.creator = reader.string();
                    break;
                case 2:
                    message.tx = reader.string();
                    break;
                case 3:
                    message.eventId = reader.string();
                    break;
                case 4:
                    message.fromChain = reader.string();
                    break;
                case 5:
                    message.tokenType = reader.int32();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            creator: isSet(object.creator) ? String(object.creator) : "",
            tx: isSet(object.tx) ? String(object.tx) : "",
            eventId: isSet(object.eventId) ? String(object.eventId) : "",
            fromChain: isSet(object.fromChain) ? String(object.fromChain) : "",
            tokenType: isSet(object.tokenType) ? typeFromJSON(object.tokenType) : 0,
        };
    },
    toJSON(message) {
        const obj = {};
        message.creator !== undefined && (obj.creator = message.creator);
        message.tx !== undefined && (obj.tx = message.tx);
        message.eventId !== undefined && (obj.eventId = message.eventId);
        message.fromChain !== undefined && (obj.fromChain = message.fromChain);
        message.tokenType !== undefined && (obj.tokenType = typeToJSON(message.tokenType));
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgCreateTransferOp();
        message.creator = object.creator ?? "";
        message.tx = object.tx ?? "";
        message.eventId = object.eventId ?? "";
        message.fromChain = object.fromChain ?? "";
        message.tokenType = object.tokenType ?? 0;
        return message;
    },
};
function createBaseMsgCreateTransferOpResponse() {
    return {};
}
export const MsgCreateTransferOpResponse = {
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMsgCreateTransferOpResponse();
        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 = createBaseMsgCreateTransferOpResponse();
        return message;
    },
};
function createBaseMsgCreateConfirmation() {
    return { creator: "", root: "", indexes: [], signatureECDSA: "" };
}
export const MsgCreateConfirmation = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.creator !== "") {
            writer.uint32(10).string(message.creator);
        }
        if (message.root !== "") {
            writer.uint32(18).string(message.root);
        }
        for (const v of message.indexes) {
            writer.uint32(26).string(v);
        }
        if (message.signatureECDSA !== "") {
            writer.uint32(34).string(message.signatureECDSA);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMsgCreateConfirmation();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.creator = reader.string();
                    break;
                case 2:
                    message.root = reader.string();
                    break;
                case 3:
                    message.indexes.push(reader.string());
                    break;
                case 4:
                    message.signatureECDSA = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            creator: isSet(object.creator) ? String(object.creator) : "",
            root: isSet(object.root) ? String(object.root) : "",
            indexes: Array.isArray(object?.indexes) ? object.indexes.map((e) => String(e)) : [],
            signatureECDSA: isSet(object.signatureECDSA) ? String(object.signatureECDSA) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        message.creator !== undefined && (obj.creator = message.creator);
        message.root !== undefined && (obj.root = message.root);
        if (message.indexes) {
            obj.indexes = message.indexes.map((e) => e);
        }
        else {
            obj.indexes = [];
        }
        message.signatureECDSA !== undefined && (obj.signatureECDSA = message.signatureECDSA);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgCreateConfirmation();
        message.creator = object.creator ?? "";
        message.root = object.root ?? "";
        message.indexes = object.indexes?.map((e) => e) || [];
        message.signatureECDSA = object.signatureECDSA ?? "";
        return message;
    },
};
function createBaseMsgCreateConfirmationResponse() {
    return {};
}
export const MsgCreateConfirmationResponse = {
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMsgCreateConfirmationResponse();
        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 = createBaseMsgCreateConfirmationResponse();
        return message;
    },
};
function createBaseMsgCreateChangeKeyECDSA() {
    return { creator: "", newKey: "" };
}
export const MsgCreateChangeKeyECDSA = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.creator !== "") {
            writer.uint32(10).string(message.creator);
        }
        if (message.newKey !== "") {
            writer.uint32(18).string(message.newKey);
        }
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMsgCreateChangeKeyECDSA();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.creator = reader.string();
                    break;
                case 2:
                    message.newKey = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromJSON(object) {
        return {
            creator: isSet(object.creator) ? String(object.creator) : "",
            newKey: isSet(object.newKey) ? String(object.newKey) : "",
        };
    },
    toJSON(message) {
        const obj = {};
        message.creator !== undefined && (obj.creator = message.creator);
        message.newKey !== undefined && (obj.newKey = message.newKey);
        return obj;
    },
    fromPartial(object) {
        const message = createBaseMsgCreateChangeKeyECDSA();
        message.creator = object.creator ?? "";
        message.newKey = object.newKey ?? "";
        return message;
    },
};
function createBaseMsgCreateChangeKeyECDSAResponse() {
    return {};
}
export const MsgCreateChangeKeyECDSAResponse = {
    encode(_, writer = _m0.Writer.create()) {
        return writer;
    },
    decode(input, length) {
        const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
        let end = length === undefined ? reader.len : reader.pos + length;
        const message = createBaseMsgCreateChangeKeyECDSAResponse();
        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 = createBaseMsgCreateChangeKeyECDSAResponse();
        return message;
    },
};
export class MsgClientImpl {
    rpc;
    constructor(rpc) {
        this.rpc = rpc;
        this.CreateTransferOperation = this.CreateTransferOperation.bind(this);
        this.CreateConfirmation = this.CreateConfirmation.bind(this);
        this.CreateChangeKeyECDSA = this.CreateChangeKeyECDSA.bind(this);
    }
    CreateTransferOperation(request) {
        const data = MsgCreateTransferOp.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Msg", "CreateTransferOperation", data);
        return promise.then((data) => MsgCreateTransferOpResponse.decode(new _m0.Reader(data)));
    }
    CreateConfirmation(request) {
        const data = MsgCreateConfirmation.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Msg", "CreateConfirmation", data);
        return promise.then((data) => MsgCreateConfirmationResponse.decode(new _m0.Reader(data)));
    }
    CreateChangeKeyECDSA(request) {
        const data = MsgCreateChangeKeyECDSA.encode(request).finish();
        const promise = this.rpc.request("rarifyprotocol.rarimocore.rarimocore.Msg", "CreateChangeKeyECDSA", data);
        return promise.then((data) => MsgCreateChangeKeyECDSAResponse.decode(new _m0.Reader(data)));
    }
}
function isSet(value) {
    return value !== null && value !== undefined;
}
//# sourceMappingURL=tx.js.map