bcs: { bool( options?: BcsTypeOptions<boolean, boolean>, ): BcsType<boolean, boolean>; bytes<T extends number>( size: T, options?: BcsTypeOptions<Uint8Array, Iterable<number>>, ): BcsType<Uint8Array, Iterable<number>>; enum<T extends Record<string, null | BcsType<any, any>>>( name: string, values: T, options?: Omit< BcsTypeOptions< EnumOutputShape< { [K in string | number | symbol]: T[K] extends BcsType<U, any> ? U : true }, >, EnumInputShape< { [K in string | number | symbol]: T[K] extends BcsType<any, U> ? U : null | boolean | object }, >, >, "name", >, ): BcsType< EnumOutputShape< { [K in string | number | symbol]: T[K] extends BcsType<U, any> ? U : true }, >, EnumInputShape< { [K in string | number | symbol]: T[K] extends BcsType<any, U> ? U : null | boolean | object }, >, >; fixedArray<T, Input>( size: number, type: BcsType<T, Input>, options?: BcsTypeOptions<T[], Iterable<Input> & { length: number }>, ): BcsType<T[], Iterable<Input> & { length: number }>; lazy<T extends BcsType<any, any>>(cb: () => T): T; map<K, V, InputK = K, InputV = V>( keyType: BcsType<K, InputK>, valueType: BcsType<V, InputV>, ): BcsType<Map<K, V>, Map<InputK, InputV>>; option<T, Input>( type: BcsType<T, Input>, ): BcsType<null | T, undefined | null | Input>; string(options?: BcsTypeOptions<string, string>): BcsType<string, string>; struct<T extends Record<string, BcsType<any, any>>>( name: string, fields: T, options?: Omit< BcsTypeOptions< { [K in string | number | symbol]: T[K] extends BcsType<U, any> ? U : never }, { [K in string | number | symbol]: T[K] extends BcsType<any, U> ? U : never }, >, "name", >, ): BcsType< { [K in string | number | symbol]: T[K] extends BcsType<U, any> ? U : never }, { [K in string | number | symbol]: T[K] extends BcsType<any, U> ? U : never }, >; tuple<const Types extends readonly BcsType<any, any>[]>( types: Types, options?: BcsTypeOptions< { -readonly [K in string | number | symbol]: Types[K<K>] extends BcsType<T, any> ? T : never }, { [K in string | number | symbol]: Types[K<K>] extends BcsType<any, T> ? T : never }, >, ): BcsType< { -readonly [K in string | number | symbol]: Types[K<K>] extends BcsType<T, any> ? T : never }, { [K in string | number | symbol]: Types[K<K>] extends BcsType<any, T> ? T : never }, >; u128( options?: BcsTypeOptions<string, string | number | bigint>, ): BcsType<string, string | number | bigint>; u16(options?: BcsTypeOptions<number, number>): BcsType<number, number>; u256( options?: BcsTypeOptions<string, string | number | bigint>, ): BcsType<string, string | number | bigint>; u32(options?: BcsTypeOptions<number, number>): BcsType<number, number>; u64( options?: BcsTypeOptions<string, string | number | bigint>, ): BcsType<string, string | number | bigint>; u8(options?: BcsTypeOptions<number, number>): BcsType<number, number>; uleb128(options?: BcsTypeOptions<number, number>): BcsType<number, number>; vector<T, Input>( type: BcsType<T, Input>, options?: BcsTypeOptions<T[], Iterable<Input> & { length: number }>, ): BcsType<T[], Iterable<Input> & { length: number }>;} = ... Type declaration
bool:function
bytes:function
- bytes<T extends number>(
size: T,
options?: BcsTypeOptions<Uint8Array, Iterable<number>>,
): BcsType<Uint8Array, Iterable<number>> Returns BcsType<Uint8Array, Iterable<number>>
enum:function
- enum<T extends Record<string, null | BcsType<any, any>>>(
name: string,
values: T,
options?: Omit<
BcsTypeOptions<
EnumOutputShape<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : true
},
>,
EnumInputShape<
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : null | boolean | object
},
>,
>,
"name",
>,
): BcsType<
EnumOutputShape<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : true
},
>,
EnumInputShape<
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : null | boolean | object
},
>,
> Type Parameters
- T extends Record<string, null | BcsType<any, any>>
Returns BcsType<
EnumOutputShape<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : true
},
>,
EnumInputShape<
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : null | boolean | object
},
>,
>
fixedArray:function
lazy:function
- lazy<T extends BcsType<any, any>>(cb: () => T): T
Returns T
map:function
- map<K, V, InputK = K, InputV = V>(
keyType: BcsType<K, InputK>,
valueType: BcsType<V, InputV>,
): BcsType<Map<K, V>, Map<InputK, InputV>>
option:function
string:function
struct:function
- struct<T extends Record<string, BcsType<any, any>>>(
name: string,
fields: T,
options?: Omit<
BcsTypeOptions<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : never
},
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : never
},
>,
"name",
>,
): BcsType<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : never
},
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : never
},
> Type Parameters
- T extends Record<string, BcsType<any, any>>
Parameters
- name: string
- fields: T
Optional
options: Omit<
BcsTypeOptions<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : never
},
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : never
},
>,
"name",
>
Returns BcsType<
{
[K in string
| number
| symbol]: T[K] extends BcsType<U, any> ? U : never
},
{
[K in string
| number
| symbol]: T[K] extends BcsType<any, U> ? U : never
},
>
tuple:function
- tuple<const Types extends readonly BcsType<any, any>[]>(
types: Types,
options?: BcsTypeOptions<
{
-readonly [K in string
| number
| symbol]: Types[K<K>] extends BcsType<T, any> ? T : never
},
{
[K in string
| number
| symbol]: Types[K<K>] extends BcsType<any, T> ? T : never
},
>,
): BcsType<
{
-readonly [K in string
| number
| symbol]: Types[K<K>] extends BcsType<T, any> ? T : never
},
{
[K in string
| number
| symbol]: Types[K<K>] extends BcsType<any, T> ? T : never
},
> Type Parameters
- const Types extends readonly BcsType<any, any>[]
Returns BcsType<
{
-readonly [K in string
| number
| symbol]: Types[K<K>] extends BcsType<T, any> ? T : never
},
{
[K in string
| number
| symbol]: Types[K<K>] extends BcsType<any, T> ? T : never
},
>
u128:function
- u128(
options?: BcsTypeOptions<string, string | number | bigint>,
): BcsType<string, string | number | bigint> Returns BcsType<string, string | number | bigint>
u16:function
u256:function
- u256(
options?: BcsTypeOptions<string, string | number | bigint>,
): BcsType<string, string | number | bigint> Returns BcsType<string, string | number | bigint>
u32:function
u64:function
- u64(
options?: BcsTypeOptions<string, string | number | bigint>,
): BcsType<string, string | number | bigint> Returns BcsType<string, string | number | bigint>
u8:function
uleb128:function
vector:function
Creates a BcsType that can be used to read and write boolean values.