Class NamedArg

Represents a named argument with a name and associated CLValue, which can be serialized to bytes.

Hierarchy

  • NamedArg

Constructors

Properties

Methods

Constructors

Properties

name: string

The name of the argument.

value: CLValue

The CLValue associated with this argument.

Methods

  • Converts the named argument to a byte array representation.

    Returns

    A Uint8Array containing the serialized argument name and value.

    Returns Uint8Array

  • Creates a NamedArg instance from a byte array.

    Returns

    A NamedArg instance.

    Parameters

    • bytes: Uint8Array

      The byte array to parse.

    Returns NamedArg

  • Converts a NamedArg object to a Uint8Array for serialization.

    The method encodes the name of the argument as a UTF-8 string, followed by the serialized bytes of its value. The resulting Uint8Array can be used for further processing, such as storage or transmission.

    Returns

    A Uint8Array representing the serialized NamedArg.

    Example

    const namedArg = new NamedArg("arg1", CLValue.u32(42));
    const serializedBytes = YourClass.toBytesWithNamedArg(namedArg);
    console.log(serializedBytes); // Logs the serialized bytes.

    Parameters

    • source: NamedArg

      The NamedArg object to serialize. It contains a name and a value.

    Returns Uint8Array

Generated using TypeDoc