import { bits as _bits, BitStructure as _BitStructure, blob as _blob, Blob as _Blob, cstr as _cstr, f32 as _f32, f32be as _f32be, f64 as _f64, f64be as _f64be, greedy as _greedy, Layout as _Layout, ns64 as _ns64, ns64be as _ns64be, nu64 as _nu64, nu64be as _nu64be, offset as _offset, s16 as _s16, s16be as _s16be, s24 as _s24, s24be as _s24be, s32 as _s32, s32be as _s32be, s40 as _s40, s40be as _s40be, s48 as _s48, s48be as _s48be, s8 as _s8, seq as _seq, struct as _struct, Structure as _Structure, u16 as _u16, u16be as _u16be, u24 as _u24, u24be as _u24be, u32 as _u32, u32be as _u32be, u40 as _u40, u40be as _u40be, u48 as _u48, u48be as _u48be, u8 as _u8, UInt as _UInt, union as _union, Union as _Union, unionLayoutDiscriminator as _unionLayoutDiscriminator, utf8 as _utf8, } from "@solana/buffer-layout"; //#region ------------------- Layout ------------------- export interface Layout { span: number; property?: P; decode(b: Buffer, offset?: number): T; encode(src: T, b: Buffer, offset?: number): number; getSpan(b: Buffer, offset?: number): number; replicate(name: AP): Layout; } export interface LayoutConstructor { new (): Layout; // for class extends syntex new (span?: T, property?: P): Layout; readonly prototype: Layout; } export const Layout = _Layout as unknown as LayoutConstructor; //#endregion //#region ------------------- Structure ------------------- // eslint-disable-next-line @typescript-eslint/no-unused-vars export interface Structure extends Layout { span: number; decode(b: Buffer, offset?: number): DecodeSchema; layoutFor(property: AP): Layout; offsetOf(property: AP): number; } interface StructureConstructor { new (): Structure; new ( fields: T, property?: P, decodePrefixes?: boolean, ): Structure; } export const Structure = _Structure as unknown as StructureConstructor; //#endregion //#region ------------------- Union ------------------- export interface Union extends Layout { registry: object; decode(b: Buffer, offset?: number): Partial; addVariant( variant: number, layout: Structure> | Layout, property?: string, ): any /* TEMP: code in Layout.js 1809 */; } interface UnionConstructor { new (): Union; new ( discr: Layout, defaultLayout: Layout, property?: string, ): Union; } export const Union = _Union as unknown as UnionConstructor; //#endregion //#region ------------------- BitStructure ------------------- export type BitStructure = Layout; interface BitStructureConstructor { new (...params: any[]): BitStructure; } export const BitStructure = _BitStructure as BitStructureConstructor; //#endregion //#region ------------------- UInt ------------------- export type UInt = Layout; interface UIntConstructor { new (span?: T, property?: P): UInt; } export const UInt = _UInt as UIntConstructor; //#endregion //#region ------------------- Blob ------------------- export type Blob

= Layout; interface BlobConstructor { new (...params: ConstructorParameters): Blob; } export const Blob = _Blob as unknown as BlobConstructor; //#endregion export const greedy = _greedy as

(elementSpan?: number, property?: P) => Layout; export const u8 = _u8 as

(property?: P) => Layout; export const u16 = _u16 as

(property?: P) => Layout; export const u24 = _u24 as

(property?: P) => Layout; export const u32 = _u32 as

(property?: P) => Layout; export const u40 = _u40 as

(property?: P) => Layout; export const u48 = _u48 as

(property?: P) => Layout; export const nu64 = _nu64 as

(property?: P) => Layout; export const u16be = _u16be as

(property?: P) => Layout; export const u24be = _u24be as

(property?: P) => Layout; export const u32be = _u32be as

(property?: P) => Layout; export const u40be = _u40be as

(property?: P) => Layout; export const u48be = _u48be as

(property?: P) => Layout; export const nu64be = _nu64be as

(property?: P) => Layout; export const s8 = _s8 as

(property?: P) => Layout; export const s16 = _s16 as

(property?: P) => Layout; export const s24 = _s24 as

(property?: P) => Layout; export const s32 = _s32 as

(property?: P) => Layout; export const s40 = _s40 as

(property?: P) => Layout; export const s48 = _s48 as

(property?: P) => Layout; export const ns64 = _ns64 as

(property?: P) => Layout; export const s16be = _s16be as

(property?: P) => Layout; export const s24be = _s24be as

(property?: P) => Layout; export const s32be = _s32be as

(property?: P) => Layout; export const s40be = _s40be as

(property?: P) => Layout; export const s48be = _s48be as

(property?: P) => Layout; export const ns64be = _ns64be as

(property?: P) => Layout; export const f32 = _f32 as

(property?: P) => Layout; export const f32be = _f32be as

(property?: P) => Layout; export const f64 = _f64 as

(property?: P) => Layout; export const f64be = _f64be as

(property?: P) => Layout; export const struct = _struct as ( fields: T, property?: P, decodePrefixes?: boolean, ) => T extends Layout[] ? Structure< Value, P, { [K in Exclude, "">]: Extract> extends Layout ? V : any; } > : any; export const seq = _seq as unknown as ( elementLayout: Layout, count: number | Layout, property?: P, ) => Layout; export const union = _union as ( discr: Layout, defaultLayout?: any, property?: string, ) => Union; export const unionLayoutDiscriminator = _unionLayoutDiscriminator as

( layout: Layout, property?: P, ) => any; export const blob = _blob as unknown as

( length: number | Layout, property?: P, ) => Blob

; export const cstr = _cstr as

(property?: P) => Layout; export const utf8 = _utf8 as

(maxSpan: number, property?: P) => Layout; export const bits = _bits as unknown as ( word: Layout, msb?: boolean, property?: P, ) => BitStructure; // TODO: not quite sure export const offset = _offset as unknown as ( layout: Layout, offset?: number, property?: P, ) => Layout; export type GetStructureSchema = T extends Structure ? S : unknown;