@requestnetwork/multi-format
Version:
Multi-format for Request Network packages.
46 lines • 1.6 kB
TypeScript
import { MultiFormatTypes } from '@requestnetwork/types';
/**
* Class to serialize and deserialize multi-format data
* This class is meant to be inherited by all the multi-format
*/
export declare class SerializableMultiFormat {
protected prefix: string;
protected type: any;
constructor(prefix: string, type: any);
/**
* 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: MultiFormatTypes.IMultiFormatDeserialized): boolean;
/**
* Checks if a string is a serialized multi-format
*
* @param data string to check
* @returns true if the data is a serialized multi-format
*/
isDeserializableString(formattedData: string): boolean;
/**
* Serializes a deserialized multi-format
*
* @param data object to serialize
* @returns the data as a serialized multi-format
*/
serialize(data: MultiFormatTypes.IMultiFormatDeserialized): string;
/**
* Deserialized a multi-format string
*
* @param data string to deserialized
* @returns the data as a deserialized multi-format
*/
deserialize(formatted: string): MultiFormatTypes.IMultiFormatDeserialized;
/**
* Removes prefix of a multi-format
*
* @param formattedData the formatted multi-format
* @returns the hash without the multi-format prefix
*/
protected removePrefix(formattedData: string): string;
}
//# sourceMappingURL=serializable-multi-format.d.ts.map