"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.BigIntSchema = exports.BigIntishSchema = exports.EventName = exports.OrderLifecycleCost = exports.DEAD_WALLET_PRIVATE_KEY = exports.EventSource = void 0;
exports.getLastElement = getLastElement;
const zod_1 = require("zod");
var EventSource;
(function (EventSource) {
    EventSource["rpc"] = "rpc";
    EventSource["stream"] = "stream";
    EventSource["sqs"] = "sqs";
    EventSource["sqsDLQ"] = "sqsDLQ";
    EventSource["sqsMessiah"] = "sqsMessiah";
})(EventSource || (exports.EventSource = EventSource = {}));
exports.DEAD_WALLET_PRIVATE_KEY = '0xDEADa4c724f487e5f768d26154a5d3aa7ef2217e78cf5df96158d8f6c975BEEF';
var OrderLifecycleCost;
(function (OrderLifecycleCost) {
    OrderLifecycleCost[OrderLifecycleCost["OrderCreatedNative"] = 0] = "OrderCreatedNative";
    OrderLifecycleCost[OrderLifecycleCost["OrderCreatedERC20"] = 1] = "OrderCreatedERC20";
    OrderLifecycleCost[OrderLifecycleCost["ConfirmedNative"] = 2] = "ConfirmedNative";
    OrderLifecycleCost[OrderLifecycleCost["ConfirmedERC20"] = 3] = "ConfirmedERC20";
    OrderLifecycleCost[OrderLifecycleCost["ClaimedNative"] = 4] = "ClaimedNative";
    OrderLifecycleCost[OrderLifecycleCost["ClaimedERC20"] = 5] = "ClaimedERC20";
})(OrderLifecycleCost || (exports.OrderLifecycleCost = OrderLifecycleCost = {}));
var EventName;
(function (EventName) {
    EventName["OrderCreated"] = "OrderCreated";
    EventName["RemoteOrderCreated"] = "RemoteOrderCreated";
    EventName["EscrowOrderCreated"] = "EscrowOrderCreated";
    EventName["L3EscrowOrderCreated"] = "L3EscrowOrderCreated";
    EventName["BRNDistributed"] = "BRNDistributed";
    EventName["BidReceived"] = "BidReceived";
    EventName["RevertOrderApproved"] = "RevertOrderApproved";
    EventName["NewOrderAttested"] = "NewOrderAttested";
    EventName["BatchApplied"] = "BatchApplied";
    EventName["DistributionAttempt"] = "DistributionAttempt";
    EventName["OrderAttested"] = "OrderAttested";
    EventName["OrderAttestationDuplicatedOrAboveLimit"] = "OrderAttestationDuplicatedOrAboveLimit";
    EventName["Confirmation"] = "Confirmation";
    EventName["ConfirmationBatch"] = "ConfirmationBatch";
    EventName["TransferCommitApplied"] = "TransferCommitApplied";
    EventName["TransferRevertApplied"] = "TransferRevertApplied";
    EventName["NonClaimable"] = "NonClaimable";
    EventName["ClaimedBatch"] = "ClaimedBatch";
    EventName["NonRefundable"] = "NonRefundable";
    EventName["Claimed"] = "Claimed";
    EventName["ClaimedV1"] = "ClaimedV1";
    EventName["ConfirmationAttest"] = "ConfirmationAttest";
    EventName["ClaimedRefund"] = "ClaimedRefund";
    EventName["ClaimedRefundV1"] = "ClaimedRefundV1";
    EventName["NewPayloadMemo"] = "NewPayloadMemo";
    EventName["RevertOrderRevertWithCommitPrevented"] = "RevertOrderRevertWithCommitPrevented";
    EventName["SegmentReceived"] = "SegmentReceived";
    EventName["NewBatchAttested"] = "NewBatchAttested";
    EventName["AlreadyApplied"] = "AlreadyApplied";
    EventName["OutbidReceived"] = "OutbidReceived";
    EventName["BatchError"] = "BatchError";
    EventName["InsuranceClaimed"] = "InsuranceClaimed";
    EventName["InsuranceSet"] = "InsuranceSet";
    EventName["TRNInflationDistributed"] = "InflationDistributed";
    EventName["BRNRewardsDistributed"] = "BRNRewardsDistributed";
    EventName["GMPExpectedPayloadNotMatched"] = "GMPExpectedPayloadNotMatched";
    EventName["BatchConstructed"] = "BatchConstructed";
    EventName["AddPendingAttestationToUnknownOrder"] = "AddPendingAttestationToUnknownOrder";
    EventName["GMPMismatch"] = "GMPMismatch";
    EventName["ExecutorMismatch"] = "ExecutorMismatch";
    EventName["OrderGasConsumed"] = "OrderGasConsumed";
    EventName["ExecuteGasConsumed"] = "ExecuteGasConsumed";
    EventName["ExecutedBatchGasConsumed"] = "ExecutedBatchGasConsumed";
})(EventName || (exports.EventName = EventName = {}));
exports.BigIntishSchema = zod_1.z.union([
    zod_1.z.object({ type: zod_1.z.literal('BigNumber'), hex: zod_1.z.string() }).transform((v) => v.hex),
    zod_1.z.object({ _hex: zod_1.z.string() }).transform((v) => v._hex),
    zod_1.z.string(),
    zod_1.z.number(),
    zod_1.z.bigint(),
]);
exports.BigIntSchema = exports.BigIntishSchema.transform(BigInt);
// Useful for consistently extracting event payload data
function getLastElement(arr) {
    if (arr.length === 0) {
        throw new Error('Array is empty');
    }
    return arr.at(-1);
}
//# sourceMappingURL=types.js.map