UNPKG

airgap-coin-lib

Version:

The airgap-coin-lib is a protocol agnostic library to prepare, sign and broadcast cryptocurrency transactions.

133 lines 5.89 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var coinlib_error_1 = require("./coinlib-error"); var SerializerErrorType; (function (SerializerErrorType) { SerializerErrorType["SERIALIZER_VERSION_MISMATCH"] = "SERIALIZER_VERSION_MISMATCH"; SerializerErrorType["PROTOCOL_NOT_SUPPORTED"] = "PROTOCOL_NOT_SUPPORTED"; SerializerErrorType["PROTOCOL_VERSION_MISMATCH"] = "PROTOCOL_VERSION_MISMATCH"; SerializerErrorType["TYPE_NOT_SUPPORTED"] = "TYPE_NOT_SUPPORTED"; SerializerErrorType["INVALID_SCHEMA"] = "INVALID_SCHEMA"; SerializerErrorType["INVALID_SCHEMA_TYPE"] = "INVALID_SCHEMA_TYPE"; SerializerErrorType["INVALID_HEX_STRING"] = "INVALID_HEX_STRING"; SerializerErrorType["INVALID_STRING"] = "INVALID_STRING"; SerializerErrorType["SCHEMA_ALREADY_EXISTS"] = "SCHEMA_ALREADY_EXISTS"; SerializerErrorType["SCHEMA_DOES_NOT_EXISTS"] = "SCHEMA_DOES_NOT_EXISTS"; SerializerErrorType["UNEXPECTED_PAYLOAD"] = "UNEXPECTED_PAYLOAD"; SerializerErrorType["PAYLOAD_TYPE_UNKNOWN"] = "PAYLOAD_TYPE_UNKNOWN"; SerializerErrorType["PAYLOAD_TYPE_MISMATCH"] = "PAYLOAD_TYPE_MISMATCH"; SerializerErrorType["PAYLOAD_TYPE_NOT_SUPPORTED"] = "PAYLOAD_TYPE_NOT_SUPPORTED"; SerializerErrorType["PROPERTY_IS_EMPTY"] = "PROPERTY_IS_EMPTY"; SerializerErrorType["PROPERTY_INVALID"] = "PROPERTY_INVALID"; })(SerializerErrorType = exports.SerializerErrorType || (exports.SerializerErrorType = {})); var SerializerError = /** @class */ (function (_super) { __extends(SerializerError, _super); function SerializerError(code, description) { return _super.call(this, coinlib_error_1.Domain.SERIALIZER, code, description) || this; } return SerializerError; }(coinlib_error_1.CoinlibError)); exports.SerializerError = SerializerError; // tslint:disable:max-classes-per-file /** * Gets thrown if the serializer version does not match */ var SerializerVersionMismatch = /** @class */ (function (_super) { __extends(SerializerVersionMismatch, _super); function SerializerVersionMismatch(description) { return _super.call(this, SerializerErrorType.SERIALIZER_VERSION_MISMATCH, description) || this; } return SerializerVersionMismatch; }(SerializerError)); exports.SerializerVersionMismatch = SerializerVersionMismatch; /** * Gets thrown if the serializer cannot handle the specified coin/protocol */ var ProtocolNotSupported = /** @class */ (function (_super) { __extends(ProtocolNotSupported, _super); function ProtocolNotSupported(description) { return _super.call(this, SerializerErrorType.PROTOCOL_NOT_SUPPORTED, description) || this; } return ProtocolNotSupported; }(SerializerError)); exports.ProtocolNotSupported = ProtocolNotSupported; /** * Gets thrown if the serializer CAN handle the specified coin/protocol, but not in this version */ var ProtocolVersionMismatch = /** @class */ (function (_super) { __extends(ProtocolVersionMismatch, _super); function ProtocolVersionMismatch(description) { return _super.call(this, SerializerErrorType.PROTOCOL_VERSION_MISMATCH, description) || this; } return ProtocolVersionMismatch; }(SerializerError)); exports.ProtocolVersionMismatch = ProtocolVersionMismatch; /** * Gets thrown if the specified Type is not supported */ var TypeNotSupported = /** @class */ (function (_super) { __extends(TypeNotSupported, _super); function TypeNotSupported(description) { return _super.call(this, SerializerErrorType.TYPE_NOT_SUPPORTED, description) || this; } return TypeNotSupported; }(SerializerError)); exports.TypeNotSupported = TypeNotSupported; /** * Gets thrown if the schema in the serializer is invalid */ var InvalidSchema = /** @class */ (function (_super) { __extends(InvalidSchema, _super); function InvalidSchema(description) { return _super.call(this, SerializerErrorType.INVALID_SCHEMA, description) || this; } return InvalidSchema; }(SerializerError)); exports.InvalidSchema = InvalidSchema; /** * Gets thrown if the 2 types provided are not compatible */ var InvalidSchemaType = /** @class */ (function (_super) { __extends(InvalidSchemaType, _super); function InvalidSchemaType(description) { return _super.call(this, SerializerErrorType.INVALID_SCHEMA_TYPE, description) || this; } return InvalidSchemaType; }(SerializerError)); exports.InvalidSchemaType = InvalidSchemaType; /** * Gets thrown if the string is not a valid hex string */ var InvalidHexString = /** @class */ (function (_super) { __extends(InvalidHexString, _super); function InvalidHexString(description) { return _super.call(this, SerializerErrorType.INVALID_HEX_STRING, description) || this; } return InvalidHexString; }(SerializerError)); exports.InvalidHexString = InvalidHexString; /** * Gets thrown if the string starts with "0x". This causes problems with RLP */ var InvalidString = /** @class */ (function (_super) { __extends(InvalidString, _super); function InvalidString(description) { return _super.call(this, SerializerErrorType.INVALID_STRING, description) || this; } return InvalidString; }(SerializerError)); exports.InvalidString = InvalidString; //# sourceMappingURL=index.js.map