@latticexyz/world 3.0.0-main-3440a86b5 → 3.0.0-main-69eb63b59
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-OZBNK257.js → chunk-2DPDMM6H.js} +2 -2
- package/dist/chunk-3EELS6P3.js +2 -0
- package/dist/chunk-3EELS6P3.js.map +1 -0
- package/dist/config/v2.d.ts +1 -1
- package/dist/config/v2.js +1 -1
- package/dist/index.d.ts +3 -12
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.js +1 -1
- package/dist/mud.config.d.ts +269 -288
- package/dist/mud.config.js +1 -1
- package/dist/node.js +1 -1
- package/dist/node.js.map +1 -1
- package/dist/{world-6e8198d8.d.ts → world-ae07544a.d.ts} +3 -5
- package/out/AccessControl.sol/AccessControl.json +1 -1
- package/out/AccessControl.t.sol/AccessControlTest.json +1 -1
- package/out/AccessManagementSystem.sol/AccessManagementSystem.json +1 -1
- package/out/AddressArray.sol/AddressArray.json +1 -1
- package/out/BalanceTransferSystem.sol/BalanceTransferSystem.json +1 -1
- package/out/Balances.sol/Balances.json +1 -1
- 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/Bool.sol/Bool.json +1 -1
- package/out/Delegation.sol/Delegation.json +1 -1
- package/out/DelegationControl.sol/DelegationControl.json +1 -1
- package/out/DelegationControlMock.sol/DelegationControlMock.json +1 -1
- package/out/Factories.t.sol/FactoriesTest.json +1 -1
- package/out/FunctionSelectors.sol/FunctionSelectors.json +1 -1
- package/out/FunctionSignatures.sol/FunctionSignatures.json +1 -1
- package/out/Hook.sol/HookInstance.json +1 -1
- package/out/Hook.sol/HookLib.json +1 -1
- package/out/Hooks.sol/Hooks.json +1 -1
- package/out/IAccessManagementSystem.sol/IAccessManagementSystem.json +1 -1
- package/out/IBaseWorld.sol/IBaseWorld.json +1 -1
- package/out/IBatchCallSystem.sol/IBatchCallSystem.json +1 -1
- package/out/IModuleInstallationSystem.sol/IModuleInstallationSystem.json +1 -1
- package/out/IWorldRegistrationSystem.sol/IWorldRegistrationSystem.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/InitModuleAddress.sol/InitModuleAddress.json +1 -1
- package/out/InitSystems.t.sol/LimitedCallContextTest.json +1 -1
- package/out/InstalledModules.sol/InstalledModules.json +1 -1
- package/out/Module.sol/Module.json +1 -1
- package/out/ModuleInstallationSystem.sol/ModuleInstallationSystem.json +1 -1
- package/out/MudTest.t.sol/MudTest.json +1 -1
- package/out/NamespaceDelegationControl.sol/NamespaceDelegationControl.json +1 -1
- package/out/NamespaceOwner.sol/NamespaceOwner.json +1 -1
- package/out/RegistrationSystem.sol/RegistrationSystem.json +1 -1
- package/out/ResourceAccess.sol/ResourceAccess.json +1 -1
- package/out/ResourceIds.sol/ResourceIds.json +1 -1
- package/out/Store.sol/Store.json +1 -1
- package/out/StoreCore.sol/StoreCore.json +1 -1
- package/out/StoreCore.sol/StoreCoreInternal.json +1 -1
- package/out/StoreHooks.sol/StoreHooks.json +1 -1
- package/out/StoreKernel.sol/StoreKernel.json +1 -1
- package/out/StoreMock.sol/StoreMock.json +1 -1
- package/out/StoreRead.sol/StoreRead.json +1 -1
- package/out/StoreRegistrationSystem.sol/StoreRegistrationSystem.json +1 -1
- package/out/StoreSwitch.sol/StoreSwitch.json +1 -1
- package/out/System.sol/System.json +1 -1
- package/out/System.t.sol/SystemTest.json +1 -1
- package/out/System.t.sol/TestSystem.json +1 -1
- package/out/SystemCall.sol/SystemCall.json +1 -1
- package/out/SystemHook.t.sol/SystemHookTest.json +1 -1
- package/out/SystemHooks.sol/SystemHooks.json +1 -1
- package/out/SystemRegistry.sol/SystemRegistry.json +1 -1
- package/out/Systems.sol/Systems.json +1 -1
- package/out/Tables.sol/Tables.json +1 -1
- package/out/TwoFields.sol/TwoFields.json +1 -1
- package/out/UserDelegationControl.sol/UserDelegationControl.json +1 -1
- package/out/Utils.sol/Utils.json +1 -1
- package/out/Utils.t.sol/UtilsTest.json +1 -1
- package/out/Utils.t.sol/UtilsTestSystem.json +1 -1
- package/out/World.sol/World.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/WorldContext.sol/WorldContextConsumer.json +1 -1
- package/out/WorldContext.sol/WorldContextConsumerLib.json +1 -1
- package/out/WorldContext.sol/WorldContextProviderLib.json +1 -1
- package/out/WorldContext.t.sol/TestContextConsumer.json +1 -1
- package/out/WorldContext.t.sol/WorldContextTest.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/WorldRegistrationSystem.sol/WorldRegistrationSystem.json +1 -1
- package/out/build-info/{11c85b26e1969ca82de39d2cfbd09ca2.json → 7d027d3c2c4234c547896a757e5b3269.json} +1 -1
- package/package.json +8 -8
- package/src/codegen/interfaces/IAccessManagementSystem.sol +1 -1
- package/src/codegen/interfaces/IBatchCallSystem.sol +1 -1
- package/src/codegen/interfaces/IModuleInstallationSystem.sol +1 -1
- package/src/codegen/interfaces/IWorldRegistrationSystem.sol +2 -2
- package/dist/chunk-BH75YTBY.js +0 -2
- package/dist/chunk-BH75YTBY.js.map +0 -1
- /package/dist/{chunk-OZBNK257.js.map → chunk-2DPDMM6H.js.map} +0 -0
@@ -1,2 +1,2 @@
|
|
1
|
-
import{c as e}from"./chunk-
|
2
|
-
//# sourceMappingURL=chunk-
|
1
|
+
import{c as e}from"./chunk-3EELS6P3.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-2DPDMM6H.js.map
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{h as c,i as p,j as l,k as a,l as i,m as y}from"./chunk-DK3XOTC2.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-3EELS6P3.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../ts/config/v2/world.ts","../ts/config/v2/systems.ts","../ts/config/v2/namespaces.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["import { ErrorMessage, conform, narrow, type withJsDoc } from \"@arktype/util\";\nimport {\n UserTypes,\n extendedScope,\n get,\n resolveTable,\n validateTable,\n mergeIfUndefined,\n validateTables,\n resolveStore,\n Store,\n hasOwnKey,\n validateStore,\n expandTableShorthand,\n} from \"@latticexyz/store/config/v2\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { Tables } from \"@latticexyz/store/internal\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { resolveNamespacedTables, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\n\nexport type validateWorld<world> = {\n readonly [key in keyof world]: key extends \"tables\"\n ? validateTables<world[key], extendedScope<world>>\n : key extends \"userTypes\"\n ? UserTypes\n : key extends \"enums\"\n ? narrow<world[key]>\n : key extends \"systems\"\n ? validateSystems<world[key]>\n : key extends \"namespaces\"\n ? // ? validateNamespaces<world[key], extendedScope<world>>\n ErrorMessage<`Namespaces config will be enabled soon.`>\n : key extends keyof WorldInput\n ? conform<world[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\n};\n\nexport function validateWorld(world: unknown): asserts world is WorldInput {\n const scope = extendedScope(world);\n validateStore(world);\n\n if (hasOwnKey(world, \"systems\")) {\n validateSystems(world.systems);\n }\n if (hasOwnKey(world, \"namespaces\")) {\n validateNamespaces(world.namespaces, scope);\n }\n}\n\nexport type resolveWorld<world, namespace = resolveStore<world>[\"namespace\"]> = withJsDoc<\n resolveStore<world> &\n mergeIfUndefined<\n { readonly tables: resolveNamespacedTables<world> } & {\n [key in Exclude<keyof world, keyof Store>]: key extends \"systems\"\n ? resolveSystems<world[key] & SystemsInput, namespace & string>\n : key extends \"deploy\"\n ? resolveDeploy<world[key]>\n : key extends \"codegen\"\n ? resolveCodegen<world[key]>\n : world[key];\n },\n CONFIG_DEFAULTS\n >,\n World\n>;\n\nexport function resolveWorld<const world extends WorldInput>(world: world): resolveWorld<world> {\n const scope = extendedScope(world);\n const resolvedStore = resolveStore(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(\n mergeIfUndefined(expandTableShorthand(table, scope), { namespace: namespaceKey, label: tableKey }),\n scope,\n ),\n ];\n }),\n )\n .flat(),\n ) as Tables;\n\n const modules = (world.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\n\n return mergeIfUndefined(\n {\n ...resolvedStore,\n tables: { ...resolvedStore.tables, ...resolvedNamespacedTables },\n codegen: mergeIfUndefined(resolvedStore.codegen, resolveCodegen(world.codegen)),\n deploy: resolveDeploy(world.deploy),\n systems: resolveSystems(world.systems ?? CONFIG_DEFAULTS.systems, resolvedStore.namespace),\n excludeSystems: get(world, \"excludeSystems\"),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): resolveWorld<input> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\n","import { ErrorMessage } from \"@arktype/util\";\nimport { isObject } from \"@latticexyz/store/config/v2\";\nimport { SystemsInput } from \"./input\";\nimport { resolveSystem, validateSystem } from \"./system\";\n\n// TODO: add nuance between \"in namespace\" (namespace provided in context) and \"in systems\" (label provided in context)\n\nexport type validateSystems<input> = {\n [label in keyof input]: input[label] extends object\n ? validateSystem<input[label], { inNamespace: true }>\n : ErrorMessage<`Expected a system config for ${label & string}.`>;\n};\n\nexport function validateSystems(input: unknown): asserts input is SystemsInput {\n if (isObject(input)) {\n for (const table of Object.values(input)) {\n validateSystem(table, { inNamespace: true });\n }\n return;\n }\n throw new Error(`Expected system config, received ${JSON.stringify(input)}`);\n}\n\nexport type resolveSystems<systems extends SystemsInput, namespace extends string> = {\n [label in keyof systems]: resolveSystem<systems[label] & { label: label; namespace: namespace }>;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespace extends string>(\n systems: systems,\n namespace: namespace,\n): resolveSystems<systems, namespace> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespace })];\n }),\n ) as never;\n}\n","import {\n Scope,\n AbiTypeScope,\n validateTables,\n isObject,\n hasOwnKey,\n resolveTable,\n mergeIfUndefined,\n extendedScope,\n getPath,\n expandTableShorthand,\n} from \"@latticexyz/store/config/v2\";\nimport { NamespaceInput, NamespacesInput } from \"./input\";\nimport { ErrorMessage, conform } from \"@arktype/util\";\n\nexport type namespacedTableKeys<world> = world extends { namespaces: infer namespaces }\n ? {\n [k in keyof namespaces]: namespaces[k] extends { tables: infer tables }\n ? `${k & string}__${keyof tables & string}`\n : never;\n }[keyof namespaces]\n : never;\n\nexport type validateNamespace<namespace, scope extends Scope = AbiTypeScope> = {\n readonly [key in keyof namespace]: key extends \"tables\"\n ? validateTables<namespace[key], scope>\n : key extends keyof NamespaceInput\n ? conform<namespace[key], NamespaceInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid namespace config option.`>;\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n namespace: unknown,\n scope: scope,\n): asserts namespace is NamespaceInput {\n if (hasOwnKey(namespace, \"tables\")) {\n validateTables(namespace.tables, scope);\n }\n}\n\nexport type validateNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {\n [label in keyof namespaces]: validateNamespace<namespaces[label], scope>;\n};\n\nexport function validateNamespaces<scope extends Scope = AbiTypeScope>(\n namespaces: unknown,\n scope: scope,\n): asserts namespaces is NamespacesInput {\n if (!isObject(namespaces)) {\n throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);\n }\n for (const namespace of Object.values(namespaces)) {\n validateNamespace(namespace, scope);\n }\n}\n\nexport type resolveNamespacedTables<world> = \"namespaces\" extends keyof world\n ? {\n readonly [key in namespacedTableKeys<world>]: key extends `${infer namespace}__${infer table}`\n ? resolveTable<\n mergeIfUndefined<\n expandTableShorthand<getPath<world, [\"namespaces\", namespace, \"tables\", table]>>,\n { name: table; namespace: namespace }\n >,\n extendedScope<world>\n >\n : never;\n }\n : {};\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/config/v2\";\nimport { CODEGEN_DEFAULTS } from \"./defaults\";\n\nexport type resolveCodegen<codegen> = codegen extends {}\n ? mergeIfUndefined<codegen, CODEGEN_DEFAULTS>\n : CODEGEN_DEFAULTS;\n\nexport function resolveCodegen<codegen>(codegen: codegen): resolveCodegen<codegen> {\n return (isObject(codegen) ? mergeIfUndefined(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS) as never;\n}\n","import { mergeIfUndefined, isObject } from \"@latticexyz/store/config/v2\";\nimport { DEPLOY_DEFAULTS } from \"./defaults\";\n\nexport type resolveDeploy<deploy> = deploy extends {} ? mergeIfUndefined<deploy, DEPLOY_DEFAULTS> : DEPLOY_DEFAULTS;\n\nexport function resolveDeploy<deploy>(deploy: deploy): resolveDeploy<deploy> {\n return (isObject(deploy) ? mergeIfUndefined(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS) as never;\n}\n"],"mappings":"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","names":["extendedScope","get","resolveTable","validateTable","mergeIfUndefined","resolveStore","hasOwnKey","validateStore","expandTableShorthand","isObject","validateSystems","input","isObject","table","validateSystem","resolveSystems","systems","namespace","label","system","resolveSystem","validateTables","isObject","hasOwnKey","validateNamespace","namespace","scope","validateNamespaces","namespaces","isObject","mergeIfUndefined","resolveCodegen","codegen","isObject","mergeIfUndefined","CODEGEN_DEFAULTS","mergeIfUndefined","isObject","resolveDeploy","deploy","isObject","mergeIfUndefined","DEPLOY_DEFAULTS","validateWorld","world","scope","extendedScope","validateStore","hasOwnKey","validateSystems","validateNamespaces","resolveWorld","resolvedStore","resolveStore","namespaces","resolvedNamespacedTables","namespaceKey","namespace","tableKey","table","validateTable","resolveTable","mergeIfUndefined","expandTableShorthand","modules","CONFIG_DEFAULTS","mod","MODULE_DEFAULTS","resolveCodegen","resolveDeploy","resolveSystems","get","defineWorld","input"]}
|
package/dist/config/v2.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-
|
1
|
+
export { d as defineWorld, r as resolveWorld, v as validateWorld } from '../world-ae07544a.js';
|
2
2
|
export { C as Codegen, D as Deploy, M as Module, S as System, b as Systems, W as World } from '../dynamicResolution-34391fca.js';
|
3
3
|
import '@arktype/util';
|
4
4
|
import '@latticexyz/store/config/v2';
|
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-3EELS6P3.js";import"../chunk-DK3XOTC2.js";export{e as defineWorld,r as resolveWorld,o as validateWorld};
|
2
2
|
//# sourceMappingURL=v2.js.map
|
package/dist/index.d.ts
CHANGED
@@ -1,20 +1,11 @@
|
|
1
|
-
|
2
|
-
import { v as validateWorld, r as resolveWorld, W as WorldWithShorthandsInput } from './world-6e8198d8.js';
|
1
|
+
export { d as defineWorld } from './world-ae07544a.js';
|
3
2
|
export { W as World } from './dynamicResolution-34391fca.js';
|
4
3
|
import '@arktype/util';
|
4
|
+
import '@latticexyz/store/config/v2';
|
5
5
|
import 'viem';
|
6
6
|
import '@latticexyz/store';
|
7
7
|
|
8
8
|
declare const worldDeployedEvent = "event WorldDeployed(address indexed newContract, uint256 salt)";
|
9
9
|
declare const helloWorldEvent = "event HelloWorld(bytes32 indexed worldVersion)";
|
10
10
|
|
11
|
-
|
12
|
-
[key in keyof world]: key extends "tables" ? validateTablesWithShorthands<world[key], extendedScope<world>> : validateWorld<world>[key];
|
13
|
-
};
|
14
|
-
type resolveWorldWithShorthands<world> = resolveWorld<{
|
15
|
-
readonly [key in keyof world]: key extends "tables" ? resolveTablesWithShorthands<world[key], extendedScope<world>> : world[key];
|
16
|
-
}>;
|
17
|
-
declare function resolveWorldWithShorthands<world extends WorldWithShorthandsInput>(world: world): resolveWorldWithShorthands<world>;
|
18
|
-
declare function defineWorldWithShorthands<world>(world: validateWorldWithShorthands<world>): resolveWorldWithShorthands<world>;
|
19
|
-
|
20
|
-
export { defineWorldWithShorthands as defineWorld, helloWorldEvent, worldDeployedEvent };
|
11
|
+
export { helloWorldEvent, worldDeployedEvent };
|
package/dist/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
import{
|
1
|
+
import{c as e}from"./chunk-3EELS6P3.js";import"./chunk-DK3XOTC2.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/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../ts/worldEvents.ts"
|
1
|
+
{"version":3,"sources":["../ts/worldEvents.ts"],"sourcesContent":["// from WorldFactory\nexport const worldDeployedEvent = \"event WorldDeployed(address indexed newContract, uint256 salt)\";\n\n// from World\nexport const helloWorldEvent = \"event HelloWorld(bytes32 indexed worldVersion)\";\n"],"mappings":"oEACO,IAAMA,EAAqB,iEAGrBC,EAAkB","names":["worldDeployedEvent","helloWorldEvent"]}
|
package/dist/internal.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
import{a as m}from"./chunk-
|
1
|
+
import{a as m}from"./chunk-2DPDMM6H.js";import"./chunk-3EELS6P3.js";import"./chunk-DK3XOTC2.js";import{encodeFunctionData as C}from"viem";function c({abi:e,systemId:a,functionName:t,args:n}){return[a,C({abi:e,functionName:t,args:n})]}import{encodeFunctionData as x}from"viem";function u({abi:e,from:a,systemId:t,functionName:n,args:i}){return[a,t,x({abi:e,functionName:n,args:i})]}function z(e,a){return a.map(t=>c({...t,abi:e}))}function Y(e,a,t){return t.map(n=>u({...n,abi:e,from:a}))}import{slice as S,concat as F}from"viem";import{getAction as d,encodeFunctionData as A}from"viem/utils";import{writeContract as b}from"viem/actions";import{readHex as g}from"@latticexyz/common";import{getKeySchema as h,getValueSchema as P,getSchemaTypes as f,decodeValueArgs as w,encodeKey as N}from"@latticexyz/protocol-parser/internal";var p=[{type:"function",name:"getDynamicField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getDynamicFieldSlice",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"dynamicFieldIndex",type:"uint8",internalType:"uint8"},{name:"start",type:"uint256",internalType:"uint256"},{name:"end",type:"uint256",internalType:"uint256"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"data",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getFieldLayout",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getFieldLength",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getKeySchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"keySchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getRecord",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"}],outputs:[{name:"staticData",type:"bytes",internalType:"bytes"},{name:"encodedLengths",type:"bytes32",internalType:"EncodedLengths"},{name:"dynamicData",type:"bytes",internalType:"bytes"}],stateMutability:"view"},{type:"function",name:"getStaticField",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"},{name:"keyTuple",type:"bytes32[]",internalType:"bytes32[]"},{name:"fieldIndex",type:"uint8",internalType:"uint8"},{name:"fieldLayout",type:"bytes32",internalType:"FieldLayout"}],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"getValueSchema",inputs:[{name:"tableId",type:"bytes32",internalType:"ResourceId"}],outputs:[{name:"valueSchema",type:"bytes32",internalType:"Schema"}],stateMutability:"view"}];function le(e){return a=>({writeContract:async t=>{if(t.address!==e.worldAddress||t.functionName==="call"||t.functionName==="callFrom"||t.functionName==="callWithSignature")return d(a,b,"writeContract")(t);let n=A({abi:t.abi,functionName:t.functionName,args:t.args}),i=S(n,0,4),{systemId:o,systemFunctionSelector:r}=await v(e,i),y=F([r,g(n,4)]),s={...t,functionName:"callFrom",args:[e.delegatorAddress,o,y]};return d(a,b,"writeContract")(s)}})}var T=new Map;async function v(e,a){let t=F([e.worldAddress,a]),n=T.get(t);if(n)return n;let i=e.worldFunctionToSystemFunction?await e.worldFunctionToSystemFunction(a):await D(e.publicClient,e.worldAddress,a);return T.set(t,i),i}async function D(e,a,t){let n=m.tables.world__FunctionSelectors,i=f(h(n)),o=f(P(n)),[r,y,s]=await e.readContract({address:a,abi:p,functionName:"getRecord",args:[n.tableId,N(i,{worldFunctionSelector:t})]}),l=w(o,{staticData:r,encodedLengths:y,dynamicData:s});return{systemId:l.systemId,systemFunctionSelector:l.systemFunctionSelector}}var ce={Call:[{name:"signer",type:"address"},{name:"systemNamespace",type:"string"},{name:"systemName",type:"string"},{name:"callData",type:"bytes"},{name:"nonce",type:"uint256"}]};function R(e){return{type:"tableId",input:e}}function W(e){return typeof e=="object"&&e!==null&&"type"in e&&"input"in e}function E(e){return typeof e=="object"&&e!==null&&"type"in e&&"value"in e}function k(e,a){if(E(e))return e;if(W(e)&&e.type==="tableId"){let t=Object.entries(a.config.tables).filter(([n,i])=>n===e.input||i.name===e.input);if(t.length>1)throw new Error(`Found more than one table with name "${e.input}". Try using one of the following table names instead: ${t.map(([n])=>n).join(", ")}`);if(t.length===1){let[n]=t,[,i]=n;return{type:"bytes32",value:i.tableId}}}throw new Error(`Could not resolve dynamic resolution:
|
2
2
|
${JSON.stringify(e,null,2)}`)}export{le as callFrom,ce as callWithSignatureTypes,c as encodeSystemCall,u as encodeSystemCallFrom,z as encodeSystemCalls,Y as encodeSystemCallsFrom,R as resolveTableId,k as resolveWithContext};
|
3
3
|
//# sourceMappingURL=internal.js.map
|