import { ImportDatum, StaticResourceData, RenderKeyTuple, RenderField, RenderStaticField, RenderDynamicField, RenderType } from '@latticexyz/common/codegen'; import { a as Store, m as Table } from './output-DjNNBwhs.js'; import { AbiType } from '@latticexyz/config'; import { SchemaType } from '@latticexyz/schema-type/deprecated'; import '@ark/util'; import '@latticexyz/schema-type/internal'; interface RenderTableOptions { /** List of symbols to import, and their file paths */ imports: ImportDatum[]; /** Name of the library to render. */ libraryName: string; /** Name of the struct to render. If undefined, struct and its methods aren't rendered. */ structName?: string; /** Data used to statically register the table. If undefined, all methods receive `_tableId` as an argument. */ staticResourceData?: StaticResourceData; /** Path for store package imports */ storeImportPath: string; keyTuple: RenderKeyTuple[]; fields: RenderField[]; staticFields: RenderStaticField[]; dynamicFields: RenderDynamicField[]; /** Whether to render getter functions */ withGetters: boolean; /** Whether to render dynamic field methods (push, pop, update) */ withDynamicFieldMethods: boolean; /** Whether to render get/set methods for the whole record */ withRecordMethods: boolean; /** Whether to additionally render field methods without a field name suffix */ withSuffixlessFieldMethods: boolean; /** Whether to render additional methods that accept a manual `IStore` argument */ storeArgument: boolean; } /** * Returns Solidity code for all the field-specific table methods (get, set, push, pop, etc.) * @param options RenderTableOptions * @returns string of Solidity code */ declare function renderFieldMethods(options: RenderTableOptions): string; /** * Returns Solidity code for how to encode a particular field into bytes before storing onchain * @param field RenderField * @returns string of Solidity code */ declare function renderEncodeFieldSingle(field: RenderField): string; /** * Returns Solidity code for decoding a bytes value into its Solidity primitive type * @param field description of field type * @param offset byte-length offset of value in encoded bytes * @returns string of Solidity code */ declare function renderDecodeValueType(field: RenderType, offset: number): string; /** * Returns Solidity code for whole-record methods (get, set) * @param options RenderTableOptions * @returns string of Solidity code */ declare function renderRecordMethods(options: RenderTableOptions): string; /** * Returns Solidity code to prepare variables needed to store encoded record on chain * @param options RenderTableOptions * @param namePrefix optional field name prefix to change how the field is accessed * @returns string of Solidity code */ declare function renderRecordData(options: RenderTableOptions, namePrefix?: string): string; /** * Returns Solidity code for the delete record method * @param options RenderTableOptions * @returns string of Solidity code */ declare function renderDeleteRecordMethods(options: RenderTableOptions): string; /** * Renders Solidity code for a MUD table library, using the specified options * @param options options for rendering the table * @returns string of Solidity code */ declare function renderTable(options: RenderTableOptions): string; /** * Renders Solidity code for enums defined in the provided config */ declare function renderTypesFromConfig(config: Store): string; type TablegenOptions = { /** * MUD project root directory where all other relative paths are resolved from. */ rootDir: string; config: Store; }; declare function tablegen({ rootDir, config }: TablegenOptions): Promise; type UserType = { readonly type: "enum" | "userType"; readonly name: string; readonly abiType: AbiType; /** * Import path relative to the root dir or absolute path if importing from a package. * Relative paths must start with a `.` to be treated as a relative path. */ readonly importPath: string; }; interface TableOptions { /** Path where the file is expected to be written (relative to project root) */ outputPath: string; /** Name of the table, as used in filename and library name */ tableName: string; /** Options for `renderTable` function */ renderOptions: RenderTableOptions; } /** * Transforms store config and available solidity user types into useful options for `tablegen` and `renderTable` */ declare function getTableOptions({ tables, rootDir, codegenDir, userTypes, storeImportPath, }: { readonly tables: Table[]; readonly rootDir: string; /** namespace codegen output dir, relative to project root dir */ readonly codegenDir: string; readonly userTypes: readonly UserType[]; /** absolute import path or, if starting with `.`, relative to project root dir */ readonly storeImportPath: string; }): TableOptions[]; /** * Renders `DecodeSlice` library with the necessary header and imports, * which provides methods for decoding `Slice` into arrays of all primitive types * @returns string of Solidity code */ declare function renderDecodeSlice(): string; /** * Renders `EncodeArray` library with the necessary header and imports, * which provides methods for encoding arrays of all primitive types into `Slice` * @returns string of Solidity code */ declare function renderEncodeArray(): string; /** * Renders `decodeArray_*` method for decoding `Slice` into the array of provided primitive type * @param element name and byte length of the primitive type * @returns string of Solidity code */ declare function renderTightCoderDecode(element: Pick): string; /** * Renders `encode` method for encoding the array of provided primitive type into `Slice` * @param element name and byte length of the primitive type * @returns string of Solidity code */ declare function renderTightCoderEncode(element: Pick): string; declare function renderTightCoderAutoTestFunction({ typeId }: { typeId: string; }): string; declare function renderTightCoderAutoTest(): string; /** * Resolve an abi or user type into a SchemaType and RenderType */ declare function resolveAbiOrUserType(abiOrUserType: string, userTypes: readonly UserType[]): { schemaType: SchemaType; renderType: RenderType; }; declare function getSchemaTypeInfo(schemaType: SchemaType): RenderType; declare function getUserTypeInfo(userType: UserType): { schemaType: SchemaType; renderType: RenderType; }; export { type RenderTableOptions, type TableOptions, type TablegenOptions, getSchemaTypeInfo, getTableOptions, getUserTypeInfo, renderDecodeSlice, renderDecodeValueType, renderDeleteRecordMethods, renderEncodeArray, renderEncodeFieldSingle, renderFieldMethods, renderRecordData, renderRecordMethods, renderTable, renderTightCoderAutoTest, renderTightCoderAutoTestFunction, renderTightCoderDecode, renderTightCoderEncode, renderTypesFromConfig, resolveAbiOrUserType, tablegen };