UNPKG

@requestnetwork/multi-format

Version:
35 lines 1.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EthereumAddressMultiFormat = void 0; const types_1 = require("@requestnetwork/types"); const hexadecimal_serializable_multi_format_1 = require("../hexadecimal-serializable-multi-format"); /** * Class to serialize and deserialize multi-format identity ethereum address */ class EthereumAddressMultiFormat extends hexadecimal_serializable_multi_format_1.HexadecimalSerializableMultiFormat { constructor() { super(types_1.MultiFormatTypes.prefix.IDENTITY_ETHEREUM_ADDRESS, types_1.IdentityTypes.TYPE.ETHEREUM_ADDRESS); } /** * Checks if an object is a deserialized multi-format * * @param data object to check * @returns true if the data is a deserialized multi-format */ isSerializableObject(data) { return (super.isSerializableObject(data) && data.value.length === types_1.MultiFormatTypes.FORMAT_IDENTITY_ETHEREUM_ADDRESS_LENGTH); } /** * Checks if a string is a serialized multi-format * * @param formatted string to check * @returns true if the data is a serialized multi-format */ isDeserializableString(formatted) { return (super.isDeserializableString(formatted) && formatted.length === types_1.MultiFormatTypes.FORMAT_IDENTITY_ETHEREUM_ADDRESS_LENGTH); } } exports.EthereumAddressMultiFormat = EthereumAddressMultiFormat; //# sourceMappingURL=ethereum-address-format.js.map