@latticexyz/world 2.0.12 → 2.0.13-main-22c9db7ef
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-LZTXZFCC.js +2 -0
- package/dist/chunk-LZTXZFCC.js.map +1 -0
- package/dist/internal.d.ts +9 -2
- package/dist/internal.js +1 -1
- package/dist/node.js +14 -14
- package/dist/node.js.map +1 -1
- package/package.json +8 -8
- package/dist/chunk-AEVS2CGG.js +0 -2
- package/dist/chunk-AEVS2CGG.js.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{UnrecognizedSystemErrorFactory as l}from"@latticexyz/config/library";function g(s,o){let t=o?.filter(e=>e.endsWith("System")&&e!=="System"&&!/(^|__)I[A-Z]/.test(e))??[],r=Object.keys(s.systems);if(o){for(let e of r)if(!o.includes(e)||e==="World")throw l(["systems",e],e)}return{systems:[...new Set([...t,...r])].filter(e=>!s.excludeSystems.includes(e)).reduce((e,n)=>({...e,[n]:a({systemName:n,configNamespace:s.namespace,config:s.systems[n],existingContracts:o})}),{})}}function a({systemName:s,configNamespace:o,config:t,existingContracts:r}){let i=s.split("__"),m=i.length===2,e=m?i[0]:o,n=m?i[1]:s,p=t?.registerFunctionSelectors??!0,d=t?.openAccess??!0,y=[],f=[],S=t&&!t.openAccess?t.accessList:[];for(let c of S)if(c.startsWith("0x"))y.push(c);else{if(r&&!r.includes(c))throw l(["systems",s,"accessList"],c);f.push(c)}return{name:n,namespace:e,registerFunctionSelectors:p,openAccess:d,accessListAddresses:y,accessListSystems:f}}export{g as a,a as b};
|
|
2
|
+
//# sourceMappingURL=chunk-LZTXZFCC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../ts/config/resolveWorldConfig.ts"],"sourcesContent":["import { UnrecognizedSystemErrorFactory } from \"@latticexyz/config/library\";\nimport { StoreConfig } from \"@latticexyz/store/internal\";\nimport { SystemConfig, WorldConfig } from \"./types\";\n\nexport type ResolvedSystemConfig = ReturnType<typeof resolveSystemConfig>;\n\nexport type ResolvedWorldConfig = ReturnType<typeof resolveWorldConfig>;\n\n/**\n * Resolves the world config by combining the default and overridden system configs,\n * filtering out excluded systems, validate system names refer to existing contracts, and\n * splitting the access list into addresses and system names.\n */\nexport function resolveWorldConfig(\n config: Pick<StoreConfig & WorldConfig, \"namespace\" | \"systems\" | \"excludeSystems\">,\n existingContracts?: string[],\n) {\n // Include contract names ending in \"System\", but not the base \"System\" contract, and not Interfaces\n const defaultSystemNames =\n existingContracts?.filter((name) => name.endsWith(\"System\") && name !== \"System\" && !/(^|__)I[A-Z]/.test(name)) ??\n [];\n const overriddenSystemNames = Object.keys(config.systems);\n\n // Validate every key in systems refers to an existing system contract (and is not called \"World\")\n if (existingContracts) {\n for (const systemName of overriddenSystemNames) {\n if (!existingContracts.includes(systemName) || systemName === \"World\") {\n throw UnrecognizedSystemErrorFactory([\"systems\", systemName], systemName);\n }\n }\n }\n\n // Combine the default and overridden system names and filter out excluded systems\n const systemNames = [...new Set([...defaultSystemNames, ...overriddenSystemNames])].filter(\n (name) => !config.excludeSystems.includes(name),\n );\n\n // Resolve the config\n const resolvedSystems: Record<string, ResolvedSystemConfig> = systemNames.reduce((acc, systemName) => {\n return {\n ...acc,\n [systemName]: resolveSystemConfig({\n systemName,\n configNamespace: config.namespace,\n config: config.systems[systemName],\n existingContracts,\n }),\n };\n }, {});\n\n return { systems: resolvedSystems };\n}\n\n/**\n * Resolves the system config by combining the default and overridden system configs,\n * @param systemName name of the system\n * @param config optional SystemConfig object, if none is provided the default config is used\n * @param existingContracts optional list of existing contract names, used to validate system names in the access list. If not provided, no validation is performed.\n * @returns ResolvedSystemConfig object\n * Default value for name is `systemName`\n * Default value for registerFunctionSelectors is true\n * Default value for openAccess is true\n * Default value for accessListAddresses is []\n * Default value for accessListSystems is []\n */\nexport function resolveSystemConfig({\n systemName,\n configNamespace,\n config,\n existingContracts,\n}: {\n systemName: string;\n configNamespace: string;\n config?: SystemConfig;\n existingContracts?: string[];\n}) {\n // If the namespace is not set in the system name, default to the config namespace\n const parts = systemName.split(\"__\");\n const namespaceIsSet = parts.length === 2;\n const namespace = namespaceIsSet ? parts[0] : configNamespace;\n const name = namespaceIsSet ? parts[1] : systemName;\n\n const registerFunctionSelectors = config?.registerFunctionSelectors ?? true;\n const openAccess = config?.openAccess ?? true;\n const accessListAddresses: string[] = [];\n const accessListSystems: string[] = [];\n const accessList = config && !config.openAccess ? config.accessList : [];\n\n // Split the access list into addresses and system names\n for (const accessListItem of accessList) {\n if (accessListItem.startsWith(\"0x\")) {\n accessListAddresses.push(accessListItem);\n } else {\n // Validate every system refers to an existing system contract\n if (existingContracts && !existingContracts.includes(accessListItem)) {\n throw UnrecognizedSystemErrorFactory([\"systems\", systemName, \"accessList\"], accessListItem);\n }\n accessListSystems.push(accessListItem);\n }\n }\n\n return { name, namespace, registerFunctionSelectors, openAccess, accessListAddresses, accessListSystems };\n}\n"],"mappings":"AAAA,OAAS,kCAAAA,MAAsC,6BAaxC,SAASC,EACdC,EACAC,EACA,CAEA,IAAMC,EACJD,GAAmB,OAAQE,GAASA,EAAK,SAAS,QAAQ,GAAKA,IAAS,UAAY,CAAC,eAAe,KAAKA,CAAI,CAAC,GAC9G,CAAC,EACGC,EAAwB,OAAO,KAAKJ,EAAO,OAAO,EAGxD,GAAIC,GACF,QAAWI,KAAcD,EACvB,GAAI,CAACH,EAAkB,SAASI,CAAU,GAAKA,IAAe,QAC5D,MAAMP,EAA+B,CAAC,UAAWO,CAAU,EAAGA,CAAU,EAuB9E,MAAO,CAAE,QAjBW,CAAC,GAAG,IAAI,IAAI,CAAC,GAAGH,EAAoB,GAAGE,CAAqB,CAAC,CAAC,EAAE,OACjFD,GAAS,CAACH,EAAO,eAAe,SAASG,CAAI,CAChD,EAG0E,OAAO,CAACG,EAAKD,KAC9E,CACL,GAAGC,EACH,CAACD,CAAU,EAAGE,EAAoB,CAChC,WAAAF,EACA,gBAAiBL,EAAO,UACxB,OAAQA,EAAO,QAAQK,CAAU,EACjC,kBAAAJ,CACF,CAAC,CACH,GACC,CAAC,CAAC,CAE6B,CACpC,CAcO,SAASM,EAAoB,CAClC,WAAAF,EACA,gBAAAG,EACA,OAAAR,EACA,kBAAAC,CACF,EAKG,CAED,IAAMQ,EAAQJ,EAAW,MAAM,IAAI,EAC7BK,EAAiBD,EAAM,SAAW,EAClCE,EAAYD,EAAiBD,EAAM,CAAC,EAAID,EACxCL,EAAOO,EAAiBD,EAAM,CAAC,EAAIJ,EAEnCO,EAA4BZ,GAAQ,2BAA6B,GACjEa,EAAab,GAAQ,YAAc,GACnCc,EAAgC,CAAC,EACjCC,EAA8B,CAAC,EAC/BC,EAAahB,GAAU,CAACA,EAAO,WAAaA,EAAO,WAAa,CAAC,EAGvE,QAAWiB,KAAkBD,EAC3B,GAAIC,EAAe,WAAW,IAAI,EAChCH,EAAoB,KAAKG,CAAc,MAClC,CAEL,GAAIhB,GAAqB,CAACA,EAAkB,SAASgB,CAAc,EACjE,MAAMnB,EAA+B,CAAC,UAAWO,EAAY,YAAY,EAAGY,CAAc,EAE5FF,EAAkB,KAAKE,CAAc,EAIzC,MAAO,CAAE,KAAAd,EAAM,UAAAQ,EAAW,0BAAAC,EAA2B,WAAAC,EAAY,oBAAAC,EAAqB,kBAAAC,CAAkB,CAC1G","names":["UnrecognizedSystemErrorFactory","resolveWorldConfig","config","existingContracts","defaultSystemNames","name","overriddenSystemNames","systemName","acc","resolveSystemConfig","configNamespace","parts","namespaceIsSet","namespace","registerFunctionSelectors","openAccess","accessListAddresses","accessListSystems","accessList","accessListItem"]}
|
package/dist/internal.d.ts
CHANGED
|
@@ -16,9 +16,10 @@ type ResolvedWorldConfig = ReturnType<typeof resolveWorldConfig>;
|
|
|
16
16
|
* filtering out excluded systems, validate system names refer to existing contracts, and
|
|
17
17
|
* splitting the access list into addresses and system names.
|
|
18
18
|
*/
|
|
19
|
-
declare function resolveWorldConfig(config: Pick<StoreConfig & WorldConfig, "systems" | "excludeSystems">, existingContracts?: string[]): {
|
|
19
|
+
declare function resolveWorldConfig(config: Pick<StoreConfig & WorldConfig, "namespace" | "systems" | "excludeSystems">, existingContracts?: string[]): {
|
|
20
20
|
systems: Record<string, {
|
|
21
21
|
name: string;
|
|
22
|
+
namespace: string;
|
|
22
23
|
registerFunctionSelectors: boolean;
|
|
23
24
|
openAccess: boolean;
|
|
24
25
|
accessListAddresses: string[];
|
|
@@ -37,8 +38,14 @@ declare function resolveWorldConfig(config: Pick<StoreConfig & WorldConfig, "sys
|
|
|
37
38
|
* Default value for accessListAddresses is []
|
|
38
39
|
* Default value for accessListSystems is []
|
|
39
40
|
*/
|
|
40
|
-
declare function resolveSystemConfig(systemName
|
|
41
|
+
declare function resolveSystemConfig({ systemName, configNamespace, config, existingContracts, }: {
|
|
42
|
+
systemName: string;
|
|
43
|
+
configNamespace: string;
|
|
44
|
+
config?: SystemConfig;
|
|
45
|
+
existingContracts?: string[];
|
|
46
|
+
}): {
|
|
41
47
|
name: string;
|
|
48
|
+
namespace: string;
|
|
42
49
|
registerFunctionSelectors: boolean;
|
|
43
50
|
openAccess: boolean;
|
|
44
51
|
accessListAddresses: string[];
|
package/dist/internal.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
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-LZTXZFCC.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
|
package/dist/node.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{a as
|
|
2
|
-
${
|
|
1
|
+
import{a as I}from"./chunk-LZTXZFCC.js";import{a as $}from"./chunk-MTFNNV27.js";import{renderArguments as y,renderList as g,renderedSolidityHeader as N,renderImports as T}from"@latticexyz/common/codegen";function b(e){let{imports:r,name:i,functionPrefix:t,functions:a,errors:o}=e;return`
|
|
2
|
+
${N}
|
|
3
3
|
|
|
4
|
-
${
|
|
4
|
+
${T(r)}
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* @title ${i}
|
|
@@ -9,20 +9,20 @@ import{a as y}from"./chunk-AEVS2CGG.js";import{a as h}from"./chunk-MTFNNV27.js";
|
|
|
9
9
|
* @dev This interface is automatically generated from the corresponding system contract. Do not edit manually.
|
|
10
10
|
*/
|
|
11
11
|
interface ${i} {
|
|
12
|
-
${
|
|
12
|
+
${g(o,({name:m,parameters:n})=>`error ${m}(${y(n)});`)}
|
|
13
13
|
|
|
14
|
-
${
|
|
15
|
-
function ${
|
|
16
|
-
${
|
|
17
|
-
) external ${
|
|
14
|
+
${g(a,({name:m,parameters:n,stateMutability:f,returnParameters:u})=>`
|
|
15
|
+
function ${t}${m}(
|
|
16
|
+
${y(n)}
|
|
17
|
+
) external ${f} ${j(u)};
|
|
18
18
|
`)}
|
|
19
19
|
}
|
|
20
|
-
`}function
|
|
21
|
-
${
|
|
20
|
+
`}function j(e){return e.length>0?`returns (${y(e)})`:""}import{renderArguments as _,renderedSolidityHeader as B,renderAbsoluteImports as C,renderRelativeImports as L}from"@latticexyz/common/codegen";function P(e){let{interfaceName:r,storeImportPath:i,worldImportPath:t,imports:a}=e,o=r==="IBaseWorld"?[{symbol:"IStore",path:`${i}IStore.sol`},{symbol:"IWorldKernel",path:`${t}IWorldKernel.sol`}]:[{symbol:"IBaseWorld",path:`${t}codegen/interfaces/IBaseWorld.sol`}],m=[...o,...a].map(({symbol:n})=>n);return`
|
|
21
|
+
${B}
|
|
22
22
|
|
|
23
|
-
${
|
|
23
|
+
${C(o)}
|
|
24
24
|
|
|
25
|
-
${
|
|
25
|
+
${L(a)}
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* @title ${r}
|
|
@@ -31,7 +31,7 @@ import{a as y}from"./chunk-AEVS2CGG.js";import{a as h}from"./chunk-MTFNNV27.js";
|
|
|
31
31
|
* that are dynamically registered in the World during deployment.
|
|
32
32
|
* @dev This is an autogenerated file; do not edit manually.
|
|
33
33
|
*/
|
|
34
|
-
interface ${r} is ${
|
|
34
|
+
interface ${r} is ${_(m)} {
|
|
35
35
|
}
|
|
36
|
-
`}import{readFileSync as
|
|
36
|
+
`}import{readFileSync as M}from"fs";import l from"path";import{formatAndWriteSolidity as W,contractToInterface as z}from"@latticexyz/common/codegen";import{ROOT_NAMESPACE as w}from"@latticexyz/common";async function Y(e,r,i){let t=$(e),a=I(t,r.map(({basename:s})=>s)),o=l.join(i,t.worldgenDirectory),m=r.filter(({basename:s})=>Object.keys(a.systems).includes(s)),n=[];for(let s of m){let x=M(s.path,"utf8"),{functions:S,errors:v,symbolImports:D}=z(x,s.basename),O=D.map(d=>d.path[0]==="."?{symbol:d.symbol,fromPath:l.join(l.dirname(s.path),d.path),usedInPath:o}:{symbol:d.symbol,path:d.path}),{namespace:p,name:h}=a.systems[s.basename],c=p===w?`I${h}`:`${p}__I${h}`,R=b({name:c,functionPrefix:p===w?"":`${p}__`,functions:S,errors:v,imports:O}),A=l.join(o,c+".sol");await W(R,A,"Generated system interface"),n.push({symbol:c,fromPath:`${c}.sol`,usedInPath:"./"})}let f=P({interfaceName:t.worldInterfaceName,imports:n,storeImportPath:e.codegen.storeImportPath,worldImportPath:t.worldImportPath}),u=l.join(o,t.worldInterfaceName+".sol");await W(f,u,"Generated world interface")}export{b as renderSystemInterface,P as renderWorldInterface,Y as worldgen};
|
|
37
37
|
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../ts/node/render-solidity/renderSystemInterface.ts","../ts/node/render-solidity/renderWorldInterface.ts","../ts/node/render-solidity/worldgen.ts"],"sourcesContent":["import { renderArguments, renderList, renderedSolidityHeader, renderImports } from \"@latticexyz/common/codegen\";\nimport { RenderSystemInterfaceOptions } from \"./types\";\n\nexport function renderSystemInterface(options: RenderSystemInterfaceOptions) {\n const { imports, name, functionPrefix, functions, errors } = options;\n\n return `\n ${renderedSolidityHeader}\n\n ${renderImports(imports)}\n\n /**\n * @title ${name} \n * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)\n * @dev This interface is automatically generated from the corresponding system contract. Do not edit manually.\n */\n interface ${name} {\n ${renderList(errors, ({ name, parameters }) => `error ${name}(${renderArguments(parameters)});`)}\n\n ${renderList(\n functions,\n ({ name, parameters, stateMutability, returnParameters }) => `\n function ${functionPrefix}${name}(\n ${renderArguments(parameters)}\n ) external ${stateMutability} ${renderReturnParameters(returnParameters)};\n `,\n )}\n }\n `;\n}\n\nfunction renderReturnParameters(returnParameters: string[]) {\n if (returnParameters.length > 0) {\n return `returns (${renderArguments(returnParameters)})`;\n } else {\n return \"\";\n }\n}\n","import {\n renderArguments,\n renderedSolidityHeader,\n renderAbsoluteImports,\n renderRelativeImports,\n type AbsoluteImportDatum,\n} from \"@latticexyz/common/codegen\";\nimport type { RenderWorldOptions } from \"./types\";\n\nexport function renderWorldInterface(options: RenderWorldOptions) {\n const { interfaceName, storeImportPath, worldImportPath, imports } = options;\n const baseImports: AbsoluteImportDatum[] =\n interfaceName === \"IBaseWorld\"\n ? [\n { symbol: \"IStore\", path: `${storeImportPath}IStore.sol` },\n { symbol: \"IWorldKernel\", path: `${worldImportPath}IWorldKernel.sol` },\n ]\n : [\n {\n symbol: \"IBaseWorld\",\n path: `${worldImportPath}codegen/interfaces/IBaseWorld.sol`,\n },\n ];\n const importSymbols = [...baseImports, ...imports].map(({ symbol }) => symbol);\n\n return `\n ${renderedSolidityHeader}\n\n ${renderAbsoluteImports(baseImports)}\n\n ${renderRelativeImports(imports)}\n\n /**\n * @title ${interfaceName} \n * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)\n * @notice This interface integrates all systems and associated function selectors \n * that are dynamically registered in the World during deployment.\n * @dev This is an autogenerated file; do not edit manually.\n */\n interface ${interfaceName} is ${renderArguments(importSymbols)} {\n }\n `;\n}\n","import { readFileSync } from \"fs\";\nimport path from \"path\";\nimport { formatAndWriteSolidity, contractToInterface, type RelativeImportDatum } from \"@latticexyz/common/codegen\";\nimport { renderSystemInterface } from \"./renderSystemInterface\";\nimport { renderWorldInterface } from \"./renderWorldInterface\";\nimport { resolveWorldConfig } from \"../../config/resolveWorldConfig\";\nimport { World as WorldConfig } from \"../../config/v2/output\";\nimport { worldToV1 } from \"../../config/v2/compat\";\n\nexport async function worldgen(\n configV2: WorldConfig,\n existingContracts: { path: string; basename: string }[],\n outputBaseDirectory: string,\n) {\n const config = worldToV1(configV2);\n const resolvedConfig = resolveWorldConfig(\n config,\n existingContracts.map(({ basename }) => basename),\n );\n\n const worldgenBaseDirectory = path.join(outputBaseDirectory, config.worldgenDirectory);\n const systems = existingContracts.filter(({ basename }) => Object.keys(resolvedConfig.systems).includes(basename));\n\n const systemInterfaceImports: RelativeImportDatum[] = [];\n for (const system of systems) {\n const data = readFileSync(system.path, \"utf8\");\n // get external funcions from a contract\n const { functions, errors, symbolImports } = contractToInterface(data, system.basename);\n const imports = symbolImports.map((symbolImport) => {\n if (symbolImport.path[0] === \".\") {\n // relative import\n return {\n symbol: symbolImport.symbol,\n fromPath: path.join(path.dirname(system.path), symbolImport.path),\n usedInPath: worldgenBaseDirectory,\n };\n } else {\n // absolute import\n return {\n symbol: symbolImport.symbol,\n path: symbolImport.path,\n };\n }\n });\n const systemInterfaceName = `I${
|
|
1
|
+
{"version":3,"sources":["../ts/node/render-solidity/renderSystemInterface.ts","../ts/node/render-solidity/renderWorldInterface.ts","../ts/node/render-solidity/worldgen.ts"],"sourcesContent":["import { renderArguments, renderList, renderedSolidityHeader, renderImports } from \"@latticexyz/common/codegen\";\nimport { RenderSystemInterfaceOptions } from \"./types\";\n\nexport function renderSystemInterface(options: RenderSystemInterfaceOptions) {\n const { imports, name, functionPrefix, functions, errors } = options;\n\n return `\n ${renderedSolidityHeader}\n\n ${renderImports(imports)}\n\n /**\n * @title ${name} \n * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)\n * @dev This interface is automatically generated from the corresponding system contract. Do not edit manually.\n */\n interface ${name} {\n ${renderList(errors, ({ name, parameters }) => `error ${name}(${renderArguments(parameters)});`)}\n\n ${renderList(\n functions,\n ({ name, parameters, stateMutability, returnParameters }) => `\n function ${functionPrefix}${name}(\n ${renderArguments(parameters)}\n ) external ${stateMutability} ${renderReturnParameters(returnParameters)};\n `,\n )}\n }\n `;\n}\n\nfunction renderReturnParameters(returnParameters: string[]) {\n if (returnParameters.length > 0) {\n return `returns (${renderArguments(returnParameters)})`;\n } else {\n return \"\";\n }\n}\n","import {\n renderArguments,\n renderedSolidityHeader,\n renderAbsoluteImports,\n renderRelativeImports,\n type AbsoluteImportDatum,\n} from \"@latticexyz/common/codegen\";\nimport type { RenderWorldOptions } from \"./types\";\n\nexport function renderWorldInterface(options: RenderWorldOptions) {\n const { interfaceName, storeImportPath, worldImportPath, imports } = options;\n const baseImports: AbsoluteImportDatum[] =\n interfaceName === \"IBaseWorld\"\n ? [\n { symbol: \"IStore\", path: `${storeImportPath}IStore.sol` },\n { symbol: \"IWorldKernel\", path: `${worldImportPath}IWorldKernel.sol` },\n ]\n : [\n {\n symbol: \"IBaseWorld\",\n path: `${worldImportPath}codegen/interfaces/IBaseWorld.sol`,\n },\n ];\n const importSymbols = [...baseImports, ...imports].map(({ symbol }) => symbol);\n\n return `\n ${renderedSolidityHeader}\n\n ${renderAbsoluteImports(baseImports)}\n\n ${renderRelativeImports(imports)}\n\n /**\n * @title ${interfaceName} \n * @author MUD (https://mud.dev) by Lattice (https://lattice.xyz)\n * @notice This interface integrates all systems and associated function selectors \n * that are dynamically registered in the World during deployment.\n * @dev This is an autogenerated file; do not edit manually.\n */\n interface ${interfaceName} is ${renderArguments(importSymbols)} {\n }\n `;\n}\n","import { readFileSync } from \"fs\";\nimport path from \"path\";\nimport { formatAndWriteSolidity, contractToInterface, type RelativeImportDatum } from \"@latticexyz/common/codegen\";\nimport { renderSystemInterface } from \"./renderSystemInterface\";\nimport { renderWorldInterface } from \"./renderWorldInterface\";\nimport { resolveWorldConfig } from \"../../config/resolveWorldConfig\";\nimport { World as WorldConfig } from \"../../config/v2/output\";\nimport { worldToV1 } from \"../../config/v2/compat\";\nimport { ROOT_NAMESPACE } from \"@latticexyz/common\";\n\nexport async function worldgen(\n configV2: WorldConfig,\n existingContracts: { path: string; basename: string }[],\n outputBaseDirectory: string,\n) {\n const config = worldToV1(configV2);\n const resolvedConfig = resolveWorldConfig(\n config,\n existingContracts.map(({ basename }) => basename),\n );\n\n const worldgenBaseDirectory = path.join(outputBaseDirectory, config.worldgenDirectory);\n const systems = existingContracts.filter(({ basename }) => Object.keys(resolvedConfig.systems).includes(basename));\n\n const systemInterfaceImports: RelativeImportDatum[] = [];\n for (const system of systems) {\n const data = readFileSync(system.path, \"utf8\");\n // get external funcions from a contract\n const { functions, errors, symbolImports } = contractToInterface(data, system.basename);\n const imports = symbolImports.map((symbolImport) => {\n if (symbolImport.path[0] === \".\") {\n // relative import\n return {\n symbol: symbolImport.symbol,\n fromPath: path.join(path.dirname(system.path), symbolImport.path),\n usedInPath: worldgenBaseDirectory,\n };\n } else {\n // absolute import\n return {\n symbol: symbolImport.symbol,\n path: symbolImport.path,\n };\n }\n });\n\n const { namespace, name } = resolvedConfig.systems[system.basename];\n\n const systemInterfaceName = namespace === ROOT_NAMESPACE ? `I${name}` : `${namespace}__I${name}`;\n const output = renderSystemInterface({\n name: systemInterfaceName,\n functionPrefix: namespace === ROOT_NAMESPACE ? \"\" : `${namespace}__`,\n functions,\n errors,\n imports,\n });\n // write to file\n const fullOutputPath = path.join(worldgenBaseDirectory, systemInterfaceName + \".sol\");\n await formatAndWriteSolidity(output, fullOutputPath, \"Generated system interface\");\n\n // prepare imports for IWorld\n systemInterfaceImports.push({\n symbol: systemInterfaceName,\n fromPath: `${systemInterfaceName}.sol`,\n usedInPath: \"./\",\n });\n }\n\n // render IWorld\n const output = renderWorldInterface({\n interfaceName: config.worldInterfaceName,\n imports: systemInterfaceImports,\n storeImportPath: configV2.codegen.storeImportPath,\n worldImportPath: config.worldImportPath,\n });\n // write to file\n const fullOutputPath = path.join(worldgenBaseDirectory, config.worldInterfaceName + \".sol\");\n await formatAndWriteSolidity(output, fullOutputPath, \"Generated world interface\");\n}\n"],"mappings":"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","names":["renderArguments","renderList","renderedSolidityHeader","renderImports","renderSystemInterface","options","imports","name","functionPrefix","functions","errors","parameters","stateMutability","returnParameters","renderReturnParameters","renderArguments","renderedSolidityHeader","renderAbsoluteImports","renderRelativeImports","renderWorldInterface","options","interfaceName","storeImportPath","worldImportPath","imports","baseImports","importSymbols","symbol","readFileSync","path","formatAndWriteSolidity","contractToInterface","ROOT_NAMESPACE","worldgen","configV2","existingContracts","outputBaseDirectory","config","worldToV1","resolvedConfig","resolveWorldConfig","basename","worldgenBaseDirectory","path","systems","systemInterfaceImports","system","data","readFileSync","functions","errors","symbolImports","contractToInterface","imports","symbolImport","namespace","name","systemInterfaceName","output","renderSystemInterface","fullOutputPath","formatAndWriteSolidity","renderWorldInterface"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@latticexyz/world",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13-main-22c9db7ef",
|
|
4
4
|
"description": "World framework",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,11 +52,11 @@
|
|
|
52
52
|
"arktype": "1.0.29-alpha",
|
|
53
53
|
"viem": "2.9.20",
|
|
54
54
|
"zod": "^3.22.2",
|
|
55
|
-
"@latticexyz/common": "2.0.
|
|
56
|
-
"@latticexyz/config": "2.0.
|
|
57
|
-
"@latticexyz/protocol-parser": "2.0.
|
|
58
|
-
"@latticexyz/schema-type": "2.0.
|
|
59
|
-
"@latticexyz/store": "2.0.
|
|
55
|
+
"@latticexyz/common": "2.0.13-main-22c9db7ef",
|
|
56
|
+
"@latticexyz/config": "2.0.13-main-22c9db7ef",
|
|
57
|
+
"@latticexyz/protocol-parser": "2.0.13-main-22c9db7ef",
|
|
58
|
+
"@latticexyz/schema-type": "2.0.13-main-22c9db7ef",
|
|
59
|
+
"@latticexyz/store": "2.0.13-main-22c9db7ef"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@types/ejs": "^3.1.1",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"tsup": "^6.7.0",
|
|
72
72
|
"tsx": "^3.12.6",
|
|
73
73
|
"vitest": "0.34.6",
|
|
74
|
-
"@latticexyz/abi-ts": "2.0.
|
|
75
|
-
"@latticexyz/gas-report": "2.0.
|
|
74
|
+
"@latticexyz/abi-ts": "2.0.13-main-22c9db7ef",
|
|
75
|
+
"@latticexyz/gas-report": "2.0.13-main-22c9db7ef"
|
|
76
76
|
},
|
|
77
77
|
"scripts": {
|
|
78
78
|
"build": "pnpm run build:mud && pnpm run build:abi && pnpm run build:abi-ts && pnpm run build:js",
|
package/dist/chunk-AEVS2CGG.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{UnrecognizedSystemErrorFactory as y}from"@latticexyz/config/library";function S(t,s){let n=s?.filter(e=>e.endsWith("System")&&e!=="System"&&!e.match(/^I[A-Z]/))??[],c=Object.keys(t.systems);if(s){for(let e of c)if(!s.includes(e)||e==="World")throw y(["systems",e],e)}return{systems:[...new Set([...n,...c])].filter(e=>!t.excludeSystems.includes(e)).reduce((e,o)=>({...e,[o]:d(o,t.systems[o],s)}),{})}}function d(t,s,n){let c=s?.name??t,i=s?.registerFunctionSelectors??!0,m=s?.openAccess??!0,e=[],o=[],l=s&&!s.openAccess?s.accessList:[];for(let r of l)if(r.startsWith("0x"))e.push(r);else{if(n&&!n.includes(r))throw y(["systems",t,"accessList"],r);o.push(r)}return{name:c,registerFunctionSelectors:i,openAccess:m,accessListAddresses:e,accessListSystems:o}}export{S as a,d as b};
|
|
2
|
-
//# sourceMappingURL=chunk-AEVS2CGG.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../ts/config/resolveWorldConfig.ts"],"sourcesContent":["import { UnrecognizedSystemErrorFactory } from \"@latticexyz/config/library\";\nimport { StoreConfig } from \"@latticexyz/store/internal\";\nimport { SystemConfig, WorldConfig } from \"./types\";\n\nexport type ResolvedSystemConfig = ReturnType<typeof resolveSystemConfig>;\n\nexport type ResolvedWorldConfig = ReturnType<typeof resolveWorldConfig>;\n\n/**\n * Resolves the world config by combining the default and overridden system configs,\n * filtering out excluded systems, validate system names refer to existing contracts, and\n * splitting the access list into addresses and system names.\n */\nexport function resolveWorldConfig(\n config: Pick<StoreConfig & WorldConfig, \"systems\" | \"excludeSystems\">,\n existingContracts?: string[],\n) {\n // Include contract names ending in \"System\", but not the base \"System\" contract, and not Interfaces\n const defaultSystemNames =\n existingContracts?.filter((name) => name.endsWith(\"System\") && name !== \"System\" && !name.match(/^I[A-Z]/)) ?? [];\n const overriddenSystemNames = Object.keys(config.systems);\n\n // Validate every key in systems refers to an existing system contract (and is not called \"World\")\n if (existingContracts) {\n for (const systemName of overriddenSystemNames) {\n if (!existingContracts.includes(systemName) || systemName === \"World\") {\n throw UnrecognizedSystemErrorFactory([\"systems\", systemName], systemName);\n }\n }\n }\n\n // Combine the default and overridden system names and filter out excluded systems\n const systemNames = [...new Set([...defaultSystemNames, ...overriddenSystemNames])].filter(\n (name) => !config.excludeSystems.includes(name),\n );\n\n // Resolve the config\n const resolvedSystems: Record<string, ResolvedSystemConfig> = systemNames.reduce((acc, systemName) => {\n return {\n ...acc,\n [systemName]: resolveSystemConfig(systemName, config.systems[systemName], existingContracts),\n };\n }, {});\n\n return { systems: resolvedSystems };\n}\n\n/**\n * Resolves the system config by combining the default and overridden system configs,\n * @param systemName name of the system\n * @param config optional SystemConfig object, if none is provided the default config is used\n * @param existingContracts optional list of existing contract names, used to validate system names in the access list. If not provided, no validation is performed.\n * @returns ResolvedSystemConfig object\n * Default value for name is `systemName`\n * Default value for registerFunctionSelectors is true\n * Default value for openAccess is true\n * Default value for accessListAddresses is []\n * Default value for accessListSystems is []\n */\nexport function resolveSystemConfig(systemName: string, config?: SystemConfig, existingContracts?: string[]) {\n const name = config?.name ?? systemName;\n const registerFunctionSelectors = config?.registerFunctionSelectors ?? true;\n const openAccess = config?.openAccess ?? true;\n const accessListAddresses: string[] = [];\n const accessListSystems: string[] = [];\n const accessList = config && !config.openAccess ? config.accessList : [];\n\n // Split the access list into addresses and system names\n for (const accessListItem of accessList) {\n if (accessListItem.startsWith(\"0x\")) {\n accessListAddresses.push(accessListItem);\n } else {\n // Validate every system refers to an existing system contract\n if (existingContracts && !existingContracts.includes(accessListItem)) {\n throw UnrecognizedSystemErrorFactory([\"systems\", systemName, \"accessList\"], accessListItem);\n }\n accessListSystems.push(accessListItem);\n }\n }\n\n return { name, registerFunctionSelectors, openAccess, accessListAddresses, accessListSystems };\n}\n"],"mappings":"AAAA,OAAS,kCAAAA,MAAsC,6BAaxC,SAASC,EACdC,EACAC,EACA,CAEA,IAAMC,EACJD,GAAmB,OAAQE,GAASA,EAAK,SAAS,QAAQ,GAAKA,IAAS,UAAY,CAACA,EAAK,MAAM,SAAS,CAAC,GAAK,CAAC,EAC5GC,EAAwB,OAAO,KAAKJ,EAAO,OAAO,EAGxD,GAAIC,GACF,QAAWI,KAAcD,EACvB,GAAI,CAACH,EAAkB,SAASI,CAAU,GAAKA,IAAe,QAC5D,MAAMP,EAA+B,CAAC,UAAWO,CAAU,EAAGA,CAAU,EAkB9E,MAAO,CAAE,QAZW,CAAC,GAAG,IAAI,IAAI,CAAC,GAAGH,EAAoB,GAAGE,CAAqB,CAAC,CAAC,EAAE,OACjFD,GAAS,CAACH,EAAO,eAAe,SAASG,CAAI,CAChD,EAG0E,OAAO,CAACG,EAAKD,KAC9E,CACL,GAAGC,EACH,CAACD,CAAU,EAAGE,EAAoBF,EAAYL,EAAO,QAAQK,CAAU,EAAGJ,CAAiB,CAC7F,GACC,CAAC,CAAC,CAE6B,CACpC,CAcO,SAASM,EAAoBF,EAAoBL,EAAuBC,EAA8B,CAC3G,IAAME,EAAOH,GAAQ,MAAQK,EACvBG,EAA4BR,GAAQ,2BAA6B,GACjES,EAAaT,GAAQ,YAAc,GACnCU,EAAgC,CAAC,EACjCC,EAA8B,CAAC,EAC/BC,EAAaZ,GAAU,CAACA,EAAO,WAAaA,EAAO,WAAa,CAAC,EAGvE,QAAWa,KAAkBD,EAC3B,GAAIC,EAAe,WAAW,IAAI,EAChCH,EAAoB,KAAKG,CAAc,MAClC,CAEL,GAAIZ,GAAqB,CAACA,EAAkB,SAASY,CAAc,EACjE,MAAMf,EAA+B,CAAC,UAAWO,EAAY,YAAY,EAAGQ,CAAc,EAE5FF,EAAkB,KAAKE,CAAc,EAIzC,MAAO,CAAE,KAAAV,EAAM,0BAAAK,EAA2B,WAAAC,EAAY,oBAAAC,EAAqB,kBAAAC,CAAkB,CAC/F","names":["UnrecognizedSystemErrorFactory","resolveWorldConfig","config","existingContracts","defaultSystemNames","name","overriddenSystemNames","systemName","acc","resolveSystemConfig","registerFunctionSelectors","openAccess","accessListAddresses","accessListSystems","accessList","accessListItem"]}
|