import { AnyU8a, Codec, IHash } from '../types'; /** * @name U8a * @description * A basic wrapper around Uint8Array, with no frills and no fuss. It does differ * from other implementations where it will consume the full Uint8Array as passed to it. * As such it is meant to be subclassed where the wrapper takes care of the * actual lengths instead of used directly. * @noInheritDoc */ export default class U8a extends Uint8Array implements Codec { constructor(value?: AnyU8a); private static decodeU8a; /** * @description The length of the value when encoded as a Uint8Array */ readonly encodedLength: number; /** * @description returns a hash of the contents */ readonly hash: IHash; /** * @description Returns true if the type wraps an empty/default all-0 value */ readonly isEmpty: boolean; /** * @description The length of the value */ readonly length: number; /** * @description Returns the number of bits in the value */ bitLength(): number; /** * @description Compares the value of the input to see if there is a match */ eq(other?: any): boolean; /** * @description Create a new subarray from the actual buffer. This is needed for compat reasons since a new Uint8Array gets returned here * @param begin The position to start at * @param end The position to end at */ subarray(begin: number, end?: number): Uint8Array; /** * @description Returns a hex string representation of the value */ toHex(): string; /** * @description Converts the Object to JSON, typically used for RPC transfers */ toJSON(): 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; }