@latticexyz/world 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.
- package/dist/IBaseWorld.abi-SGUPOG6A.js +2 -0
- package/dist/{IBaseWorld.abi-S745M2QE.js.map → IBaseWorld.abi-SGUPOG6A.js.map} +1 -1
- package/dist/System.abi-D2D3OAI5.js +2 -0
- package/dist/{System.abi-UHI2DJK6.js.map → System.abi-D2D3OAI5.js.map} +1 -1
- package/dist/chunk-AJUHOWGE.js +2 -0
- package/dist/{chunk-S5LARYWY.js.map → chunk-AJUHOWGE.js.map} +1 -1
- package/dist/chunk-CGF3NYHC.js +2 -0
- package/dist/chunk-CGF3NYHC.js.map +1 -0
- package/dist/chunk-DIHBEOC2.js +2 -0
- package/dist/{chunk-TL2M3LZH.js.map → chunk-DIHBEOC2.js.map} +1 -1
- package/dist/chunk-FW4363Y4.js +2 -0
- package/dist/index.js +1 -20
- package/dist/index.js.map +1 -1
- package/dist/internal.js +3 -318
- package/dist/internal.js.map +1 -1
- package/dist/mud.config.js +1 -11
- package/dist/node.js +102 -7328
- package/dist/node.js.map +1 -1
- package/package.json +14 -49
- package/dist/IBaseWorld.abi-S745M2QE.js +0 -2015
- package/dist/System.abi-UHI2DJK6.js +0 -67
- package/dist/chunk-AAKXFFCU.js +0 -158
- package/dist/chunk-AAKXFFCU.js.map +0 -1
- package/dist/chunk-AAWFTQHP.js +0 -35
- package/dist/chunk-S5LARYWY.js +0 -136
- package/dist/chunk-TL2M3LZH.js +0 -119
- package/dist/dynamicResolution-AmVd5Qtd.d.cts +0 -161
- package/dist/index.cjs +0 -241
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -11
- package/dist/internal.cjs +0 -656
- package/dist/internal.cjs.map +0 -1
- package/dist/internal.d.cts +0 -169
- package/dist/mud.config.cjs +0 -357
- package/dist/mud.config.cjs.map +0 -1
- package/dist/mud.config.d.cts +0 -869
- package/dist/node.cjs +0 -9599
- package/dist/node.cjs.map +0 -1
- package/dist/node.d.cts +0 -131
- package/dist/world-DUniZQxy.d.cts +0 -266
- /package/dist/{chunk-AAWFTQHP.js.map → chunk-FW4363Y4.js.map} +0 -0
package/dist/internal.cjs.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../ts/exports/internal.ts","../ts/encodeSystemCall.ts","../ts/normalizeSystemFunctionName.ts","../ts/encodeSystemCallFrom.ts","../ts/encodeSystemCalls.ts","../ts/encodeSystemCallsFrom.ts","../ts/actions/callFrom.ts","../ts/config/v2/world.ts","../ts/config/v2/defaults.ts","../ts/config/v2/systems.ts","../ts/config/v2/system.ts","../ts/config/v2/namespaces.ts","../ts/config/v2/namespace.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts","../mud.config.ts","../ts/config/v2/dynamicResolution.ts"],"sourcesContent":["export * from \"../encodeSystemCall\";\nexport * from \"../encodeSystemCallFrom\";\nexport * from \"../encodeSystemCalls\";\nexport * from \"../encodeSystemCallsFrom\";\n\nexport * from \"../actions/callFrom\";\n\nexport * from \"../config/v2/codegen\";\nexport * from \"../config/v2/defaults\";\nexport * from \"../config/v2/deploy\";\nexport * from \"../config/v2/dynamicResolution\";\nexport * from \"../config/v2/input\";\nexport * from \"../config/v2/namespace\";\nexport * from \"../config/v2/namespaces\";\nexport * from \"../config/v2/output\";\nexport * from \"../config/v2/system\";\nexport * from \"../config/v2/systems\";\nexport * from \"../config/v2/world\";\n","import { Abi, EncodeFunctionDataParameters, Hex, encodeFunctionData, type ContractFunctionName } from \"viem\";\nimport type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from \"abitype\";\nimport { worldCallAbi } from \"./worldCallAbi\";\nimport { internal_normalizeSystemFunctionName } from \"./normalizeSystemFunctionName\";\n\nexport type SystemCall<abi extends Abi, functionName extends ContractFunctionName<abi>> = {\n /**\n * System ABI\n */\n readonly abi: abi;\n /**\n * System's resource ID\n */\n readonly systemId: Hex;\n /**\n * System function name to call\n */\n readonly functionName: functionName;\n} & Pick<EncodeFunctionDataParameters<abi, functionName>, \"args\">;\n\n/** Encode a system call to be passed as arguments into `World.call` */\nexport function encodeSystemCall<abi extends Abi, functionName extends ContractFunctionName<abi>>({\n abi,\n systemId,\n functionName,\n args,\n}: SystemCall<abi, functionName>): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, \"call\">[\"inputs\"]> {\n return [\n systemId,\n encodeFunctionData<abi, functionName>({\n abi,\n functionName: internal_normalizeSystemFunctionName(systemId, functionName),\n args,\n } as EncodeFunctionDataParameters<abi, functionName>),\n ];\n}\n","import { hexToResource, resourceToLabel } from \"@latticexyz/common\";\nimport { Hex } from \"viem\";\n\n/** @internal */\nexport function internal_normalizeSystemFunctionName(systemId: Hex, functionName: string) {\n const resource = hexToResource(systemId);\n const worldFunctionPrefix = resource.namespace !== \"\" ? `${resource.namespace}__` : null;\n if (worldFunctionPrefix != null && functionName.startsWith(worldFunctionPrefix)) {\n console.warn(\n // eslint-disable-next-line max-len\n `Detected world function name \"${functionName}\" used in call to system \"${resourceToLabel(resource)}\".\\n\\nIt's recommended to use a system ABI and system function name with these methods instead.`,\n );\n return functionName.slice(worldFunctionPrefix.length);\n }\n return functionName;\n}\n","import { Abi, EncodeFunctionDataParameters, encodeFunctionData, Address, type ContractFunctionName } from \"viem\";\nimport type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from \"abitype\";\nimport { SystemCall } from \"./encodeSystemCall\";\nimport { worldCallAbi } from \"./worldCallAbi\";\nimport { internal_normalizeSystemFunctionName } from \"./normalizeSystemFunctionName\";\n\nexport type SystemCallFrom<abi extends Abi, functionName extends ContractFunctionName<abi>> = SystemCall<\n abi,\n functionName\n> & {\n readonly from: Address;\n};\n\n/** Encode a system call to be passed as arguments into `World.callFrom` */\nexport function encodeSystemCallFrom<abi extends Abi, functionName extends ContractFunctionName<abi>>({\n abi,\n from,\n systemId,\n functionName,\n args,\n}: SystemCallFrom<abi, functionName>): AbiParametersToPrimitiveTypes<\n ExtractAbiFunction<worldCallAbi, \"callFrom\">[\"inputs\"]\n> {\n return [\n from,\n systemId,\n encodeFunctionData<abi, functionName>({\n abi,\n functionName: internal_normalizeSystemFunctionName(systemId, functionName),\n args,\n } as EncodeFunctionDataParameters<abi, functionName>),\n ];\n}\n","import { Abi, EncodeFunctionDataParameters, encodeFunctionData, type ContractFunctionName } from \"viem\";\nimport { SystemCall } from \"./encodeSystemCall\";\nimport type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from \"abitype\";\nimport { worldCallAbi } from \"./worldCallAbi\";\nimport { internal_normalizeSystemFunctionName } from \"./normalizeSystemFunctionName\";\n\n/** Encode system calls to be passed as arguments into `World.batchCall` */\nexport function encodeSystemCalls<abi extends Abi, functionName extends ContractFunctionName<abi>>(\n abi: abi,\n systemCalls: readonly Omit<SystemCall<abi, functionName>, \"abi\">[],\n): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, \"batchCall\">[\"inputs\"]> {\n return [\n systemCalls.map(({ systemId, functionName, args }) => ({\n systemId,\n callData: encodeFunctionData<abi, functionName>({\n abi,\n functionName: internal_normalizeSystemFunctionName(systemId, functionName),\n args,\n } as EncodeFunctionDataParameters<abi, functionName>),\n })),\n ];\n}\n","import { Abi, Address, EncodeFunctionDataParameters, encodeFunctionData, type ContractFunctionName } from \"viem\";\nimport { SystemCallFrom } from \"./encodeSystemCallFrom\";\nimport type { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from \"abitype\";\nimport { worldCallAbi } from \"./worldCallAbi\";\nimport { internal_normalizeSystemFunctionName } from \"./normalizeSystemFunctionName\";\n\n/** Encode system calls to be passed as arguments into `World.batchCallFrom` */\nexport function encodeSystemCallsFrom<abi extends Abi, functionName extends ContractFunctionName<abi>>(\n abi: abi,\n from: Address,\n systemCalls: readonly Omit<SystemCallFrom<abi, functionName>, \"abi\" | \"from\">[],\n): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, \"batchCallFrom\">[\"inputs\"]> {\n return [\n systemCalls.map(({ systemId, functionName, args }) => ({\n from,\n systemId,\n callData: encodeFunctionData<abi, functionName>({\n abi,\n functionName: internal_normalizeSystemFunctionName(systemId, functionName),\n args,\n } as EncodeFunctionDataParameters<abi, functionName>),\n })),\n ];\n}\n","import {\n slice,\n concat,\n type Transport,\n type Chain,\n type Account,\n type Hex,\n type WalletActions,\n type Client,\n type PublicActions,\n type WriteContractParameters,\n type EncodeFunctionDataParameters,\n} from \"viem\";\nimport { getAction, encodeFunctionData } from \"viem/utils\";\nimport { readContract, writeContract as viem_writeContract } from \"viem/actions\";\nimport { readHex } from \"@latticexyz/common\";\nimport {\n getKeySchema,\n getValueSchema,\n getSchemaTypes,\n decodeValueArgs,\n encodeKey,\n} from \"@latticexyz/protocol-parser/internal\";\nimport worldConfig from \"../../mud.config\";\nimport { worldCallAbi } from \"../worldCallAbi\";\n\ntype CallFromParameters = {\n worldAddress: Hex;\n delegatorAddress: Hex;\n worldFunctionToSystemFunction?: (worldFunctionSelector: Hex) => Promise<SystemFunction>;\n publicClient?: Client;\n};\n\ntype SystemFunction = { systemId: Hex; systemFunctionSelector: Hex };\n\n// By extending viem clients with this function after delegation, the delegation is automatically applied to World contract writes.\n// This means that these writes are made on behalf of the delegator.\n// Internally, it transforms the write arguments to use `callFrom`.\n//\n// Accepts either `worldFunctionToSystemFunction` or `publicClient` as an argument.\n// `worldFunctionToSystemFunction` allows manually providing the mapping function, thus users can utilize their client store for the lookup.\n// If `publicClient` is provided instead, this function retrieves the corresponding system function from the World contract.\n//\n// The function mapping is cached to avoid redundant retrievals for the same World function.\nexport function callFrom(\n params: CallFromParameters,\n): <chain extends Chain, account extends Account | undefined>(\n client: Client<Transport, chain, account>,\n) => Pick<WalletActions<chain, account>, \"writeContract\"> {\n return (client) => ({\n async writeContract(writeArgs) {\n const _writeContract = getAction(client, viem_writeContract, \"writeContract\");\n\n // Skip if the contract isn't the World or the function called should not be redirected through `callFrom`.\n if (\n writeArgs.address !== params.worldAddress ||\n writeArgs.functionName === \"call\" ||\n writeArgs.functionName === \"callFrom\" ||\n writeArgs.functionName === \"batchCallFrom\" ||\n writeArgs.functionName === \"callWithSignature\"\n ) {\n return _writeContract(writeArgs);\n }\n\n // Wrap system calls from `batchCall` with delegator for a `batchCallFrom`\n // TODO: remove this specific workaround once https://github.com/latticexyz/mud/pull/3506 lands\n if (writeArgs.functionName === \"batchCall\") {\n const batchCallArgs = writeArgs as unknown as WriteContractParameters<worldCallAbi, \"batchCall\">;\n const [systemCalls] = batchCallArgs.args;\n if (!systemCalls.length) {\n throw new Error(\"`batchCall` should have at least one system call.\");\n }\n\n return _writeContract({\n ...batchCallArgs,\n functionName: \"batchCallFrom\",\n args: [systemCalls.map((systemCall) => ({ from: params.delegatorAddress, ...systemCall }))],\n });\n }\n\n // Encode the World's calldata (which includes the World's function selector).\n const worldCalldata = encodeFunctionData({\n abi: writeArgs.abi,\n functionName: writeArgs.functionName,\n args: writeArgs.args,\n } as unknown as EncodeFunctionDataParameters);\n\n // The first 4 bytes of calldata represent the function selector.\n const worldFunctionSelector = slice(worldCalldata, 0, 4);\n\n // Get the systemId and System's function selector.\n const { systemId, systemFunctionSelector } = await worldFunctionToSystemFunction({\n ...params,\n publicClient: params.publicClient ?? client,\n worldFunctionSelector,\n });\n\n // Construct the System's calldata by replacing the World's function selector with the System's.\n // Use `readHex` instead of `slice` to prevent out-of-bounds errors with calldata that has no args.\n const systemCalldata = concat([systemFunctionSelector, readHex(worldCalldata, 4)]);\n\n // Call `writeContract` with the new args.\n return _writeContract({\n ...(writeArgs as unknown as WriteContractParameters<worldCallAbi, \"callFrom\">),\n functionName: \"callFrom\",\n args: [params.delegatorAddress, systemId, systemCalldata],\n });\n },\n });\n}\n\nconst systemFunctionCache = new Map<Hex, SystemFunction>();\n\nasync function worldFunctionToSystemFunction(params: {\n worldAddress: Hex;\n delegatorAddress: Hex;\n worldFunctionSelector: Hex;\n worldFunctionToSystemFunction?: (worldFunctionSelector: Hex) => Promise<SystemFunction>;\n publicClient: Client;\n}): Promise<SystemFunction> {\n const cacheKey = concat([params.worldAddress, params.worldFunctionSelector]);\n\n // Use cache if the function has been called previously.\n const cached = systemFunctionCache.get(cacheKey);\n if (cached) return cached;\n\n // If a mapping function is provided, use it. Otherwise, call the World contract.\n const systemFunction = params.worldFunctionToSystemFunction\n ? await params.worldFunctionToSystemFunction(params.worldFunctionSelector)\n : await retrieveSystemFunctionFromContract(params.publicClient, params.worldAddress, params.worldFunctionSelector);\n\n systemFunctionCache.set(cacheKey, systemFunction);\n\n return systemFunction;\n}\n\nasync function retrieveSystemFunctionFromContract(\n publicClient: Client,\n worldAddress: Hex,\n worldFunctionSelector: Hex,\n): Promise<SystemFunction> {\n const table = worldConfig.tables.world__FunctionSelectors;\n\n const keySchema = getSchemaTypes(getKeySchema(table));\n const valueSchema = getSchemaTypes(getValueSchema(table));\n\n const _readContract = getAction(publicClient, readContract, \"readContract\") as PublicActions[\"readContract\"];\n\n const [staticData, encodedLengths, dynamicData] = await _readContract({\n address: worldAddress,\n abi: [\n {\n type: \"function\",\n name: \"getRecord\",\n inputs: [\n {\n name: \"tableId\",\n type: \"bytes32\",\n internalType: \"ResourceId\",\n },\n {\n name: \"keyTuple\",\n type: \"bytes32[]\",\n internalType: \"bytes32[]\",\n },\n ],\n outputs: [\n {\n name: \"staticData\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n {\n name: \"encodedLengths\",\n type: \"bytes32\",\n internalType: \"EncodedLengths\",\n },\n {\n name: \"dynamicData\",\n type: \"bytes\",\n internalType: \"bytes\",\n },\n ],\n stateMutability: \"view\",\n },\n ],\n functionName: \"getRecord\",\n args: [table.tableId, encodeKey(keySchema, { worldFunctionSelector })],\n });\n\n const decoded = decodeValueArgs(valueSchema, { staticData, encodedLengths, dynamicData });\n\n const systemFunction: SystemFunction = {\n systemId: decoded.systemId,\n systemFunctionSelector: decoded.systemFunctionSelector,\n };\n\n return systemFunction;\n}\n","import { ErrorMessage, conform, show, type withJsDoc } from \"@ark/util\";\nimport {\n extendedScope,\n get,\n mergeIfUndefined,\n resolveStore,\n hasOwnKey,\n validateStore,\n flattenNamespacedTables,\n CONFIG_DEFAULTS as STORE_CONFIG_DEFAULTS,\n} from \"@latticexyz/store/internal\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { resolveNamespaces, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\nimport { StoreInput } from \"@latticexyz/store\";\n\nexport type validateWorld<input> = {\n readonly [key in keyof input]: key extends \"namespaces\"\n ? input extends { namespace?: unknown; tables?: unknown; systems?: unknown }\n ? ErrorMessage<\"Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.\">\n : validateNamespaces<input[key], extendedScope<input>>\n : key extends \"systems\"\n ? validateSystems<input[key]>\n : key extends \"codegen\"\n ? conform<input[key], WorldInput[key] & StoreInput[key]>\n : key extends keyof StoreInput\n ? validateStore<input>[key]\n : key extends keyof WorldInput\n ? conform<input[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\n};\n\nexport function validateWorld(input: unknown): asserts input is WorldInput {\n const scope = extendedScope(input);\n\n if (hasOwnKey(input, \"namespaces\")) {\n if (hasOwnKey(input, \"namespace\") || hasOwnKey(input, \"tables\") || hasOwnKey(input, \"systems\")) {\n throw new Error(\"Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.\");\n }\n validateNamespaces(input.namespaces, scope);\n }\n if (hasOwnKey(input, \"systems\")) {\n validateSystems(input.systems);\n }\n\n validateStore(input);\n}\n\nexport type resolveNamespaceMode<input> = \"namespaces\" extends keyof input\n ? {\n readonly multipleNamespaces: true;\n readonly namespace: null;\n readonly namespaces: show<resolveNamespaces<input[\"namespaces\"], extendedScope<input>>>;\n }\n : {\n readonly multipleNamespaces: false;\n readonly namespace: string;\n readonly namespaces: show<\n resolveNamespaces<\n {\n // TODO: improve this so we don't have to duplicate store behavior\n readonly [label in \"namespace\" extends keyof input\n ? input[\"namespace\"] extends string\n ? input[\"namespace\"]\n : STORE_CONFIG_DEFAULTS[\"namespace\"]\n : STORE_CONFIG_DEFAULTS[\"namespace\"]]: input;\n },\n extendedScope<input>\n >\n >;\n };\n\ntype resolveModules<input> = { [key in keyof input]: mergeIfUndefined<input[key], MODULE_DEFAULTS> };\n\nexport type resolveWorld<input> = resolveNamespaceMode<input> &\n Omit<resolveStore<input>, \"multipleNamespaces\" | \"namespace\" | \"namespaces\" | \"tables\"> & {\n readonly tables: flattenNamespacedTables<resolveNamespaceMode<input>>;\n // TODO: flatten systems from namespaces\n readonly systems: \"systems\" extends keyof input\n ? input[\"systems\"] extends SystemsInput\n ? resolveNamespaceMode<input>[\"namespace\"] extends string\n ? show<resolveSystems<input[\"systems\"], resolveNamespaceMode<input>[\"namespace\"]>>\n : {}\n : {}\n : {};\n readonly excludeSystems: \"excludeSystems\" extends keyof input\n ? input[\"excludeSystems\"]\n : CONFIG_DEFAULTS[\"excludeSystems\"];\n readonly modules: \"modules\" extends keyof input ? resolveModules<input[\"modules\"]> : CONFIG_DEFAULTS[\"modules\"];\n readonly codegen: show<resolveCodegen<\"codegen\" extends keyof input ? input[\"codegen\"] : {}>>;\n readonly deploy: show<resolveDeploy<\"deploy\" extends keyof input ? input[\"deploy\"] : {}>>;\n };\n\nexport function resolveWorld<const input extends WorldInput>(input: input): resolveWorld<input> {\n const scope = extendedScope(input);\n const store = resolveStore(input);\n\n const namespaces = input.namespaces\n ? resolveNamespaces(input.namespaces, scope)\n : resolveNamespaces({ [store.namespace!]: input }, scope);\n\n const tables = flattenNamespacedTables({ namespaces });\n const modules = (input.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\n\n return mergeIfUndefined(\n {\n ...store,\n namespaces,\n tables,\n // TODO: flatten systems from namespaces\n systems:\n !store.multipleNamespaces && input.systems\n ? resolveSystems(input.systems, store.namespace, store.namespace)\n : CONFIG_DEFAULTS.systems,\n excludeSystems: get(input, \"excludeSystems\"),\n codegen: mergeIfUndefined(store.codegen, resolveCodegen(input.codegen)),\n deploy: resolveDeploy(input.deploy),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): withJsDoc<resolveWorld<input>, World> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\n","import { CodegenInput, DeployInput, ModuleInput, SystemDeployInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEPLOY_DEFAULTS = {\n disabled: false,\n registerWorldFunctions: true,\n} as const satisfies Required<SystemDeployInput>;\n\nexport type SYSTEM_DEPLOY_DEFAULTS = typeof SYSTEM_DEPLOY_DEFAULTS;\n\nexport const SYSTEM_DEFAULTS = {\n namespaceLabel: \"\",\n openAccess: true,\n accessList: [],\n} as const satisfies Omit<Required<SystemInput>, \"label\" | \"namespace\" | \"name\" | \"deploy\">;\n\nexport type SYSTEM_DEFAULTS = typeof SYSTEM_DEFAULTS;\n\nexport const MODULE_DEFAULTS = {\n root: false,\n args: [],\n artifactPath: undefined,\n} as const satisfies Pick<ModuleInput, \"root\" | \"args\" | \"artifactPath\">;\n\nexport type MODULE_DEFAULTS = typeof MODULE_DEFAULTS;\n\nexport const CODEGEN_DEFAULTS = {\n worldInterfaceName: \"IWorld\",\n worldgenDirectory: \"world\",\n systemLibrariesDirectory: \"systems\",\n generateSystemLibraries: false,\n worldImportPath: \"@latticexyz/world/src\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\n postDeployScript: \"PostDeploy\",\n deploysDirectory: \"./deploys\",\n worldsFile: \"./worlds.json\",\n upgradeableWorldImplementation: false,\n} as const satisfies DeployInput;\n\nexport type DEPLOY_DEFAULTS = typeof DEPLOY_DEFAULTS;\n\nexport const CONFIG_DEFAULTS = {\n systems: {},\n tables: {},\n excludeSystems: [],\n modules: [],\n codegen: CODEGEN_DEFAULTS,\n deploy: DEPLOY_DEFAULTS,\n} as const satisfies WorldInput;\n\nexport type CONFIG_DEFAULTS = typeof CONFIG_DEFAULTS;\n","import { ErrorMessage } from \"@ark/util\";\nimport { isObject } from \"@latticexyz/store/internal\";\nimport { SystemsInput } from \"./input\";\nimport { resolveSystem, validateSystem } from \"./system\";\n\n// TODO: add nuance between \"in namespace\" (namespace provided in context) and \"in systems\" (label provided in context)\n\nexport type validateSystems<input> = {\n [label in keyof input]: input[label] extends object\n ? validateSystem<input[label], { inNamespace: true }>\n : ErrorMessage<`Expected a system config for ${label & string}.`>;\n};\n\nexport function validateSystems(input: unknown): asserts input is SystemsInput {\n if (isObject(input)) {\n for (const system of Object.values(input)) {\n validateSystem(system, { inNamespace: true });\n }\n return;\n }\n throw new Error(`Expected system config, received ${JSON.stringify(input)}`);\n}\n\nexport type resolveSystems<systems extends SystemsInput, namespaceLabel extends string> = {\n [label in keyof systems]: resolveSystem<\n systems[label] & { label: label; namespaceLabel: namespaceLabel; namespace: string }\n >;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespaceLabel extends string>(\n systems: systems,\n namespaceLabel: namespaceLabel,\n namespace: string,\n): resolveSystems<systems, namespaceLabel> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespaceLabel, namespace })];\n }),\n ) as never;\n}\n","import { SYSTEM_DEFAULTS, SYSTEM_DEPLOY_DEFAULTS } from \"./defaults\";\nimport { SystemInput } from \"./input\";\nimport { hasOwnKey, mergeIfUndefined } from \"@latticexyz/store/internal\";\nimport { ErrorMessage, narrow, requiredKeyOf, show } from \"@ark/util\";\nimport { Hex } from \"viem\";\nimport { resourceToHex } from \"@latticexyz/common\";\n\nexport type ValidateSystemOptions = { readonly inNamespace?: true };\n\nexport type requiredSystemKey<inNamespace extends true | undefined> = Exclude<\n requiredKeyOf<SystemInput>,\n inNamespace extends true ? \"label\" | \"namespaceLabel\" | \"namespace\" : never\n>;\n\nexport type validateSystem<input, options extends ValidateSystemOptions = {}> = {\n [key in keyof input | requiredSystemKey<options[\"inNamespace\"]>]: key extends keyof SystemInput\n ? key extends \"label\" | \"namespaceLabel\" | \"namespace\"\n ? options[\"inNamespace\"] extends true\n ? ErrorMessage<\"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.\">\n : key extends keyof input\n ? narrow<input[key]>\n : never\n : SystemInput[key]\n : ErrorMessage<`Key \\`${key & string}\\` does not exist in SystemInput`>;\n};\n\nexport function validateSystem<input>(\n input: input,\n options: ValidateSystemOptions = {},\n): asserts input is SystemInput & input {\n if (typeof input !== \"object\" || input == null) {\n throw new Error(`Expected full system config, got \\`${JSON.stringify(input)}\\``);\n }\n\n if (\n options.inNamespace &&\n (hasOwnKey(input, \"label\") || hasOwnKey(input, \"namespaceLabel\") || hasOwnKey(input, \"namespace\"))\n ) {\n throw new Error(\n \"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.\",\n );\n }\n\n if (\n hasOwnKey(input, \"namespaceLabel\") &&\n typeof input.namespaceLabel === \"string\" &&\n (!hasOwnKey(input, \"namespace\") || typeof input.namespace !== \"string\") &&\n input.namespaceLabel.length > 14\n ) {\n throw new Error(\n `System \\`namespace\\` defaults to \\`namespaceLabel\\`, but must fit into a \\`bytes14\\` and \"${input.namespaceLabel}\" is too long. Provide explicit \\`namespace\\` override.`,\n );\n }\n\n if (hasOwnKey(input, \"namespace\") && typeof input.namespace === \"string\" && input.namespace.length > 14) {\n throw new Error(`System \\`namespace\\` must fit into a \\`bytes14\\`, but \"${input.namespace}\" is too long.`);\n }\n if (hasOwnKey(input, \"name\") && typeof input.name === \"string\" && input.name.length > 16) {\n throw new Error(`System \\`name\\` must fit into a \\`bytes16\\`, but \"${input.name}\" is too long.`);\n }\n}\n\nexport type resolveSystem<input> = input extends SystemInput\n ? {\n readonly label: input[\"label\"];\n readonly namespaceLabel: undefined extends input[\"namespaceLabel\"]\n ? typeof SYSTEM_DEFAULTS.namespaceLabel\n : input[\"namespaceLabel\"];\n readonly namespace: string;\n readonly name: string;\n readonly systemId: Hex;\n readonly openAccess: undefined extends input[\"openAccess\"] ? SYSTEM_DEFAULTS[\"openAccess\"] : input[\"openAccess\"];\n readonly accessList: undefined extends input[\"accessList\"] ? SYSTEM_DEFAULTS[\"accessList\"] : input[\"accessList\"];\n readonly deploy: show<\n mergeIfUndefined<undefined extends input[\"deploy\"] ? {} : input[\"deploy\"], SYSTEM_DEPLOY_DEFAULTS>\n >;\n }\n : never;\n\nexport function resolveSystem<input extends SystemInput>(input: input): resolveSystem<input> {\n const namespaceLabel = input.namespaceLabel ?? SYSTEM_DEFAULTS.namespaceLabel;\n // validate ensures this is length constrained\n const namespace = input.namespace ?? namespaceLabel;\n\n const label = input.label;\n const name = input.name ?? label.slice(0, 16);\n const systemId = resourceToHex({ type: \"system\", namespace, name });\n\n return mergeIfUndefined(\n {\n ...input,\n label,\n namespaceLabel,\n namespace,\n name,\n systemId,\n deploy: mergeIfUndefined(input.deploy ?? {}, SYSTEM_DEPLOY_DEFAULTS),\n },\n SYSTEM_DEFAULTS,\n ) as never;\n}\n\nexport function defineSystem<input>(input: validateSystem<input>): resolveSystem<input> {\n validateSystem(input);\n return resolveSystem(input) as never;\n}\n","import { show, flatMorph } from \"@ark/util\";\nimport { NamespacesInput } from \"./input\";\nimport { validateNamespace, resolveNamespace } from \"./namespace\";\nimport { groupBy } from \"@latticexyz/common/utils\";\nimport { AbiTypeScope, Scope, isObject, mergeIfUndefined } from \"@latticexyz/store/internal\";\n\n// Copied from store/ts/config/v2/namespaces.ts but using world namespace validate/resolve methods\n// TODO: figure out how to dedupe these?\n\nexport type validateNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {\n [label in keyof namespaces]: validateNamespace<namespaces[label], scope>;\n};\n\nexport function validateNamespaces<scope extends Scope = AbiTypeScope>(\n namespaces: unknown,\n scope: scope,\n): asserts namespaces is NamespacesInput {\n if (!isObject(namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);\n }\n for (const namespace of Object.values(namespaces)) {\n validateNamespace(namespace, scope);\n }\n}\n\nexport type resolveNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {\n readonly [label in keyof namespaces]: resolveNamespace<mergeIfUndefined<namespaces[label], { label: label }>, scope>;\n};\n\nexport function resolveNamespaces<input extends NamespacesInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope,\n): resolveNamespaces<input, scope> {\n if (!isObject(input)) {\n throw new Error(`Expected namespaces config, received ${JSON.stringify(input)}`);\n }\n\n const namespaces = flatMorph(input as NamespacesInput, (label, namespace) => [\n label,\n resolveNamespace(mergeIfUndefined(namespace, { label }), scope),\n ]);\n\n // This should probably be in `validate`, but `namespace` gets set during the resolve step above, so it's easier to validate here.\n const duplicates = Array.from(groupBy(Object.values(namespaces), (namespace) => namespace.namespace).entries())\n .filter(([, entries]) => entries.length > 1)\n .map(([namespace]) => namespace);\n if (duplicates.length > 0) {\n throw new Error(`Found namespaces defined more than once in config: ${duplicates.join(\", \")}`);\n }\n\n return namespaces as never;\n}\n\nexport function defineNamespaces<input, scope extends Scope = AbiTypeScope>(\n input: validateNamespaces<input, scope>,\n scope: scope = AbiTypeScope as never,\n): show<resolveNamespaces<input, scope>> {\n validateNamespaces(input, scope);\n return resolveNamespaces(input, scope) as never;\n}\n","import { NamespaceInput, SystemsInput } from \"./input\";\nimport {\n hasOwnKey,\n validateNamespace as validateStoreNamespace,\n resolveNamespace as resolveStoreNamespace,\n Scope,\n AbiTypeScope,\n} from \"@latticexyz/store/internal\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { show } from \"@ark/util\";\n\nexport type validateNamespace<input, scope extends Scope = AbiTypeScope> = {\n [key in keyof input]: key extends \"systems\" ? validateSystems<input[key]> : validateStoreNamespace<input, scope>[key];\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n input: unknown,\n scope: scope,\n): asserts input is NamespaceInput {\n if (hasOwnKey(input, \"systems\")) {\n validateSystems(input.systems);\n }\n validateStoreNamespace(input, scope);\n}\n\nexport type resolveNamespace<input, scope extends Scope = AbiTypeScope> = input extends NamespaceInput\n ? show<\n resolveStoreNamespace<input, scope> & {\n readonly systems: input[\"systems\"] extends SystemsInput\n ? show<resolveSystems<input[\"systems\"], resolveStoreNamespace<input, scope>[\"label\"]>>\n : {};\n }\n >\n : never;\n\nexport function resolveNamespace<const input extends NamespaceInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope = AbiTypeScope as never,\n): resolveNamespace<input, scope> {\n const namespace = resolveStoreNamespace(input, scope);\n const systems = resolveSystems(input.systems ?? {}, namespace.label, namespace.namespace);\n return {\n ...namespace,\n systems,\n } as never;\n}\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/internal\";\nimport { CODEGEN_DEFAULTS } from \"./defaults\";\n\nexport type resolveCodegen<codegen> = codegen extends {}\n ? mergeIfUndefined<codegen, CODEGEN_DEFAULTS>\n : CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS) as never;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/internal\";\nimport { DEPLOY_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, DEPLOY_DEFAULTS> : DEPLOY_DEFAULTS;\n\nexport function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {\n return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as never;\n}\n","import { defineWorld } from \"./ts/config/v2/world\";\n\n/**\n * @internal\n */\nexport const configInput = {\n namespace: \"world\", // NOTE: this namespace is only used for tables, the core system is deployed in the root namespace.\n codegen: {\n worldImportPath: \"./src\",\n worldgenDirectory: \"interfaces\",\n worldInterfaceName: \"IBaseWorld\",\n },\n userTypes: {\n ResourceId: { filePath: \"@latticexyz/store/src/ResourceId.sol\", type: \"bytes32\" },\n },\n tables: {\n NamespaceOwner: {\n schema: {\n namespaceId: \"ResourceId\",\n owner: \"address\",\n },\n key: [\"namespaceId\"],\n },\n ResourceAccess: {\n schema: {\n resourceId: \"ResourceId\",\n caller: \"address\",\n access: \"bool\",\n },\n key: [\"resourceId\", \"caller\"],\n },\n InstalledModules: {\n schema: {\n moduleAddress: \"address\",\n argumentsHash: \"bytes32\", // Hash of the params passed to the `install` function\n isInstalled: \"bool\",\n },\n key: [\"moduleAddress\", \"argumentsHash\"],\n },\n UserDelegationControl: {\n schema: {\n delegator: \"address\",\n delegatee: \"address\",\n delegationControlId: \"ResourceId\",\n },\n key: [\"delegator\", \"delegatee\"],\n },\n NamespaceDelegationControl: {\n schema: {\n namespaceId: \"ResourceId\",\n delegationControlId: \"ResourceId\",\n },\n key: [\"namespaceId\"],\n },\n Balances: {\n schema: {\n namespaceId: \"ResourceId\",\n balance: \"uint256\",\n },\n key: [\"namespaceId\"],\n },\n Systems: {\n schema: {\n systemId: \"ResourceId\",\n system: \"address\",\n publicAccess: \"bool\",\n },\n key: [\"systemId\"],\n codegen: {\n dataStruct: false,\n },\n },\n SystemRegistry: {\n schema: {\n system: \"address\",\n systemId: \"ResourceId\",\n },\n key: [\"system\"],\n },\n SystemHooks: {\n schema: {\n systemId: \"ResourceId\",\n value: \"bytes21[]\",\n },\n key: [\"systemId\"],\n },\n FunctionSelectors: {\n schema: {\n worldFunctionSelector: \"bytes4\",\n systemId: \"ResourceId\",\n systemFunctionSelector: \"bytes4\",\n },\n key: [\"worldFunctionSelector\"],\n codegen: {\n dataStruct: false,\n },\n },\n FunctionSignatures: {\n type: \"offchainTable\",\n schema: {\n functionSelector: \"bytes4\",\n functionSignature: \"string\",\n },\n key: [\"functionSelector\"],\n },\n InitModuleAddress: {\n schema: {\n value: \"address\",\n },\n key: [],\n },\n },\n excludeSystems: [\n // Worldgen currently does not support systems inheriting logic\n // from other contracts, so all parts of RegistrationSystem are named\n // System too to be included in the IBaseWorld interface.\n // However, IStoreRegistrationSystem overlaps with IStore if\n // included in IBaseWorld, so it needs to be excluded from worldgen.\n // TODO: add support for inheritance to worldgen\n // (see: https://github.com/latticexyz/mud/issues/631)\n \"StoreRegistrationSystem\",\n ],\n} as const;\n\nexport default defineWorld(configInput);\n","import { World } from \"./output\";\n\nexport type DynamicResolution = {\n // TODO: add systemAddress support\n type: \"tableId\";\n input: string;\n};\n\nexport type ValueWithType = {\n value: string | number | Uint8Array;\n type: string;\n};\n\n/**\n * Dynamically resolve a table name to a table id at deploy time\n */\nexport function resolveTableId(tableName: string) {\n return {\n type: \"tableId\",\n input: tableName,\n } as const;\n}\n\n/** Type guard for DynamicResolution */\nexport function isDynamicResolution(value: unknown): value is DynamicResolution {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"input\" in value;\n}\n\n/** Type guard for ValueWithType */\nexport function isValueWithType(value: unknown): value is ValueWithType {\n return typeof value === \"object\" && value !== null && \"type\" in value && \"value\" in value;\n}\n\n/**\n * Turn a DynamicResolution object into a ValueWithType based on the provided context\n */\nexport function resolveWithContext(\n input: unknown,\n context: { config: World; systemAddresses?: Record<string, Promise<string>> },\n): ValueWithType {\n if (isValueWithType(input)) return input;\n\n if (isDynamicResolution(input)) {\n if (input.type === \"tableId\") {\n const tableEntries = Object.entries(context.config.tables).filter(\n ([tableName, table]) => tableName === input.input || table.name === input.input,\n );\n\n if (tableEntries.length > 1) {\n throw new Error(\n `Found more than one table with name \"${input.input}\". Try using one of the following table names instead: ${tableEntries.map(([tableName]) => tableName).join(\", \")}`,\n );\n }\n\n if (tableEntries.length === 1) {\n const [entry] = tableEntries;\n const [, table] = entry;\n return { type: \"bytes32\", value: table.tableId };\n }\n }\n }\n\n throw new Error(`Could not resolve dynamic resolution:\\n${JSON.stringify(input, null, 2)}`);\n}\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAsG;;;ACAtG,oBAA+C;AAIxC,SAAS,qCAAqC,UAAe,cAAsB;AACxF,QAAM,eAAW,6BAAc,QAAQ;AACvC,QAAM,sBAAsB,SAAS,cAAc,KAAK,GAAG,SAAS,SAAS,OAAO;AACpF,MAAI,uBAAuB,QAAQ,aAAa,WAAW,mBAAmB,GAAG;AAC/E,YAAQ;AAAA;AAAA,MAEN,iCAAiC,YAAY,iCAA6B,+BAAgB,QAAQ,CAAC;AAAA;AAAA;AAAA,IACrG;AACA,WAAO,aAAa,MAAM,oBAAoB,MAAM;AAAA,EACtD;AACA,SAAO;AACT;;;ADMO,SAAS,iBAAkF;AAAA,EAChG;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAqH;AACnH,SAAO;AAAA,IACL;AAAA,QACA,gCAAsC;AAAA,MACpC;AAAA,MACA,cAAc,qCAAqC,UAAU,YAAY;AAAA,MACzE;AAAA,IACF,CAAoD;AAAA,EACtD;AACF;;;AEnCA,IAAAA,eAA0G;AAcnG,SAAS,qBAAsF;AAAA,EACpG;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAEE;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,QACA,iCAAsC;AAAA,MACpC;AAAA,MACA,cAAc,qCAAqC,UAAU,YAAY;AAAA,MACzE;AAAA,IACF,CAAoD;AAAA,E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AAI,gBAAgB,KAAK,EAAG,QAAO;AAEnC,MAAI,oBAAoB,KAAK,GAAG;AAC9B,QAAI,MAAM,SAAS,WAAW;AAC5B,YAAM,eAAe,OAAO,QAAQ,QAAQ,OAAO,MAAM,EAAE;AAAA,QACzD,CAAC,CAAC,WAAW,KAAK,MAAM,cAAc,MAAM,SAAS,MAAM,SAAS,MAAM;AAAA,MAC5E;AAEA,UAAI,aAAa,SAAS,GAAG;AAC3B,cAAM,IAAI;AAAA,UACR,wCAAwC,MAAM,KAAK,0DAA0D,aAAa,IAAI,CAAC,CAAC,SAAS,MAAM,SAAS,EAAE,KAAK,IAAI,CAAC;AAAA,QACtK;AAAA,MACF;AAEA,UAAI,aAAa,WAAW,GAAG;AAC7B,cAAM,CAAC,KAAK,IAAI;AAChB,cAAM,CAAC,EAAE,KAAK,IAAI;AAClB,eAAO,EAAE,MAAM,WAAW,OAAO,MAAM,QAAQ;AAAA,MACjD;AAAA,IACF;AAAA,EACF;AAEA,QAAM,IAAI,MAAM;AAAA,EAA0C,KAAK,UAAU,OAAO,MAAM,CAAC,CAAC,EAAE;AAC5F;","names":["import_viem","import_viem","import_viem","import_viem","import_utils","import_common","import_internal","import_internal","import_internal","import_common","import_internal","validateStoreNamespace","resolveStoreNamespace","import_internal","import_internal","import_internal","viem_writeContract"]}
|
package/dist/internal.d.cts
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
import { Abi, ContractFunctionName, Hex, EncodeFunctionDataParameters, Address, Chain, Account, Client, Transport, WalletActions } from 'viem';
|
2
|
-
import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
|
3
|
-
export { C as CODEGEN_DEFAULTS, b as CONFIG_DEFAULTS, k as CodegenInput, D as DEPLOY_DEFAULTS, j as DeployInput, M as MODULE_DEFAULTS, i as ModuleInput, N as NamespaceInput, h as NamespacesInput, a as SYSTEM_DEFAULTS, S as SYSTEM_DEPLOY_DEFAULTS, e as SystemDeployInput, f as SystemInput, g as SystemsInput, V as ValidateSystemOptions, W as WorldInput, o as defineNamespaces, t as defineSystem, d as defineWorld, p as requiredSystemKey, r as resolveCodegen, c as resolveDeploy, l as resolveNamespace, y as resolveNamespaceMode, n as resolveNamespaces, s as resolveSystem, w as resolveSystems, z as resolveWorld, v as validateNamespace, m as validateNamespaces, q as validateSystem, u as validateSystems, x as validateWorld } from './world-DUniZQxy.cjs';
|
4
|
-
export { C as Codegen, f as Deploy, D as DynamicResolution, M as Module, N as Namespace, e as Namespaces, c as System, S as SystemDeploy, d as Systems, V as ValueWithType, W as World, i as isDynamicResolution, a as isValueWithType, r as resolveTableId, b as resolveWithContext } from './dynamicResolution-AmVd5Qtd.cjs';
|
5
|
-
import '@ark/util';
|
6
|
-
import '@latticexyz/store/internal';
|
7
|
-
import '@latticexyz/store';
|
8
|
-
|
9
|
-
declare const worldCallAbi: readonly [{
|
10
|
-
readonly type: "function";
|
11
|
-
readonly name: "batchCall";
|
12
|
-
readonly inputs: readonly [{
|
13
|
-
readonly name: "systemCalls";
|
14
|
-
readonly type: "tuple[]";
|
15
|
-
readonly internalType: "struct SystemCallData[]";
|
16
|
-
readonly components: readonly [{
|
17
|
-
readonly name: "systemId";
|
18
|
-
readonly type: "bytes32";
|
19
|
-
readonly internalType: "ResourceId";
|
20
|
-
}, {
|
21
|
-
readonly name: "callData";
|
22
|
-
readonly type: "bytes";
|
23
|
-
readonly internalType: "bytes";
|
24
|
-
}];
|
25
|
-
}];
|
26
|
-
readonly outputs: readonly [{
|
27
|
-
readonly name: "returnDatas";
|
28
|
-
readonly type: "bytes[]";
|
29
|
-
readonly internalType: "bytes[]";
|
30
|
-
}];
|
31
|
-
readonly stateMutability: "nonpayable";
|
32
|
-
}, {
|
33
|
-
readonly type: "function";
|
34
|
-
readonly name: "batchCallFrom";
|
35
|
-
readonly inputs: readonly [{
|
36
|
-
readonly name: "systemCalls";
|
37
|
-
readonly type: "tuple[]";
|
38
|
-
readonly internalType: "struct SystemCallFromData[]";
|
39
|
-
readonly components: readonly [{
|
40
|
-
readonly name: "from";
|
41
|
-
readonly type: "address";
|
42
|
-
readonly internalType: "address";
|
43
|
-
}, {
|
44
|
-
readonly name: "systemId";
|
45
|
-
readonly type: "bytes32";
|
46
|
-
readonly internalType: "ResourceId";
|
47
|
-
}, {
|
48
|
-
readonly name: "callData";
|
49
|
-
readonly type: "bytes";
|
50
|
-
readonly internalType: "bytes";
|
51
|
-
}];
|
52
|
-
}];
|
53
|
-
readonly outputs: readonly [{
|
54
|
-
readonly name: "returnDatas";
|
55
|
-
readonly type: "bytes[]";
|
56
|
-
readonly internalType: "bytes[]";
|
57
|
-
}];
|
58
|
-
readonly stateMutability: "nonpayable";
|
59
|
-
}, {
|
60
|
-
readonly type: "function";
|
61
|
-
readonly name: "call";
|
62
|
-
readonly inputs: readonly [{
|
63
|
-
readonly name: "systemId";
|
64
|
-
readonly type: "bytes32";
|
65
|
-
readonly internalType: "ResourceId";
|
66
|
-
}, {
|
67
|
-
readonly name: "callData";
|
68
|
-
readonly type: "bytes";
|
69
|
-
readonly internalType: "bytes";
|
70
|
-
}];
|
71
|
-
readonly outputs: readonly [{
|
72
|
-
readonly name: "";
|
73
|
-
readonly type: "bytes";
|
74
|
-
readonly internalType: "bytes";
|
75
|
-
}];
|
76
|
-
readonly stateMutability: "payable";
|
77
|
-
}, {
|
78
|
-
readonly type: "function";
|
79
|
-
readonly name: "callFrom";
|
80
|
-
readonly inputs: readonly [{
|
81
|
-
readonly name: "delegator";
|
82
|
-
readonly type: "address";
|
83
|
-
readonly internalType: "address";
|
84
|
-
}, {
|
85
|
-
readonly name: "systemId";
|
86
|
-
readonly type: "bytes32";
|
87
|
-
readonly internalType: "ResourceId";
|
88
|
-
}, {
|
89
|
-
readonly name: "callData";
|
90
|
-
readonly type: "bytes";
|
91
|
-
readonly internalType: "bytes";
|
92
|
-
}];
|
93
|
-
readonly outputs: readonly [{
|
94
|
-
readonly name: "";
|
95
|
-
readonly type: "bytes";
|
96
|
-
readonly internalType: "bytes";
|
97
|
-
}];
|
98
|
-
readonly stateMutability: "payable";
|
99
|
-
}, {
|
100
|
-
readonly type: "function";
|
101
|
-
readonly name: "callWithSignature";
|
102
|
-
readonly inputs: readonly [{
|
103
|
-
readonly name: "signer";
|
104
|
-
readonly type: "address";
|
105
|
-
readonly internalType: "address";
|
106
|
-
}, {
|
107
|
-
readonly name: "systemId";
|
108
|
-
readonly type: "bytes32";
|
109
|
-
readonly internalType: "ResourceId";
|
110
|
-
}, {
|
111
|
-
readonly name: "callData";
|
112
|
-
readonly type: "bytes";
|
113
|
-
readonly internalType: "bytes";
|
114
|
-
}, {
|
115
|
-
readonly name: "signature";
|
116
|
-
readonly type: "bytes";
|
117
|
-
readonly internalType: "bytes";
|
118
|
-
}];
|
119
|
-
readonly outputs: readonly [{
|
120
|
-
readonly name: "";
|
121
|
-
readonly type: "bytes";
|
122
|
-
readonly internalType: "bytes";
|
123
|
-
}];
|
124
|
-
readonly stateMutability: "payable";
|
125
|
-
}];
|
126
|
-
type worldCallAbi = typeof worldCallAbi;
|
127
|
-
|
128
|
-
type SystemCall<abi extends Abi, functionName extends ContractFunctionName<abi>> = {
|
129
|
-
/**
|
130
|
-
* System ABI
|
131
|
-
*/
|
132
|
-
readonly abi: abi;
|
133
|
-
/**
|
134
|
-
* System's resource ID
|
135
|
-
*/
|
136
|
-
readonly systemId: Hex;
|
137
|
-
/**
|
138
|
-
* System function name to call
|
139
|
-
*/
|
140
|
-
readonly functionName: functionName;
|
141
|
-
} & Pick<EncodeFunctionDataParameters<abi, functionName>, "args">;
|
142
|
-
/** Encode a system call to be passed as arguments into `World.call` */
|
143
|
-
declare function encodeSystemCall<abi extends Abi, functionName extends ContractFunctionName<abi>>({ abi, systemId, functionName, args, }: SystemCall<abi, functionName>): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, "call">["inputs"]>;
|
144
|
-
|
145
|
-
type SystemCallFrom<abi extends Abi, functionName extends ContractFunctionName<abi>> = SystemCall<abi, functionName> & {
|
146
|
-
readonly from: Address;
|
147
|
-
};
|
148
|
-
/** Encode a system call to be passed as arguments into `World.callFrom` */
|
149
|
-
declare function encodeSystemCallFrom<abi extends Abi, functionName extends ContractFunctionName<abi>>({ abi, from, systemId, functionName, args, }: SystemCallFrom<abi, functionName>): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, "callFrom">["inputs"]>;
|
150
|
-
|
151
|
-
/** Encode system calls to be passed as arguments into `World.batchCall` */
|
152
|
-
declare function encodeSystemCalls<abi extends Abi, functionName extends ContractFunctionName<abi>>(abi: abi, systemCalls: readonly Omit<SystemCall<abi, functionName>, "abi">[]): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, "batchCall">["inputs"]>;
|
153
|
-
|
154
|
-
/** Encode system calls to be passed as arguments into `World.batchCallFrom` */
|
155
|
-
declare function encodeSystemCallsFrom<abi extends Abi, functionName extends ContractFunctionName<abi>>(abi: abi, from: Address, systemCalls: readonly Omit<SystemCallFrom<abi, functionName>, "abi" | "from">[]): AbiParametersToPrimitiveTypes<ExtractAbiFunction<worldCallAbi, "batchCallFrom">["inputs"]>;
|
156
|
-
|
157
|
-
type CallFromParameters = {
|
158
|
-
worldAddress: Hex;
|
159
|
-
delegatorAddress: Hex;
|
160
|
-
worldFunctionToSystemFunction?: (worldFunctionSelector: Hex) => Promise<SystemFunction>;
|
161
|
-
publicClient?: Client;
|
162
|
-
};
|
163
|
-
type SystemFunction = {
|
164
|
-
systemId: Hex;
|
165
|
-
systemFunctionSelector: Hex;
|
166
|
-
};
|
167
|
-
declare function callFrom(params: CallFromParameters): <chain extends Chain, account extends Account | undefined>(client: Client<Transport, chain, account>) => Pick<WalletActions<chain, account>, "writeContract">;
|
168
|
-
|
169
|
-
export { type SystemCall, type SystemCallFrom, callFrom, encodeSystemCall, encodeSystemCallFrom, encodeSystemCalls, encodeSystemCallsFrom };
|
package/dist/mud.config.cjs
DELETED
@@ -1,357 +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
|
-
// mud.config.ts
|
21
|
-
var mud_config_exports = {};
|
22
|
-
__export(mud_config_exports, {
|
23
|
-
configInput: () => configInput,
|
24
|
-
default: () => mud_config_default
|
25
|
-
});
|
26
|
-
module.exports = __toCommonJS(mud_config_exports);
|
27
|
-
|
28
|
-
// ts/config/v2/world.ts
|
29
|
-
var import_internal7 = require("@latticexyz/store/internal");
|
30
|
-
|
31
|
-
// ts/config/v2/defaults.ts
|
32
|
-
var SYSTEM_DEPLOY_DEFAULTS = {
|
33
|
-
disabled: false,
|
34
|
-
registerWorldFunctions: true
|
35
|
-
};
|
36
|
-
var SYSTEM_DEFAULTS = {
|
37
|
-
namespaceLabel: "",
|
38
|
-
openAccess: true,
|
39
|
-
accessList: []
|
40
|
-
};
|
41
|
-
var MODULE_DEFAULTS = {
|
42
|
-
root: false,
|
43
|
-
args: [],
|
44
|
-
artifactPath: void 0
|
45
|
-
};
|
46
|
-
var CODEGEN_DEFAULTS = {
|
47
|
-
worldInterfaceName: "IWorld",
|
48
|
-
worldgenDirectory: "world",
|
49
|
-
systemLibrariesDirectory: "systems",
|
50
|
-
generateSystemLibraries: false,
|
51
|
-
worldImportPath: "@latticexyz/world/src"
|
52
|
-
};
|
53
|
-
var DEPLOY_DEFAULTS = {
|
54
|
-
postDeployScript: "PostDeploy",
|
55
|
-
deploysDirectory: "./deploys",
|
56
|
-
worldsFile: "./worlds.json",
|
57
|
-
upgradeableWorldImplementation: false
|
58
|
-
};
|
59
|
-
var CONFIG_DEFAULTS = {
|
60
|
-
systems: {},
|
61
|
-
tables: {},
|
62
|
-
excludeSystems: [],
|
63
|
-
modules: [],
|
64
|
-
codegen: CODEGEN_DEFAULTS,
|
65
|
-
deploy: DEPLOY_DEFAULTS
|
66
|
-
};
|
67
|
-
|
68
|
-
// ts/config/v2/systems.ts
|
69
|
-
var import_internal2 = require("@latticexyz/store/internal");
|
70
|
-
|
71
|
-
// ts/config/v2/system.ts
|
72
|
-
var import_internal = require("@latticexyz/store/internal");
|
73
|
-
var import_common = require("@latticexyz/common");
|
74
|
-
function validateSystem(input, options = {}) {
|
75
|
-
if (typeof input !== "object" || input == null) {
|
76
|
-
throw new Error(`Expected full system config, got \`${JSON.stringify(input)}\``);
|
77
|
-
}
|
78
|
-
if (options.inNamespace && ((0, import_internal.hasOwnKey)(input, "label") || (0, import_internal.hasOwnKey)(input, "namespaceLabel") || (0, import_internal.hasOwnKey)(input, "namespace"))) {
|
79
|
-
throw new Error(
|
80
|
-
"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context."
|
81
|
-
);
|
82
|
-
}
|
83
|
-
if ((0, import_internal.hasOwnKey)(input, "namespaceLabel") && typeof input.namespaceLabel === "string" && (!(0, import_internal.hasOwnKey)(input, "namespace") || typeof input.namespace !== "string") && input.namespaceLabel.length > 14) {
|
84
|
-
throw new Error(
|
85
|
-
`System \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${input.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`
|
86
|
-
);
|
87
|
-
}
|
88
|
-
if ((0, import_internal.hasOwnKey)(input, "namespace") && typeof input.namespace === "string" && input.namespace.length > 14) {
|
89
|
-
throw new Error(`System \`namespace\` must fit into a \`bytes14\`, but "${input.namespace}" is too long.`);
|
90
|
-
}
|
91
|
-
if ((0, import_internal.hasOwnKey)(input, "name") && typeof input.name === "string" && input.name.length > 16) {
|
92
|
-
throw new Error(`System \`name\` must fit into a \`bytes16\`, but "${input.name}" is too long.`);
|
93
|
-
}
|
94
|
-
}
|
95
|
-
function resolveSystem(input) {
|
96
|
-
const namespaceLabel = input.namespaceLabel ?? SYSTEM_DEFAULTS.namespaceLabel;
|
97
|
-
const namespace = input.namespace ?? namespaceLabel;
|
98
|
-
const label = input.label;
|
99
|
-
const name = input.name ?? label.slice(0, 16);
|
100
|
-
const systemId = (0, import_common.resourceToHex)({ type: "system", namespace, name });
|
101
|
-
return (0, import_internal.mergeIfUndefined)(
|
102
|
-
{
|
103
|
-
...input,
|
104
|
-
label,
|
105
|
-
namespaceLabel,
|
106
|
-
namespace,
|
107
|
-
name,
|
108
|
-
systemId,
|
109
|
-
deploy: (0, import_internal.mergeIfUndefined)(input.deploy ?? {}, SYSTEM_DEPLOY_DEFAULTS)
|
110
|
-
},
|
111
|
-
SYSTEM_DEFAULTS
|
112
|
-
);
|
113
|
-
}
|
114
|
-
|
115
|
-
// ts/config/v2/systems.ts
|
116
|
-
function validateSystems(input) {
|
117
|
-
if ((0, import_internal2.isObject)(input)) {
|
118
|
-
for (const system of Object.values(input)) {
|
119
|
-
validateSystem(system, { inNamespace: true });
|
120
|
-
}
|
121
|
-
return;
|
122
|
-
}
|
123
|
-
throw new Error(`Expected system config, received ${JSON.stringify(input)}`);
|
124
|
-
}
|
125
|
-
function resolveSystems(systems, namespaceLabel, namespace) {
|
126
|
-
return Object.fromEntries(
|
127
|
-
Object.entries(systems).map(([label, system]) => {
|
128
|
-
return [label, resolveSystem({ ...system, label, namespaceLabel, namespace })];
|
129
|
-
})
|
130
|
-
);
|
131
|
-
}
|
132
|
-
|
133
|
-
// ts/config/v2/namespaces.ts
|
134
|
-
var import_util = require("@ark/util");
|
135
|
-
|
136
|
-
// ts/config/v2/namespace.ts
|
137
|
-
var import_internal3 = require("@latticexyz/store/internal");
|
138
|
-
function validateNamespace(input, scope) {
|
139
|
-
if ((0, import_internal3.hasOwnKey)(input, "systems")) {
|
140
|
-
validateSystems(input.systems);
|
141
|
-
}
|
142
|
-
(0, import_internal3.validateNamespace)(input, scope);
|
143
|
-
}
|
144
|
-
function resolveNamespace(input, scope = import_internal3.AbiTypeScope) {
|
145
|
-
const namespace = (0, import_internal3.resolveNamespace)(input, scope);
|
146
|
-
const systems = resolveSystems(input.systems ?? {}, namespace.label, namespace.namespace);
|
147
|
-
return {
|
148
|
-
...namespace,
|
149
|
-
systems
|
150
|
-
};
|
151
|
-
}
|
152
|
-
|
153
|
-
// ts/config/v2/namespaces.ts
|
154
|
-
var import_utils = require("@latticexyz/common/utils");
|
155
|
-
var import_internal4 = require("@latticexyz/store/internal");
|
156
|
-
function validateNamespaces(namespaces, scope) {
|
157
|
-
if (!(0, import_internal4.isObject)(namespaces)) {
|
158
|
-
throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);
|
159
|
-
}
|
160
|
-
for (const namespace of Object.values(namespaces)) {
|
161
|
-
validateNamespace(namespace, scope);
|
162
|
-
}
|
163
|
-
}
|
164
|
-
function resolveNamespaces(input, scope) {
|
165
|
-
if (!(0, import_internal4.isObject)(input)) {
|
166
|
-
throw new Error(`Expected namespaces config, received ${JSON.stringify(input)}`);
|
167
|
-
}
|
168
|
-
const namespaces = (0, import_util.flatMorph)(input, (label, namespace) => [
|
169
|
-
label,
|
170
|
-
resolveNamespace((0, import_internal4.mergeIfUndefined)(namespace, { label }), scope)
|
171
|
-
]);
|
172
|
-
const duplicates = Array.from((0, import_utils.groupBy)(Object.values(namespaces), (namespace) => namespace.namespace).entries()).filter(([, entries]) => entries.length > 1).map(([namespace]) => namespace);
|
173
|
-
if (duplicates.length > 0) {
|
174
|
-
throw new Error(`Found namespaces defined more than once in config: ${duplicates.join(", ")}`);
|
175
|
-
}
|
176
|
-
return namespaces;
|
177
|
-
}
|
178
|
-
|
179
|
-
// ts/config/v2/codegen.ts
|
180
|
-
var import_internal5 = require("@latticexyz/store/internal");
|
181
|
-
function resolveCodegen(codegen) {
|
182
|
-
return (0, import_internal5.isObject)(codegen) ? (0, import_internal5.mergeIfUndefined)(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS;
|
183
|
-
}
|
184
|
-
|
185
|
-
// ts/config/v2/deploy.ts
|
186
|
-
var import_internal6 = require("@latticexyz/store/internal");
|
187
|
-
function resolveDeploy(deploy) {
|
188
|
-
return (0, import_internal6.isObject)(deploy) ? (0, import_internal6.mergeIfUndefined)(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS;
|
189
|
-
}
|
190
|
-
|
191
|
-
// ts/config/v2/world.ts
|
192
|
-
function validateWorld(input) {
|
193
|
-
const scope = (0, import_internal7.extendedScope)(input);
|
194
|
-
if ((0, import_internal7.hasOwnKey)(input, "namespaces")) {
|
195
|
-
if ((0, import_internal7.hasOwnKey)(input, "namespace") || (0, import_internal7.hasOwnKey)(input, "tables") || (0, import_internal7.hasOwnKey)(input, "systems")) {
|
196
|
-
throw new Error("Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.");
|
197
|
-
}
|
198
|
-
validateNamespaces(input.namespaces, scope);
|
199
|
-
}
|
200
|
-
if ((0, import_internal7.hasOwnKey)(input, "systems")) {
|
201
|
-
validateSystems(input.systems);
|
202
|
-
}
|
203
|
-
(0, import_internal7.validateStore)(input);
|
204
|
-
}
|
205
|
-
function resolveWorld(input) {
|
206
|
-
const scope = (0, import_internal7.extendedScope)(input);
|
207
|
-
const store = (0, import_internal7.resolveStore)(input);
|
208
|
-
const namespaces = input.namespaces ? resolveNamespaces(input.namespaces, scope) : resolveNamespaces({ [store.namespace]: input }, scope);
|
209
|
-
const tables = (0, import_internal7.flattenNamespacedTables)({ namespaces });
|
210
|
-
const modules = (input.modules ?? CONFIG_DEFAULTS.modules).map((mod) => (0, import_internal7.mergeIfUndefined)(mod, MODULE_DEFAULTS));
|
211
|
-
return (0, import_internal7.mergeIfUndefined)(
|
212
|
-
{
|
213
|
-
...store,
|
214
|
-
namespaces,
|
215
|
-
tables,
|
216
|
-
// TODO: flatten systems from namespaces
|
217
|
-
systems: !store.multipleNamespaces && input.systems ? resolveSystems(input.systems, store.namespace, store.namespace) : CONFIG_DEFAULTS.systems,
|
218
|
-
excludeSystems: (0, import_internal7.get)(input, "excludeSystems"),
|
219
|
-
codegen: (0, import_internal7.mergeIfUndefined)(store.codegen, resolveCodegen(input.codegen)),
|
220
|
-
deploy: resolveDeploy(input.deploy),
|
221
|
-
modules
|
222
|
-
},
|
223
|
-
CONFIG_DEFAULTS
|
224
|
-
);
|
225
|
-
}
|
226
|
-
function defineWorld(input) {
|
227
|
-
validateWorld(input);
|
228
|
-
return resolveWorld(input);
|
229
|
-
}
|
230
|
-
|
231
|
-
// mud.config.ts
|
232
|
-
var configInput = {
|
233
|
-
namespace: "world",
|
234
|
-
// NOTE: this namespace is only used for tables, the core system is deployed in the root namespace.
|
235
|
-
codegen: {
|
236
|
-
worldImportPath: "./src",
|
237
|
-
worldgenDirectory: "interfaces",
|
238
|
-
worldInterfaceName: "IBaseWorld"
|
239
|
-
},
|
240
|
-
userTypes: {
|
241
|
-
ResourceId: { filePath: "@latticexyz/store/src/ResourceId.sol", type: "bytes32" }
|
242
|
-
},
|
243
|
-
tables: {
|
244
|
-
NamespaceOwner: {
|
245
|
-
schema: {
|
246
|
-
namespaceId: "ResourceId",
|
247
|
-
owner: "address"
|
248
|
-
},
|
249
|
-
key: ["namespaceId"]
|
250
|
-
},
|
251
|
-
ResourceAccess: {
|
252
|
-
schema: {
|
253
|
-
resourceId: "ResourceId",
|
254
|
-
caller: "address",
|
255
|
-
access: "bool"
|
256
|
-
},
|
257
|
-
key: ["resourceId", "caller"]
|
258
|
-
},
|
259
|
-
InstalledModules: {
|
260
|
-
schema: {
|
261
|
-
moduleAddress: "address",
|
262
|
-
argumentsHash: "bytes32",
|
263
|
-
// Hash of the params passed to the `install` function
|
264
|
-
isInstalled: "bool"
|
265
|
-
},
|
266
|
-
key: ["moduleAddress", "argumentsHash"]
|
267
|
-
},
|
268
|
-
UserDelegationControl: {
|
269
|
-
schema: {
|
270
|
-
delegator: "address",
|
271
|
-
delegatee: "address",
|
272
|
-
delegationControlId: "ResourceId"
|
273
|
-
},
|
274
|
-
key: ["delegator", "delegatee"]
|
275
|
-
},
|
276
|
-
NamespaceDelegationControl: {
|
277
|
-
schema: {
|
278
|
-
namespaceId: "ResourceId",
|
279
|
-
delegationControlId: "ResourceId"
|
280
|
-
},
|
281
|
-
key: ["namespaceId"]
|
282
|
-
},
|
283
|
-
Balances: {
|
284
|
-
schema: {
|
285
|
-
namespaceId: "ResourceId",
|
286
|
-
balance: "uint256"
|
287
|
-
},
|
288
|
-
key: ["namespaceId"]
|
289
|
-
},
|
290
|
-
Systems: {
|
291
|
-
schema: {
|
292
|
-
systemId: "ResourceId",
|
293
|
-
system: "address",
|
294
|
-
publicAccess: "bool"
|
295
|
-
},
|
296
|
-
key: ["systemId"],
|
297
|
-
codegen: {
|
298
|
-
dataStruct: false
|
299
|
-
}
|
300
|
-
},
|
301
|
-
SystemRegistry: {
|
302
|
-
schema: {
|
303
|
-
system: "address",
|
304
|
-
systemId: "ResourceId"
|
305
|
-
},
|
306
|
-
key: ["system"]
|
307
|
-
},
|
308
|
-
SystemHooks: {
|
309
|
-
schema: {
|
310
|
-
systemId: "ResourceId",
|
311
|
-
value: "bytes21[]"
|
312
|
-
},
|
313
|
-
key: ["systemId"]
|
314
|
-
},
|
315
|
-
FunctionSelectors: {
|
316
|
-
schema: {
|
317
|
-
worldFunctionSelector: "bytes4",
|
318
|
-
systemId: "ResourceId",
|
319
|
-
systemFunctionSelector: "bytes4"
|
320
|
-
},
|
321
|
-
key: ["worldFunctionSelector"],
|
322
|
-
codegen: {
|
323
|
-
dataStruct: false
|
324
|
-
}
|
325
|
-
},
|
326
|
-
FunctionSignatures: {
|
327
|
-
type: "offchainTable",
|
328
|
-
schema: {
|
329
|
-
functionSelector: "bytes4",
|
330
|
-
functionSignature: "string"
|
331
|
-
},
|
332
|
-
key: ["functionSelector"]
|
333
|
-
},
|
334
|
-
InitModuleAddress: {
|
335
|
-
schema: {
|
336
|
-
value: "address"
|
337
|
-
},
|
338
|
-
key: []
|
339
|
-
}
|
340
|
-
},
|
341
|
-
excludeSystems: [
|
342
|
-
// Worldgen currently does not support systems inheriting logic
|
343
|
-
// from other contracts, so all parts of RegistrationSystem are named
|
344
|
-
// System too to be included in the IBaseWorld interface.
|
345
|
-
// However, IStoreRegistrationSystem overlaps with IStore if
|
346
|
-
// included in IBaseWorld, so it needs to be excluded from worldgen.
|
347
|
-
// TODO: add support for inheritance to worldgen
|
348
|
-
// (see: https://github.com/latticexyz/mud/issues/631)
|
349
|
-
"StoreRegistrationSystem"
|
350
|
-
]
|
351
|
-
};
|
352
|
-
var mud_config_default = defineWorld(configInput);
|
353
|
-
// Annotate the CommonJS export names for ESM import in node:
|
354
|
-
0 && (module.exports = {
|
355
|
-
configInput
|
356
|
-
});
|
357
|
-
//# sourceMappingURL=mud.config.cjs.map
|