import { AnyJsonObject, Codec, Constructor, ConstructorDef, IHash, InterfaceTypes } from '../types'; declare type TypesDef = Record>; /** * @name Struct * @description * A Struct defines an Object with key-value pairs - where the values are Codec values. It removes * a lot of repetition from the actual coding, define a structure type, pass it the key/Codec * values in the constructor and it manages the decoding. It is important that the constructor * values matches 100% to the order in th Rust code, i.e. don't go crazy and make it alphabetical, * it needs to decoded in the specific defined order. * @noInheritDoc */ export default class Struct extends Map implements Codec { protected _jsonMap: Map; protected _Types: ConstructorDef; constructor(Types: S, value?: V | Map | any[] | string, jsonMap?: Map); /** * Decode input to pass into constructor. * * @param Types - Types definition. * @param value - Value to decode, one of: * - null * - undefined * - hex * - Uint8Array * - object with `{ key1: value1, key2: value2 }`, assuming `key1` and `key2` * are also keys in `Types` * - array with `[value1, value2]` assuming the array has the same length as * `Object.keys(Types)` * @param jsonMap */ private static decodeStruct; private static decodeStructFromObject; static with(Types: S): Constructor>; /** * @description Checks if the value is an empty value */ readonly isEmpty: boolean; /** * @description Returns the Type description to sthe structure */ readonly Type: E; /** * @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 Compares the value of the input to see if there is a match */ eq(other?: any): boolean; /** * @description Returns a specific names entry in the structure * @param name The name of the entry to retrieve */ get(name: keyof S): Codec | undefined; /** * @description Returns the values of a member at a specific index (Rather use get(name) for performance) */ getAtIndex(index: number): Codec; /** * @description Converts the Object to an standard JavaScript Array */ toArray(): Codec[]; /** * @description Returns a hex string representation of the value */ toHex(): string; /** * @description Converts the Object to JSON, typically used for RPC transfers */ toJSON(): AnyJsonObject | string; static typesToMap(Types: Record): Record; /** * @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; } export {};