Documentation
    Preparing search index...

    Class BcsType<T, Input, Name>

    A BCS type descriptor that can serialize and deserialize values of type T. Compose types using the bcs factory (e.g. bcs.struct, bcs.enum, bcs.vector).

    Type Parameters

    • T
    • Input = T
    • const Name extends string = string

    Hierarchy (View Summary)

    Index

    Constructors

    • Type Parameters

      • T
      • Input = T
      • const Name extends string = string

      Parameters

      • options: {
            kind?: string;
            name: Name;
            read: ((reader: BcsReader) => T) | (() => T);
            serialize?: (value: Input) => Uint8Array<ArrayBuffer>;
            serializedSize?: (value: Input) => number | null;
            validate?: (value: Input) => void;
            write:
                | ((value: Input, writer: BcsWriter) => void)
                | ((value: Input) => void);
        } & BcsTypeOptions<T, Input, Name>

      Returns BcsType<T, Input, Name>

    Properties

    _codec: { kind?: string; read: () => T; write: (value: Input) => void }

    Internal codec holding the fast read/write closures and an optional kind tag used by bulk encoder/decoder dispatch.

    $inferInput: Input
    $inferType: T
    name: Name
    serialize: (value: Input, options?: BcsWriterOptions) => SerializedBcs<T, Input>
    serializedSize: (value: Input, options?: BcsWriterOptions) => number | null
    validate: (value: Input) => void

    Methods

    • Parameters

      • b58: string

      Returns T

    • Parameters

      • b64: string

      Returns T

    • Parameters

      • hex: string

      Returns T

    • Parameters

      • bytes: Uint8Array

      Returns T

    • Decode from a BcsReader. Syncs the singleton decoder to the reader's state, runs the fast decode path, then syncs the position back. For the common case, use parse() instead.

      Parameters

      Returns T

    • Parameters

      Returns string

    • Parameters

      Returns string

    • Parameters

      Returns Uint8Array<ArrayBuffer>

    • Parameters

      Returns string

    • Parameters

      Returns void