@polkadot/types-codec
Version:
Implementation of the SCALE codec
78 lines (77 loc) • 2.46 kB
TypeScript
import type { HexString } from '@polkadot/util/types';
import type { AnyString, AnyU8a, Inspect, IText, IU8a, Registry } from '../types/index.js';
/**
* @name Text
* @description
* This is a string wrapper, along with the length. It is used both for strings as well
* as items such as documentation. It simply extends the standard JS `String` built-in
* object, inheriting all methods exposed from `String`.
* @noInheritDoc
*/
export declare class Text extends String implements IText {
#private;
readonly registry: Registry;
createdAtHash?: IU8a;
initialU8aLength?: number;
isStorageFallback?: boolean;
constructor(registry: Registry, value?: null | AnyString | AnyU8a | {
toString: () => string;
});
/**
* @description The length of the value when encoded as a Uint8Array
*/
get encodedLength(): number;
/**
* @description returns a hash of the contents
*/
get hash(): IU8a;
/**
* @description Checks if the value is an empty value
*/
get isEmpty(): boolean;
/**
* @description The length of the value
*/
get length(): number;
/**
* @description Compares the value of the input to see if there is a match
*/
eq(other?: unknown): boolean;
/**
* @description Returns a breakdown of the hex encoding for this Codec
*/
inspect(): Inspect;
/**
* @description Set an override value for this
*/
setOverride(override: string): void;
/**
* @description Returns a hex string representation of the value
*/
toHex(): HexString;
/**
* @description Converts the Object to to a human-friendly JSON, with additional fields, expansion and formatting of information
*/
toHuman(): string;
/**
* @description Converts the Object to JSON, typically used for RPC transfers
*/
toJSON(): string;
/**
* @description Converts the value in a best-fit primitive form
*/
toPrimitive(): string;
/**
* @description Returns the base runtime type name for this instance
*/
toRawType(): string;
/**
* @description Returns the string representation of the value
*/
toString(): string;
/**
* @description Encodes the value as a Uint8Array as per the SCALE specifications
* @param isBare true when the value has none of the type-specific prefixes (internal)
*/
toU8a(isBare?: boolean): Uint8Array;
}