"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.IndexerTendermintBlock = exports.IndexerTendermintEvent = exports.IndexerEventsStoreValue = exports.IndexerTendermintEventWrapper = exports.IndexerTendermintEvent_BlockEventSDKType = exports.IndexerTendermintEvent_BlockEvent = void 0;
exports.indexerTendermintEvent_BlockEventFromJSON = indexerTendermintEvent_BlockEventFromJSON;
exports.indexerTendermintEvent_BlockEventToJSON = indexerTendermintEvent_BlockEventToJSON;
const timestamp_1 = require("../../../google/protobuf/timestamp");
const _m0 = __importStar(require("protobufjs/minimal"));
const helpers_1 = require("../../../helpers");
/** enum to specify that the IndexerTendermintEvent is a block event. */
var IndexerTendermintEvent_BlockEvent;
(function (IndexerTendermintEvent_BlockEvent) {
    /** BLOCK_EVENT_UNSPECIFIED - Default value. This value is invalid and unused. */
    IndexerTendermintEvent_BlockEvent[IndexerTendermintEvent_BlockEvent["BLOCK_EVENT_UNSPECIFIED"] = 0] = "BLOCK_EVENT_UNSPECIFIED";
    /**
     * BLOCK_EVENT_BEGIN_BLOCK - BLOCK_EVENT_BEGIN_BLOCK indicates that the event was generated during
     * BeginBlock.
     */
    IndexerTendermintEvent_BlockEvent[IndexerTendermintEvent_BlockEvent["BLOCK_EVENT_BEGIN_BLOCK"] = 1] = "BLOCK_EVENT_BEGIN_BLOCK";
    /**
     * BLOCK_EVENT_END_BLOCK - BLOCK_EVENT_END_BLOCK indicates that the event was generated during
     * EndBlock.
     */
    IndexerTendermintEvent_BlockEvent[IndexerTendermintEvent_BlockEvent["BLOCK_EVENT_END_BLOCK"] = 2] = "BLOCK_EVENT_END_BLOCK";
    IndexerTendermintEvent_BlockEvent[IndexerTendermintEvent_BlockEvent["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
})(IndexerTendermintEvent_BlockEvent || (exports.IndexerTendermintEvent_BlockEvent = IndexerTendermintEvent_BlockEvent = {}));
exports.IndexerTendermintEvent_BlockEventSDKType = IndexerTendermintEvent_BlockEvent;
function indexerTendermintEvent_BlockEventFromJSON(object) {
    switch (object) {
        case 0:
        case "BLOCK_EVENT_UNSPECIFIED":
            return IndexerTendermintEvent_BlockEvent.BLOCK_EVENT_UNSPECIFIED;
        case 1:
        case "BLOCK_EVENT_BEGIN_BLOCK":
            return IndexerTendermintEvent_BlockEvent.BLOCK_EVENT_BEGIN_BLOCK;
        case 2:
        case "BLOCK_EVENT_END_BLOCK":
            return IndexerTendermintEvent_BlockEvent.BLOCK_EVENT_END_BLOCK;
        case -1:
        case "UNRECOGNIZED":
        default:
            return IndexerTendermintEvent_BlockEvent.UNRECOGNIZED;
    }
}
function indexerTendermintEvent_BlockEventToJSON(object) {
    switch (object) {
        case IndexerTendermintEvent_BlockEvent.BLOCK_EVENT_UNSPECIFIED:
            return "BLOCK_EVENT_UNSPECIFIED";
        case IndexerTendermintEvent_BlockEvent.BLOCK_EVENT_BEGIN_BLOCK:
            return "BLOCK_EVENT_BEGIN_BLOCK";
        case IndexerTendermintEvent_BlockEvent.BLOCK_EVENT_END_BLOCK:
            return "BLOCK_EVENT_END_BLOCK";
        case IndexerTendermintEvent_BlockEvent.UNRECOGNIZED:
        default:
            return "UNRECOGNIZED";
    }
}
function createBaseIndexerTendermintEventWrapper() {
    return {
        event: undefined,
        txnHash: ""
    };
}
exports.IndexerTendermintEventWrapper = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.event !== undefined) {
            exports.IndexerTendermintEvent.encode(message.event, writer.uint32(10).fork()).ldelim();
        }
        if (message.txnHash !== "") {
            writer.uint32(18).string(message.txnHash);
        }
        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 = createBaseIndexerTendermintEventWrapper();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.event = exports.IndexerTendermintEvent.decode(reader, reader.uint32());
                    break;
                case 2:
                    message.txnHash = reader.string();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        var _a;
        const message = createBaseIndexerTendermintEventWrapper();
        message.event = object.event !== undefined && object.event !== null ? exports.IndexerTendermintEvent.fromPartial(object.event) : undefined;
        message.txnHash = (_a = object.txnHash) !== null && _a !== void 0 ? _a : "";
        return message;
    }
};
function createBaseIndexerEventsStoreValue() {
    return {
        events: []
    };
}
exports.IndexerEventsStoreValue = {
    encode(message, writer = _m0.Writer.create()) {
        for (const v of message.events) {
            exports.IndexerTendermintEventWrapper.encode(v, writer.uint32(10).fork()).ldelim();
        }
        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 = createBaseIndexerEventsStoreValue();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.events.push(exports.IndexerTendermintEventWrapper.decode(reader, reader.uint32()));
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        var _a;
        const message = createBaseIndexerEventsStoreValue();
        message.events = ((_a = object.events) === null || _a === void 0 ? void 0 : _a.map(e => exports.IndexerTendermintEventWrapper.fromPartial(e))) || [];
        return message;
    }
};
function createBaseIndexerTendermintEvent() {
    return {
        subtype: "",
        transactionIndex: undefined,
        blockEvent: undefined,
        eventIndex: 0,
        version: 0,
        dataBytes: new Uint8Array()
    };
}
exports.IndexerTendermintEvent = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.subtype !== "") {
            writer.uint32(10).string(message.subtype);
        }
        if (message.transactionIndex !== undefined) {
            writer.uint32(24).uint32(message.transactionIndex);
        }
        if (message.blockEvent !== undefined) {
            writer.uint32(32).int32(message.blockEvent);
        }
        if (message.eventIndex !== 0) {
            writer.uint32(40).uint32(message.eventIndex);
        }
        if (message.version !== 0) {
            writer.uint32(48).uint32(message.version);
        }
        if (message.dataBytes.length !== 0) {
            writer.uint32(58).bytes(message.dataBytes);
        }
        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 = createBaseIndexerTendermintEvent();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.subtype = reader.string();
                    break;
                case 3:
                    message.transactionIndex = reader.uint32();
                    break;
                case 4:
                    message.blockEvent = reader.int32();
                    break;
                case 5:
                    message.eventIndex = reader.uint32();
                    break;
                case 6:
                    message.version = reader.uint32();
                    break;
                case 7:
                    message.dataBytes = reader.bytes();
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        var _a, _b, _c, _d, _e, _f;
        const message = createBaseIndexerTendermintEvent();
        message.subtype = (_a = object.subtype) !== null && _a !== void 0 ? _a : "";
        message.transactionIndex = (_b = object.transactionIndex) !== null && _b !== void 0 ? _b : undefined;
        message.blockEvent = (_c = object.blockEvent) !== null && _c !== void 0 ? _c : undefined;
        message.eventIndex = (_d = object.eventIndex) !== null && _d !== void 0 ? _d : 0;
        message.version = (_e = object.version) !== null && _e !== void 0 ? _e : 0;
        message.dataBytes = (_f = object.dataBytes) !== null && _f !== void 0 ? _f : new Uint8Array();
        return message;
    }
};
function createBaseIndexerTendermintBlock() {
    return {
        height: 0,
        time: undefined,
        events: [],
        txHashes: []
    };
}
exports.IndexerTendermintBlock = {
    encode(message, writer = _m0.Writer.create()) {
        if (message.height !== 0) {
            writer.uint32(8).uint32(message.height);
        }
        if (message.time !== undefined) {
            timestamp_1.Timestamp.encode((0, helpers_1.toTimestamp)(message.time), writer.uint32(18).fork()).ldelim();
        }
        for (const v of message.events) {
            exports.IndexerTendermintEvent.encode(v, writer.uint32(26).fork()).ldelim();
        }
        for (const v of message.txHashes) {
            writer.uint32(34).string(v);
        }
        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 = createBaseIndexerTendermintBlock();
        while (reader.pos < end) {
            const tag = reader.uint32();
            switch (tag >>> 3) {
                case 1:
                    message.height = reader.uint32();
                    break;
                case 2:
                    message.time = (0, helpers_1.fromTimestamp)(timestamp_1.Timestamp.decode(reader, reader.uint32()));
                    break;
                case 3:
                    message.events.push(exports.IndexerTendermintEvent.decode(reader, reader.uint32()));
                    break;
                case 4:
                    message.txHashes.push(reader.string());
                    break;
                default:
                    reader.skipType(tag & 7);
                    break;
            }
        }
        return message;
    },
    fromPartial(object) {
        var _a, _b, _c, _d;
        const message = createBaseIndexerTendermintBlock();
        message.height = (_a = object.height) !== null && _a !== void 0 ? _a : 0;
        message.time = (_b = object.time) !== null && _b !== void 0 ? _b : undefined;
        message.events = ((_c = object.events) === null || _c === void 0 ? void 0 : _c.map(e => exports.IndexerTendermintEvent.fromPartial(e))) || [];
        message.txHashes = ((_d = object.txHashes) === null || _d === void 0 ? void 0 : _d.map(e => e)) || [];
        return message;
    }
};
//# sourceMappingURL=data:application/json;base64, 