@latticexyz/world 2.0.12-main-9be2bb86 → 2.0.12-main-e43c0938

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/dist/chunk-UMWFUO6H.js +2 -0
  2. package/dist/chunk-UMWFUO6H.js.map +1 -0
  3. package/dist/{chunk-PWEXBICA.js → chunk-ZUIIMEYR.js} +2 -2
  4. package/dist/chunk-ZUIIMEYR.js.map +1 -0
  5. package/dist/config/v2.d.ts +3 -3
  6. package/dist/config/v2.js +1 -1
  7. package/dist/{dynamicResolution-e364a0fe.d.ts → dynamicResolution-1a0cabb0.d.ts} +4 -1
  8. package/dist/index.d.ts +2 -2
  9. package/dist/index.js +1 -1
  10. package/dist/internal.d.ts +3 -3
  11. package/dist/internal.js +1 -1
  12. package/dist/mud.config.d.ts +13 -12
  13. package/dist/mud.config.js +1 -1
  14. package/dist/node.d.ts +1 -1
  15. package/dist/register.d.ts +2 -2
  16. package/dist/{types-05e0a946.d.ts → types-daf44583.d.ts} +6 -6
  17. package/dist/{world-028cabe5.d.ts → world-487f256a.d.ts} +3 -1
  18. package/package.json +15 -27
  19. package/cache/solidity-files-cache.json +0 -1
  20. package/dist/chunk-HG6V522M.js +0 -2
  21. package/dist/chunk-HG6V522M.js.map +0 -1
  22. package/dist/chunk-PWEXBICA.js.map +0 -1
  23. package/mud.config.ts +0 -118
  24. package/ts/actions/callFrom.ts +0 -146
  25. package/ts/callWithSignatureTypes.ts +0 -11
  26. package/ts/config/defaults.ts +0 -21
  27. package/ts/config/resolveWorldConfig.ts +0 -82
  28. package/ts/config/types.ts +0 -91
  29. package/ts/config/v2/codegen.ts +0 -10
  30. package/ts/config/v2/compat.test.ts +0 -99
  31. package/ts/config/v2/compat.ts +0 -46
  32. package/ts/config/v2/defaults.ts +0 -44
  33. package/ts/config/v2/deploy.ts +0 -8
  34. package/ts/config/v2/dynamicResolution.ts +0 -64
  35. package/ts/config/v2/index.ts +0 -3
  36. package/ts/config/v2/input.ts +0 -107
  37. package/ts/config/v2/namespaces.ts +0 -58
  38. package/ts/config/v2/output.ts +0 -80
  39. package/ts/config/v2/systems.ts +0 -12
  40. package/ts/config/v2/world.test.ts +0 -782
  41. package/ts/config/v2/world.ts +0 -113
  42. package/ts/config/v2/worldWithShorthands.test.ts +0 -353
  43. package/ts/config/v2/worldWithShorthands.ts +0 -86
  44. package/ts/config/worldConfig.test-d.ts +0 -12
  45. package/ts/config/worldConfig.ts +0 -39
  46. package/ts/encodeSystemCall.test.ts +0 -50
  47. package/ts/encodeSystemCall.ts +0 -29
  48. package/ts/encodeSystemCallFrom.ts +0 -32
  49. package/ts/encodeSystemCalls.test.ts +0 -56
  50. package/ts/encodeSystemCalls.ts +0 -12
  51. package/ts/encodeSystemCallsFrom.ts +0 -15
  52. package/ts/exports/index.ts +0 -10
  53. package/ts/exports/internal.ts +0 -15
  54. package/ts/node/index.ts +0 -1
  55. package/ts/node/render-solidity/index.ts +0 -4
  56. package/ts/node/render-solidity/renderSystemInterface.ts +0 -38
  57. package/ts/node/render-solidity/renderWorldInterface.ts +0 -43
  58. package/ts/node/render-solidity/types.ts +0 -26
  59. package/ts/node/render-solidity/worldgen.ts +0 -75
  60. package/ts/protocol-snapshots/2.0.0.snap +0 -102
  61. package/ts/protocol-snapshots/2.0.1.snap +0 -102
  62. package/ts/protocol-snapshots/2.0.2.snap +0 -102
  63. package/ts/protocolVersions.test.ts +0 -30
  64. package/ts/protocolVersions.ts +0 -7
  65. package/ts/register/configExtensions.ts +0 -18
  66. package/ts/register/index.ts +0 -11
  67. package/ts/register/typeExtensions.ts +0 -28
  68. package/ts/scripts/codegenTightcoder.ts +0 -17
  69. package/ts/scripts/generate-test-tables.ts +0 -40
  70. package/ts/scripts/list-tables-from-store-and-world-configs.ts +0 -11
  71. package/ts/scripts/tablegen.ts +0 -11
  72. package/ts/scripts/worldgen.ts +0 -33
  73. package/ts/worldEvents.test.ts +0 -33
  74. package/ts/worldEvents.ts +0 -5
@@ -0,0 +1,2 @@
1
+ import{a as y}from"./chunk-E5NQ4W4F.js";import{extendedScope as u,get as O,resolveTable as _,validateTable as A,mergeIfUndefined as d,validateTables as b,resolveStore as k,hasOwnKey as E,validateStore as w,isObject as C}from"@latticexyz/store/config/v2";var i={root:!1,args:[],artifactPath:void 0},r={worldInterfaceName:"IWorld",worldgenDirectory:"world",worldImportPath:"@latticexyz/world/src/"},n={customWorldContract:void 0,postDeployScript:"PostDeploy",deploysDirectory:"./deploys",worldsFile:"./worlds.json",upgradeableWorldImplementation:!1},p={systems:{},tables:{},excludeSystems:[],modules:[],codegen:r,deploy:n};import{mapObject as x}from"@latticexyz/common/utils";import{mergeIfUndefined as U}from"@latticexyz/store/config/v2";function c(e){return x(e,o=>U(o,y))}import{isObject as g,mergeIfUndefined as I}from"@latticexyz/store/config/v2";function f(e){return g(e)?I(e,r):r}import{mergeIfUndefined as L,isObject as F}from"@latticexyz/store/config/v2";function S(e){return F(e)?L(e,n):n}function W(e){let o=u(e);if(w(e),E(e,"namespaces")){if(!C(e.namespaces))throw new Error(`Expected namespaces, received ${JSON.stringify(e.namespaces)}`);for(let s of Object.values(e.namespaces))E(s,"tables")&&b(s.tables,o)}}function N(e){let o=u(e),s=e.namespaces??{},D=Object.fromEntries(Object.entries(s).map(([t,v])=>Object.entries(v.tables??{}).map(([a,m])=>(A(m,o),[`${t}__${a}`,_(d(m,{namespace:t,name:a}),o)]))).flat()),l=k(e),T=(e.modules??p.modules).map(t=>d(t,i));return d({...l,tables:{...l.tables,...D},codegen:d(l.codegen,f(e.codegen)),deploy:S(e.deploy),systems:c(e.systems??p.systems),excludeSystems:O(e,"excludeSystems"),modules:T},p)}function ee(e){return W(e),N(e)}export{W as a,N as b,ee as c};
2
+ //# sourceMappingURL=chunk-UMWFUO6H.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../ts/config/v2/world.ts","../ts/config/v2/defaults.ts","../ts/config/v2/systems.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["import { ErrorMessage, conform, evaluate, narrow } 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 isObject,\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 } from \"./systems\";\nimport { resolveNamespacedTables } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\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 \"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, \"namespaces\")) {\n if (!isObject(world.namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(world.namespaces)}`);\n }\n for (const namespace of Object.values(world.namespaces)) {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n }\n }\n}\n\nexport type resolveWorld<world> = evaluate<\n resolveStore<world> &\n mergeIfUndefined<\n { tables: resolveNamespacedTables<world> } & Omit<\n {\n [key in keyof world]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n \"namespaces\" | keyof Store\n >,\n CONFIG_DEFAULTS\n >\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),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const world>(world: validateWorld<world>): resolveWorld<world> {\n validateWorld(world);\n return resolveWorld(world) as never;\n}\n","import { CodegenInput, DeployInput, ModuleInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEFAULTS = {\n registerFunctionSelectors: true,\n openAccess: true,\n accessList: [],\n} as const satisfies SystemInput;\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 { mapObject } from \"@latticexyz/common/utils\";\nimport { SYSTEM_DEFAULTS } from \"../defaults\";\nimport { SystemsInput } from \"./input\";\nimport { mergeIfUndefined } from \"@latticexyz/store/config/v2\";\n\nexport type resolveSystems<systems extends SystemsInput> = {\n [system in keyof systems]: mergeIfUndefined<systems[system], typeof SYSTEM_DEFAULTS>;\n};\n\nexport function resolveSystems<systems extends SystemsInput>(systems: systems): resolveSystems<systems> {\n return mapObject(systems, (system) => mergeIfUndefined(system, SYSTEM_DEFAULTS));\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":"wCACA,OAEE,iBAAAA,EACA,OAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gBAAAC,EAEA,aAAAC,EACA,iBAAAC,EACA,YAAAC,MACK,8BCJA,IAAMC,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,EC3CA,OAAS,aAAAE,MAAiB,2BAG1B,OAAS,oBAAAC,MAAwB,8BAM1B,SAASC,EAA6CC,EAA2C,CACtG,OAAOC,EAAUD,EAAUE,GAAWJ,EAAiBI,EAAQC,CAAe,CAAC,CACjF,CCXA,OAAS,YAAAC,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,CJ+BO,SAASC,EAAcC,EAA6C,CACzE,IAAMC,EAAQC,EAAcF,CAAK,EAGjC,GAFAG,EAAcH,CAAK,EAEfI,EAAUJ,EAAO,YAAY,EAAG,CAClC,GAAI,CAACK,EAASL,EAAM,UAAU,EAC5B,MAAM,IAAI,MAAM,iCAAiC,KAAK,UAAUA,EAAM,UAAU,GAAG,EAErF,QAAWM,KAAa,OAAO,OAAON,EAAM,UAAU,EAChDI,EAAUE,EAAW,QAAQ,GAC/BC,EAAeD,EAAU,OAAQL,CAAK,EAI9C,CAqBO,SAASO,EAA6CR,EAAmC,CAC9F,IAAMC,EAAQC,EAAcF,CAAK,EAC3BS,EAAaT,EAAM,YAAc,CAAC,EAElCU,EAA2B,OAAO,YACtC,OAAO,QAAQD,CAAU,EACtB,IAAI,CAAC,CAACE,EAAcL,CAAS,IAC5B,OAAO,QAAQA,EAAU,QAAU,CAAC,CAAC,EAAE,IAAI,CAAC,CAACM,EAAUC,CAAK,KAC1DC,EAAcD,EAAOZ,CAAK,EACnB,CACL,GAAGU,MAAiBC,IACpBG,EAAaC,EAAiBH,EAAO,CAAE,UAAWF,EAAc,KAAMC,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,GAAGP,CAAyB,EAC/D,QAASM,EAAiBC,EAAc,QAASM,EAAevB,EAAM,OAAO,CAAC,EAC9E,OAAQwB,EAAcxB,EAAM,MAAM,EAClC,QAASyB,EAAezB,EAAM,SAAWoB,EAAgB,OAAO,EAChE,eAAgBM,EAAI1B,EAAO,gBAAgB,EAC3C,QAAAmB,CACF,EACAC,CACF,CACF,CAEO,SAASO,GAAyB3B,EAAkD,CACzF,OAAAD,EAAcC,CAAK,EACZQ,EAAaR,CAAK,CAC3B","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","validateTables","resolveStore","hasOwnKey","validateStore","isObject","MODULE_DEFAULTS","CODEGEN_DEFAULTS","DEPLOY_DEFAULTS","CONFIG_DEFAULTS","mapObject","mergeIfUndefined","resolveSystems","systems","mapObject","system","SYSTEM_DEFAULTS","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","isObject","namespace","validateTables","resolveWorld","namespaces","resolvedNamespacedTables","namespaceKey","tableKey","table","validateTable","resolveTable","mergeIfUndefined","resolvedStore","resolveStore","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld"]}
@@ -1,2 +1,2 @@
1
- import{c as e}from"./chunk-HG6V522M.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-PWEXBICA.js.map
1
+ import{c as e}from"./chunk-UMWFUO6H.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-ZUIIMEYR.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../mud.config.ts"],"sourcesContent":["import { defineWorld } from \"./ts/config/v2/world\";\n\nexport default defineWorld({\n codegen: {\n worldImportPath: \"../../\",\n worldgenDirectory: \"interfaces\",\n worldInterfaceName: \"IBaseWorld\",\n },\n namespace: \"world\", // NOTE: this namespace is only used for tables, the core system is deployed in the root namespace.\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});\n"],"mappings":"wCAEA,IAAOA,EAAQC,EAAY,CACzB,QAAS,CACP,gBAAiB,SACjB,kBAAmB,aACnB,mBAAoB,YACtB,EACA,UAAW,QACX,UAAW,CACT,WAAY,CAAE,SAAU,uCAAwC,KAAM,SAAU,CAClF,EACA,OAAQ,CACN,eAAgB,CACd,OAAQ,CACN,YAAa,aACb,MAAO,SACT,EACA,IAAK,CAAC,aAAa,CACrB,EACA,eAAgB,CACd,OAAQ,CACN,WAAY,aACZ,OAAQ,UACR,OAAQ,MACV,EACA,IAAK,CAAC,aAAc,QAAQ,CAC9B,EACA,iBAAkB,CAChB,OAAQ,CACN,cAAe,UACf,cAAe,UACf,YAAa,MACf,EACA,IAAK,CAAC,gBAAiB,eAAe,CACxC,EACA,sBAAuB,CACrB,OAAQ,CACN,UAAW,UACX,UAAW,UACX,oBAAqB,YACvB,EACA,IAAK,CAAC,YAAa,WAAW,CAChC,EACA,2BAA4B,CAC1B,OAAQ,CACN,YAAa,aACb,oBAAqB,YACvB,EACA,IAAK,CAAC,aAAa,CACrB,EACA,SAAU,CACR,OAAQ,CACN,YAAa,aACb,QAAS,SACX,EACA,IAAK,CAAC,aAAa,CACrB,EACA,QAAS,CACP,OAAQ,CACN,SAAU,aACV,OAAQ,UACR,aAAc,MAChB,EACA,IAAK,CAAC,UAAU,EAChB,QAAS,CACP,WAAY,EACd,CACF,EACA,eAAgB,CACd,OAAQ,CACN,OAAQ,UACR,SAAU,YACZ,EACA,IAAK,CAAC,QAAQ,CAChB,EACA,YAAa,CACX,OAAQ,CACN,SAAU,aACV,MAAO,WACT,EACA,IAAK,CAAC,UAAU,CAClB,EACA,kBAAmB,CACjB,OAAQ,CACN,sBAAuB,SACvB,SAAU,aACV,uBAAwB,QAC1B,EACA,IAAK,CAAC,uBAAuB,EAC7B,QAAS,CACP,WAAY,EACd,CACF,EACA,mBAAoB,CAClB,KAAM,gBACN,OAAQ,CACN,iBAAkB,SAClB,kBAAmB,QACrB,EACA,IAAK,CAAC,kBAAkB,CAC1B,EACA,kBAAmB,CACjB,OAAQ,CACN,MAAO,SACT,EACA,IAAK,CAAC,CACR,CACF,EACA,eAAgB,CAQd,yBACF,CACF,CAAC","names":["mud_config_default","defineWorld"]}
@@ -1,6 +1,6 @@
1
- export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-028cabe5.js';
2
- import { W as World, S as Systems } from '../dynamicResolution-e364a0fe.js';
3
- export { C as Codegen, c as Deploy, M as Module, b as System } from '../dynamicResolution-e364a0fe.js';
1
+ export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-487f256a.js';
2
+ import { W as World, S as Systems } from '../dynamicResolution-1a0cabb0.js';
3
+ export { C as Codegen, c as Deploy, M as Module, b as System } from '../dynamicResolution-1a0cabb0.js';
4
4
  import { conform } from '@arktype/util';
5
5
  import { storeToV1 } from '@latticexyz/store/config/v2';
6
6
  import '../defaults-1be1ffd2.js';
package/dist/config/v2.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as e}from"../chunk-HG6V522M.js";import"../chunk-E5NQ4W4F.js";import{a as f}from"../chunk-MTFNNV27.js";export{e as defineWorld,r as resolveWorld,o as validateWorld,f as worldToV1};
1
+ import{a as o,b as r,c as e}from"../chunk-UMWFUO6H.js";import"../chunk-E5NQ4W4F.js";import{a as f}from"../chunk-MTFNNV27.js";export{e as defineWorld,r as resolveWorld,o as validateWorld,f as worldToV1};
2
2
  //# sourceMappingURL=v2.js.map
@@ -60,7 +60,10 @@ type Codegen = {
60
60
  readonly worldInterfaceName: string;
61
61
  /** Directory to output system and world interfaces of `worldgen` (Default "world") */
62
62
  readonly worldgenDirectory: string;
63
- /** Path for world package imports. Default is "@latticexyz/world/src/" */
63
+ /**
64
+ * Path for world package imports. Default is "@latticexyz/world/src/"
65
+ * @internal
66
+ */
64
67
  readonly worldImportPath: string;
65
68
  };
66
69
  type World = Store & {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { validateTablesWithShorthands, extendedScope, Scope, AbiTypeScope, resolveTablesWithShorthands } from '@latticexyz/store/config/v2';
2
- import { v as validateWorld, a as validateNamespaces, r as resolveWorld, W as WorldWithShorthandsInput } from './world-028cabe5.js';
3
- export { W as World } from './dynamicResolution-e364a0fe.js';
2
+ import { v as validateWorld, a as validateNamespaces, r as resolveWorld, W as WorldWithShorthandsInput } from './world-487f256a.js';
3
+ export { W as World } from './dynamicResolution-1a0cabb0.js';
4
4
  import '@arktype/util';
5
5
  import './defaults-1be1ffd2.js';
6
6
  import '@latticexyz/store';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{a as d,b as l}from"./chunk-HG6V522M.js";import"./chunk-E5NQ4W4F.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 s of Object.keys(e.namespaces))c(S(e.namespaces,[s,"tables"])??{},t)}function x(e){let t=m(e),s=r(e.tables??{},o=>h(o)?i(o,t):o),y=r(e.namespaces??{},o=>({...o,tables:r(o.tables??{},a=>h(a)?i(a,t):a)})),n={...e,tables:s,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-UMWFUO6H.js";import"./chunk-E5NQ4W4F.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 s of Object.keys(e.namespaces))c(S(e.namespaces,[s,"tables"])??{},t)}function x(e){let t=m(e),s=r(e.tables??{},o=>h(o)?i(o,t):o),y=r(e.namespaces??{},o=>({...o,tables:r(o.tables??{},a=>h(a)?i(a,t):a)})),n={...e,tables:s,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,10 +1,10 @@
1
1
  export { S as SYSTEM_DEFAULTS, W as WORLD_DEFAULTS } from './defaults-1be1ffd2.js';
2
2
  import { StoreConfig } from '@latticexyz/store/internal';
3
- import { W as WorldConfig, S as SystemConfig } from './types-05e0a946.js';
4
- export { E as ExpandSystemConfig, c as ExpandSystemsConfig, M as ModuleConfig, a as SystemUserConfig, b as SystemsUserConfig, d as WorldUserConfig, e as zPluginWorldConfig, z as zWorldConfig } from './types-05e0a946.js';
3
+ import { W as WorldConfig, S as SystemConfig } from './types-daf44583.js';
4
+ export { E as ExpandSystemConfig, c as ExpandSystemsConfig, M as ModuleConfig, a as SystemUserConfig, b as SystemsUserConfig, d as WorldUserConfig, e as zPluginWorldConfig, z as zWorldConfig } from './types-daf44583.js';
5
5
  import { Abi, ContractFunctionName, EncodeFunctionDataParameters, Hex, Address, Chain, Account, Client, Transport, WalletActions, PublicClient } from 'viem';
6
6
  import { AbiParametersToPrimitiveTypes, ExtractAbiFunction } from 'abitype';
7
- export { r as resolveTableId, a as resolveWithContext } from './dynamicResolution-e364a0fe.js';
7
+ export { r as resolveTableId, a as resolveWithContext } from './dynamicResolution-1a0cabb0.js';
8
8
  import 'zod';
9
9
  import '@latticexyz/common/type-utils';
10
10
  import '@latticexyz/store';
package/dist/internal.js CHANGED
@@ -1,3 +1,3 @@
1
- import{a as m}from"./chunk-PWEXBICA.js";import{a as K,b as O}from"./chunk-NXAGBVBE.js";import"./chunk-HG6V522M.js";import{a as M,b as H}from"./chunk-E5NQ4W4F.js";import{a as V,b as j}from"./chunk-AEVS2CGG.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 p({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function ee(e,a){return a.map(t=>c({...t,abi:e}))}function ie(e,a,t){return t.map(n=>p({...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 u=[{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 be(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:u,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 Te={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-ZUIIMEYR.js";import{a as K,b as O}from"./chunk-NXAGBVBE.js";import"./chunk-UMWFUO6H.js";import{a as M,b as H}from"./chunk-E5NQ4W4F.js";import{a as V,b as j}from"./chunk-AEVS2CGG.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 p({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function ee(e,a){return a.map(t=>c({...t,abi:e}))}function ie(e,a,t){return t.map(n=>p({...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 u=[{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 be(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:u,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 Te={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{M as SYSTEM_DEFAULTS,H as WORLD_DEFAULTS,be as callFrom,Te as callWithSignatureTypes,c as encodeSystemCall,p as encodeSystemCallFrom,ee as encodeSystemCalls,ie as encodeSystemCallsFrom,j as resolveSystemConfig,R as resolveTableId,k as resolveWithContext,V as resolveWorldConfig,O as zPluginWorldConfig,K as zWorldConfig};
3
3
  //# sourceMappingURL=internal.js.map
@@ -1,4 +1,5 @@
1
1
  declare const _default: {
2
+ readonly sourceDirectory: "src";
2
3
  readonly tables: {
3
4
  readonly world__NamespaceOwner: {
4
5
  readonly tableId: `0x${string}`;
@@ -17,7 +18,7 @@ declare const _default: {
17
18
  };
18
19
  };
19
20
  readonly codegen: {
20
- readonly outputDirectory: "tables";
21
+ readonly outputDirectory: string;
21
22
  readonly tableIdArgument: false;
22
23
  readonly storeArgument: false;
23
24
  readonly dataStruct: boolean;
@@ -47,7 +48,7 @@ declare const _default: {
47
48
  };
48
49
  };
49
50
  readonly codegen: {
50
- readonly outputDirectory: "tables";
51
+ readonly outputDirectory: string;
51
52
  readonly tableIdArgument: false;
52
53
  readonly storeArgument: false;
53
54
  readonly dataStruct: boolean;
@@ -77,7 +78,7 @@ declare const _default: {
77
78
  };
78
79
  };
79
80
  readonly codegen: {
80
- readonly outputDirectory: "tables";
81
+ readonly outputDirectory: string;
81
82
  readonly tableIdArgument: false;
82
83
  readonly storeArgument: false;
83
84
  readonly dataStruct: boolean;
@@ -107,7 +108,7 @@ declare const _default: {
107
108
  };
108
109
  };
109
110
  readonly codegen: {
110
- readonly outputDirectory: "tables";
111
+ readonly outputDirectory: string;
111
112
  readonly tableIdArgument: false;
112
113
  readonly storeArgument: false;
113
114
  readonly dataStruct: boolean;
@@ -133,7 +134,7 @@ declare const _default: {
133
134
  };
134
135
  };
135
136
  readonly codegen: {
136
- readonly outputDirectory: "tables";
137
+ readonly outputDirectory: string;
137
138
  readonly tableIdArgument: false;
138
139
  readonly storeArgument: false;
139
140
  readonly dataStruct: boolean;
@@ -159,7 +160,7 @@ declare const _default: {
159
160
  };
160
161
  };
161
162
  readonly codegen: {
162
- readonly outputDirectory: "tables";
163
+ readonly outputDirectory: string;
163
164
  readonly tableIdArgument: false;
164
165
  readonly storeArgument: false;
165
166
  readonly dataStruct: boolean;
@@ -189,7 +190,7 @@ declare const _default: {
189
190
  };
190
191
  };
191
192
  readonly codegen: {
192
- readonly outputDirectory: "tables";
193
+ readonly outputDirectory: string;
193
194
  readonly tableIdArgument: false;
194
195
  readonly storeArgument: false;
195
196
  readonly dataStruct: false;
@@ -215,7 +216,7 @@ declare const _default: {
215
216
  };
216
217
  };
217
218
  readonly codegen: {
218
- readonly outputDirectory: "tables";
219
+ readonly outputDirectory: string;
219
220
  readonly tableIdArgument: false;
220
221
  readonly storeArgument: false;
221
222
  readonly dataStruct: boolean;
@@ -241,7 +242,7 @@ declare const _default: {
241
242
  };
242
243
  };
243
244
  readonly codegen: {
244
- readonly outputDirectory: "tables";
245
+ readonly outputDirectory: string;
245
246
  readonly tableIdArgument: false;
246
247
  readonly storeArgument: false;
247
248
  readonly dataStruct: boolean;
@@ -271,7 +272,7 @@ declare const _default: {
271
272
  };
272
273
  };
273
274
  readonly codegen: {
274
- readonly outputDirectory: "tables";
275
+ readonly outputDirectory: string;
275
276
  readonly tableIdArgument: false;
276
277
  readonly storeArgument: false;
277
278
  readonly dataStruct: false;
@@ -297,7 +298,7 @@ declare const _default: {
297
298
  };
298
299
  };
299
300
  readonly codegen: {
300
- readonly outputDirectory: "tables";
301
+ readonly outputDirectory: string;
301
302
  readonly tableIdArgument: false;
302
303
  readonly storeArgument: false;
303
304
  readonly dataStruct: boolean;
@@ -319,7 +320,7 @@ declare const _default: {
319
320
  };
320
321
  };
321
322
  readonly codegen: {
322
- readonly outputDirectory: "tables";
323
+ readonly outputDirectory: string;
323
324
  readonly tableIdArgument: false;
324
325
  readonly storeArgument: false;
325
326
  readonly dataStruct: boolean;
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-PWEXBICA.js";import"./chunk-HG6V522M.js";import"./chunk-E5NQ4W4F.js";export{a as default};
1
+ import{a}from"./chunk-ZUIIMEYR.js";import"./chunk-UMWFUO6H.js";import"./chunk-E5NQ4W4F.js";export{a as default};
2
2
  //# sourceMappingURL=mud.config.js.map
package/dist/node.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ImportDatum, ContractInterfaceFunction, ContractInterfaceError, RelativeImportDatum } from '@latticexyz/common/codegen';
2
- import { W as World } from './dynamicResolution-e364a0fe.js';
2
+ import { W as World } from './dynamicResolution-1a0cabb0.js';
3
3
  import '@latticexyz/store';
4
4
 
5
5
  interface RenderSystemInterfaceOptions {
@@ -2,9 +2,9 @@ export { mudConfig, mudCoreConfig } from '@latticexyz/store/register';
2
2
  import { OrDefaults } from '@latticexyz/common/type-utils';
3
3
  import { MUDCoreUserConfig } from '@latticexyz/config/library';
4
4
  import { W as WORLD_DEFAULTS } from './defaults-1be1ffd2.js';
5
- import { d as WorldUserConfig, W as WorldConfig, c as ExpandSystemsConfig } from './types-05e0a946.js';
5
+ import { d as WorldUserConfig, W as WorldConfig, c as ExpandSystemsConfig } from './types-daf44583.js';
6
6
  import 'zod';
7
- import './dynamicResolution-e364a0fe.js';
7
+ import './dynamicResolution-1a0cabb0.js';
8
8
  import '@latticexyz/store';
9
9
 
10
10
  declare module "@latticexyz/config/library" {
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
2
  import { OrDefaults } from '@latticexyz/common/type-utils';
3
3
  import { S as SYSTEM_DEFAULTS } from './defaults-1be1ffd2.js';
4
- import { V as ValueWithType, D as DynamicResolution } from './dynamicResolution-e364a0fe.js';
4
+ import { V as ValueWithType, D as DynamicResolution } from './dynamicResolution-1a0cabb0.js';
5
5
 
6
6
  declare const zWorldConfig: z.ZodObject<{
7
7
  worldContractName: z.ZodOptional<z.ZodString>;
@@ -25,8 +25,8 @@ declare const zWorldConfig: z.ZodObject<{
25
25
  openAccess: z.ZodLiteral<false>;
26
26
  accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
27
27
  }, "strip", z.ZodTypeAny, {
28
- accessList: readonly string[];
29
28
  openAccess: false;
29
+ accessList: readonly string[];
30
30
  }, {
31
31
  openAccess: false;
32
32
  accessList?: readonly string[] | undefined;
@@ -44,8 +44,8 @@ declare const zWorldConfig: z.ZodObject<{
44
44
  } & ({
45
45
  openAccess: true;
46
46
  } | {
47
- accessList: readonly string[];
48
47
  openAccess: false;
48
+ accessList: readonly string[];
49
49
  })>;
50
50
  excludeSystems: readonly string[];
51
51
  worldInterfaceName: string;
@@ -96,8 +96,8 @@ declare const zPluginWorldConfig: z.ZodObject<{
96
96
  openAccess: z.ZodLiteral<false>;
97
97
  accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
98
98
  }, "strip", z.ZodTypeAny, {
99
- accessList: readonly string[];
100
99
  openAccess: false;
100
+ accessList: readonly string[];
101
101
  }, {
102
102
  openAccess: false;
103
103
  accessList?: readonly string[] | undefined;
@@ -130,8 +130,8 @@ declare const zPluginWorldConfig: z.ZodObject<{
130
130
  openAccess: z.ZodLiteral<false>;
131
131
  accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
132
132
  }, "strip", z.ZodTypeAny, {
133
- accessList: readonly string[];
134
133
  openAccess: false;
134
+ accessList: readonly string[];
135
135
  }, {
136
136
  openAccess: false;
137
137
  accessList?: readonly string[] | undefined;
@@ -164,8 +164,8 @@ declare const zPluginWorldConfig: z.ZodObject<{
164
164
  openAccess: z.ZodLiteral<false>;
165
165
  accessList: z.ZodDefault<z.ZodReadonly<z.ZodArray<z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEffects<z.ZodString, string, string>]>, "many">>>;
166
166
  }, "strip", z.ZodTypeAny, {
167
- accessList: readonly string[];
168
167
  openAccess: false;
168
+ accessList: readonly string[];
169
169
  }, {
170
170
  openAccess: false;
171
171
  accessList?: readonly string[] | undefined;
@@ -1,6 +1,6 @@
1
1
  import { evaluate, narrow, ErrorMessage, conform } from '@arktype/util';
2
2
  import { StoreInput, StoreWithShorthandsInput, resolveTable, mergeIfUndefined, getPath, extendedScope, Scope, AbiTypeScope, validateTables, UserTypes, resolveStore, Store } from '@latticexyz/store/config/v2';
3
- import { V as ValueWithType, D as DynamicResolution } from './dynamicResolution-e364a0fe.js';
3
+ import { V as ValueWithType, D as DynamicResolution } from './dynamicResolution-1a0cabb0.js';
4
4
  import { S as SYSTEM_DEFAULTS } from './defaults-1be1ffd2.js';
5
5
 
6
6
  type SystemInput = {
@@ -50,6 +50,8 @@ type ModuleInput = ModuleInputArtifactPath & {
50
50
  readonly args?: readonly (ValueWithType | DynamicResolution)[];
51
51
  };
52
52
  type DeployInput = {
53
+ /** The name of a custom World contract to deploy. If no name is provided, a default MUD World is deployed. */
54
+ customWorldContract?: never;
53
55
  /**
54
56
  * Script to execute after the deployment is complete (Default "PostDeploy").
55
57
  * Script must be placed in the forge scripts directory (see foundry.toml) and have a ".s.sol" extension.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/world",
3
- "version": "2.0.12-main-9be2bb86",
3
+ "version": "2.0.12-main-e43c0938",
4
4
  "description": "World framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -18,36 +18,24 @@
18
18
  "./node": "./dist/node.js",
19
19
  "./out/*": "./out/*"
20
20
  },
21
- "typesVersions": {
22
- "*": {
23
- "index": [
24
- "./ts/exports/index.ts"
25
- ],
26
- "internal": [
27
- "./ts/exports/internal.ts"
28
- ],
29
- "config/v2": [
30
- "./ts/config/v2/index.ts"
31
- ],
32
- "register": [
33
- "./ts/register/index.ts"
34
- ],
35
- "node": [
36
- "./ts/node/index.ts"
37
- ]
38
- }
39
- },
21
+ "files": [
22
+ "dist",
23
+ "out",
24
+ "foundry.toml",
25
+ "src",
26
+ "test/MudTest.t.sol"
27
+ ],
40
28
  "dependencies": {
41
29
  "@arktype/util": "0.0.29",
42
30
  "abitype": "1.0.0",
43
31
  "arktype": "1.0.29-alpha",
44
32
  "viem": "2.9.20",
45
33
  "zod": "^3.22.2",
46
- "@latticexyz/common": "2.0.12-main-9be2bb86",
47
- "@latticexyz/config": "2.0.12-main-9be2bb86",
48
- "@latticexyz/protocol-parser": "2.0.12-main-9be2bb86",
49
- "@latticexyz/schema-type": "2.0.12-main-9be2bb86",
50
- "@latticexyz/store": "2.0.12-main-9be2bb86"
34
+ "@latticexyz/common": "2.0.12-main-e43c0938",
35
+ "@latticexyz/config": "2.0.12-main-e43c0938",
36
+ "@latticexyz/schema-type": "2.0.12-main-e43c0938",
37
+ "@latticexyz/store": "2.0.12-main-e43c0938",
38
+ "@latticexyz/protocol-parser": "2.0.12-main-e43c0938"
51
39
  },
52
40
  "devDependencies": {
53
41
  "@types/ejs": "^3.1.1",
@@ -62,8 +50,8 @@
62
50
  "tsup": "^6.7.0",
63
51
  "tsx": "^3.12.6",
64
52
  "vitest": "0.34.6",
65
- "@latticexyz/abi-ts": "2.0.12-main-9be2bb86",
66
- "@latticexyz/gas-report": "2.0.12-main-9be2bb86"
53
+ "@latticexyz/abi-ts": "2.0.12-main-e43c0938",
54
+ "@latticexyz/gas-report": "2.0.12-main-e43c0938"
67
55
  },
68
56
  "scripts": {
69
57
  "build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js",