@neo-one/node-protocol
Version:
NEO•ONE NEO node and consensus protocol.
21 lines (19 loc) • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.assertInventoryType = exports.InvalidInventoryTypeError = exports.InventoryType = void 0;
const utils_1 = require("@neo-one/utils");
var InventoryType;
(function (InventoryType) {
InventoryType[InventoryType["Transaction"] = 1] = "Transaction";
InventoryType[InventoryType["Block"] = 2] = "Block";
InventoryType[InventoryType["Consensus"] = 224] = "Consensus";
})(InventoryType = exports.InventoryType || (exports.InventoryType = {}));
exports.InvalidInventoryTypeError = utils_1.makeErrorWithCode('INVALID_INVENTORY_TYPE', (inventoryType) => `Expected inventory type, found: ${inventoryType}`);
const isInventoryType = (inventoryType) => InventoryType[inventoryType] !== undefined;
exports.assertInventoryType = (inventoryType) => {
if (isInventoryType(inventoryType)) {
return inventoryType;
}
throw new exports.InvalidInventoryTypeError(inventoryType);
};
//# sourceMappingURL=InventoryType.js.map