import { RenderType, ImportDatum, StaticResourceData, RenderKeyTuple, RenderField, RenderStaticField } from '@latticexyz/common/codegen'; import { TableOptions } from '@latticexyz/store/codegen'; import { a as TableIdx, S as StoreIdxsConfig } from './output-BkDh1xax.js'; import { AbiType } from '@latticexyz/config'; import { Store } from '@latticexyz/store'; import { Hex } from 'viem'; /** * Renders solidity typecasts to get from `bytes32` to the given type * @param name variable name to be typecasted * @param param1 type data */ declare function renderBytes32ToValueType(name: string, { typeUnwrap, internalTypeId }: Pick): string; interface RenderWithStoreArgCallbackData { _typedStore: string | undefined; _store: string | undefined; } declare function renderWithStoreArg(storeArgument: boolean, callback: (data: RenderWithStoreArgCallbackData) => string): string; interface RenderTableIdxOptions { /** List of symbols to import, and their file paths */ imports: ImportDatum[]; /** Name of the library to render. */ libraryName: string; unique: boolean; /** Data used to statically register the table. If undefined, all relevant methods receive `_sourceTableId` as an argument. */ staticResourceData?: StaticResourceData; /** Path for store package imports */ storeImportPath: string; idxImportPath: string; keyTuple: RenderKeyTuple[]; fields: RenderField[]; selectedKeys: RenderStaticField[]; selectedKeyIndexes: Uint8Array; selectedFields: RenderField[]; selectedFieldIndexes: Uint8Array; /** Whether to render additional methods that accept a manual `IStore` argument */ storeArgument: boolean; } 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 TableIdxOptions { /** Path where the file is expected to be written (relative to project root) */ outputPath: string; /** Name of the idx, as used in filename and library name */ idxName: string; /** Options for `renderTableIdx` function */ renderOptions: RenderTableIdxOptions; } /** * Transforms store and idx configs into useful options for `idxgen` and `renderTableIdx` */ declare function getTableIdxOptions({ tableOptions, tableIdxs, rootDir, codegenDir, userTypes, idxImportPath, }: { readonly tableOptions: TableOptions; readonly tableIdxs: TableIdx[]; 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 idxImportPath: string; }): TableIdxOptions[]; type IdxgenOptions = { /** * MUD project root directory where all other relative paths are resolved from. */ rootDir: string; idxsConfig: StoreIdxsConfig; storeConfig: Store; }; declare function idxgen({ rootDir, idxsConfig, storeConfig }: IdxgenOptions): Promise; /** * Renders the necessary helper functions to typecast from the types of given keys * */ declare function renderFromKeyTypeHelpers(options: { keyTuple: RenderKeyTuple[]; }): string; /** * Renders Solidity code for a table idx library, using the specified options * @param options options for rendering the table idx * @returns string of Solidity code */ declare function renderTableIdx(options: RenderTableIdxOptions): string; declare function renderDecodeKeyTuple(keyTuple: RenderKeyTuple[]): string; declare function renderUint8Map(array: Uint8Array): `0x${string}`; declare function uint8ArrayToBytemap(array: Uint8Array): Hex; export { type IdxgenOptions, type RenderTableIdxOptions, type TableIdxOptions, getTableIdxOptions, idxgen, renderBytes32ToValueType, renderDecodeKeyTuple, renderFromKeyTypeHelpers, renderTableIdx, renderUint8Map, renderWithStoreArg, uint8ArrayToBytemap };