@latticexyz/common 2.2.18-9fa07c8489f1fbf167d0db01cd9aaa645a29c8e2 → 2.2.18-c44207f620a38653497b78db0b71f5de7bc1a940

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/dist/actions.js +1 -39
  2. package/dist/actions.js.map +1 -1
  3. package/dist/chains.js +1 -75
  4. package/dist/chains.js.map +1 -1
  5. package/dist/chunk-6FIKI2CG.js +2 -0
  6. package/dist/{chunk-MYWRXQQH.js.map → chunk-6FIKI2CG.js.map} +1 -1
  7. package/dist/chunk-DPUUE7NM.js +2 -0
  8. package/dist/{chunk-Z6SVAIZN.js.map → chunk-DPUUE7NM.js.map} +1 -1
  9. package/dist/chunk-QQCZY3XJ.js +2 -0
  10. package/dist/{chunk-MF5NFUW7.js.map → chunk-QQCZY3XJ.js.map} +1 -1
  11. package/dist/chunk-TCWGPC6G.js +2 -0
  12. package/dist/{chunk-MK6UECU7.js.map → chunk-TCWGPC6G.js.map} +1 -1
  13. package/dist/chunk-ZIUX7JCQ.js +2 -0
  14. package/dist/{chunk-D4GDXAMP.js.map → chunk-ZIUX7JCQ.js.map} +1 -1
  15. package/dist/chunk-ZV2KGJCD.js +2 -0
  16. package/dist/{chunk-IYZZFDNO.js.map → chunk-ZV2KGJCD.js.map} +1 -1
  17. package/dist/codegen.js +49 -706
  18. package/dist/codegen.js.map +1 -1
  19. package/dist/errors.js +1 -6
  20. package/dist/foundry.js +2 -71
  21. package/dist/foundry.js.map +1 -1
  22. package/dist/index.js +1 -233
  23. package/dist/index.js.map +1 -1
  24. package/dist/internal.js +9 -205
  25. package/dist/internal.js.map +1 -1
  26. package/dist/kms.js +1 -168
  27. package/dist/kms.js.map +1 -1
  28. package/dist/utils.js +1 -122
  29. package/dist/utils.js.map +1 -1
  30. package/package.json +16 -104
  31. package/dist/actions.cjs +0 -334
  32. package/dist/actions.cjs.map +0 -1
  33. package/dist/actions.d.cts +0 -27
  34. package/dist/chains.cjs +0 -106
  35. package/dist/chains.cjs.map +0 -1
  36. package/dist/chains.d.cts +0 -968
  37. package/dist/chunk-D4GDXAMP.js +0 -64
  38. package/dist/chunk-IYZZFDNO.js +0 -16
  39. package/dist/chunk-MF5NFUW7.js +0 -12
  40. package/dist/chunk-MK6UECU7.js +0 -11
  41. package/dist/chunk-MYWRXQQH.js +0 -208
  42. package/dist/chunk-Z6SVAIZN.js +0 -70
  43. package/dist/codegen.cjs +0 -889
  44. package/dist/codegen.cjs.map +0 -1
  45. package/dist/codegen.d.cts +0 -228
  46. package/dist/errors.cjs +0 -38
  47. package/dist/errors.cjs.map +0 -1
  48. package/dist/errors.d.cts +0 -5
  49. package/dist/foundry.cjs +0 -105
  50. package/dist/foundry.cjs.map +0 -1
  51. package/dist/foundry.d.cts +0 -69
  52. package/dist/getContract-CA0EdVg6.d.cts +0 -20
  53. package/dist/index.cjs +0 -597
  54. package/dist/index.cjs.map +0 -1
  55. package/dist/index.d.cts +0 -160
  56. package/dist/internal.cjs +0 -459
  57. package/dist/internal.cjs.map +0 -1
  58. package/dist/internal.d.cts +0 -36
  59. package/dist/kms.cjs +0 -204
  60. package/dist/kms.cjs.map +0 -1
  61. package/dist/kms.d.cts +0 -18
  62. package/dist/type-utils.cjs +0 -19
  63. package/dist/type-utils.cjs.map +0 -1
  64. package/dist/type-utils.d.cts +0 -19
  65. package/dist/utils.cjs +0 -174
  66. package/dist/utils.cjs.map +0 -1
  67. package/dist/utils.d.cts +0 -40
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/codegen/index.ts","../src/codegen/render-solidity/abiToInterface.ts","../src/resourceToHex.ts","../src/hexToResource.ts","../src/resourceTypes.ts","../src/resourceToLabel.ts","../src/codegen/render-solidity/renderImportPath.ts","../src/codegen/render-solidity/common.ts","../src/codegen/render-solidity/renderEnums.ts","../src/codegen/render-solidity/renderTypeHelpers.ts","../src/codegen/render-typescript/schemaTypesToRecsTypeStrings.ts","../src/codegen/utils/contractToInterface.ts","../src/errors/MUDError.ts","../src/codegen/utils/format.ts","../src/codegen/utils/formatAndWrite.ts","../src/debug.ts","../src/codegen/debug.ts"],"sourcesContent":["import \"./modules.d\";\nexport * from \"./render-solidity\";\nexport * from \"./render-typescript\";\nexport * from \"./utils\";\n","import { AbiParameter, Hex } from \"viem\";\nimport { Abi, AbiError, AbiFunction, formatAbiItem, formatAbiParameter } from \"abitype\";\nimport { renderedSolidityHeader } from \"./common\";\nimport { hexToResource } from \"../../hexToResource\";\n\nfunction formatParam(param: AbiParameter): string {\n // return param.type === \"string\" || param.type === \"bytes\" || param.type === \"tuple\" || param.type.endsWith(\"]\")\n // ? `${formatAbiParameter(param)} memory`\n // : formatAbiParameter(param);\n return formatAbiParameter(param);\n}\n\nfunction formatFunction(item: AbiFunction): string {\n const params = item.inputs.map(formatParam).join(\", \");\n const returns = item.outputs.map(formatParam).join(\", \");\n return `function ${item.name}(${params}) external${returns.length ? ` returns (${returns})` : \"\"}`;\n}\n\nfunction formatSystemId(systemId: Hex): string {\n const resource = hexToResource(systemId);\n return `\n // equivalent to \\`WorldResourceIdLib.encode({ namespace: ${JSON.stringify(\n resource.namespace,\n )}, name: ${JSON.stringify(resource.name)}, typeId: RESOURCE_SYSTEM });\\`\n ResourceId constant systemId = ResourceId.wrap(${systemId});\n `;\n}\n\nexport type AbiToInterfaceOptions = {\n name: string;\n systemId?: Hex;\n abi: Abi;\n};\n\nexport function abiToInterface({ name, systemId, abi }: AbiToInterfaceOptions): string {\n const imports = systemId ? [`{ ResourceId } from \"@latticexyz/store/src/ResourceId.sol\"`] : [];\n const errors = abi.filter((item): item is AbiError => item.type === \"error\");\n const functions = abi.filter((item): item is AbiFunction => item.type === \"function\");\n\n return `\n ${renderedSolidityHeader}\n\n ${imports.map((item) => `import ${item};`).join(\"\\n\")}\n\n ${systemId ? formatSystemId(systemId) : \"\"}\n\n interface ${name} {\n ${errors.map((item) => `${formatAbiItem(item)};`).join(\"\\n\")}\n\n ${functions\n .map((item) => {\n if ([...item.inputs, ...item.outputs].some((param) => param.type.startsWith(\"tuple\"))) {\n return `// TODO: replace tuple with struct\\n// ${formatFunction(item)};`;\n }\n return `${formatFunction(item)};`;\n })\n .join(\"\\n\")}\n }\n `;\n}\n","import { Hex, stringToHex, concatHex } from \"viem\";\nimport { Resource } from \"./common\";\nimport { ResourceType } from \"./resourceTypes\";\n\n/** @internal */\nexport const resourceTypeIds = {\n // keep these in sync with storeResourceTypes.sol\n table: \"tb\",\n offchainTable: \"ot\",\n // keep these in sync with worldResourceTypes.sol\n namespace: \"ns\",\n system: \"sy\",\n} as const satisfies Record<ResourceType, string>;\n\nexport function resourceToHex(resource: Omit<Resource, \"resourceId\">): Hex {\n const typeId = resourceTypeIds[resource.type];\n // Because namespaces are tied to access control, it's not safe to automatically truncate. Instead, we'll throw an error.\n if (resource.namespace.length > 14) {\n throw new Error(`Namespaces must fit into \\`bytes14\\`, but \"${resource.namespace}\" is too long.`);\n }\n return concatHex([\n stringToHex(typeId, { size: 2 }),\n stringToHex(resource.namespace, { size: 14 }),\n stringToHex(resource.name.slice(0, 16), { size: 16 }),\n ]);\n}\n","import { Hex, hexToString, sliceHex } from \"viem\";\nimport { Resource } from \"./common\";\nimport { ResourceType, resourceTypes } from \"./resourceTypes\";\nimport { resourceTypeIds } from \"./resourceToHex\";\nimport { ReverseMap } from \"./type-utils/common\";\nimport { resourceToLabel } from \"./resourceToLabel\";\n\nconst resourceTypeIdToType = Object.fromEntries(\n Object.entries(resourceTypeIds).map(([key, value]) => [value, key]),\n) as ReverseMap<typeof resourceTypeIds>;\n\nfunction getResourceType(resourceTypeId: string): ResourceType | undefined {\n // TODO: replace Partial with `noUncheckedIndexedAccess`\n const type = (resourceTypeIdToType as Partial<Record<string, ResourceType>>)[resourceTypeId];\n if (resourceTypes.includes(type as ResourceType)) {\n return type;\n }\n}\n\nexport function hexToResource(hex: Hex): Resource {\n const resourceTypeId = hexToString(sliceHex(hex, 0, 2)).replace(/\\0+$/, \"\");\n const type = getResourceType(resourceTypeId);\n const namespace = hexToString(sliceHex(hex, 2, 16)).replace(/\\0+$/, \"\");\n const name = hexToString(sliceHex(hex, 16, 32)).replace(/\\0+$/, \"\");\n\n if (!type) {\n throw new Error(`Unknown type (${resourceTypeId}) for resource (${resourceToLabel({ namespace, name })})`);\n }\n\n return { resourceId: hex, type, namespace, name };\n}\n","export const resourceTypes = [\"table\", \"offchainTable\", \"namespace\", \"system\"] as const;\n\nexport type ResourceType = (typeof resourceTypes)[number];\n","const rootNamespace = \"\";\n\nexport type ResourceLabel<\n namespace extends string = string,\n name extends string = string,\n> = namespace extends typeof rootNamespace ? name : `${namespace}__${name}`;\n\nexport function resourceToLabel<namespace extends string, name extends string>({\n namespace,\n name,\n}: {\n readonly namespace: namespace;\n readonly name: name;\n}): ResourceLabel<namespace, name> {\n return (namespace === rootNamespace ? name : `${namespace}__${name}`) as ResourceLabel<namespace, name>;\n}\n","import path from \"node:path\";\n\n// This will probably break for backslash-escaped POSIX paths,\n// but we'll worry about that later.\nfunction winToPosix(segment: string): string {\n return segment.replaceAll(path.win32.sep, path.posix.sep);\n}\n\nexport function renderImportPath(basePath: string, ...segments: readonly string[]): string {\n // Solidity compiler expects POSIX paths\n const fullPath = path.posix\n .join(winToPosix(basePath), ...segments.map(winToPosix))\n // remove trailing slash\n .replace(/\\/$/, \"\");\n\n // `path.join` strips the leading `./`\n // so if we started with a relative path, make it relative again\n if (basePath.startsWith(\".\")) {\n const relativePath = \"./\" + fullPath;\n return relativePath.replace(/^(\\.\\/)+\\./, \".\");\n }\n\n return fullPath;\n}\n","import { ImportDatum, StaticResourceData, RenderKeyTuple, RenderType } from \"./types\";\nimport { resourceToHex } from \"../../resourceToHex\";\nimport { hexToResource } from \"../../hexToResource\";\nimport { renderImportPath } from \"./renderImportPath\";\n\n/**\n * Common header for all codegenerated solidity files\n */\nexport const renderedSolidityHeader = `// SPDX-License-Identifier: MIT\npragma solidity >=0.8.24;\n\n/* Autogenerated file. Do not edit manually. */`;\n\n/**\n * Renders a list of lines\n */\nexport function renderList<T>(list: T[], renderItem: (item: T, index: number) => string): string {\n return internalRenderList(\"\", list, renderItem);\n}\n\n/**\n * Renders a comma-separated list of arguments for solidity functions, ignoring empty and undefined ones\n */\nexport function renderArguments(args: (string | undefined)[]): string {\n const filteredArgs = args.filter((arg) => arg !== undefined && arg !== \"\") as string[];\n return internalRenderList(\",\", filteredArgs, (arg) => arg);\n}\n\ninterface RenderedCommonData {\n /** `_tableId` variable prefixed with its type (empty string if absent) */\n _typedTableId: string;\n /** Comma-separated table key names prefixed with their types (empty string if 0 keys) */\n _typedKeyArgs: string;\n /** Definition and initialization of the dynamic `_keyTuple` bytes32 array */\n _keyTupleDefinition: string;\n}\n\n/**\n * Renders some solidity statements commonly used within table libraries\n * @param param0.staticResourceData static data about the table library\n * @param param0.keyTuple key tuple of the table library\n * @returns Rendered statement strings\n */\nexport function renderCommonData({\n staticResourceData,\n keyTuple,\n}: {\n staticResourceData?: StaticResourceData;\n keyTuple: RenderKeyTuple[];\n}): RenderedCommonData {\n // static resource means static tableId as well, and no tableId arguments\n const _typedTableId = staticResourceData ? \"\" : \"ResourceId _tableId\";\n const _typedKeyArgs = renderArguments(keyTuple.map(({ name, typeWithLocation }) => `${typeWithLocation} ${name}`));\n\n const _keyTupleDefinition = `\n bytes32[] memory _keyTuple = new bytes32[](${keyTuple.length});\n ${renderList(keyTuple, (key, index) => `_keyTuple[${index}] = ${renderValueTypeToBytes32(key.name, key)};`)}\n `;\n\n return {\n _typedTableId,\n _typedKeyArgs,\n _keyTupleDefinition,\n };\n}\n\n/**\n * Aggregates, deduplicates and renders imports for symbols per path.\n * Identical symbols from different paths are NOT handled, they should be checked before rendering.\n */\nexport function renderImports(imports: ImportDatum[]): string {\n // Aggregate symbols by import path, also deduplicating them\n const aggregatedImports = new Map<string, Set<string>>();\n for (const { symbol, path } of imports) {\n if (!aggregatedImports.has(path)) {\n aggregatedImports.set(path, new Set());\n }\n aggregatedImports.get(path)?.add(symbol);\n }\n // Render imports\n const renderedImports = [];\n for (const [path, symbols] of aggregatedImports) {\n const renderedSymbols = [...symbols].join(\", \");\n renderedImports.push(`import { ${renderedSymbols} } from \"${renderImportPath(path)}\";`);\n }\n return renderedImports.join(\"\\n\");\n}\n\ninterface RenderWithStoreCallbackData {\n /** `_store` variable prefixed with its type (undefined if library name) */\n _typedStore: string | undefined;\n /** `_store` variable (undefined if library name) */\n _store: string;\n /** Empty string if storeArgument is false, otherwise `\" (using the specified store)\"` */\n _commentSuffix: string;\n /** Prefix to differentiate different kinds of store usage within methods */\n _methodNamePrefix: string;\n /** Whether FieldLayout variable should be passed to store methods */\n _useExplicitFieldLayout?: boolean;\n}\n\n/**\n * Renders several versions of the callback's result, which access Store in different ways\n * @param storeArgument whether to render a version with `IStore _store` as an argument\n * @param callback renderer for a method which uses store\n * @returns Concatenated results of all callback calls\n */\nexport function renderWithStore(\n storeArgument: boolean,\n callback: (data: RenderWithStoreCallbackData) => string,\n): string {\n let result = \"\";\n result += callback({ _typedStore: undefined, _store: \"StoreSwitch\", _commentSuffix: \"\", _methodNamePrefix: \"\" });\n result += callback({\n _typedStore: undefined,\n _store: \"StoreCore\",\n _commentSuffix: \"\",\n _methodNamePrefix: \"_\",\n _useExplicitFieldLayout: true,\n });\n\n if (storeArgument) {\n result +=\n \"\\n\" +\n callback({\n _typedStore: \"IStore _store\",\n _store: \"_store\",\n _commentSuffix: \" (using the specified store)\",\n _methodNamePrefix: \"\",\n });\n }\n\n return result;\n}\n\n/**\n * Renders several versions of the callback's result, which have different method name suffixes\n * @param withSuffixlessFieldMethods whether to render methods with an empty suffix\n * @param fieldName name of the field which the methods access, used for a suffix\n * @param callback renderer for a method to be suffixed\n * @returns Concatenated results of all callback calls\n */\nexport function renderWithFieldSuffix(\n withSuffixlessFieldMethods: boolean,\n fieldName: string,\n callback: (_methodNameSuffix: string) => string,\n): string {\n const methodNameSuffix = `${fieldName[0].toUpperCase()}${fieldName.slice(1)}`;\n let result = \"\";\n result += callback(methodNameSuffix);\n\n if (withSuffixlessFieldMethods) {\n result += \"\\n\" + callback(\"\");\n }\n\n return result;\n}\n\n/**\n * Renders `_tableId` definition of the given table.\n * @param param0 static resource data needed to construct the table ID\n */\nexport function renderTableId({\n namespace,\n name,\n offchainOnly,\n}: Pick<StaticResourceData, \"namespace\" | \"name\" | \"offchainOnly\">): string {\n const tableId = resourceToHex({\n type: offchainOnly ? \"offchainTable\" : \"table\",\n namespace,\n name,\n });\n // turn table ID back into arguments that would be valid in `WorldResourceIdLib.encode` (like truncated names)\n const resource = hexToResource(tableId);\n return `\n // Hex below is the result of \\`WorldResourceIdLib.encode({ namespace: ${JSON.stringify(\n resource.namespace,\n )}, name: ${JSON.stringify(resource.name)}, typeId: ${offchainOnly ? \"RESOURCE_OFFCHAIN_TABLE\" : \"RESOURCE_TABLE\"} });\\`\n ResourceId constant _tableId = ResourceId.wrap(${tableId});\n `;\n}\n\n/**\n * Renders solidity typecasts to get from the given type to `bytes32`\n * @param name variable name to be typecasted\n * @param param1 type data\n */\nexport function renderValueTypeToBytes32(\n name: string,\n { typeUnwrap, internalTypeId }: Pick<RenderType, \"typeUnwrap\" | \"internalTypeId\">,\n): string {\n const innerText = typeUnwrap.length ? `${typeUnwrap}(${name})` : name;\n\n if (internalTypeId === \"bytes32\") {\n return innerText;\n } else if (/^bytes\\d{1,2}$/.test(internalTypeId)) {\n return `bytes32(${innerText})`;\n } else if (/^uint\\d{1,3}$/.test(internalTypeId)) {\n return `bytes32(uint256(${innerText}))`;\n } else if (/^int\\d{1,3}$/.test(internalTypeId)) {\n return `bytes32(uint256(int256(${innerText})))`;\n } else if (internalTypeId === \"address\") {\n return `bytes32(uint256(uint160(${innerText})))`;\n } else if (internalTypeId === \"bool\") {\n return `_boolToBytes32(${innerText})`;\n } else {\n throw new Error(`Unknown value type id ${internalTypeId}`);\n }\n}\n\n/**\n * Whether the storage representation of the given solidity type is left aligned\n */\nexport function isLeftAligned(field: Pick<RenderType, \"internalTypeId\">): boolean {\n return /^bytes\\d{1,2}$/.test(field.internalTypeId);\n}\n\n/**\n * The number of padding bits in the storage representation of a right-aligned solidity type\n */\nexport function getLeftPaddingBits(field: Pick<RenderType, \"internalTypeId\" | \"staticByteLength\">): number {\n if (isLeftAligned(field)) {\n return 0;\n } else {\n return 256 - field.staticByteLength * 8;\n }\n}\n\n/**\n * Internal helper to render `lineTerminator`-separated list of items mapped by `renderItem`\n */\nfunction internalRenderList<T>(\n lineTerminator: string,\n list: T[],\n renderItem: (item: T, index: number) => string,\n): string {\n return list\n .map((item, index) => renderItem(item, index) + (index === list.length - 1 ? \"\" : lineTerminator))\n .join(\"\\n\");\n}\n","import { renderedSolidityHeader } from \"./common\";\n\n// importing this from config or store would be a cyclic dependency :(\ntype Enums = {\n readonly [name: string]: readonly [string, ...string[]];\n};\n\n/**\n * Render a list of enum data as solidity enum definitions\n */\nexport function renderEnums(enums: Enums): string {\n const enumDefinitions = Object.entries(enums).map(\n ([name, values]) => `\n enum ${name} {\n ${values.join(\", \")}\n }\n `,\n );\n\n return `\n ${renderedSolidityHeader}\n ${enumDefinitions.join(\"\")}\n `;\n}\n","import { RenderField, RenderKeyTuple, RenderType } from \"./types\";\n\n/**\n * Renders the necessary helper functions to typecast to/from the types of given fields and keys\n */\nexport function renderTypeHelpers(options: { fields: RenderField[]; keyTuple: RenderKeyTuple[] }): string {\n const { fields, keyTuple } = options;\n\n let result = \"\";\n\n for (const wrappingHelper of getWrappingHelpers([...fields, ...keyTuple])) {\n result += wrappingHelper;\n }\n\n // bool is special - it's the only primitive value type that can't be typecasted to/from\n if (fields.some(({ internalTypeId }) => internalTypeId.match(\"bool\"))) {\n result += `\n /**\n * @notice Cast a value to a bool.\n * @dev Boolean values are encoded as uint8 (1 = true, 0 = false), but Solidity doesn't allow casting between uint8 and bool.\n * @param value The uint8 value to convert.\n * @return result The boolean value.\n */\n function _toBool(uint8 value) pure returns (bool result) {\n assembly {\n result := value\n }\n }\n `;\n }\n if (keyTuple.some(({ internalTypeId }) => internalTypeId.match(\"bool\"))) {\n result += `\n /**\n * @notice Cast a bool to a bytes32.\n * @dev The boolean value is casted to a bytes32 value with 0 or 1 at the least significant bit.\n */\n function _boolToBytes32(bool value) pure returns (bytes32 result) {\n assembly {\n result := value\n }\n }\n `;\n }\n\n return result;\n}\n\nfunction getWrappingHelpers(array: RenderType[]): string[] {\n const wrappers = new Map<string, string>();\n const unwrappers = new Map<string, string>();\n for (const { typeWrappingData, typeWrap, typeUnwrap, internalTypeId } of array) {\n if (!typeWrappingData) continue;\n const { kind } = typeWrappingData;\n\n if (kind === \"staticArray\") {\n const { elementType, staticLength } = typeWrappingData;\n wrappers.set(typeWrap, renderWrapperStaticArray(typeWrap, elementType, staticLength, internalTypeId));\n unwrappers.set(typeUnwrap, renderUnwrapperStaticArray(typeUnwrap, elementType, staticLength, internalTypeId));\n }\n }\n\n return [...wrappers.values(), ...unwrappers.values()];\n}\n\n/**\n * Renders a function to cast a dynamic array to a static array.\n * @param functionName name of the function to be rendered\n * @param elementType type of the array's element\n * @param staticLength length of the static array\n * @param internalTypeId solidity type name of the dynamic array\n * @returns\n */\nfunction renderWrapperStaticArray(\n functionName: string,\n elementType: string,\n staticLength: number,\n internalTypeId: string,\n): string {\n // WARNING: ensure this still works if changing major solidity versions!\n // (the memory layout for static arrays may change)\n return `\n /**\n * @notice Cast a dynamic array to a static array.\n * @dev In memory static arrays are just dynamic arrays without the 32 length bytes,\n * so this function moves the pointer to the first element of the dynamic array.\n * If the length of the dynamic array is smaller than the static length,\n * the function returns an uninitialized array to avoid memory corruption.\n * @param _value The dynamic array to cast.\n * @return _result The static array.\n */\n function ${functionName}(\n ${internalTypeId} memory _value\n ) pure returns (\n ${elementType}[${staticLength}] memory _result\n ) {\n if (_value.length < ${staticLength}) {\n // return an uninitialized array if the length is smaller than the fixed length to avoid memory corruption\n return _result;\n } else {\n // in memory static arrays are just dynamic arrays without the 32 length bytes\n // (without the length check this could lead to memory corruption)\n assembly {\n _result := add(_value, 0x20)\n }\n }\n }\n `;\n}\n\n/**\n * Renders a function to cast a static array to a dynamic array.\n * @param functionName name of the function to be rendered\n * @param elementType type of the array's element\n * @param staticLength length of the static array\n * @param internalTypeId solidity type name of the dynamic array\n * @returns\n */\nfunction renderUnwrapperStaticArray(\n functionName: string,\n elementType: string,\n staticLength: number,\n internalTypeId: string,\n): string {\n // byte length for memory copying (more efficient than a loop)\n const byteLength = staticLength * 32;\n // TODO to optimize memory usage consider generalizing TightEncoder to a render-time utility\n return `\n /**\n * @notice Copy a static array to a dynamic array.\n * @dev Static arrays don't have a length prefix, so this function copies the memory from the static array to a new dynamic array.\n * @param _value The static array to copy.\n * @return _result The dynamic array.\n */ \n function ${functionName}(\n ${elementType}[${staticLength}] memory _value\n ) pure returns (\n ${internalTypeId} memory _result\n ) {\n _result = new ${internalTypeId}(${staticLength});\n uint256 fromPointer;\n uint256 toPointer;\n assembly {\n fromPointer := _value\n toPointer := add(_result, 0x20)\n }\n Memory.copy(fromPointer, toPointer, ${byteLength});\n }\n `;\n}\n","import { SchemaType } from \"@latticexyz/schema-type/deprecated\";\n\nexport const schemaTypesToRecsTypeStrings: Record<SchemaType, string> = {\n [SchemaType.UINT8]: \"RecsType.Number\",\n [SchemaType.UINT16]: \"RecsType.Number\",\n [SchemaType.UINT24]: \"RecsType.Number\",\n [SchemaType.UINT32]: \"RecsType.Number\",\n [SchemaType.UINT40]: \"RecsType.Number\",\n [SchemaType.UINT48]: \"RecsType.Number\",\n [SchemaType.UINT56]: \"RecsType.BigInt\",\n [SchemaType.UINT64]: \"RecsType.BigInt\",\n [SchemaType.UINT72]: \"RecsType.BigInt\",\n [SchemaType.UINT80]: \"RecsType.BigInt\",\n [SchemaType.UINT88]: \"RecsType.BigInt\",\n [SchemaType.UINT96]: \"RecsType.BigInt\",\n [SchemaType.UINT104]: \"RecsType.BigInt\",\n [SchemaType.UINT112]: \"RecsType.BigInt\",\n [SchemaType.UINT120]: \"RecsType.BigInt\",\n [SchemaType.UINT128]: \"RecsType.BigInt\",\n [SchemaType.UINT136]: \"RecsType.BigInt\",\n [SchemaType.UINT144]: \"RecsType.BigInt\",\n [SchemaType.UINT152]: \"RecsType.BigInt\",\n [SchemaType.UINT160]: \"RecsType.BigInt\",\n [SchemaType.UINT168]: \"RecsType.BigInt\",\n [SchemaType.UINT176]: \"RecsType.BigInt\",\n [SchemaType.UINT184]: \"RecsType.BigInt\",\n [SchemaType.UINT192]: \"RecsType.BigInt\",\n [SchemaType.UINT200]: \"RecsType.BigInt\",\n [SchemaType.UINT208]: \"RecsType.BigInt\",\n [SchemaType.UINT216]: \"RecsType.BigInt\",\n [SchemaType.UINT224]: \"RecsType.BigInt\",\n [SchemaType.UINT232]: \"RecsType.BigInt\",\n [SchemaType.UINT240]: \"RecsType.BigInt\",\n [SchemaType.UINT248]: \"RecsType.BigInt\",\n [SchemaType.UINT256]: \"RecsType.BigInt\",\n [SchemaType.INT8]: \"RecsType.Number\",\n [SchemaType.INT16]: \"RecsType.Number\",\n [SchemaType.INT24]: \"RecsType.Number\",\n [SchemaType.INT32]: \"RecsType.Number\",\n [SchemaType.INT40]: \"RecsType.Number\",\n [SchemaType.INT48]: \"RecsType.Number\",\n [SchemaType.INT56]: \"RecsType.BigInt\",\n [SchemaType.INT64]: \"RecsType.BigInt\",\n [SchemaType.INT72]: \"RecsType.BigInt\",\n [SchemaType.INT80]: \"RecsType.BigInt\",\n [SchemaType.INT88]: \"RecsType.BigInt\",\n [SchemaType.INT96]: \"RecsType.BigInt\",\n [SchemaType.INT104]: \"RecsType.BigInt\",\n [SchemaType.INT112]: \"RecsType.BigInt\",\n [SchemaType.INT120]: \"RecsType.BigInt\",\n [SchemaType.INT128]: \"RecsType.BigInt\",\n [SchemaType.INT136]: \"RecsType.BigInt\",\n [SchemaType.INT144]: \"RecsType.BigInt\",\n [SchemaType.INT152]: \"RecsType.BigInt\",\n [SchemaType.INT160]: \"RecsType.BigInt\",\n [SchemaType.INT168]: \"RecsType.BigInt\",\n [SchemaType.INT176]: \"RecsType.BigInt\",\n [SchemaType.INT184]: \"RecsType.BigInt\",\n [SchemaType.INT192]: \"RecsType.BigInt\",\n [SchemaType.INT200]: \"RecsType.BigInt\",\n [SchemaType.INT208]: \"RecsType.BigInt\",\n [SchemaType.INT216]: \"RecsType.BigInt\",\n [SchemaType.INT224]: \"RecsType.BigInt\",\n [SchemaType.INT232]: \"RecsType.BigInt\",\n [SchemaType.INT240]: \"RecsType.BigInt\",\n [SchemaType.INT248]: \"RecsType.BigInt\",\n [SchemaType.INT256]: \"RecsType.BigInt\",\n [SchemaType.BYTES1]: \"RecsType.String\",\n [SchemaType.BYTES2]: \"RecsType.String\",\n [SchemaType.BYTES3]: \"RecsType.String\",\n [SchemaType.BYTES4]: \"RecsType.String\",\n [SchemaType.BYTES5]: \"RecsType.String\",\n [SchemaType.BYTES6]: \"RecsType.String\",\n [SchemaType.BYTES7]: \"RecsType.String\",\n [SchemaType.BYTES8]: \"RecsType.String\",\n [SchemaType.BYTES9]: \"RecsType.String\",\n [SchemaType.BYTES10]: \"RecsType.String\",\n [SchemaType.BYTES11]: \"RecsType.String\",\n [SchemaType.BYTES12]: \"RecsType.String\",\n [SchemaType.BYTES13]: \"RecsType.String\",\n [SchemaType.BYTES14]: \"RecsType.String\",\n [SchemaType.BYTES15]: \"RecsType.String\",\n [SchemaType.BYTES16]: \"RecsType.String\",\n [SchemaType.BYTES17]: \"RecsType.String\",\n [SchemaType.BYTES18]: \"RecsType.String\",\n [SchemaType.BYTES19]: \"RecsType.String\",\n [SchemaType.BYTES20]: \"RecsType.String\",\n [SchemaType.BYTES21]: \"RecsType.String\",\n [SchemaType.BYTES22]: \"RecsType.String\",\n [SchemaType.BYTES23]: \"RecsType.String\",\n [SchemaType.BYTES24]: \"RecsType.String\",\n [SchemaType.BYTES25]: \"RecsType.String\",\n [SchemaType.BYTES26]: \"RecsType.String\",\n [SchemaType.BYTES27]: \"RecsType.String\",\n [SchemaType.BYTES28]: \"RecsType.String\",\n [SchemaType.BYTES29]: \"RecsType.String\",\n [SchemaType.BYTES30]: \"RecsType.String\",\n [SchemaType.BYTES31]: \"RecsType.String\",\n [SchemaType.BYTES32]: \"RecsType.String\",\n [SchemaType.BOOL]: \"RecsType.Boolean\",\n [SchemaType.ADDRESS]: \"RecsType.String\",\n [SchemaType.UINT8_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.UINT16_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.UINT24_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.UINT32_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.UINT40_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.UINT48_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.UINT56_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT64_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT72_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT80_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT88_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT96_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT104_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT112_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT120_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT128_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT136_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT144_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT152_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT160_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT168_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT176_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT184_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT192_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT200_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT208_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT216_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT224_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT232_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT240_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT248_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.UINT256_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT8_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.INT16_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.INT24_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.INT32_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.INT40_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.INT48_ARRAY]: \"RecsType.NumberArray\",\n [SchemaType.INT56_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT64_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT72_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT80_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT88_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT96_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT104_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT112_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT120_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT128_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT136_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT144_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT152_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT160_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT168_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT176_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT184_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT192_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT200_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT208_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT216_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT224_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT232_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT240_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT248_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.INT256_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES1_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES2_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES3_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES4_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES5_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES6_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES7_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES8_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES9_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES10_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES11_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES12_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES13_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES14_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES15_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES16_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES17_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES18_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES19_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES20_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES21_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES22_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES23_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES24_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES25_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES26_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES27_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES28_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES29_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES30_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES31_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BYTES32_ARRAY]: \"RecsType.BigIntArray\",\n [SchemaType.BOOL_ARRAY]: \"RecsType.T\", // no boolean array\n [SchemaType.ADDRESS_ARRAY]: \"RecsType.StringArray\",\n [SchemaType.BYTES]: \"RecsType.String\",\n [SchemaType.STRING]: \"RecsType.String\",\n};\n","import { parse, visit } from \"@solidity-parser/parser\";\nimport type {\n ContractDefinition,\n SourceUnit,\n TypeName,\n VariableDeclaration,\n} from \"@solidity-parser/parser/dist/src/ast-types\";\nimport { MUDError } from \"../../errors\";\n\nexport interface ContractInterfaceFunction {\n name: string;\n parameters: string[];\n stateMutability: string;\n returnParameters: string[];\n}\n\nexport interface ContractInterfaceError {\n name: string;\n parameters: string[];\n}\n\ninterface SymbolImport {\n symbol: string;\n path: string;\n}\n\n/**\n * Parse the contract data to get the functions necessary to generate an interface,\n * and symbols to import from the original contract.\n * @param source contents of a file with the solidity contract\n * @param contractName name of the contract\n * @returns interface data\n */\nexport function contractToInterface(\n source: string,\n contractName: string,\n): {\n functions: ContractInterfaceFunction[];\n errors: ContractInterfaceError[];\n symbolImports: SymbolImport[];\n} {\n const ast = parse(source);\n const contractNode = findContractNode(ast, contractName);\n let symbolImports: SymbolImport[] = [];\n const functions: ContractInterfaceFunction[] = [];\n const errors: ContractInterfaceError[] = [];\n\n if (!contractNode) {\n throw new MUDError(`Contract not found: ${contractName}`);\n }\n\n visit(contractNode, {\n FunctionDefinition({\n name,\n visibility,\n parameters,\n stateMutability,\n returnParameters,\n isConstructor,\n isFallback,\n isReceiveEther,\n }) {\n try {\n // skip constructor and fallbacks\n if (isConstructor || isFallback || isReceiveEther) return;\n // forbid default visibility (this check might be unnecessary, modern solidity already disallows this)\n if (visibility === \"default\") throw new MUDError(`Visibility is not specified`);\n\n if (visibility === \"external\" || visibility === \"public\") {\n functions.push({\n name: name === null ? \"\" : name,\n parameters: parameters.map(parseParameter),\n stateMutability: stateMutability || \"\",\n returnParameters: returnParameters === null ? [] : returnParameters.map(parseParameter),\n });\n\n for (const { typeName } of parameters.concat(returnParameters ?? [])) {\n const symbols = typeNameToSymbols(typeName);\n symbolImports = symbolImports.concat(symbolsToImports(ast, symbols));\n }\n }\n } catch (error: unknown) {\n if (error instanceof MUDError) {\n error.message = `Function \"${name}\" in contract \"${contractName}\": ${error.message}`;\n }\n throw error;\n }\n },\n CustomErrorDefinition({ name, parameters }) {\n errors.push({\n name,\n parameters: parameters.map(parseParameter),\n });\n\n for (const parameter of parameters) {\n const symbols = typeNameToSymbols(parameter.typeName);\n symbolImports = symbolImports.concat(symbolsToImports(ast, symbols));\n }\n },\n });\n\n return {\n functions,\n errors,\n symbolImports,\n };\n}\n\nexport function findContractNode(ast: SourceUnit, contractName: string): ContractDefinition | undefined {\n let contract: ContractDefinition | undefined = undefined;\n\n visit(ast, {\n ContractDefinition(node) {\n if (node.name === contractName) {\n contract = node;\n }\n },\n });\n\n return contract;\n}\n\nfunction parseParameter({ name, typeName, storageLocation }: VariableDeclaration): string {\n let typedNameWithLocation = \"\";\n\n const { name: flattenedTypeName, stateMutability } = flattenTypeName(typeName);\n // type name (e.g. uint256)\n typedNameWithLocation += flattenedTypeName;\n // optional mutability (e.g. address payable)\n if (stateMutability !== null) {\n typedNameWithLocation += ` ${stateMutability}`;\n }\n // location, when relevant (e.g. string memory)\n if (storageLocation !== null) {\n typedNameWithLocation += ` ${storageLocation}`;\n }\n // optional variable name\n if (name !== null) {\n typedNameWithLocation += ` ${name}`;\n }\n\n return typedNameWithLocation;\n}\n\nfunction flattenTypeName(typeName: TypeName | null): { name: string; stateMutability: string | null } {\n if (typeName === null) {\n return {\n name: \"\",\n stateMutability: null,\n };\n }\n if (typeName.type === \"ElementaryTypeName\") {\n return {\n name: typeName.name,\n stateMutability: typeName.stateMutability,\n };\n } else if (typeName.type === \"UserDefinedTypeName\") {\n return {\n name: typeName.namePath,\n stateMutability: null,\n };\n } else if (typeName.type === \"ArrayTypeName\") {\n let length = \"\";\n if (typeName.length?.type === \"NumberLiteral\") {\n length = typeName.length.number;\n } else if (typeName.length?.type === \"Identifier\") {\n length = typeName.length.name;\n }\n\n const { name, stateMutability } = flattenTypeName(typeName.baseTypeName);\n return {\n name: `${name}[${length}]`,\n stateMutability,\n };\n } else {\n // TODO function types are unsupported but could be useful\n throw new MUDError(`Invalid typeName.type ${typeName.type}`);\n }\n}\n\n// Get symbols that need to be imported for given typeName\nfunction typeNameToSymbols(typeName: TypeName | null): string[] {\n if (typeName?.type === \"UserDefinedTypeName\") {\n // split is needed to get a library, if types are internal to it\n const symbol = typeName.namePath.split(\".\")[0];\n return [symbol];\n } else if (typeName?.type === \"ArrayTypeName\") {\n const symbols = typeNameToSymbols(typeName.baseTypeName);\n // array types can also use symbols (constants) for length\n if (typeName.length?.type === \"Identifier\") {\n const innerTypeName = typeName.length.name;\n symbols.push(innerTypeName.split(\".\")[0]);\n }\n return symbols;\n } else {\n return [];\n }\n}\n\n// Get imports for given symbols.\n// To avoid circular dependencies of interfaces on their implementations,\n// symbols used for args/returns must always be imported from an auxiliary file.\n// To avoid parsing the entire project to build dependencies,\n// symbols must be imported with an explicit `import { symbol } from ...`\nfunction symbolsToImports(ast: SourceUnit, symbols: string[]): SymbolImport[] {\n const imports: SymbolImport[] = [];\n\n for (const symbol of symbols) {\n let symbolImport: SymbolImport | undefined;\n\n visit(ast, {\n ImportDirective({ path, symbolAliases }) {\n if (symbolAliases) {\n for (const symbolAndAlias of symbolAliases) {\n // either check the alias, or the original symbol if there's no alias\n const symbolAlias = symbolAndAlias[1] || symbolAndAlias[0];\n if (symbol === symbolAlias) {\n symbolImport = {\n // always use the original symbol for interface imports\n symbol: symbolAndAlias[0],\n path,\n };\n return;\n }\n }\n }\n },\n });\n\n if (symbolImport) {\n imports.push(symbolImport);\n } else {\n throw new MUDError(`Symbol \"${symbol}\" has no explicit import`);\n }\n }\n\n return imports;\n}\n","export class MUDError extends Error {\n name = \"MUDError\";\n}\n","import prettier from \"prettier\";\nimport prettierPluginSolidity from \"prettier-plugin-solidity\";\n\n/**\n * Formats solidity code using prettier\n * @param content solidity code\n * @param prettierConfigPath optional path to a prettier config\n * @returns formatted solidity code\n */\nexport async function formatSolidity(content: string, prettierConfigPath?: string): Promise<string> {\n let config;\n if (prettierConfigPath) {\n config = await prettier.resolveConfig(prettierConfigPath);\n }\n try {\n return prettier.format(content, {\n plugins: [prettierPluginSolidity],\n parser: \"solidity-parse\",\n\n printWidth: 120,\n semi: true,\n tabWidth: 2,\n useTabs: false,\n bracketSpacing: true,\n\n ...config,\n });\n } catch (error) {\n let message;\n if (error instanceof Error) {\n message = error.message;\n } else {\n message = error;\n }\n console.log(`Error during output formatting: ${message}`);\n return content;\n }\n}\n\n/**\n * Formats typescript code using prettier\n * @param content typescript code\n * @returns formatted typescript code\n */\nexport async function formatTypescript(content: string): Promise<string> {\n return prettier.format(content, {\n parser: \"typescript\",\n });\n}\n","import fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { formatSolidity, formatTypescript } from \"./format\";\nimport { debug } from \"../debug\";\n\n/**\n * Formats solidity code using prettier and write it to a file\n * @param output solidity code\n * @param fullOutputPath full path to the output file\n * @param logPrefix prefix for debug logs\n */\nexport async function formatAndWriteSolidity(output: string, fullOutputPath: string, logPrefix: string): Promise<void> {\n const formattedOutput = await formatSolidity(output);\n\n await fs.mkdir(path.dirname(fullOutputPath), { recursive: true });\n\n await fs.writeFile(fullOutputPath, formattedOutput);\n debug(`${logPrefix}: ${fullOutputPath}`);\n}\n\n/**\n * Formats typescript code using prettier and write it to a file\n * @param output typescript code\n * @param fullOutputPath full path to the output file\n * @param logPrefix prefix for debug logs\n */\nexport async function formatAndWriteTypescript(\n output: string,\n fullOutputPath: string,\n logPrefix: string,\n): Promise<void> {\n const formattedOutput = await formatTypescript(output);\n\n await fs.mkdir(path.dirname(fullOutputPath), { recursive: true });\n\n await fs.writeFile(fullOutputPath, formattedOutput);\n debug(`${logPrefix}: ${fullOutputPath}`);\n}\n","import createDebug from \"debug\";\n\nexport const debug = createDebug(\"mud:common\");\nexport const error = createDebug(\"mud:common\");\n\n// Pipe debug output to stdout instead of stderr\ndebug.log = console.debug.bind(console);\n\n// Pipe error output to stderr\nerror.log = console.error.bind(console);\n","import { debug as parentDebug } from \"../debug\";\n\nexport const debug = parentDebug.extend(\"codegen\");\nexport const error = parentDebug.extend(\"codegen\");\n\n// Pipe debug output to stdout instead of stderr\ndebug.log = console.debug.bind(console);\n\n// Pipe error output to stderr\nerror.log = console.error.bind(console);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,qBAA8E;;;ACD9E,kBAA4C;AAKrC,IAAM,kBAAkB;AAAA;AAAA,EAE7B,OAAO;AAAA,EACP,eAAe;AAAA;AAAA,EAEf,WAAW;AAAA,EACX,QAAQ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AACzC;AAQA,eAAsB,yBACpB,QACA,gBACA,WACe;AACf,QAAM,kBAAkB,MAAM,iBAAiB,MAAM;AAErD,QAAM,gBAAAF,QAAG,MAAM,kBAAAC,QAAK,QAAQ,cAAc,GAAG,EAAE,WAAW,KAAK,CAAC;AAEhE,QAAM,gBAAAD,QAAG,UAAU,gBAAgB,eAAe;AAClD,EAAAE,OAAM,GAAG,SAAS,KAAK,cAAc,EAAE;AACzC;","names":["import_viem","path","path","error","path","prettier","prettierPluginSolidity","error","import_node_path","createDebug","debug","error","fs","path","debug"]}
@@ -1,228 +0,0 @@
1
- import { Hex } from 'viem';
2
- import { Abi } from 'abitype';
3
- import { SchemaType } from '@latticexyz/schema-type/deprecated';
4
- import { SourceUnit, ContractDefinition } from '@solidity-parser/parser/dist/src/ast-types';
5
-
6
- declare module "prettier-plugin-solidity" {}
7
-
8
- type AbiToInterfaceOptions = {
9
- name: string;
10
- systemId?: Hex;
11
- abi: Abi;
12
- };
13
- declare function abiToInterface({ name, systemId, abi }: AbiToInterfaceOptions): string;
14
-
15
- type ImportDatum = {
16
- symbol: string;
17
- path: string;
18
- };
19
- interface StaticResourceData {
20
- /** Table namespace string */
21
- namespace: string;
22
- /** Table name string */
23
- name: string;
24
- /** Whether the table is offchain only (does not use storage) */
25
- offchainOnly: boolean;
26
- }
27
- interface RenderType {
28
- /** Fully-qualified name of the user-defined type (may include a library name as prefix) */
29
- typeId: string;
30
- /** Fully-qualified name of the user-defined type (may include a library name as prefix), followed by location (none/memory/storage) */
31
- typeWithLocation: string;
32
- /** The name of the enum element in SchemaType to use for schema registration (e.g. "UINT256_ARRAY") */
33
- enumName: string;
34
- staticByteLength: number;
35
- isDynamic: boolean;
36
- /** Empty for internal types. Custom `wrap` method for user defined types. */
37
- typeWrap: string;
38
- /** Empty for internal types. Custom `unwrap` method for user defined types. */
39
- typeUnwrap: string;
40
- /** Data to generate the custom wrapper and unwrapper if necessary. */
41
- typeWrappingData?: RenderFieldTypeWrappingData;
42
- /** Same as typeId for internal types. The underlying `typeId` for user defined types. */
43
- internalTypeId: string;
44
- }
45
- interface RenderKeyTuple extends RenderType {
46
- name: string;
47
- isDynamic: false;
48
- }
49
- interface RenderField extends RenderType {
50
- arrayElement: RenderType | undefined;
51
- name: string;
52
- }
53
- interface RenderStaticField extends RenderField {
54
- isDynamic: false;
55
- }
56
- interface RenderDynamicField extends RenderField {
57
- isDynamic: true;
58
- }
59
- type RenderFieldTypeWrappingData = {
60
- kind: "staticArray";
61
- elementType: string;
62
- staticLength: number;
63
- };
64
- interface RenderEnum {
65
- name: string;
66
- memberNames: string[];
67
- }
68
-
69
- /**
70
- * Common header for all codegenerated solidity files
71
- */
72
- declare const renderedSolidityHeader = "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.24;\n\n/* Autogenerated file. Do not edit manually. */";
73
- /**
74
- * Renders a list of lines
75
- */
76
- declare function renderList<T>(list: T[], renderItem: (item: T, index: number) => string): string;
77
- /**
78
- * Renders a comma-separated list of arguments for solidity functions, ignoring empty and undefined ones
79
- */
80
- declare function renderArguments(args: (string | undefined)[]): string;
81
- interface RenderedCommonData {
82
- /** `_tableId` variable prefixed with its type (empty string if absent) */
83
- _typedTableId: string;
84
- /** Comma-separated table key names prefixed with their types (empty string if 0 keys) */
85
- _typedKeyArgs: string;
86
- /** Definition and initialization of the dynamic `_keyTuple` bytes32 array */
87
- _keyTupleDefinition: string;
88
- }
89
- /**
90
- * Renders some solidity statements commonly used within table libraries
91
- * @param param0.staticResourceData static data about the table library
92
- * @param param0.keyTuple key tuple of the table library
93
- * @returns Rendered statement strings
94
- */
95
- declare function renderCommonData({ staticResourceData, keyTuple, }: {
96
- staticResourceData?: StaticResourceData;
97
- keyTuple: RenderKeyTuple[];
98
- }): RenderedCommonData;
99
- /**
100
- * Aggregates, deduplicates and renders imports for symbols per path.
101
- * Identical symbols from different paths are NOT handled, they should be checked before rendering.
102
- */
103
- declare function renderImports(imports: ImportDatum[]): string;
104
- interface RenderWithStoreCallbackData {
105
- /** `_store` variable prefixed with its type (undefined if library name) */
106
- _typedStore: string | undefined;
107
- /** `_store` variable (undefined if library name) */
108
- _store: string;
109
- /** Empty string if storeArgument is false, otherwise `" (using the specified store)"` */
110
- _commentSuffix: string;
111
- /** Prefix to differentiate different kinds of store usage within methods */
112
- _methodNamePrefix: string;
113
- /** Whether FieldLayout variable should be passed to store methods */
114
- _useExplicitFieldLayout?: boolean;
115
- }
116
- /**
117
- * Renders several versions of the callback's result, which access Store in different ways
118
- * @param storeArgument whether to render a version with `IStore _store` as an argument
119
- * @param callback renderer for a method which uses store
120
- * @returns Concatenated results of all callback calls
121
- */
122
- declare function renderWithStore(storeArgument: boolean, callback: (data: RenderWithStoreCallbackData) => string): string;
123
- /**
124
- * Renders several versions of the callback's result, which have different method name suffixes
125
- * @param withSuffixlessFieldMethods whether to render methods with an empty suffix
126
- * @param fieldName name of the field which the methods access, used for a suffix
127
- * @param callback renderer for a method to be suffixed
128
- * @returns Concatenated results of all callback calls
129
- */
130
- declare function renderWithFieldSuffix(withSuffixlessFieldMethods: boolean, fieldName: string, callback: (_methodNameSuffix: string) => string): string;
131
- /**
132
- * Renders `_tableId` definition of the given table.
133
- * @param param0 static resource data needed to construct the table ID
134
- */
135
- declare function renderTableId({ namespace, name, offchainOnly, }: Pick<StaticResourceData, "namespace" | "name" | "offchainOnly">): string;
136
- /**
137
- * Renders solidity typecasts to get from the given type to `bytes32`
138
- * @param name variable name to be typecasted
139
- * @param param1 type data
140
- */
141
- declare function renderValueTypeToBytes32(name: string, { typeUnwrap, internalTypeId }: Pick<RenderType, "typeUnwrap" | "internalTypeId">): string;
142
- /**
143
- * Whether the storage representation of the given solidity type is left aligned
144
- */
145
- declare function isLeftAligned(field: Pick<RenderType, "internalTypeId">): boolean;
146
- /**
147
- * The number of padding bits in the storage representation of a right-aligned solidity type
148
- */
149
- declare function getLeftPaddingBits(field: Pick<RenderType, "internalTypeId" | "staticByteLength">): number;
150
-
151
- type Enums = {
152
- readonly [name: string]: readonly [string, ...string[]];
153
- };
154
- /**
155
- * Render a list of enum data as solidity enum definitions
156
- */
157
- declare function renderEnums(enums: Enums): string;
158
-
159
- declare function renderImportPath(basePath: string, ...segments: readonly string[]): string;
160
-
161
- /**
162
- * Renders the necessary helper functions to typecast to/from the types of given fields and keys
163
- */
164
- declare function renderTypeHelpers(options: {
165
- fields: RenderField[];
166
- keyTuple: RenderKeyTuple[];
167
- }): string;
168
-
169
- declare const schemaTypesToRecsTypeStrings: Record<SchemaType, string>;
170
-
171
- interface ContractInterfaceFunction {
172
- name: string;
173
- parameters: string[];
174
- stateMutability: string;
175
- returnParameters: string[];
176
- }
177
- interface ContractInterfaceError {
178
- name: string;
179
- parameters: string[];
180
- }
181
- interface SymbolImport {
182
- symbol: string;
183
- path: string;
184
- }
185
- /**
186
- * Parse the contract data to get the functions necessary to generate an interface,
187
- * and symbols to import from the original contract.
188
- * @param source contents of a file with the solidity contract
189
- * @param contractName name of the contract
190
- * @returns interface data
191
- */
192
- declare function contractToInterface(source: string, contractName: string): {
193
- functions: ContractInterfaceFunction[];
194
- errors: ContractInterfaceError[];
195
- symbolImports: SymbolImport[];
196
- };
197
- declare function findContractNode(ast: SourceUnit, contractName: string): ContractDefinition | undefined;
198
-
199
- /**
200
- * Formats solidity code using prettier
201
- * @param content solidity code
202
- * @param prettierConfigPath optional path to a prettier config
203
- * @returns formatted solidity code
204
- */
205
- declare function formatSolidity(content: string, prettierConfigPath?: string): Promise<string>;
206
- /**
207
- * Formats typescript code using prettier
208
- * @param content typescript code
209
- * @returns formatted typescript code
210
- */
211
- declare function formatTypescript(content: string): Promise<string>;
212
-
213
- /**
214
- * Formats solidity code using prettier and write it to a file
215
- * @param output solidity code
216
- * @param fullOutputPath full path to the output file
217
- * @param logPrefix prefix for debug logs
218
- */
219
- declare function formatAndWriteSolidity(output: string, fullOutputPath: string, logPrefix: string): Promise<void>;
220
- /**
221
- * Formats typescript code using prettier and write it to a file
222
- * @param output typescript code
223
- * @param fullOutputPath full path to the output file
224
- * @param logPrefix prefix for debug logs
225
- */
226
- declare function formatAndWriteTypescript(output: string, fullOutputPath: string, logPrefix: string): Promise<void>;
227
-
228
- export { type AbiToInterfaceOptions, type ContractInterfaceError, type ContractInterfaceFunction, type ImportDatum, type RenderDynamicField, type RenderEnum, type RenderField, type RenderFieldTypeWrappingData, type RenderKeyTuple, type RenderStaticField, type RenderType, type StaticResourceData, abiToInterface, contractToInterface, findContractNode, formatAndWriteSolidity, formatAndWriteTypescript, formatSolidity, formatTypescript, getLeftPaddingBits, isLeftAligned, renderArguments, renderCommonData, renderEnums, renderImportPath, renderImports, renderList, renderTableId, renderTypeHelpers, renderValueTypeToBytes32, renderWithFieldSuffix, renderWithStore, renderedSolidityHeader, schemaTypesToRecsTypeStrings };
package/dist/errors.cjs DELETED
@@ -1,38 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/errors/index.ts
21
- var errors_exports = {};
22
- __export(errors_exports, {
23
- MUDError: () => MUDError
24
- });
25
- module.exports = __toCommonJS(errors_exports);
26
-
27
- // src/errors/MUDError.ts
28
- var MUDError = class extends Error {
29
- constructor() {
30
- super(...arguments);
31
- this.name = "MUDError";
32
- }
33
- };
34
- // Annotate the CommonJS export names for ESM import in node:
35
- 0 && (module.exports = {
36
- MUDError
37
- });
38
- //# sourceMappingURL=errors.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/errors/index.ts","../src/errors/MUDError.ts"],"sourcesContent":["export * from \"./MUDError\";\n","export class MUDError extends Error {\n name = \"MUDError\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,WAAN,cAAuB,MAAM;AAAA,EAA7B;AAAA;AACL,gBAAO;AAAA;AACT;","names":[]}
package/dist/errors.d.cts DELETED
@@ -1,5 +0,0 @@
1
- declare class MUDError extends Error {
2
- name: string;
3
- }
4
-
5
- export { MUDError };
package/dist/foundry.cjs DELETED
@@ -1,105 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/foundry/index.ts
21
- var foundry_exports = {};
22
- __export(foundry_exports, {
23
- anvil: () => anvil,
24
- cast: () => cast,
25
- forge: () => forge,
26
- getForgeConfig: () => getForgeConfig,
27
- getOutDirectory: () => getOutDirectory,
28
- getRpcUrl: () => getRpcUrl,
29
- getScriptDirectory: () => getScriptDirectory,
30
- getSrcDirectory: () => getSrcDirectory,
31
- getTestDirectory: () => getTestDirectory
32
- });
33
- module.exports = __toCommonJS(foundry_exports);
34
- var import_execa = require("execa");
35
- async function getForgeConfig(profile) {
36
- const { stdout } = await (0, import_execa.execa)("forge", ["config", "--json"], {
37
- stdio: ["inherit", "pipe", "pipe"],
38
- env: { FOUNDRY_PROFILE: profile }
39
- });
40
- return JSON.parse(stdout);
41
- }
42
- async function getSrcDirectory(profile) {
43
- return (await getForgeConfig(profile)).src;
44
- }
45
- async function getScriptDirectory(profile) {
46
- return (await getForgeConfig(profile)).script;
47
- }
48
- async function getTestDirectory(profile) {
49
- return (await getForgeConfig(profile)).test;
50
- }
51
- async function getOutDirectory(profile) {
52
- return (await getForgeConfig(profile)).out;
53
- }
54
- async function getRpcUrl(profile) {
55
- return process.env.FOUNDRY_ETH_RPC_URL || process.env.RPC_HTTP_URL || process.env.RPC_URL || (await getForgeConfig(profile)).eth_rpc_url || "http://127.0.0.1:8545";
56
- }
57
- async function forge(args, options) {
58
- const execOptions = {
59
- env: { FOUNDRY_PROFILE: options?.profile, ...options?.env },
60
- stdout: "inherit",
61
- stderr: "pipe",
62
- cwd: options?.cwd
63
- };
64
- await (options?.silent ? (0, import_execa.execa)("forge", args, execOptions) : execLog("forge", args, execOptions));
65
- }
66
- async function cast(args, options) {
67
- return execLog("cast", args, {
68
- env: { FOUNDRY_PROFILE: options?.profile }
69
- });
70
- }
71
- async function anvil(args) {
72
- return execLog("anvil", args);
73
- }
74
- async function execLog(command, args, options) {
75
- const commandString = `${command} ${args.join(" ")}`;
76
- try {
77
- console.log(`running "${commandString}"`);
78
- const { stdout } = await (0, import_execa.execa)(command, args, {
79
- ...options,
80
- stdout: "pipe",
81
- stderr: "pipe",
82
- lines: false,
83
- encoding: "utf8"
84
- });
85
- return stdout;
86
- } catch (error) {
87
- let errorMessage = error?.stderr || error?.message || "";
88
- errorMessage += `
89
- Error running "${commandString}"`;
90
- throw new Error(errorMessage);
91
- }
92
- }
93
- // Annotate the CommonJS export names for ESM import in node:
94
- 0 && (module.exports = {
95
- anvil,
96
- cast,
97
- forge,
98
- getForgeConfig,
99
- getOutDirectory,
100
- getRpcUrl,
101
- getScriptDirectory,
102
- getSrcDirectory,
103
- getTestDirectory
104
- });
105
- //# sourceMappingURL=foundry.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/foundry/index.ts"],"sourcesContent":["import { execa, Options } from \"execa\";\n\nexport interface ForgeConfig {\n // project\n src: string;\n test: string;\n script: string;\n out: string;\n libs: string[];\n cache: boolean;\n cache_path: string;\n eth_rpc_url: string | null;\n\n // compiler\n remappings: string[];\n\n // all unspecified keys (this interface is far from comprehensive)\n [key: string]: unknown;\n}\n\n/**\n * Get forge config as a parsed json object.\n */\nexport async function getForgeConfig(profile?: string): Promise<ForgeConfig> {\n const { stdout } = await execa(\"forge\", [\"config\", \"--json\"], {\n stdio: [\"inherit\", \"pipe\", \"pipe\"],\n env: { FOUNDRY_PROFILE: profile },\n });\n\n return JSON.parse(stdout) as ForgeConfig;\n}\n\n/**\n * Get the value of \"src\" from forge config.\n * The path to the contract sources relative to the root of the project.\n */\nexport async function getSrcDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).src;\n}\n\n/**\n * Get the value of \"script\" from forge config.\n * The path to the contract sources relative to the root of the project.\n */\nexport async function getScriptDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).script;\n}\n\n/**\n * Get the value of \"test\" from forge config.\n * The path to the test contract sources relative to the root of the project.\n */\nexport async function getTestDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).test;\n}\n\n/**\n * Get the value of \"out\" from forge config.\n * The path to put contract artifacts in, relative to the root of the project.\n */\nexport async function getOutDirectory(profile?: string): Promise<string> {\n return (await getForgeConfig(profile)).out;\n}\n\n/**\n * Get the value of \"eth_rpc_url\" from forge config, default to \"http://127.0.0.1:8545\"\n * @param profile The foundry profile to use\n * @returns The rpc url\n */\nexport async function getRpcUrl(profile?: string): Promise<string> {\n return (\n process.env.FOUNDRY_ETH_RPC_URL ||\n process.env.RPC_HTTP_URL ||\n process.env.RPC_URL ||\n (await getForgeConfig(profile)).eth_rpc_url ||\n \"http://127.0.0.1:8545\"\n );\n}\n\n/**\n * Execute a forge command\n * @param args The arguments to pass to forge\n * @param options { profile?: The foundry profile to use; silent?: If true, nothing will be logged to the console }\n */\nexport async function forge(\n args: string[],\n options?: { profile?: string; silent?: boolean; env?: NodeJS.ProcessEnv; cwd?: string },\n): Promise<void> {\n const execOptions = {\n env: { FOUNDRY_PROFILE: options?.profile, ...options?.env },\n stdout: \"inherit\",\n stderr: \"pipe\",\n cwd: options?.cwd,\n } satisfies Options;\n\n await (options?.silent ? execa(\"forge\", args, execOptions) : execLog(\"forge\", args, execOptions));\n}\n\n/**\n * Execute a cast command\n * @param args The arguments to pass to cast\n * @returns Stdout of the command\n */\nexport async function cast(args: string[], options?: { profile?: string }): Promise<string> {\n return execLog(\"cast\", args, {\n env: { FOUNDRY_PROFILE: options?.profile },\n });\n}\n\n/**\n * Start an anvil chain\n * @param args The arguments to pass to anvil\n * @returns Stdout of the command\n */\nexport async function anvil(args: string[]): Promise<string> {\n return execLog(\"anvil\", args);\n}\n\n/**\n * Executes the given command, returns the stdout, and logs the command to the console.\n * Throws an error if the command fails.\n * @param command The command to execute\n * @param args The arguments to pass to the command\n * @returns The stdout of the command\n */\nasync function execLog(command: string, args: string[], options?: Options): Promise<string> {\n const commandString = `${command} ${args.join(\" \")}`;\n try {\n console.log(`running \"${commandString}\"`);\n const { stdout } = await execa(command, args, {\n ...options,\n stdout: \"pipe\",\n stderr: \"pipe\",\n lines: false,\n encoding: \"utf8\",\n });\n return stdout;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } catch (error: any) {\n let errorMessage = error?.stderr || error?.message || \"\";\n errorMessage += `\\nError running \"${commandString}\"`;\n throw new Error(errorMessage);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mB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AAK,GAAG,CAAC;AAClD,MAAI;AACF,YAAQ,IAAI,YAAY,aAAa,GAAG;AACxC,UAAM,EAAE,OAAO,IAAI,UAAM,oBAAM,SAAS,MAAM;AAAA,MAC5C,GAAG;AAAA,MACH,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,UAAU;AAAA,IACZ,CAAC;AACD,WAAO;AAAA,EAET,SAAS,OAAY;AACnB,QAAI,eAAe,OAAO,UAAU,OAAO,WAAW;AACtD,oBAAgB;AAAA,iBAAoB,aAAa;AACjD,UAAM,IAAI,MAAM,YAAY;AAAA,EAC9B;AACF;","names":[]}
@@ -1,69 +0,0 @@
1
- interface ForgeConfig {
2
- src: string;
3
- test: string;
4
- script: string;
5
- out: string;
6
- libs: string[];
7
- cache: boolean;
8
- cache_path: string;
9
- eth_rpc_url: string | null;
10
- remappings: string[];
11
- [key: string]: unknown;
12
- }
13
- /**
14
- * Get forge config as a parsed json object.
15
- */
16
- declare function getForgeConfig(profile?: string): Promise<ForgeConfig>;
17
- /**
18
- * Get the value of "src" from forge config.
19
- * The path to the contract sources relative to the root of the project.
20
- */
21
- declare function getSrcDirectory(profile?: string): Promise<string>;
22
- /**
23
- * Get the value of "script" from forge config.
24
- * The path to the contract sources relative to the root of the project.
25
- */
26
- declare function getScriptDirectory(profile?: string): Promise<string>;
27
- /**
28
- * Get the value of "test" from forge config.
29
- * The path to the test contract sources relative to the root of the project.
30
- */
31
- declare function getTestDirectory(profile?: string): Promise<string>;
32
- /**
33
- * Get the value of "out" from forge config.
34
- * The path to put contract artifacts in, relative to the root of the project.
35
- */
36
- declare function getOutDirectory(profile?: string): Promise<string>;
37
- /**
38
- * Get the value of "eth_rpc_url" from forge config, default to "http://127.0.0.1:8545"
39
- * @param profile The foundry profile to use
40
- * @returns The rpc url
41
- */
42
- declare function getRpcUrl(profile?: string): Promise<string>;
43
- /**
44
- * Execute a forge command
45
- * @param args The arguments to pass to forge
46
- * @param options { profile?: The foundry profile to use; silent?: If true, nothing will be logged to the console }
47
- */
48
- declare function forge(args: string[], options?: {
49
- profile?: string;
50
- silent?: boolean;
51
- env?: NodeJS.ProcessEnv;
52
- cwd?: string;
53
- }): Promise<void>;
54
- /**
55
- * Execute a cast command
56
- * @param args The arguments to pass to cast
57
- * @returns Stdout of the command
58
- */
59
- declare function cast(args: string[], options?: {
60
- profile?: string;
61
- }): Promise<string>;
62
- /**
63
- * Start an anvil chain
64
- * @param args The arguments to pass to anvil
65
- * @returns Stdout of the command
66
- */
67
- declare function anvil(args: string[]): Promise<string>;
68
-
69
- export { type ForgeConfig, anvil, cast, forge, getForgeConfig, getOutDirectory, getRpcUrl, getScriptDirectory, getSrcDirectory, getTestDirectory };
@@ -1,20 +0,0 @@
1
- import { WriteContractParameters, Hex, Transport, Address, Abi, Chain, Account, PublicClient, WalletClient, GetContractParameters, GetContractReturnType } from 'viem';
2
-
3
- type ContractWrite = {
4
- id: string;
5
- request: WriteContractParameters;
6
- result: Promise<Hex>;
7
- };
8
- type GetContractOptions<TTransport extends Transport, TAddress extends Address, TAbi extends Abi, TChain extends Chain, TAccount extends Account, TPublicClient extends PublicClient<TTransport, TChain>, TWalletClient extends WalletClient<TTransport, TChain, TAccount>> = GetContractParameters<TTransport, TChain, TAccount, TAbi, {
9
- public: TPublicClient;
10
- wallet: TWalletClient;
11
- }, TAddress> & {
12
- onWrite?: (write: ContractWrite) => void;
13
- };
14
- /** @deprecated Use `walletClient.extend(transactionQueue()).extend(writeObserver({ onWrite }))` and viem's `getContract` instead. */
15
- declare function getContract<TTransport extends Transport, TAddress extends Address, TAbi extends Abi, TChain extends Chain, TAccount extends Account, TPublicClient extends PublicClient<TTransport, TChain>, TWalletClient extends WalletClient<TTransport, TChain, TAccount>>({ abi, address, client: { public: publicClient, wallet: walletClient }, onWrite, }: GetContractOptions<TTransport, TAddress, TAbi, TChain, TAccount, TPublicClient, TWalletClient>): GetContractReturnType<TAbi, {
16
- public: TPublicClient;
17
- wallet: TWalletClient;
18
- }, TAddress>;
19
-
20
- export { type ContractWrite as C, type GetContractOptions as G, getContract as g };