@eliseev_s/tolk-tlb-transpiler
Version:
Transpile Tolk structs to TLB definitions and generate TypeScript wrappers for TON blockchain smart contracts
132 lines • 2.74 kB
TypeScript
export interface PrefixInfo {
value: number;
length: number;
format: 'hex' | 'binary';
}
export interface StructField {
name: string;
type: TolkType;
default?: any;
}
export interface TolkStruct {
name: string;
prefix?: PrefixInfo;
fields: StructField[];
annotations: AnnotationInfo[];
genericParams: GenericParam[];
}
export interface TolkConstant {
name: string;
value: number;
type?: TolkType;
}
export interface AnnotationInfo {
name: string;
parameters: any[];
}
export interface GenericParam {
name: string;
constraints?: string[];
}
export type TolkType = {
kind: 'primitive';
name: string;
} | {
kind: 'type_identifier';
name: string;
} | {
kind: 'nullable';
inner: TolkType;
} | {
kind: 'tensor';
items: TolkType[];
} | {
kind: 'tuple';
items: TolkType[];
} | {
kind: 'union';
alternatives: TolkType[];
} | {
kind: 'generic';
name: string;
params: TolkType[];
} | {
kind: 'map';
key: TolkType;
value: TolkType;
} | {
kind: 'bits';
width: number;
} | {
kind: 'bytes';
size: number;
} | {
kind: 'int';
width: number;
} | {
kind: 'uint';
width: number;
} | {
kind: 'cell_ref';
inner?: TolkType;
} | {
kind: 'special';
name: string;
} | {
kind: 'dict';
} | {
kind: 'unknown';
};
export interface TypeAliasInfo {
name: string;
underlyingType: TolkType;
genericParams: GenericParam[];
}
export interface TLBDefinition {
name: string;
statement: string[];
}
export declare enum UnionStrategy {
MAYBE_PATTERN = 0,// For T? nullable types
EITHER_PATTERN = 1,// For binary unions without prefixes
CUSTOM_PREFIX = 2
}
export interface GetMethodParameter {
name: string;
type: TolkType;
isMutable?: boolean;
defaultValue?: string;
}
export interface GetMethod {
name: string;
parameters: GetMethodParameter[];
returnType: TolkType;
annotations: AnnotationInfo[];
}
export interface WrapperConfig {
contractName: string;
storageType: string;
internalMessageType: string;
getMethods: GetMethod[];
structures: TolkStruct[];
typeAliases: TypeAliasInfo[];
}
/**
* Configuration for the new instance-based wrapper generator
*/
export interface WrapperGeneratorConfig {
contractName: string;
storageType: string;
incomingMessageType: string;
internalMessageType: string;
getMethods: GetMethod[];
structures: TolkStruct[];
typeAliases: TypeAliasInfo[];
tlbDefinitions: TLBDefinition[];
}
export interface SendMethodInfo {
name: string;
messageType: string;
parameters: StructField[];
}
//# sourceMappingURL=types.d.ts.map