Documentation
    Preparing search index...

    Variable bcsConst

    bcs: {
        fixedArray: {
            <T extends BcsType<any, any, string>, Name extends string = string>(
                size: number,
                type: T,
                options?: BcsTypeOptions<
                    InferBcsType<T>[],
                    Iterable<InferBcsInput<T>, any, any> & { length: number },
                    Name,
                >,
            ): BcsType<
                InferBcsType<T>[],
                Iterable<InferBcsInput<T>, any, any> & { length: number },
                Name,
            >;
            <T, Input, Name extends string = string>(
                size: number,
                type: BcsType<T, Input>,
                options?: BcsTypeOptions<
                    T[],
                    Iterable<Input, any, any> & { length: number },
                    Name,
                >,
            ): BcsType<T[], Iterable<Input, any, any> & { length: number }, Name>;
        };
        map: {
            <
                K extends BcsType<any, any, string>,
                V extends BcsType<any, any, string>,
            >(
                keyType: K,
                valueType: V,
            ): BcsType<
                Map<InferBcsType<K>, InferBcsType<V>>,
                Map<InferBcsInput<K>, InferBcsInput<V>>,
                `Map<${K["name"]}, ${V["name"]}>`,
            >;
            <K, V, InputK = K, InputV = V>(
                keyType: BcsType<K, InputK>,
                valueType: BcsType<V, InputV>,
            ): BcsType<Map<K, V>, Map<InputK, InputV>, `Map<${string}, ${string}>`>;
        };
        option: {
            <T extends BcsType<any, any, string>>(
                type: T,
            ): BcsType<
                InferBcsType<T>
                | null,
                InferBcsInput<T> | null | undefined,
                `Option<${T["name"]}>`,
            >;
            <T, Input, Name extends string = string>(
                type: BcsType<T, Input, Name>,
            ): BcsType<T | null, Input | null | undefined>;
        };
        vector: {
            <
                T extends BcsType<any, any, string>,
                Name extends string = `vector<${T["name"]}>`,
            >(
                type: T,
                options?: BcsTypeOptions<
                    InferBcsType<T>[],
                    Iterable<InferBcsInput<T>, any, any> & { length: number },
                    Name,
                >,
            ): BcsType<
                InferBcsType<T>[],
                Iterable<InferBcsInput<T>, any, any> & { length: number },
                Name,
            >;
            <T, Input, Name extends string = string>(
                type: BcsType<T, Input, Name>,
                options?: BcsTypeOptions<
                    T[],
                    Iterable<Input, any, any> & { length: number },
                    `vector<${Name}>`,
                >,
            ): BcsType<
                T[],
                Iterable<Input, any, any> & { length: number },
                `vector<${Name}>`,
            >;
        };
        bool(
            options?: BcsTypeOptions<boolean, boolean, string>,
        ): BcsType<boolean, boolean, "bool">;
        bytes<T extends number>(
            size: T,
            options?: BcsTypeOptions<
                Uint8Array<ArrayBufferLike>,
                Iterable<number, any, any>,
                string,
            >,
        ): BcsType<
            Uint8Array<ArrayBufferLike>,
            Iterable<number, any, any>,
            `bytes[${T}]`,
        >;
        byteVector(
            options?: BcsTypeOptions<
                Uint8Array<ArrayBufferLike>,
                Iterable<number, any, any>,
                string,
            >,
        ): BcsType<
            Uint8Array<ArrayBufferLike>,
            Iterable<number, any, any>,
            "vector<u8>",
        >;
        enum<
            T extends Record<string, BcsType<any, any, string> | null>,
            const Name extends string = string,
        >(
            name: Name,
            fields: T,
            options?: Omit<
                BcsTypeOptions<
                    EnumOutputShape<
                        {
                            [K in string
                            | number
                            | symbol]: T[K] extends BcsType<U, any, any> ? U : true
                        },
                    >,
                    EnumInputShape<
                        {
                            [K in string
                            | number
                            | symbol]: T[K] extends BcsType<any, U, any>
                                ? U
                                : boolean | object | null
                        },
                    >,
                    Name,
                >,
                "name",
            >,
        ): BcsEnum<T, Name>;
        lazy<T extends BcsType<any, any, string>>(cb: () => T): T;
        string(
            options?: BcsTypeOptions<string, string, string>,
        ): BcsType<string, string, "string">;
        struct<
            T extends Record<string, BcsType<any, any, string>>,
            const Name extends string = string,
        >(
            name: Name,
            fields: T,
            options?: Omit<
                BcsTypeOptions<
                    {
                        [K in string
                        | number
                        | symbol]: T[K] extends BcsType<U, any, string> ? U : never
                    },
                    {
                        [K in string
                        | number
                        | symbol]: T[K] extends BcsType<any, U, string> ? U : never
                    },
                    string,
                >,
                "name",
            >,
        ): BcsStruct<T, string>;
        tuple<
            const T extends readonly BcsType<any, any, string>[],
            const Name extends
                string = `(${JoinString<
                {
                    [K in string
                    | number
                    | symbol]: T[K] extends BcsType<any, any, T> ? T : never
                },
                ", ",
            >})`,
        >(
            fields: T,
            options?: BcsTypeOptions<
                {
                    -readonly [K in string
                    | number
                    | symbol]: T[K] extends BcsType<T, any, string> ? T : never
                },
                {
                    [K in string
                    | number
                    | symbol]: T[K] extends BcsType<any, T, string> ? T : never
                },
                Name,
            >,
        ): BcsTuple<T, Name>;
        u128(
            options?: BcsTypeOptions<string, string | number | bigint, string>,
        ): BcsType<string, string | number | bigint, "u128">;
        u16(
            options?: BcsTypeOptions<number, number, string>,
        ): BcsType<number, number, "u16">;
        u256(
            options?: BcsTypeOptions<string, string | number | bigint, string>,
        ): BcsType<string, string | number | bigint, "u256">;
        u32(
            options?: BcsTypeOptions<number, number, string>,
        ): BcsType<number, number, "u32">;
        u64(
            options?: BcsTypeOptions<string, string | number | bigint, string>,
        ): BcsType<string, string | number | bigint, "u64">;
        u8(
            options?: BcsTypeOptions<number, number, string>,
        ): BcsType<number, number, "u8">;
        uleb128(
            options?: BcsTypeOptions<number, number, string>,
        ): BcsType<number, number, "uleb128">;
    } = ...

    Type Declaration

    • fixedArray: {
          <T extends BcsType<any, any, string>, Name extends string = string>(
              size: number,
              type: T,
              options?: BcsTypeOptions<
                  InferBcsType<T>[],
                  Iterable<InferBcsInput<T>, any, any> & { length: number },
                  Name,
              >,
          ): BcsType<
              InferBcsType<T>[],
              Iterable<InferBcsInput<T>, any, any> & { length: number },
              Name,
          >;
          <T, Input, Name extends string = string>(
              size: number,
              type: BcsType<T, Input>,
              options?: BcsTypeOptions<
                  T[],
                  Iterable<Input, any, any> & { length: number },
                  Name,
              >,
          ): BcsType<T[], Iterable<Input, any, any> & { length: number }, Name>;
      }
    • map: {
          <
              K extends BcsType<any, any, string>,
              V extends BcsType<any, any, string>,
          >(
              keyType: K,
              valueType: V,
          ): BcsType<
              Map<InferBcsType<K>, InferBcsType<V>>,
              Map<InferBcsInput<K>, InferBcsInput<V>>,
              `Map<${K["name"]}, ${V["name"]}>`,
          >;
          <K, V, InputK = K, InputV = V>(
              keyType: BcsType<K, InputK>,
              valueType: BcsType<V, InputV>,
          ): BcsType<Map<K, V>, Map<InputK, InputV>, `Map<${string}, ${string}>`>;
      }
    • option: {
          <T extends BcsType<any, any, string>>(
              type: T,
          ): BcsType<
              InferBcsType<T>
              | null,
              InferBcsInput<T> | null | undefined,
              `Option<${T["name"]}>`,
          >;
          <T, Input, Name extends string = string>(
              type: BcsType<T, Input, Name>,
          ): BcsType<T | null, Input | null | undefined>;
      }
    • vector: {
          <
              T extends BcsType<any, any, string>,
              Name extends string = `vector<${T["name"]}>`,
          >(
              type: T,
              options?: BcsTypeOptions<
                  InferBcsType<T>[],
                  Iterable<InferBcsInput<T>, any, any> & { length: number },
                  Name,
              >,
          ): BcsType<
              InferBcsType<T>[],
              Iterable<InferBcsInput<T>, any, any> & { length: number },
              Name,
          >;
          <T, Input, Name extends string = string>(
              type: BcsType<T, Input, Name>,
              options?: BcsTypeOptions<
                  T[],
                  Iterable<Input, any, any> & { length: number },
                  `vector<${Name}>`,
              >,
          ): BcsType<
              T[],
              Iterable<Input, any, any> & { length: number },
              `vector<${Name}>`,
          >;
      }
    • bool: function
      • Parameters

        Returns BcsType<boolean, boolean, "bool">

    • bytes: function
      • Type Parameters

        • T extends number

        Parameters

        • size: T
        • Optionaloptions: BcsTypeOptions<Uint8Array<ArrayBufferLike>, Iterable<number, any, any>, string>

        Returns BcsType<Uint8Array<ArrayBufferLike>, Iterable<number, any, any>, `bytes[${T}]`>

    • byteVector: function
      • Parameters

        • Optionaloptions: BcsTypeOptions<Uint8Array<ArrayBufferLike>, Iterable<number, any, any>, string>

        Returns BcsType<Uint8Array<ArrayBufferLike>, Iterable<number, any, any>, "vector<u8>">

    • enum: function
      • Type Parameters

        • T extends Record<string, BcsType<any, any, string> | null>
        • const Name extends string = string

        Parameters

        • name: Name
        • fields: T
        • Optionaloptions: Omit<
              BcsTypeOptions<
                  EnumOutputShape<
                      {
                          [K in string
                          | number
                          | symbol]: T[K] extends BcsType<U, any, any> ? U : true
                      },
                  >,
                  EnumInputShape<
                      {
                          [K in string
                          | number
                          | symbol]: T[K] extends BcsType<any, U, any>
                              ? U
                              : boolean | object | null
                      },
                  >,
                  Name,
              >,
              "name",
          >

        Returns BcsEnum<T, Name>

    • lazy: function
      • Type Parameters

        • T extends BcsType<any, any, string>

        Parameters

        • cb: () => T

        Returns T

    • string: function
      • Parameters

        Returns BcsType<string, string, "string">

    • struct: function
      • Type Parameters

        • T extends Record<string, BcsType<any, any, string>>
        • const Name extends string = string

        Parameters

        • name: Name
        • fields: T
        • Optionaloptions: Omit<
              BcsTypeOptions<
                  {
                      [K in string
                      | number
                      | symbol]: T[K] extends BcsType<U, any, string> ? U : never
                  },
                  {
                      [K in string
                      | number
                      | symbol]: T[K] extends BcsType<any, U, string> ? U : never
                  },
                  string,
              >,
              "name",
          >

        Returns BcsStruct<T, string>

    • tuple: function
      • Type Parameters

        • const T extends readonly BcsType<any, any, string>[]
        • const Name extends string = `(${JoinString<
              {
                  [K in string
                  | number
                  | symbol]: T[K] extends BcsType<any, any, T> ? T : never
              },
              ", ",
          >})`

        Parameters

        • fields: T
        • Optionaloptions: BcsTypeOptions<
              {
                  -readonly [K in string
                  | number
                  | symbol]: T[K] extends BcsType<T, any, string> ? T : never
              },
              {
                  [K in string
                  | number
                  | symbol]: T[K] extends BcsType<any, T, string> ? T : never
              },
              Name,
          >

        Returns BcsTuple<T, Name>

    • u128: function
      • Parameters

        • Optionaloptions: BcsTypeOptions<string, string | number | bigint, string>

        Returns BcsType<string, string | number | bigint, "u128">

    • u16: function
      • Parameters

        Returns BcsType<number, number, "u16">

    • u256: function
      • Parameters

        • Optionaloptions: BcsTypeOptions<string, string | number | bigint, string>

        Returns BcsType<string, string | number | bigint, "u256">

    • u32: function
      • Parameters

        Returns BcsType<number, number, "u32">

    • u64: function
      • Parameters

        • Optionaloptions: BcsTypeOptions<string, string | number | bigint, string>

        Returns BcsType<string, string | number | bigint, "u64">

    • u8: function
      • Parameters

        Returns BcsType<number, number, "u8">

    • uleb128: function
      • Parameters

        Returns BcsType<number, number, "uleb128">