@latticexyz/world 3.0.0-main-560fd6a0c → 3.0.0-main-8f6fa588d

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.
@@ -0,0 +1,2 @@
1
+ var c=Object.create;var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var y=Object.getOwnPropertyNames;var l=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var u=(e,t,s)=>t in e?a(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s;var L=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var S=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of y(t))!d.call(e,o)&&o!==s&&a(e,o,{get:()=>t[o],enumerable:!(n=m(t,o))||n.enumerable});return e};var F=(e,t,s)=>(s=e!=null?c(l(e)):{},S(t||!e||!e.__esModule?a(s,"default",{value:e,enumerable:!0}):s,e));var T=(e,t,s)=>(u(e,typeof t!="symbol"?t+"":t,s),s),p=(e,t,s)=>{if(!t.has(e))throw TypeError("Cannot "+s)};var I=(e,t,s)=>(p(e,t,"read from private field"),s?s.call(e):t.get(e)),g=(e,t,s)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,s)},A=(e,t,s,n)=>(p(e,t,"write to private field"),n?n.call(e,s):t.set(e,s),s);var U=(e,t,s)=>(p(e,t,"access private method"),s);var i={namespace:"",registerFunctionSelectors:!0,openAccess:!0,accessList:[]},w={root:!1,args:[],artifactPath:void 0},f={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},E={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},_={systems:{},tables:{},excludeSystems:[],modules:[],codegen:f,deploy:E};import{hasOwnKey as r,mergeIfUndefined as x}from"@latticexyz/store/config/v2";import{resourceToHex as D}from"@latticexyz/common";function h(e,t={}){if(typeof e!="object"||e==null)throw new Error(`Expected full system config, got \`${JSON.stringify(e)}\``);if(t.inNamespace&&(r(e,"label")||r(e,"namespace")))throw new Error("Overrides of `label` and `namespace` are not allowed for systems in this context.");if(r(e,"namespace")&&typeof e.namespace=="string"&&e.namespace.length>14)throw new Error(`System \`namespace\` must fit into a \`bytes14\`, but "${e.namespace}" is too long.`);if(r(e,"name")&&typeof e.name=="string"&&e.name.length>16)throw new Error(`System \`name\` must fit into a \`bytes16\`, but "${e.name}" is too long.`)}function k(e){let t=e.label,s=e.namespace??i.namespace,n=e.name??t.slice(0,16),o=D({type:"system",namespace:s,name:n});return x({...e,label:t,namespace:s,name:n,systemId:o},i)}export{L as a,F as b,T as c,I as d,g as e,A as f,U as g,w as h,f as i,E as j,_ as k,h as l,k as m};
2
+ //# sourceMappingURL=chunk-DK3XOTC2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../ts/config/v2/defaults.ts","../ts/config/v2/system.ts"],"sourcesContent":["import { CodegenInput, DeployInput, ModuleInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEFAULTS = {\n namespace: \"\",\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [],\n} as const satisfies Omit<Required<SystemInput>, \"label\" | \"name\">;\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 worldImportPath: \"@latticexyz/world/src/\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\n customWorldContract: undefined,\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 { SYSTEM_DEFAULTS } from \"./defaults\";\nimport { SystemInput } from \"./input\";\nimport { hasOwnKey, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\nimport { ErrorMessage, narrow, requiredKeyOf } from \"@arktype/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\" | \"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\" | \"namespace\"\n ? options[\"inNamespace\"] extends true\n ? ErrorMessage<\"Overrides of `label` 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 (options.inNamespace && (hasOwnKey(input, \"label\") || hasOwnKey(input, \"namespace\"))) {\n throw new Error(\"Overrides of `label` and `namespace` are not allowed for systems in this context.\");\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 namespace: undefined extends input[\"namespace\"] ? SYSTEM_DEFAULTS[\"namespace\"] : input[\"namespace\"];\n readonly name: string;\n readonly systemId: Hex;\n readonly registerFunctionSelectors: undefined extends input[\"registerFunctionSelectors\"]\n ? SYSTEM_DEFAULTS[\"registerFunctionSelectors\"]\n : input[\"registerFunctionSelectors\"];\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 }\n : never;\n\nexport function resolveSystem<input extends SystemInput>(input: input): resolveSystem<input> {\n const label = input.label;\n const namespace = input.namespace ?? SYSTEM_DEFAULTS.namespace;\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 namespace,\n name,\n systemId,\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"],"mappings":"shCAEO,IAAMA,EAAkB,CAC7B,UAAW,GACX,0BAA2B,GAC3B,WAAY,GACZ,WAAY,CAAC,CACf,EAIaC,EAAkB,CAC7B,KAAM,GACN,KAAM,CAAC,EACP,aAAc,MAChB,EAIaC,EAAmB,CAC9B,mBAAoB,SACpB,kBAAmB,QACnB,gBAAiB,wBACnB,EAIaC,EAAkB,CAC7B,oBAAqB,OACrB,iBAAkB,aAClB,iBAAkB,YAClB,WAAY,gBACZ,+BAAgC,EAClC,EAIaC,EAAkB,CAC7B,QAAS,CAAC,EACV,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,QAAS,CAAC,EACV,QAASF,EACT,OAAQC,CACV,EC1CA,OAAS,aAAAE,EAAW,oBAAAC,MAAwB,8BAG5C,OAAS,iBAAAC,MAAqB,qBAqBvB,SAASC,EACdC,EACAC,EAAiC,CAAC,EACI,CACtC,GAAI,OAAOD,GAAU,UAAYA,GAAS,KACxC,MAAM,IAAI,MAAM,sCAAsC,KAAK,UAAUA,CAAK,KAAK,EAGjF,GAAIC,EAAQ,cAAgBL,EAAUI,EAAO,OAAO,GAAKJ,EAAUI,EAAO,WAAW,GACnF,MAAM,IAAI,MAAM,mFAAmF,EAGrG,GAAIJ,EAAUI,EAAO,WAAW,GAAK,OAAOA,EAAM,WAAc,UAAYA,EAAM,UAAU,OAAS,GACnG,MAAM,IAAI,MAAM,0DAA0DA,EAAM,yBAAyB,EAE3G,GAAIJ,EAAUI,EAAO,MAAM,GAAK,OAAOA,EAAM,MAAS,UAAYA,EAAM,KAAK,OAAS,GACpF,MAAM,IAAI,MAAM,qDAAqDA,EAAM,oBAAoB,CAEnG,CAgBO,SAASE,EAAyCF,EAAoC,CAC3F,IAAMG,EAAQH,EAAM,MACdI,EAAYJ,EAAM,WAAaK,EAAgB,UAC/CC,EAAON,EAAM,MAAQG,EAAM,MAAM,EAAG,EAAE,EACtCI,EAAWT,EAAc,CAAE,KAAM,SAAU,UAAAM,EAAW,KAAAE,CAAK,CAAC,EAElE,OAAOT,EACL,CACE,GAAGG,EACH,MAAAG,EACA,UAAAC,EACA,KAAAE,EACA,SAAAC,CACF,EACAF,CACF,CACF","names":["SYSTEM_DEFAULTS","MODULE_DEFAULTS","CODEGEN_DEFAULTS","DEPLOY_DEFAULTS","CONFIG_DEFAULTS","hasOwnKey","mergeIfUndefined","resourceToHex","validateSystem","input","options","resolveSystem","label","namespace","SYSTEM_DEFAULTS","name","systemId"]}
@@ -0,0 +1,2 @@
1
+ import{h as i,i as l,j as m,k as a,l as y,m as f}from"./chunk-DK3XOTC2.js";import{extendedScope as g,get as j,resolveTable as L,validateTable as F,mergeIfUndefined as n,resolveStore as $,hasOwnKey as k,validateStore as C}from"@latticexyz/store/config/v2";import{isObject as w}from"@latticexyz/store/config/v2";function v(e){if(w(e)){for(let s of Object.values(e))y(s,{inNamespace:!0});return}throw new Error(`Expected system config, received ${JSON.stringify(e)}`)}function b(e,s){return Object.fromEntries(Object.entries(e).map(([o,p])=>[o,f({...p,label:o,namespace:s})]))}import{validateTables as I,isObject as N,hasOwnKey as O}from"@latticexyz/store/config/v2";function D(e,s){O(e,"tables")&&I(e.tables,s)}function u(e,s){if(!N(e))throw new Error(`Expected namespaces, received ${JSON.stringify(e)}`);for(let o of Object.values(e))D(o,s)}import{isObject as U,mergeIfUndefined as W}from"@latticexyz/store/config/v2";function x(e){return U(e)?W(e,l):l}import{mergeIfUndefined as _,isObject as A}from"@latticexyz/store/config/v2";function S(e){return A(e)?_(e,m):m}function h(e){let s=g(e);C(e),k(e,"systems")&&v(e.systems),k(e,"namespaces")&&u(e.namespaces,s)}function M(e){let s=g(e),o=e.namespaces??{},p=Object.fromEntries(Object.entries(o).map(([r,T])=>Object.entries(T.tables??{}).map(([d,c])=>(F(c,s),[`${r}__${d}`,L(n(c,{namespace:r,name:d}),s)]))).flat()),t=$(e),E=(e.modules??a.modules).map(r=>n(r,i));return n({...t,tables:{...t.tables,...p},codegen:n(t.codegen,x(e.codegen)),deploy:S(e.deploy),systems:b(e.systems??a.systems,t.namespace),excludeSystems:j(e,"excludeSystems"),modules:E},a)}function ye(e){return h(e),M(e)}export{h as a,M as b,ye as c};
2
+ //# sourceMappingURL=chunk-OM2LE2WB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../ts/config/v2/world.ts","../ts/config/v2/systems.ts","../ts/config/v2/namespaces.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["import { ErrorMessage, conform, narrow, type withJsDoc } from \"@arktype/util\";\nimport {\n UserTypes,\n extendedScope,\n get,\n resolveTable,\n validateTable,\n mergeIfUndefined,\n validateTables,\n resolveStore,\n Store,\n hasOwnKey,\n validateStore,\n} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store/internal\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\n\nexport type validateWorld<world> = {\n readonly [key in keyof world]: key extends \"tables\"\n ? validateTables<world[key], extendedScope<world>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<world[key]>\n : key extends \"systems\"\n ? validateSystems<world[key]>\n : key extends \"namespaces\"\n ? // ? validateNamespaces<world[key], extendedScope<world>>\n ErrorMessage<`Namespaces config will be enabled soon.`>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\n};\n\nexport function validateWorld(world: unknown): asserts world is WorldInput {\n const scope = extendedScope(world);\n validateStore(world);\n\n if (hasOwnKey(world, \"systems\")) {\n validateSystems(world.systems);\n }\n if (hasOwnKey(world, \"namespaces\")) {\n validateNamespaces(world.namespaces, scope);\n }\n}\n\nexport type resolveWorld<world, namespace = resolveStore<world>[\"namespace\"]> = withJsDoc<\n resolveStore<world> &\n mergeIfUndefined<\n { readonly tables: resolveNamespacedTables<world> } & {\n [key in Exclude<keyof world, \"namespaces\" | keyof Store>]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput, namespace & string>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n CONFIG_DEFAULTS\n >,\n World\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const namespaces = world.namespaces ?? {};\n\n const resolvedNamespacedTables = Object.fromEntries(\n Object.entries(namespaces)\n .map(([namespaceKey, namespace]) =>\n Object.entries(namespace.tables ?? {}).map(([tableKey, table]) => {\n validateTable(table, scope);\n return [\n `${namespaceKey}__${tableKey}`,\n resolveTable(mergeIfUndefined(table, { namespace: namespaceKey, name: tableKey }), scope),\n ];\n }),\n )\n .flat(),\n ) as Tables;\n\n const resolvedStore = resolveStore(world);\n\n const modules = (world.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\n\n return mergeIfUndefined(\n {\n ...resolvedStore,\n tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },\n codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),\n deploy: resolveDeploy(world.deploy),\n systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems, resolvedStore.namespace),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\n","import { ErrorMessage } from \"@arktype/util\";\nimport { isObject } from \"@latticexyz/store/config/v2\";\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 table of Object.values(input)) {\n validateSystem(table, { 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, namespace extends string> = {\n [label in keyof systems]: resolveSystem<systems[label] & { label: label; namespace: namespace }>;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespace extends string>(\n systems: systems,\n namespace: namespace,\n): resolveSystems<systems, namespace> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespace })];\n }),\n ) as never;\n}\n","import {\n Scope,\n AbiTypeScope,\n validateTables,\n isObject,\n hasOwnKey,\n resolveTable,\n mergeIfUndefined,\n extendedScope,\n getPath,\n} from \"@latticexyz/store/config/v2\";\nimport { NamespaceInput, NamespacesInput } from \"./input\";\nimport { ErrorMessage, conform } from \"@arktype/util\";\n\nexport type namespacedTableKeys<world> = world extends { namespaces: infer namespaces }\n ? {\n [k in keyof namespaces]: namespaces[k] extends { tables: infer tables }\n ? `${k & string}__${keyof tables & string}`\n : never;\n }[keyof namespaces]\n : never;\n\nexport type validateNamespace<namespace, scope extends Scope = AbiTypeScope> = {\n readonly [key in keyof namespace]: key extends \"tables\"\n ? validateTables<namespace[key], scope>\n : key extends keyof NamespaceInput\n ? conform<namespace[key], NamespaceInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid namespace config option.`>;\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n namespace: unknown,\n scope: scope,\n): asserts namespace is NamespaceInput {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n}\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 resolveNamespacedTables<world> = \"namespaces\" extends keyof world\n ? {\n readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}`\n ? resolveTable<\n mergeIfUndefined<\n getPath<world, [\"namespaces\", namespace, \"tables\", table]>,\n { name: table; namespace: namespace }\n >,\n extendedScope<world>\n >\n : never;\n }\n : {};\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\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/config/v2\";\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"],"mappings":"2EACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EAEA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,MACK,8BCZP,OAAS,YAAAC,MAAgB,8BAYlB,SAASC,EAAgBC,EAA+C,CAC7E,GAAIC,EAASD,CAAK,EAAG,CACnB,QAAWE,KAAS,OAAO,OAAOF,CAAK,EACrCG,EAAeD,EAAO,CAAE,YAAa,EAAK,CAAC,EAE7C,OAEF,MAAM,IAAI,MAAM,oCAAoC,KAAK,UAAUF,CAAK,GAAG,CAC7E,CAMO,SAASI,EACdC,EACAC,EACoC,CACpC,OAAO,OAAO,YACZ,OAAO,QAAQD,CAAO,EAAE,IAAI,CAAC,CAACE,EAAOC,CAAM,IAClC,CAACD,EAAOE,EAAc,CAAE,GAAGD,EAAQ,MAAAD,EAAO,UAAAD,CAAU,CAAC,CAAC,CAC9D,CACH,CACF,CCpCA,OAGE,kBAAAI,EACA,YAAAC,EACA,aAAAC,MAKK,8BAoBA,SAASC,EACdC,EACAC,EACqC,CACjCH,EAAUE,EAAW,QAAQ,GAC/BJ,EAAeI,EAAU,OAAQC,CAAK,CAE1C,CAMO,SAASC,EACdC,EACAF,EACuC,CACvC,GAAI,CAACJ,EAASM,CAAU,EACtB,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,CAAU,GAAG,EAE/E,QAAWH,KAAa,OAAO,OAAOG,CAAU,EAC9CJ,EAAkBC,EAAWC,CAAK,CAEtC,CCrDA,OAAS,YAAAG,EAAU,oBAAAC,MAAwB,8BAOpC,SAASC,EAAwBC,EAA2C,CACjF,OAAQC,EAASD,CAAO,EAAIE,EAAiBF,EAASG,CAAgB,EAAIA,CAC5E,CCTA,OAAS,oBAAAC,EAAkB,YAAAC,MAAgB,8BAKpC,SAASC,EAAsBC,EAAuC,CAC3E,OAAQC,EAASD,CAAM,EAAIE,EAAiBF,EAAQG,CAAe,EAAIA,CACzE,CJiCO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EACjCG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,SAAS,GAC5BK,EAAgBL,EAAM,OAAO,EAE3BI,EAAUJ,EAAO,YAAY,GAC/BM,EAAmBN,EAAM,WAAYC,CAAK,CAE9C,CAmBO,SAASM,EAA6CP,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BQ,EAAaR,EAAM,YAAc,CAAC,EAElCS,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcC,CAAS,IAC5B,OAAO,QAAQA,EAAU,QAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAACC,EAAUC,CAAK,KAC1DC,EAAcD,EAAOZ,CAAK,EACnB,CACL,GAAGS,MAAiBE,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWH,EAAc,KAAME,CAAS,CAAC,EAAGX,CAAK,CAC1F,EACD,CACH,EACC,KAAK,CACV,EAEMgB,EAAgBC,EAAalB,CAAK,EAElCmB,GAAWnB,EAAM,SAAWoB,EAAgB,SAAS,IAAKC,GAAQL,EAAiBK,EAAKC,CAAe,CAAC,EAE9G,OAAON,EACL,CACE,GAAGC,EACH,OAAQ,CAAE,GAAGA,EAAc,OAAQ,GAAGR,CAAyB,EAC/D,QAASO,EAAiBC,EAAc,QAASM,EAAevB,EAAM,OAAO,CAAC,EAC9E,OAAQwB,EAAcxB,EAAM,MAAM,EAClC,QAASyB,EAAezB,EAAM,SAAWoB,EAAgB,QAASH,EAAc,SAAS,EACzF,eAAgBS,EAAI1B,EAAO,gBAAgB,EAC3C,QAAAmB,CACF,EACAC,CACF,CACF,CAEO,SAASO,GAAyBC,EAAkD,CACzF,OAAA7B,EAAc6B,CAAK,EACZrB,EAAaqB,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","resolveStore","hasOwnKey","validateStore","isObject","validateSystems","input","isObject","table","validateSystem","resolveSystems","systems","namespace","label","system","resolveSystem","validateTables","isObject","hasOwnKey","validateNamespace","namespace","scope","validateNamespaces","namespaces","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","validateSystems","validateNamespaces","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","namespace","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld","input"]}
@@ -1,2 +1,2 @@
1
- import{c as e}from"./chunk-QWCOI4NR.js";var a=e({codegen:{worldImportPath:"../../",worldgenDirectory:"interfaces",worldInterfaceName:"IBaseWorld"},namespace:"world",userTypes:{ResourceId:{filePath:"@latticexyz/store/src/ResourceId.sol",type:"bytes32"}},tables:{NamespaceOwner:{schema:{namespaceId:"ResourceId",owner:"address"},key:["namespaceId"]},ResourceAccess:{schema:{resourceId:"ResourceId",caller:"address",access:"bool"},key:["resourceId","caller"]},InstalledModules:{schema:{moduleAddress:"address",argumentsHash:"bytes32",isInstalled:"bool"},key:["moduleAddress","argumentsHash"]},UserDelegationControl:{schema:{delegator:"address",delegatee:"address",delegationControlId:"ResourceId"},key:["delegator","delegatee"]},NamespaceDelegationControl:{schema:{namespaceId:"ResourceId",delegationControlId:"ResourceId"},key:["namespaceId"]},Balances:{schema:{namespaceId:"ResourceId",balance:"uint256"},key:["namespaceId"]},Systems:{schema:{systemId:"ResourceId",system:"address",publicAccess:"bool"},key:["systemId"],codegen:{dataStruct:!1}},SystemRegistry:{schema:{system:"address",systemId:"ResourceId"},key:["system"]},SystemHooks:{schema:{systemId:"ResourceId",value:"bytes21[]"},key:["systemId"]},FunctionSelectors:{schema:{worldFunctionSelector:"bytes4",systemId:"ResourceId",systemFunctionSelector:"bytes4"},key:["worldFunctionSelector"],codegen:{dataStruct:!1}},FunctionSignatures:{type:"offchainTable",schema:{functionSelector:"bytes4",functionSignature:"string"},key:["functionSelector"]},InitModuleAddress:{schema:{value:"address"},key:[]}},excludeSystems:["StoreRegistrationSystem"]});export{a};
2
- //# sourceMappingURL=chunk-236CU3CY.js.map
1
+ import{c as e}from"./chunk-OM2LE2WB.js";var a=e({codegen:{worldImportPath:"../../",worldgenDirectory:"interfaces",worldInterfaceName:"IBaseWorld"},namespace:"world",userTypes:{ResourceId:{filePath:"@latticexyz/store/src/ResourceId.sol",type:"bytes32"}},tables:{NamespaceOwner:{schema:{namespaceId:"ResourceId",owner:"address"},key:["namespaceId"]},ResourceAccess:{schema:{resourceId:"ResourceId",caller:"address",access:"bool"},key:["resourceId","caller"]},InstalledModules:{schema:{moduleAddress:"address",argumentsHash:"bytes32",isInstalled:"bool"},key:["moduleAddress","argumentsHash"]},UserDelegationControl:{schema:{delegator:"address",delegatee:"address",delegationControlId:"ResourceId"},key:["delegator","delegatee"]},NamespaceDelegationControl:{schema:{namespaceId:"ResourceId",delegationControlId:"ResourceId"},key:["namespaceId"]},Balances:{schema:{namespaceId:"ResourceId",balance:"uint256"},key:["namespaceId"]},Systems:{schema:{systemId:"ResourceId",system:"address",publicAccess:"bool"},key:["systemId"],codegen:{dataStruct:!1}},SystemRegistry:{schema:{system:"address",systemId:"ResourceId"},key:["system"]},SystemHooks:{schema:{systemId:"ResourceId",value:"bytes21[]"},key:["systemId"]},FunctionSelectors:{schema:{worldFunctionSelector:"bytes4",systemId:"ResourceId",systemFunctionSelector:"bytes4"},key:["worldFunctionSelector"],codegen:{dataStruct:!1}},FunctionSignatures:{type:"offchainTable",schema:{functionSelector:"bytes4",functionSignature:"string"},key:["functionSelector"]},InitModuleAddress:{schema:{value:"address"},key:[]}},excludeSystems:["StoreRegistrationSystem"]});export{a};
2
+ //# sourceMappingURL=chunk-Z53LAQKB.js.map
@@ -1,5 +1,6 @@
1
- export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-95f49fc0.js';
2
- export { C as Codegen, D as Deploy, M as Module, S as System, b as Systems, W as World } from '../dynamicResolution-b1bf86e3.js';
1
+ export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-ef5ac077.js';
2
+ export { C as Codegen, D as Deploy, M as Module, S as System, b as Systems, W as World } from '../dynamicResolution-34391fca.js';
3
3
  import '@arktype/util';
4
4
  import '@latticexyz/store/config/v2';
5
+ import 'viem';
5
6
  import '@latticexyz/store';
package/dist/config/v2.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as e}from"../chunk-QWCOI4NR.js";import"../chunk-JEHHYC6A.js";export{e as defineWorld,r as resolveWorld,o as validateWorld};
1
+ import{a as o,b as r,c as e}from"../chunk-OM2LE2WB.js";import"../chunk-DK3XOTC2.js";export{e as defineWorld,r as resolveWorld,o as validateWorld};
2
2
  //# sourceMappingURL=v2.js.map
@@ -1,4 +1,5 @@
1
1
  import { Store } from '@latticexyz/store';
2
+ import { Hex } from 'viem';
2
3
 
3
4
  type Module = {
4
5
  /**
@@ -22,8 +23,23 @@ type Module = {
22
23
  readonly artifactPath: string | undefined;
23
24
  };
24
25
  type System = {
25
- /** The name of the system contract. Becomes part of the `systemId`. */
26
+ /**
27
+ * Human-readable system label. Used as config keys, interface names, and filenames.
28
+ * Labels are not length constrained like resource names, but special characters should be avoided to be compatible with the filesystem, Solidity compiler, etc.
29
+ */
30
+ readonly label: string;
31
+ /**
32
+ * System namespace used in system's resource ID and determines access control.
33
+ */
34
+ readonly namespace: string;
35
+ /**
36
+ * System name used in system's resource ID.
37
+ */
26
38
  readonly name: string;
39
+ /**
40
+ * System's resource ID.
41
+ */
42
+ readonly systemId: Hex;
27
43
  /**
28
44
  * Register function selectors for the system in the World.
29
45
  * Defaults to true.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import { validateTablesWithShorthands, extendedScope, Scope, AbiTypeScope, resolveTablesWithShorthands } from '@latticexyz/store/config/v2';
2
- import { v as validateWorld, a as validateNamespace, r as resolveWorld, W as WorldWithShorthandsInput } from './world-95f49fc0.js';
3
- export { W as World } from './dynamicResolution-b1bf86e3.js';
2
+ import { v as validateWorld, a as validateNamespace, r as resolveWorld, W as WorldWithShorthandsInput } from './world-ef5ac077.js';
3
+ export { W as World } from './dynamicResolution-34391fca.js';
4
4
  import '@arktype/util';
5
+ import 'viem';
5
6
  import '@latticexyz/store';
6
7
 
7
8
  declare const worldDeployedEvent = "event WorldDeployed(address indexed newContract, uint256 salt)";
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as d,b as l}from"./chunk-QWCOI4NR.js";import"./chunk-JEHHYC6A.js";var W="event WorldDeployed(address indexed newContract, uint256 salt)",v="event HelloWorld(bytes32 indexed worldVersion)";import{mapObject as r}from"@latticexyz/common/utils";import{extendedScope as m,getPath as S,hasOwnKey as p,isObject as f,isTableShorthandInput as h,resolveTableShorthand as i,validateTablesWithShorthands as c}from"@latticexyz/store/config/v2";function k(e){let t=m(e);if(p(e,"tables")&&c(e.tables,t),p(e,"namespaces")&&f(e.namespaces))for(let a of Object.keys(e.namespaces))c(S(e.namespaces,[a,"tables"])??{},t)}function x(e){let t=m(e),a=r(e.tables??{},o=>h(o)?i(o,t):o),y=r(e.namespaces??{},o=>({...o,tables:r(o.tables??{},s=>h(s)?i(s,t):s)})),n={...e,tables:a,namespaces:y};return d(n),l(n)}function b(e){return k(e),x(e)}export{b as defineWorld,v as helloWorldEvent,W as worldDeployedEvent};
1
+ import{a as d,b as l}from"./chunk-OM2LE2WB.js";import"./chunk-DK3XOTC2.js";var W="event WorldDeployed(address indexed newContract, uint256 salt)",v="event HelloWorld(bytes32 indexed worldVersion)";import{mapObject as r}from"@latticexyz/common/utils";import{extendedScope as m,getPath as S,hasOwnKey as p,isObject as f,isTableShorthandInput as h,resolveTableShorthand as i,validateTablesWithShorthands as c}from"@latticexyz/store/config/v2";function k(e){let t=m(e);if(p(e,"tables")&&c(e.tables,t),p(e,"namespaces")&&f(e.namespaces))for(let a of Object.keys(e.namespaces))c(S(e.namespaces,[a,"tables"])??{},t)}function x(e){let t=m(e),a=r(e.tables??{},o=>h(o)?i(o,t):o),y=r(e.namespaces??{},o=>({...o,tables:r(o.tables??{},s=>h(s)?i(s,t):s)})),n={...e,tables:a,namespaces:y};return d(n),l(n)}function b(e){return k(e),x(e)}export{b as defineWorld,v as helloWorldEvent,W as worldDeployedEvent};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  import { Abi, ContractFunctionName, EncodeFunctionDataParameters, Hex, Address, Chain, Account, Client, Transport, WalletActions, PublicClient } from 'viem';
2
2
  import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
3
- export { r as resolveTableId, a as resolveWithContext } from './dynamicResolution-b1bf86e3.js';
3
+ export { r as resolveTableId, a as resolveWithContext } from './dynamicResolution-34391fca.js';
4
4
  import '@latticexyz/store';
5
5
 
6
6
  declare const abi: [
package/dist/internal.js CHANGED
@@ -1,3 +1,3 @@
1
- import{a as m}from"./chunk-236CU3CY.js";import"./chunk-QWCOI4NR.js";import"./chunk-JEHHYC6A.js";import{encodeFunctionData as C}from"viem";function c({abi:e,systemId:a,functionName:t,args:n}){return[a,C({abi:e,functionName:t,args:n})]}import{encodeFunctionData as x}from"viem";function u({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function z(e,a){return a.map(t=>c({...t,abi:e}))}function Y(e,a,t){return t.map(n=>u({...n,abi:e,from:a}))}import{slice as S,concat as F}from"viem";import{getAction as d,encodeFunctionData as A}from"viem/utils";import{writeContract as b}from"viem/actions";import{readHex as g}from"@latticexyz/common";import{getKeySchema as h,getValueSchema as P,getSchemaTypes as f,decodeValueArgs as w,encodeKey as N}from"@latticexyz/protocol-parser/internal";var p=[{type:"function",name:"getDynamicField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldSlice",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"},{name:"start",type:"uint256",internalType:"uint256"},{name:"end",type:"uint256",internalType:"uint256"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getFieldLayout",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getKeySchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"keySchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getStaticField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getValueSchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"valueSchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"}];function le(e){return a=>({writeContract:async t=>{if(t.address!==e.worldAddress||t.functionName==="call"||t.functionName==="callFrom"||t.functionName==="callWithSignature")return d(a,b,"writeContract")(t);let n=A({abi:t.abi,functionName:t.functionName,args:t.args}),i=S(n,0,4),{systemId:o,systemFunctionSelector:r}=await v(e,i),y=F([r,g(n,4)]),s={...t,functionName:"callFrom",args:[e.delegatorAddress,o,y]};return d(a,b,"writeContract")(s)}})}var T=new Map;async function v(e,a){let t=F([e.worldAddress,a]),n=T.get(t);if(n)return n;let i=e.worldFunctionToSystemFunction?await e.worldFunctionToSystemFunction(a):await D(e.publicClient,e.worldAddress,a);return T.set(t,i),i}async function D(e,a,t){let n=m.tables.world__FunctionSelectors,i=f(h(n)),o=f(P(n)),[r,y,s]=await e.readContract({address:a,abi:p,functionName:"getRecord",args:[n.tableId,N(i,{worldFunctionSelector:t})]}),l=w(o,{staticData:r,encodedLengths:y,dynamicData:s});return{systemId:l.systemId,systemFunctionSelector:l.systemFunctionSelector}}var ce={Call:[{name:"signer",type:"address"},{name:"systemNamespace",type:"string"},{name:"systemName",type:"string"},{name:"callData",type:"bytes"},{name:"nonce",type:"uint256"}]};function R(e){return{type:"tableId",input:e}}function W(e){return typeof e=="object"&&e!==null&&"type"in e&&"input"in e}function E(e){return typeof e=="object"&&e!==null&&"type"in e&&"value"in e}function k(e,a){if(E(e))return e;if(W(e)&&e.type==="tableId"){let t=Object.entries(a.config.tables).filter(([n,i])=>n===e.input||i.name===e.input);if(t.length>1)throw new Error(`Found more than one table with name "${e.input}". Try using one of the following table names instead: ${t.map(([n])=>n).join(", ")}`);if(t.length===1){let[n]=t,[,i]=n;return{type:"bytes32",value:i.tableId}}}throw new Error(`Could not resolve dynamic resolution:
1
+ import{a as m}from"./chunk-Z53LAQKB.js";import"./chunk-OM2LE2WB.js";import"./chunk-DK3XOTC2.js";import{encodeFunctionData as C}from"viem";function c({abi:e,systemId:a,functionName:t,args:n}){return[a,C({abi:e,functionName:t,args:n})]}import{encodeFunctionData as x}from"viem";function u({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function z(e,a){return a.map(t=>c({...t,abi:e}))}function Y(e,a,t){return t.map(n=>u({...n,abi:e,from:a}))}import{slice as S,concat as F}from"viem";import{getAction as d,encodeFunctionData as A}from"viem/utils";import{writeContract as b}from"viem/actions";import{readHex as g}from"@latticexyz/common";import{getKeySchema as h,getValueSchema as P,getSchemaTypes as f,decodeValueArgs as w,encodeKey as N}from"@latticexyz/protocol-parser/internal";var p=[{type:"function",name:"getDynamicField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldSlice",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"},{name:"start",type:"uint256",internalType:"uint256"},{name:"end",type:"uint256",internalType:"uint256"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getFieldLayout",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getKeySchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"keySchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getStaticField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getValueSchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"valueSchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"}];function le(e){return a=>({writeContract:async t=>{if(t.address!==e.worldAddress||t.functionName==="call"||t.functionName==="callFrom"||t.functionName==="callWithSignature")return d(a,b,"writeContract")(t);let n=A({abi:t.abi,functionName:t.functionName,args:t.args}),i=S(n,0,4),{systemId:o,systemFunctionSelector:r}=await v(e,i),y=F([r,g(n,4)]),s={...t,functionName:"callFrom",args:[e.delegatorAddress,o,y]};return d(a,b,"writeContract")(s)}})}var T=new Map;async function v(e,a){let t=F([e.worldAddress,a]),n=T.get(t);if(n)return n;let i=e.worldFunctionToSystemFunction?await e.worldFunctionToSystemFunction(a):await D(e.publicClient,e.worldAddress,a);return T.set(t,i),i}async function D(e,a,t){let n=m.tables.world__FunctionSelectors,i=f(h(n)),o=f(P(n)),[r,y,s]=await e.readContract({address:a,abi:p,functionName:"getRecord",args:[n.tableId,N(i,{worldFunctionSelector:t})]}),l=w(o,{staticData:r,encodedLengths:y,dynamicData:s});return{systemId:l.systemId,systemFunctionSelector:l.systemFunctionSelector}}var ce={Call:[{name:"signer",type:"address"},{name:"systemNamespace",type:"string"},{name:"systemName",type:"string"},{name:"callData",type:"bytes"},{name:"nonce",type:"uint256"}]};function R(e){return{type:"tableId",input:e}}function W(e){return typeof e=="object"&&e!==null&&"type"in e&&"input"in e}function E(e){return typeof e=="object"&&e!==null&&"type"in e&&"value"in e}function k(e,a){if(E(e))return e;if(W(e)&&e.type==="tableId"){let t=Object.entries(a.config.tables).filter(([n,i])=>n===e.input||i.name===e.input);if(t.length>1)throw new Error(`Found more than one table with name "${e.input}". Try using one of the following table names instead: ${t.map(([n])=>n).join(", ")}`);if(t.length===1){let[n]=t,[,i]=n;return{type:"bytes32",value:i.tableId}}}throw new Error(`Could not resolve dynamic resolution:
2
2
  ${JSON.stringify(e,null,2)}`)}export{le as callFrom,ce as callWithSignatureTypes,c as encodeSystemCall,u as encodeSystemCallFrom,z as encodeSystemCalls,Y as encodeSystemCallsFrom,R as resolveTableId,k as resolveWithContext};
3
3
  //# sourceMappingURL=internal.js.map
@@ -26,9 +26,9 @@ declare const _default: {
26
26
  readonly storeArgument: false;
27
27
  readonly dataStruct: boolean;
28
28
  };
29
- readonly deploy: {
29
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
30
30
  readonly disabled: false;
31
- };
31
+ }>;
32
32
  };
33
33
  readonly ResourceAccess: {
34
34
  readonly label: "ResourceAccess";
@@ -57,9 +57,9 @@ declare const _default: {
57
57
  readonly storeArgument: false;
58
58
  readonly dataStruct: boolean;
59
59
  };
60
- readonly deploy: {
60
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
61
61
  readonly disabled: false;
62
- };
62
+ }>;
63
63
  };
64
64
  readonly InstalledModules: {
65
65
  readonly label: "InstalledModules";
@@ -88,9 +88,9 @@ declare const _default: {
88
88
  readonly storeArgument: false;
89
89
  readonly dataStruct: boolean;
90
90
  };
91
- readonly deploy: {
91
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
92
92
  readonly disabled: false;
93
- };
93
+ }>;
94
94
  };
95
95
  readonly UserDelegationControl: {
96
96
  readonly label: "UserDelegationControl";
@@ -119,9 +119,9 @@ declare const _default: {
119
119
  readonly storeArgument: false;
120
120
  readonly dataStruct: boolean;
121
121
  };
122
- readonly deploy: {
122
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
123
123
  readonly disabled: false;
124
- };
124
+ }>;
125
125
  };
126
126
  readonly NamespaceDelegationControl: {
127
127
  readonly label: "NamespaceDelegationControl";
@@ -146,9 +146,9 @@ declare const _default: {
146
146
  readonly storeArgument: false;
147
147
  readonly dataStruct: boolean;
148
148
  };
149
- readonly deploy: {
149
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
150
150
  readonly disabled: false;
151
- };
151
+ }>;
152
152
  };
153
153
  readonly Balances: {
154
154
  readonly label: "Balances";
@@ -173,9 +173,9 @@ declare const _default: {
173
173
  readonly storeArgument: false;
174
174
  readonly dataStruct: boolean;
175
175
  };
176
- readonly deploy: {
176
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
177
177
  readonly disabled: false;
178
- };
178
+ }>;
179
179
  };
180
180
  readonly Systems: {
181
181
  readonly label: "Systems";
@@ -204,9 +204,9 @@ declare const _default: {
204
204
  readonly storeArgument: false;
205
205
  readonly dataStruct: false;
206
206
  };
207
- readonly deploy: {
207
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
208
208
  readonly disabled: false;
209
- };
209
+ }>;
210
210
  };
211
211
  readonly SystemRegistry: {
212
212
  readonly label: "SystemRegistry";
@@ -231,9 +231,9 @@ declare const _default: {
231
231
  readonly storeArgument: false;
232
232
  readonly dataStruct: boolean;
233
233
  };
234
- readonly deploy: {
234
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
235
235
  readonly disabled: false;
236
- };
236
+ }>;
237
237
  };
238
238
  readonly SystemHooks: {
239
239
  readonly label: "SystemHooks";
@@ -258,9 +258,9 @@ declare const _default: {
258
258
  readonly storeArgument: false;
259
259
  readonly dataStruct: boolean;
260
260
  };
261
- readonly deploy: {
261
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
262
262
  readonly disabled: false;
263
- };
263
+ }>;
264
264
  };
265
265
  readonly FunctionSelectors: {
266
266
  readonly label: "FunctionSelectors";
@@ -289,9 +289,9 @@ declare const _default: {
289
289
  readonly storeArgument: false;
290
290
  readonly dataStruct: false;
291
291
  };
292
- readonly deploy: {
292
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
293
293
  readonly disabled: false;
294
- };
294
+ }>;
295
295
  };
296
296
  readonly FunctionSignatures: {
297
297
  readonly label: "FunctionSignatures";
@@ -316,9 +316,9 @@ declare const _default: {
316
316
  readonly storeArgument: false;
317
317
  readonly dataStruct: boolean;
318
318
  };
319
- readonly deploy: {
319
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
320
320
  readonly disabled: false;
321
- };
321
+ }>;
322
322
  };
323
323
  readonly InitModuleAddress: {
324
324
  readonly label: "InitModuleAddress";
@@ -339,9 +339,9 @@ declare const _default: {
339
339
  readonly storeArgument: false;
340
340
  readonly dataStruct: boolean;
341
341
  };
342
- readonly deploy: {
342
+ readonly deploy: _latticexyz_store_config_v2.mergeIfUndefined<{}, {
343
343
  readonly disabled: false;
344
- };
344
+ }>;
345
345
  };
346
346
  }, "world">;
347
347
  readonly userTypes: {
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-236CU3CY.js";import"./chunk-QWCOI4NR.js";import"./chunk-JEHHYC6A.js";export{a as default};
1
+ import{a}from"./chunk-Z53LAQKB.js";import"./chunk-OM2LE2WB.js";import"./chunk-DK3XOTC2.js";export{a as default};
2
2
  //# sourceMappingURL=mud.config.js.map
package/dist/node.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ImportDatum, ContractInterfaceFunction, ContractInterfaceError, RelativeImportDatum } from '@latticexyz/common/codegen';
2
- import { W as World, S as System } from './dynamicResolution-b1bf86e3.js';
3
- import { Hex } from 'viem';
2
+ import { W as World, S as System } from './dynamicResolution-34391fca.js';
4
3
  import '@latticexyz/store';
4
+ import 'viem';
5
5
 
6
6
  interface RenderSystemInterfaceOptions {
7
7
  /** List of symbols to import, and their file paths */
@@ -51,9 +51,6 @@ type GetSystemContractsOptions = {
51
51
  declare function getSystemContracts({ rootDir, config, }: GetSystemContractsOptions): Promise<readonly SolidityContract[]>;
52
52
 
53
53
  type ResolvedSystem = System & {
54
- readonly label: string;
55
- readonly namespace: string;
56
- readonly systemId: Hex;
57
54
  readonly sourcePath: string;
58
55
  };
59
56
  declare function resolveSystems({ rootDir, config, }: {