@latticexyz/world 3.0.0-main-69eb63b59 → 3.0.0-main-570086e7b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-3GDI67QT.js +2 -0
- package/dist/chunk-3GDI67QT.js.map +1 -0
- package/dist/chunk-TKEDEBQZ.js +2 -0
- package/dist/chunk-TKEDEBQZ.js.map +1 -0
- package/dist/{chunk-3EELS6P3.js → chunk-TKS7AYPJ.js} +2 -2
- package/dist/config/v2.d.ts +2 -2
- package/dist/config/v2.js +1 -1
- package/dist/{dynamicResolution-34391fca.d.ts → dynamicResolution-26462ea5.d.ts} +3 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/mud.config.js +1 -1
- package/dist/node.d.ts +17 -16
- package/dist/node.js +13 -15
- package/dist/node.js.map +1 -1
- package/dist/{world-ae07544a.d.ts → world-5ea87cd7.d.ts} +4 -11
- package/out/BatchCall.t.sol/BatchCallTest.json +1 -1
- package/out/BatchCall.t.sol/TestSystem.json +1 -1
- package/out/BatchCallSystem.sol/BatchCallSystem.json +1 -1
- package/out/Factories.t.sol/FactoriesTest.json +1 -1
- package/out/IBaseWorld.sol/IBaseWorld.json +1 -1
- package/out/InitModule.sol/InitModule.json +1 -1
- package/out/InitModule.t.sol/InitModuleTest.json +1 -1
- package/out/InitModule.t.sol/WorldMock.json +1 -1
- package/out/InitSystems.t.sol/LimitedCallContextTest.json +1 -1
- package/out/Utils.t.sol/UtilsTest.json +1 -1
- package/out/Utils.t.sol/UtilsTestSystem.json +1 -1
- package/out/World.t.sol/EchoSystemHook.json +1 -1
- package/out/World.t.sol/IWorldTestSystem.json +1 -1
- package/out/World.t.sol/PayableFallbackSystem.json +1 -1
- package/out/World.t.sol/RevertSystemHook.json +1 -1
- package/out/World.t.sol/WorldTest.json +1 -1
- package/out/World.t.sol/WorldTestSystem.json +1 -1
- package/out/WorldBalance.t.sol/WorldBalanceTest.json +1 -1
- package/out/WorldBalance.t.sol/WorldBalanceTestSystem.json +1 -1
- package/out/WorldDynamicUpdate.t.sol/UpdateInDynamicFieldTest.json +1 -1
- package/out/WorldFactory.sol/WorldFactory.json +1 -1
- package/out/WorldProxy.sol/WorldProxy.json +1 -1
- package/out/WorldProxy.t.sol/WorldProxyTest.json +1 -1
- package/out/WorldProxyFactory.sol/WorldProxyFactory.json +1 -1
- package/out/WorldProxyFactory.t.sol/WorldProxyFactoryTest.json +1 -1
- package/out/build-info/{7d027d3c2c4234c547896a757e5b3269.json → 9140863eb5fa14e70284daf8950dfe77.json} +1 -1
- package/package.json +8 -8
- package/src/codegen/interfaces/IBaseWorld.sol +0 -1
- package/dist/chunk-2DPDMM6H.js +0 -2
- package/dist/chunk-2DPDMM6H.js.map +0 -1
- package/dist/chunk-DK3XOTC2.js +0 -2
- package/dist/chunk-DK3XOTC2.js.map +0 -1
- /package/dist/{chunk-3EELS6P3.js.map → chunk-TKS7AYPJ.js.map} +0 -0
@@ -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-3GDI67QT.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,uBACnB,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{c as e}from"./chunk-TKS7AYPJ.js";var a=e({codegen:{worldImportPath:"./src",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-TKEDEBQZ.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: \"./src\",\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,QACjB,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,2 +1,2 @@
|
|
1
|
-
import{h as c,i as p,j as l,k as a,l as i,m as y}from"./chunk-
|
2
|
-
//# sourceMappingURL=chunk-
|
1
|
+
import{h as c,i as p,j as l,k as a,l as i,m as y}from"./chunk-3GDI67QT.js";import{extendedScope as k,get as A,resolveTable as j,validateTable as L,mergeIfUndefined as r,resolveStore as F,hasOwnKey as S,validateStore as $,expandTableShorthand as C}from"@latticexyz/store/config/v2";import{isObject as w}from"@latticexyz/store/config/v2";function f(e){if(w(e)){for(let s of Object.values(e))i(s,{inNamespace:!0});return}throw new Error(`Expected system config, received ${JSON.stringify(e)}`)}function v(e,s){return Object.fromEntries(Object.entries(e).map(([o,n])=>[o,y({...n,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 b(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,p):p}import{mergeIfUndefined as _,isObject as h}from"@latticexyz/store/config/v2";function u(e){return h(e)?_(e,l):l}function M(e){let s=k(e);$(e),S(e,"systems")&&f(e.systems),S(e,"namespaces")&&b(e.namespaces,s)}function G(e){let s=k(e),o=F(e),n=e.namespaces??{},g=Object.fromEntries(Object.entries(n).map(([t,E])=>Object.entries(E.tables??{}).map(([d,m])=>(L(m,s),[`${t}__${d}`,j(r(C(m,s),{namespace:t,label:d}),s)]))).flat()),T=(e.modules??a.modules).map(t=>r(t,c));return r({...o,tables:{...o.tables,...g},codegen:r(o.codegen,x(e.codegen)),deploy:u(e.deploy),systems:v(e.systems??a.systems,o.namespace),excludeSystems:A(e,"excludeSystems"),modules:T},a)}function ve(e){return M(e),G(e)}export{M as a,G as b,ve as c};
|
2
|
+
//# sourceMappingURL=chunk-TKS7AYPJ.js.map
|
package/dist/config/v2.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-
|
2
|
-
export { C as Codegen, D as Deploy, M as Module, S as System, b as Systems, W as World } from '../dynamicResolution-
|
1
|
+
export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-5ea87cd7.js';
|
2
|
+
export { C as Codegen, D as Deploy, M as Module, S as System, b as Systems, W as World } from '../dynamicResolution-26462ea5.js';
|
3
3
|
import '@arktype/util';
|
4
4
|
import '@latticexyz/store/config/v2';
|
5
5
|
import 'viem';
|
package/dist/config/v2.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{a as o,b as r,c as e}from"../chunk-
|
1
|
+
import{a as o,b as r,c as e}from"../chunk-TKS7AYPJ.js";import"../chunk-3GDI67QT.js";export{e as defineWorld,r as resolveWorld,o as validateWorld};
|
2
2
|
//# sourceMappingURL=v2.js.map
|
@@ -77,8 +77,10 @@ type Codegen = {
|
|
77
77
|
/** Directory to output system and world interfaces of `worldgen` (Default "world") */
|
78
78
|
readonly worldgenDirectory: string;
|
79
79
|
/**
|
80
|
-
* Path for world package imports. Default is "@latticexyz/world/src/"
|
81
80
|
* @internal
|
81
|
+
* Absolute import path for a package import or starting with `.` for an import relative to project root dir.
|
82
|
+
*
|
83
|
+
* Defaults to `@latticexyz/world/src` if not set.
|
82
84
|
*/
|
83
85
|
readonly worldImportPath: string;
|
84
86
|
};
|
package/dist/index.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
export { d as defineWorld } from './world-
|
2
|
-
export { W as World } from './dynamicResolution-
|
1
|
+
export { d as defineWorld } from './world-5ea87cd7.js';
|
2
|
+
export { W as World } from './dynamicResolution-26462ea5.js';
|
3
3
|
import '@arktype/util';
|
4
4
|
import '@latticexyz/store/config/v2';
|
5
5
|
import 'viem';
|
package/dist/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{c as e}from"./chunk-
|
1
|
+
import{c as e}from"./chunk-TKS7AYPJ.js";import"./chunk-3GDI67QT.js";var o="event WorldDeployed(address indexed newContract, uint256 salt)",t="event HelloWorld(bytes32 indexed worldVersion)";export{e as defineWorld,t as helloWorldEvent,o as worldDeployedEvent};
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/internal.d.ts
CHANGED
@@ -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-
|
3
|
+
export { r as resolveTableId, a as resolveWithContext } from './dynamicResolution-26462ea5.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-
|
1
|
+
import{a as m}from"./chunk-TKEDEBQZ.js";import"./chunk-TKS7AYPJ.js";import"./chunk-3GDI67QT.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
|
package/dist/mud.config.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{a}from"./chunk-
|
1
|
+
import{a}from"./chunk-TKEDEBQZ.js";import"./chunk-TKS7AYPJ.js";import"./chunk-3GDI67QT.js";export{a as default};
|
2
2
|
//# sourceMappingURL=mud.config.js.map
|
package/dist/node.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import { ImportDatum, ContractInterfaceFunction, ContractInterfaceError
|
2
|
-
import { W as World, S as System } from './dynamicResolution-
|
1
|
+
import { ImportDatum, ContractInterfaceFunction, ContractInterfaceError } from '@latticexyz/common/codegen';
|
2
|
+
import { W as World, S as System } from './dynamicResolution-26462ea5.js';
|
3
3
|
import '@latticexyz/store';
|
4
4
|
import 'viem';
|
5
5
|
|
@@ -11,20 +11,20 @@ interface RenderSystemInterfaceOptions {
|
|
11
11
|
functions: ContractInterfaceFunction[];
|
12
12
|
errors: ContractInterfaceError[];
|
13
13
|
}
|
14
|
-
|
14
|
+
|
15
|
+
declare function renderSystemInterface(options: RenderSystemInterfaceOptions): string;
|
16
|
+
|
17
|
+
type RenderWorldOptions = {
|
15
18
|
/** List of symbols to import, and their file paths */
|
16
|
-
imports:
|
19
|
+
imports: ImportDatum[];
|
17
20
|
/** Name of the interface to render */
|
18
21
|
interfaceName: string;
|
19
22
|
/** Path for store package imports */
|
20
23
|
storeImportPath: string;
|
21
24
|
/** Path for world package imports */
|
22
25
|
worldImportPath: string;
|
23
|
-
}
|
24
|
-
|
25
|
-
declare function renderSystemInterface(options: RenderSystemInterfaceOptions): string;
|
26
|
-
|
27
|
-
declare function renderWorldInterface(options: RenderWorldOptions): string;
|
26
|
+
};
|
27
|
+
declare function renderWorldInterface({ interfaceName, storeImportPath, worldImportPath, imports: initialImports, }: RenderWorldOptions): string;
|
28
28
|
|
29
29
|
declare function worldgen({ rootDir, config, clean, }: {
|
30
30
|
rootDir: string;
|
@@ -32,23 +32,24 @@ declare function worldgen({ rootDir, config, clean, }: {
|
|
32
32
|
clean?: boolean;
|
33
33
|
}): Promise<void>;
|
34
34
|
|
35
|
-
declare function findSolidityFiles({
|
36
|
-
|
37
|
-
|
35
|
+
declare function findSolidityFiles({ cwd, pattern }: {
|
36
|
+
cwd?: string;
|
37
|
+
pattern: string;
|
38
38
|
}): Promise<{
|
39
39
|
filename: string;
|
40
40
|
basename: string;
|
41
41
|
}[]>;
|
42
42
|
|
43
|
-
type
|
43
|
+
type SystemContract = {
|
44
44
|
readonly sourcePath: string;
|
45
|
-
readonly
|
45
|
+
readonly namespaceLabel: string;
|
46
|
+
readonly systemLabel: string;
|
46
47
|
};
|
47
48
|
type GetSystemContractsOptions = {
|
48
49
|
readonly rootDir: string;
|
49
50
|
readonly config: World;
|
50
51
|
};
|
51
|
-
declare function getSystemContracts({ rootDir, config, }: GetSystemContractsOptions): Promise<readonly
|
52
|
+
declare function getSystemContracts({ rootDir, config, }: GetSystemContractsOptions): Promise<readonly SystemContract[]>;
|
52
53
|
|
53
54
|
type ResolvedSystem = System & {
|
54
55
|
readonly sourcePath: string;
|
@@ -58,4 +59,4 @@ declare function resolveSystems({ rootDir, config, }: {
|
|
58
59
|
config: World;
|
59
60
|
}): Promise<readonly ResolvedSystem[]>;
|
60
61
|
|
61
|
-
export { GetSystemContractsOptions, RenderSystemInterfaceOptions, RenderWorldOptions, ResolvedSystem,
|
62
|
+
export { GetSystemContractsOptions, RenderSystemInterfaceOptions, RenderWorldOptions, ResolvedSystem, SystemContract, findSolidityFiles, getSystemContracts, renderSystemInterface, renderWorldInterface, resolveSystems, worldgen };
|