@latticexyz/world 2.2.18-8d0ce55e964e646a1c804c401df01c4deb866f30 → 2.2.18-9fa07c8489f1fbf167d0db01cd9aaa645a29c8e2
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/IBaseWorld.abi-S745M2QE.js +2015 -0
- package/dist/{IBaseWorld.abi-SGUPOG6A.js.map → IBaseWorld.abi-S745M2QE.js.map} +1 -1
- package/dist/System.abi-UHI2DJK6.js +67 -0
- package/dist/{System.abi-D2D3OAI5.js.map → System.abi-UHI2DJK6.js.map} +1 -1
- package/dist/chunk-AAKXFFCU.js +158 -0
- package/dist/chunk-AAKXFFCU.js.map +1 -0
- package/dist/chunk-AAWFTQHP.js +35 -0
- package/dist/chunk-S5LARYWY.js +136 -0
- package/dist/{chunk-AJUHOWGE.js.map → chunk-S5LARYWY.js.map} +1 -1
- package/dist/chunk-TL2M3LZH.js +119 -0
- package/dist/{chunk-DIHBEOC2.js.map → chunk-TL2M3LZH.js.map} +1 -1
- package/dist/dynamicResolution-AmVd5Qtd.d.cts +161 -0
- package/dist/index.cjs +241 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +11 -0
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +656 -0
- package/dist/internal.cjs.map +1 -0
- package/dist/internal.d.cts +169 -0
- package/dist/internal.js +318 -3
- package/dist/internal.js.map +1 -1
- package/dist/mud.config.cjs +357 -0
- package/dist/mud.config.cjs.map +1 -0
- package/dist/mud.config.d.cts +869 -0
- package/dist/mud.config.js +11 -1
- package/dist/node.cjs +9599 -0
- package/dist/node.cjs.map +1 -0
- package/dist/node.d.cts +131 -0
- package/dist/node.js +7328 -102
- package/dist/node.js.map +1 -1
- package/dist/world-DUniZQxy.d.cts +266 -0
- package/package.json +49 -13
- package/dist/IBaseWorld.abi-SGUPOG6A.js +0 -2
- package/dist/System.abi-D2D3OAI5.js +0 -2
- package/dist/chunk-AJUHOWGE.js +0 -2
- package/dist/chunk-CGF3NYHC.js +0 -2
- package/dist/chunk-CGF3NYHC.js.map +0 -1
- package/dist/chunk-DIHBEOC2.js +0 -2
- package/dist/chunk-FW4363Y4.js +0 -2
- /package/dist/{chunk-FW4363Y4.js.map → chunk-AAWFTQHP.js.map} +0 -0
@@ -0,0 +1,161 @@
|
|
1
|
+
import { Store } from '@latticexyz/store';
|
2
|
+
import { Namespace as Namespace$1 } from '@latticexyz/store/internal';
|
3
|
+
import { Hex } from 'viem';
|
4
|
+
|
5
|
+
type Module = {
|
6
|
+
/**
|
7
|
+
* The name of the module
|
8
|
+
* @deprecated
|
9
|
+
*/
|
10
|
+
readonly name?: string;
|
11
|
+
/** Should this module be installed as a root module? */
|
12
|
+
readonly root: boolean;
|
13
|
+
/** Arguments to be passed to the module's install method */
|
14
|
+
readonly args: readonly (ValueWithType | DynamicResolution)[];
|
15
|
+
/**
|
16
|
+
* Import path to module's forge/solc JSON artifact with the module's compiled bytecode. This is used to create consistent, deterministic deploys for already-built modules
|
17
|
+
* like those installed and imported from npm.
|
18
|
+
*
|
19
|
+
* This path is resolved using node's module resolution, so this supports both relative file paths (`../path/to/MyModule.json`) as well as JS import paths
|
20
|
+
* (`@latticexyz/world-modules/out/CallWithSignatureModule.sol/CallWithSignatureModule.json`).
|
21
|
+
*
|
22
|
+
* If not provided, it's assumed that this is a local module as part of the project's source and the artifact will be looked up in forge's output directory.
|
23
|
+
*/
|
24
|
+
readonly artifactPath: string | undefined;
|
25
|
+
};
|
26
|
+
type SystemDeploy = {
|
27
|
+
/**
|
28
|
+
* Whether or not to deploy the system.
|
29
|
+
* Defaults to `false`.
|
30
|
+
*/
|
31
|
+
readonly disabled: boolean;
|
32
|
+
/**
|
33
|
+
* Whether or not to register system functions on the world.
|
34
|
+
* System functions are prefixed with the system namespace when registering on the world, so system function names must be unique within their namespace.
|
35
|
+
* Defaults to `true`.
|
36
|
+
*/
|
37
|
+
readonly registerWorldFunctions: boolean;
|
38
|
+
};
|
39
|
+
type System = {
|
40
|
+
/**
|
41
|
+
* Human-readable label for this system. Used as config keys, interface names, and filenames.
|
42
|
+
* Labels are not length constrained like resource names, but special characters should be avoided to be compatible with the filesystem, Solidity compiler, etc.
|
43
|
+
*/
|
44
|
+
readonly label: string;
|
45
|
+
/**
|
46
|
+
* Human-readable label for this system's namespace. Used for namespace config keys and directory names.
|
47
|
+
*/
|
48
|
+
readonly namespaceLabel: string;
|
49
|
+
/**
|
50
|
+
* System namespace used in system's resource ID and determines access control.
|
51
|
+
*/
|
52
|
+
readonly namespace: string;
|
53
|
+
/**
|
54
|
+
* System name used in system's resource ID.
|
55
|
+
*/
|
56
|
+
readonly name: string;
|
57
|
+
/**
|
58
|
+
* System's resource ID.
|
59
|
+
*/
|
60
|
+
readonly systemId: Hex;
|
61
|
+
/** If openAccess is true, any address can call the system */
|
62
|
+
readonly openAccess: boolean;
|
63
|
+
/** An array of addresses or system names that can access the system */
|
64
|
+
readonly accessList: readonly string[];
|
65
|
+
readonly deploy: SystemDeploy;
|
66
|
+
};
|
67
|
+
type Systems = {
|
68
|
+
readonly [label: string]: System;
|
69
|
+
};
|
70
|
+
type Namespace = Namespace$1 & {
|
71
|
+
readonly systems: Systems;
|
72
|
+
};
|
73
|
+
type Namespaces = {
|
74
|
+
readonly [label: string]: Namespace;
|
75
|
+
};
|
76
|
+
type Deploy = {
|
77
|
+
/**
|
78
|
+
* Script to execute after the deployment is complete (Default "PostDeploy").
|
79
|
+
* Script must be placed in the forge scripts directory (see foundry.toml) and have a ".s.sol" extension.
|
80
|
+
*/
|
81
|
+
readonly postDeployScript: string;
|
82
|
+
/** Directory to write the deployment info to (Default "./deploys") */
|
83
|
+
readonly deploysDirectory: string;
|
84
|
+
/** JSON file to write to with chain -> latest world deploy address (Default "./worlds.json") */
|
85
|
+
readonly worldsFile: string;
|
86
|
+
/** Deploy the World as an upgradeable proxy */
|
87
|
+
readonly upgradeableWorldImplementation: boolean;
|
88
|
+
/**
|
89
|
+
* Deploy the World using a custom implementation. This world must implement the same interface as `World.sol` so that it can initialize core modules, etc.
|
90
|
+
* If you want to extend the world with new functions or override existing registered functions, we recommend using [root systems](https://mud.dev/world/systems#root-systems).
|
91
|
+
* However, there are rare cases where this may not be enough to modify the native/internal World behavior.
|
92
|
+
* Note that deploying a custom World opts out of the world factory, deterministic world deploys, and upgradeable implementation proxy.
|
93
|
+
*/
|
94
|
+
readonly customWorld?: {
|
95
|
+
/** Path to custom world source file relative to project root dir. */
|
96
|
+
sourcePath: string;
|
97
|
+
/** Contract name in custom world source file. */
|
98
|
+
name: string;
|
99
|
+
};
|
100
|
+
};
|
101
|
+
type Codegen = {
|
102
|
+
/**
|
103
|
+
* @internal
|
104
|
+
* The name of the World interface to generate. (Default `IWorld`)
|
105
|
+
*/
|
106
|
+
readonly worldInterfaceName: string;
|
107
|
+
/** Directory to output system and world interfaces of `worldgen` (Default "world") */
|
108
|
+
readonly worldgenDirectory: string;
|
109
|
+
/** Directory to output system libraries (Default "libraries") */
|
110
|
+
readonly systemLibrariesDirectory: string;
|
111
|
+
/** Generate libraries for each system (Default false) */
|
112
|
+
readonly generateSystemLibraries: boolean;
|
113
|
+
/**
|
114
|
+
* @internal
|
115
|
+
* Absolute import path for a package import or starting with `.` for an import relative to project root dir.
|
116
|
+
*
|
117
|
+
* Defaults to `@latticexyz/world/src` if not set.
|
118
|
+
*/
|
119
|
+
readonly worldImportPath: string;
|
120
|
+
};
|
121
|
+
type World = Omit<Store, "namespaces"> & {
|
122
|
+
readonly namespaces: Namespaces;
|
123
|
+
readonly systems: Systems;
|
124
|
+
/** Systems to exclude from automatic deployment */
|
125
|
+
readonly excludeSystems: readonly string[];
|
126
|
+
/** Modules to in the World */
|
127
|
+
readonly modules: readonly Module[];
|
128
|
+
/** Deploy config */
|
129
|
+
readonly deploy: Deploy;
|
130
|
+
/** Codegen config */
|
131
|
+
readonly codegen: Codegen;
|
132
|
+
};
|
133
|
+
|
134
|
+
type DynamicResolution = {
|
135
|
+
type: "tableId";
|
136
|
+
input: string;
|
137
|
+
};
|
138
|
+
type ValueWithType = {
|
139
|
+
value: string | number | Uint8Array;
|
140
|
+
type: string;
|
141
|
+
};
|
142
|
+
/**
|
143
|
+
* Dynamically resolve a table name to a table id at deploy time
|
144
|
+
*/
|
145
|
+
declare function resolveTableId(tableName: string): {
|
146
|
+
readonly type: "tableId";
|
147
|
+
readonly input: string;
|
148
|
+
};
|
149
|
+
/** Type guard for DynamicResolution */
|
150
|
+
declare function isDynamicResolution(value: unknown): value is DynamicResolution;
|
151
|
+
/** Type guard for ValueWithType */
|
152
|
+
declare function isValueWithType(value: unknown): value is ValueWithType;
|
153
|
+
/**
|
154
|
+
* Turn a DynamicResolution object into a ValueWithType based on the provided context
|
155
|
+
*/
|
156
|
+
declare function resolveWithContext(input: unknown, context: {
|
157
|
+
config: World;
|
158
|
+
systemAddresses?: Record<string, Promise<string>>;
|
159
|
+
}): ValueWithType;
|
160
|
+
|
161
|
+
export { type Codegen as C, type DynamicResolution as D, type Module as M, type Namespace as N, type SystemDeploy as S, type ValueWithType as V, type World as W, isValueWithType as a, resolveWithContext as b, type System as c, type Systems as d, type Namespaces as e, type Deploy as f, isDynamicResolution as i, resolveTableId as r };
|
package/dist/index.cjs
ADDED
@@ -0,0 +1,241 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __defProp = Object.defineProperty;
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
6
|
+
var __export = (target, all) => {
|
7
|
+
for (var name in all)
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
9
|
+
};
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
12
|
+
for (let key of __getOwnPropNames(from))
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
15
|
+
}
|
16
|
+
return to;
|
17
|
+
};
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
19
|
+
|
20
|
+
// ts/exports/index.ts
|
21
|
+
var exports_exports = {};
|
22
|
+
__export(exports_exports, {
|
23
|
+
defineWorld: () => defineWorld,
|
24
|
+
helloWorldEvent: () => helloWorldEvent,
|
25
|
+
worldDeployedEvent: () => worldDeployedEvent
|
26
|
+
});
|
27
|
+
module.exports = __toCommonJS(exports_exports);
|
28
|
+
|
29
|
+
// ts/worldEvents.ts
|
30
|
+
var worldDeployedEvent = "event WorldDeployed(address indexed newContract, uint256 salt)";
|
31
|
+
var helloWorldEvent = "event HelloWorld(bytes32 indexed worldVersion)";
|
32
|
+
|
33
|
+
// ts/config/v2/world.ts
|
34
|
+
var import_internal7 = require("@latticexyz/store/internal");
|
35
|
+
|
36
|
+
// ts/config/v2/defaults.ts
|
37
|
+
var SYSTEM_DEPLOY_DEFAULTS = {
|
38
|
+
disabled: false,
|
39
|
+
registerWorldFunctions: true
|
40
|
+
};
|
41
|
+
var SYSTEM_DEFAULTS = {
|
42
|
+
namespaceLabel: "",
|
43
|
+
openAccess: true,
|
44
|
+
accessList: []
|
45
|
+
};
|
46
|
+
var MODULE_DEFAULTS = {
|
47
|
+
root: false,
|
48
|
+
args: [],
|
49
|
+
artifactPath: void 0
|
50
|
+
};
|
51
|
+
var CODEGEN_DEFAULTS = {
|
52
|
+
worldInterfaceName: "IWorld",
|
53
|
+
worldgenDirectory: "world",
|
54
|
+
systemLibrariesDirectory: "systems",
|
55
|
+
generateSystemLibraries: false,
|
56
|
+
worldImportPath: "@latticexyz/world/src"
|
57
|
+
};
|
58
|
+
var DEPLOY_DEFAULTS = {
|
59
|
+
postDeployScript: "PostDeploy",
|
60
|
+
deploysDirectory: "./deploys",
|
61
|
+
worldsFile: "./worlds.json",
|
62
|
+
upgradeableWorldImplementation: false
|
63
|
+
};
|
64
|
+
var CONFIG_DEFAULTS = {
|
65
|
+
systems: {},
|
66
|
+
tables: {},
|
67
|
+
excludeSystems: [],
|
68
|
+
modules: [],
|
69
|
+
codegen: CODEGEN_DEFAULTS,
|
70
|
+
deploy: DEPLOY_DEFAULTS
|
71
|
+
};
|
72
|
+
|
73
|
+
// ts/config/v2/systems.ts
|
74
|
+
var import_internal2 = require("@latticexyz/store/internal");
|
75
|
+
|
76
|
+
// ts/config/v2/system.ts
|
77
|
+
var import_internal = require("@latticexyz/store/internal");
|
78
|
+
var import_common = require("@latticexyz/common");
|
79
|
+
function validateSystem(input, options = {}) {
|
80
|
+
if (typeof input !== "object" || input == null) {
|
81
|
+
throw new Error(`Expected full system config, got \`${JSON.stringify(input)}\``);
|
82
|
+
}
|
83
|
+
if (options.inNamespace && ((0, import_internal.hasOwnKey)(input, "label") || (0, import_internal.hasOwnKey)(input, "namespaceLabel") || (0, import_internal.hasOwnKey)(input, "namespace"))) {
|
84
|
+
throw new Error(
|
85
|
+
"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context."
|
86
|
+
);
|
87
|
+
}
|
88
|
+
if ((0, import_internal.hasOwnKey)(input, "namespaceLabel") && typeof input.namespaceLabel === "string" && (!(0, import_internal.hasOwnKey)(input, "namespace") || typeof input.namespace !== "string") && input.namespaceLabel.length > 14) {
|
89
|
+
throw new Error(
|
90
|
+
`System \`namespace\` defaults to \`namespaceLabel\`, but must fit into a \`bytes14\` and "${input.namespaceLabel}" is too long. Provide explicit \`namespace\` override.`
|
91
|
+
);
|
92
|
+
}
|
93
|
+
if ((0, import_internal.hasOwnKey)(input, "namespace") && typeof input.namespace === "string" && input.namespace.length > 14) {
|
94
|
+
throw new Error(`System \`namespace\` must fit into a \`bytes14\`, but "${input.namespace}" is too long.`);
|
95
|
+
}
|
96
|
+
if ((0, import_internal.hasOwnKey)(input, "name") && typeof input.name === "string" && input.name.length > 16) {
|
97
|
+
throw new Error(`System \`name\` must fit into a \`bytes16\`, but "${input.name}" is too long.`);
|
98
|
+
}
|
99
|
+
}
|
100
|
+
function resolveSystem(input) {
|
101
|
+
const namespaceLabel = input.namespaceLabel ?? SYSTEM_DEFAULTS.namespaceLabel;
|
102
|
+
const namespace = input.namespace ?? namespaceLabel;
|
103
|
+
const label = input.label;
|
104
|
+
const name = input.name ?? label.slice(0, 16);
|
105
|
+
const systemId = (0, import_common.resourceToHex)({ type: "system", namespace, name });
|
106
|
+
return (0, import_internal.mergeIfUndefined)(
|
107
|
+
{
|
108
|
+
...input,
|
109
|
+
label,
|
110
|
+
namespaceLabel,
|
111
|
+
namespace,
|
112
|
+
name,
|
113
|
+
systemId,
|
114
|
+
deploy: (0, import_internal.mergeIfUndefined)(input.deploy ?? {}, SYSTEM_DEPLOY_DEFAULTS)
|
115
|
+
},
|
116
|
+
SYSTEM_DEFAULTS
|
117
|
+
);
|
118
|
+
}
|
119
|
+
|
120
|
+
// ts/config/v2/systems.ts
|
121
|
+
function validateSystems(input) {
|
122
|
+
if ((0, import_internal2.isObject)(input)) {
|
123
|
+
for (const system of Object.values(input)) {
|
124
|
+
validateSystem(system, { inNamespace: true });
|
125
|
+
}
|
126
|
+
return;
|
127
|
+
}
|
128
|
+
throw new Error(`Expected system config, received ${JSON.stringify(input)}`);
|
129
|
+
}
|
130
|
+
function resolveSystems(systems, namespaceLabel, namespace) {
|
131
|
+
return Object.fromEntries(
|
132
|
+
Object.entries(systems).map(([label, system]) => {
|
133
|
+
return [label, resolveSystem({ ...system, label, namespaceLabel, namespace })];
|
134
|
+
})
|
135
|
+
);
|
136
|
+
}
|
137
|
+
|
138
|
+
// ts/config/v2/namespaces.ts
|
139
|
+
var import_util = require("@ark/util");
|
140
|
+
|
141
|
+
// ts/config/v2/namespace.ts
|
142
|
+
var import_internal3 = require("@latticexyz/store/internal");
|
143
|
+
function validateNamespace(input, scope) {
|
144
|
+
if ((0, import_internal3.hasOwnKey)(input, "systems")) {
|
145
|
+
validateSystems(input.systems);
|
146
|
+
}
|
147
|
+
(0, import_internal3.validateNamespace)(input, scope);
|
148
|
+
}
|
149
|
+
function resolveNamespace(input, scope = import_internal3.AbiTypeScope) {
|
150
|
+
const namespace = (0, import_internal3.resolveNamespace)(input, scope);
|
151
|
+
const systems = resolveSystems(input.systems ?? {}, namespace.label, namespace.namespace);
|
152
|
+
return {
|
153
|
+
...namespace,
|
154
|
+
systems
|
155
|
+
};
|
156
|
+
}
|
157
|
+
|
158
|
+
// ts/config/v2/namespaces.ts
|
159
|
+
var import_utils = require("@latticexyz/common/utils");
|
160
|
+
var import_internal4 = require("@latticexyz/store/internal");
|
161
|
+
function validateNamespaces(namespaces, scope) {
|
162
|
+
if (!(0, import_internal4.isObject)(namespaces)) {
|
163
|
+
throw new Error(`Expected namespaces, received ${JSON.stringify(namespaces)}`);
|
164
|
+
}
|
165
|
+
for (const namespace of Object.values(namespaces)) {
|
166
|
+
validateNamespace(namespace, scope);
|
167
|
+
}
|
168
|
+
}
|
169
|
+
function resolveNamespaces(input, scope) {
|
170
|
+
if (!(0, import_internal4.isObject)(input)) {
|
171
|
+
throw new Error(`Expected namespaces config, received ${JSON.stringify(input)}`);
|
172
|
+
}
|
173
|
+
const namespaces = (0, import_util.flatMorph)(input, (label, namespace) => [
|
174
|
+
label,
|
175
|
+
resolveNamespace((0, import_internal4.mergeIfUndefined)(namespace, { label }), scope)
|
176
|
+
]);
|
177
|
+
const duplicates = Array.from((0, import_utils.groupBy)(Object.values(namespaces), (namespace) => namespace.namespace).entries()).filter(([, entries]) => entries.length > 1).map(([namespace]) => namespace);
|
178
|
+
if (duplicates.length > 0) {
|
179
|
+
throw new Error(`Found namespaces defined more than once in config: ${duplicates.join(", ")}`);
|
180
|
+
}
|
181
|
+
return namespaces;
|
182
|
+
}
|
183
|
+
|
184
|
+
// ts/config/v2/codegen.ts
|
185
|
+
var import_internal5 = require("@latticexyz/store/internal");
|
186
|
+
function resolveCodegen(codegen) {
|
187
|
+
return (0, import_internal5.isObject)(codegen) ? (0, import_internal5.mergeIfUndefined)(codegen, CODEGEN_DEFAULTS) : CODEGEN_DEFAULTS;
|
188
|
+
}
|
189
|
+
|
190
|
+
// ts/config/v2/deploy.ts
|
191
|
+
var import_internal6 = require("@latticexyz/store/internal");
|
192
|
+
function resolveDeploy(deploy) {
|
193
|
+
return (0, import_internal6.isObject)(deploy) ? (0, import_internal6.mergeIfUndefined)(deploy, DEPLOY_DEFAULTS) : DEPLOY_DEFAULTS;
|
194
|
+
}
|
195
|
+
|
196
|
+
// ts/config/v2/world.ts
|
197
|
+
function validateWorld(input) {
|
198
|
+
const scope = (0, import_internal7.extendedScope)(input);
|
199
|
+
if ((0, import_internal7.hasOwnKey)(input, "namespaces")) {
|
200
|
+
if ((0, import_internal7.hasOwnKey)(input, "namespace") || (0, import_internal7.hasOwnKey)(input, "tables") || (0, import_internal7.hasOwnKey)(input, "systems")) {
|
201
|
+
throw new Error("Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.");
|
202
|
+
}
|
203
|
+
validateNamespaces(input.namespaces, scope);
|
204
|
+
}
|
205
|
+
if ((0, import_internal7.hasOwnKey)(input, "systems")) {
|
206
|
+
validateSystems(input.systems);
|
207
|
+
}
|
208
|
+
(0, import_internal7.validateStore)(input);
|
209
|
+
}
|
210
|
+
function resolveWorld(input) {
|
211
|
+
const scope = (0, import_internal7.extendedScope)(input);
|
212
|
+
const store = (0, import_internal7.resolveStore)(input);
|
213
|
+
const namespaces = input.namespaces ? resolveNamespaces(input.namespaces, scope) : resolveNamespaces({ [store.namespace]: input }, scope);
|
214
|
+
const tables = (0, import_internal7.flattenNamespacedTables)({ namespaces });
|
215
|
+
const modules = (input.modules ?? CONFIG_DEFAULTS.modules).map((mod) => (0, import_internal7.mergeIfUndefined)(mod, MODULE_DEFAULTS));
|
216
|
+
return (0, import_internal7.mergeIfUndefined)(
|
217
|
+
{
|
218
|
+
...store,
|
219
|
+
namespaces,
|
220
|
+
tables,
|
221
|
+
// TODO: flatten systems from namespaces
|
222
|
+
systems: !store.multipleNamespaces && input.systems ? resolveSystems(input.systems, store.namespace, store.namespace) : CONFIG_DEFAULTS.systems,
|
223
|
+
excludeSystems: (0, import_internal7.get)(input, "excludeSystems"),
|
224
|
+
codegen: (0, import_internal7.mergeIfUndefined)(store.codegen, resolveCodegen(input.codegen)),
|
225
|
+
deploy: resolveDeploy(input.deploy),
|
226
|
+
modules
|
227
|
+
},
|
228
|
+
CONFIG_DEFAULTS
|
229
|
+
);
|
230
|
+
}
|
231
|
+
function defineWorld(input) {
|
232
|
+
validateWorld(input);
|
233
|
+
return resolveWorld(input);
|
234
|
+
}
|
235
|
+
// Annotate the CommonJS export names for ESM import in node:
|
236
|
+
0 && (module.exports = {
|
237
|
+
defineWorld,
|
238
|
+
helloWorldEvent,
|
239
|
+
worldDeployedEvent
|
240
|
+
});
|
241
|
+
//# sourceMappingURL=index.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../ts/exports/index.ts","../ts/worldEvents.ts","../ts/config/v2/world.ts","../ts/config/v2/defaults.ts","../ts/config/v2/systems.ts","../ts/config/v2/system.ts","../ts/config/v2/namespaces.ts","../ts/config/v2/namespace.ts","../ts/config/v2/codegen.ts","../ts/config/v2/deploy.ts"],"sourcesContent":["/**\n * External exports.\n *\n * Be sure we're ready to commit to these being supported and changes made backward compatible!\n */\n\nexport { helloWorldEvent, worldDeployedEvent } from \"../worldEvents\";\n\nexport { defineWorld } from \"../config/v2/world\";\nexport type { WorldInput } from \"../config/v2/input\";\nexport type { World } from \"../config/v2/output\";\n","// 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","import { ErrorMessage, conform, show, type withJsDoc } from \"@ark/util\";\nimport {\n extendedScope,\n get,\n mergeIfUndefined,\n resolveStore,\n hasOwnKey,\n validateStore,\n flattenNamespacedTables,\n CONFIG_DEFAULTS as STORE_CONFIG_DEFAULTS,\n} from \"@latticexyz/store/internal\";\nimport { SystemsInput, WorldInput } from \"./input\";\nimport { CONFIG_DEFAULTS, MODULE_DEFAULTS } from \"./defaults\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { resolveNamespaces, validateNamespaces } from \"./namespaces\";\nimport { resolveCodegen } from \"./codegen\";\nimport { resolveDeploy } from \"./deploy\";\nimport type { World } from \"./output.js\";\nimport { StoreInput } from \"@latticexyz/store\";\n\nexport type validateWorld<input> = {\n readonly [key in keyof input]: key extends \"namespaces\"\n ? input extends { namespace?: unknown; tables?: unknown; systems?: unknown }\n ? ErrorMessage<\"Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.\">\n : validateNamespaces<input[key], extendedScope<input>>\n : key extends \"systems\"\n ? validateSystems<input[key]>\n : key extends \"codegen\"\n ? conform<input[key], WorldInput[key] & StoreInput[key]>\n : key extends keyof StoreInput\n ? validateStore<input>[key]\n : key extends keyof WorldInput\n ? conform<input[key], WorldInput[key]>\n : ErrorMessage<`\\`${key & string}\\` is not a valid World config option.`>;\n};\n\nexport function validateWorld(input: unknown): asserts input is WorldInput {\n const scope = extendedScope(input);\n\n if (hasOwnKey(input, \"namespaces\")) {\n if (hasOwnKey(input, \"namespace\") || hasOwnKey(input, \"tables\") || hasOwnKey(input, \"systems\")) {\n throw new Error(\"Cannot use `namespaces` with `namespace`, `tables`, or `systems` keys.\");\n }\n validateNamespaces(input.namespaces, scope);\n }\n if (hasOwnKey(input, \"systems\")) {\n validateSystems(input.systems);\n }\n\n validateStore(input);\n}\n\nexport type resolveNamespaceMode<input> = \"namespaces\" extends keyof input\n ? {\n readonly multipleNamespaces: true;\n readonly namespace: null;\n readonly namespaces: show<resolveNamespaces<input[\"namespaces\"], extendedScope<input>>>;\n }\n : {\n readonly multipleNamespaces: false;\n readonly namespace: string;\n readonly namespaces: show<\n resolveNamespaces<\n {\n // TODO: improve this so we don't have to duplicate store behavior\n readonly [label in \"namespace\" extends keyof input\n ? input[\"namespace\"] extends string\n ? input[\"namespace\"]\n : STORE_CONFIG_DEFAULTS[\"namespace\"]\n : STORE_CONFIG_DEFAULTS[\"namespace\"]]: input;\n },\n extendedScope<input>\n >\n >;\n };\n\ntype resolveModules<input> = { [key in keyof input]: mergeIfUndefined<input[key], MODULE_DEFAULTS> };\n\nexport type resolveWorld<input> = resolveNamespaceMode<input> &\n Omit<resolveStore<input>, \"multipleNamespaces\" | \"namespace\" | \"namespaces\" | \"tables\"> & {\n readonly tables: flattenNamespacedTables<resolveNamespaceMode<input>>;\n // TODO: flatten systems from namespaces\n readonly systems: \"systems\" extends keyof input\n ? input[\"systems\"] extends SystemsInput\n ? resolveNamespaceMode<input>[\"namespace\"] extends string\n ? show<resolveSystems<input[\"systems\"], resolveNamespaceMode<input>[\"namespace\"]>>\n : {}\n : {}\n : {};\n readonly excludeSystems: \"excludeSystems\" extends keyof input\n ? input[\"excludeSystems\"]\n : CONFIG_DEFAULTS[\"excludeSystems\"];\n readonly modules: \"modules\" extends keyof input ? resolveModules<input[\"modules\"]> : CONFIG_DEFAULTS[\"modules\"];\n readonly codegen: show<resolveCodegen<\"codegen\" extends keyof input ? input[\"codegen\"] : {}>>;\n readonly deploy: show<resolveDeploy<\"deploy\" extends keyof input ? input[\"deploy\"] : {}>>;\n };\n\nexport function resolveWorld<const input extends WorldInput>(input: input): resolveWorld<input> {\n const scope = extendedScope(input);\n const store = resolveStore(input);\n\n const namespaces = input.namespaces\n ? resolveNamespaces(input.namespaces, scope)\n : resolveNamespaces({ [store.namespace!]: input }, scope);\n\n const tables = flattenNamespacedTables({ namespaces });\n const modules = (input.modules ?? CONFIG_DEFAULTS.modules).map((mod) => mergeIfUndefined(mod, MODULE_DEFAULTS));\n\n return mergeIfUndefined(\n {\n ...store,\n namespaces,\n tables,\n // TODO: flatten systems from namespaces\n systems:\n !store.multipleNamespaces && input.systems\n ? resolveSystems(input.systems, store.namespace, store.namespace)\n : CONFIG_DEFAULTS.systems,\n excludeSystems: get(input, \"excludeSystems\"),\n codegen: mergeIfUndefined(store.codegen, resolveCodegen(input.codegen)),\n deploy: resolveDeploy(input.deploy),\n modules,\n },\n CONFIG_DEFAULTS,\n ) as never;\n}\n\nexport function defineWorld<const input>(input: validateWorld<input>): withJsDoc<resolveWorld<input>, World> {\n validateWorld(input);\n return resolveWorld(input) as never;\n}\n","import { CodegenInput, DeployInput, ModuleInput, SystemDeployInput, SystemInput, WorldInput } from \"./input\";\n\nexport const SYSTEM_DEPLOY_DEFAULTS = {\n disabled: false,\n registerWorldFunctions: true,\n} as const satisfies Required<SystemDeployInput>;\n\nexport type SYSTEM_DEPLOY_DEFAULTS = typeof SYSTEM_DEPLOY_DEFAULTS;\n\nexport const SYSTEM_DEFAULTS = {\n namespaceLabel: \"\",\n openAccess: true,\n accessList: [],\n} as const satisfies Omit<Required<SystemInput>, \"label\" | \"namespace\" | \"name\" | \"deploy\">;\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 systemLibrariesDirectory: \"systems\",\n generateSystemLibraries: false,\n worldImportPath: \"@latticexyz/world/src\",\n} as const satisfies CodegenInput;\n\nexport type CODEGEN_DEFAULTS = typeof CODEGEN_DEFAULTS;\n\nexport const DEPLOY_DEFAULTS = {\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 { ErrorMessage } from \"@ark/util\";\nimport { isObject } from \"@latticexyz/store/internal\";\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 system of Object.values(input)) {\n validateSystem(system, { 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, namespaceLabel extends string> = {\n [label in keyof systems]: resolveSystem<\n systems[label] & { label: label; namespaceLabel: namespaceLabel; namespace: string }\n >;\n};\n\nexport function resolveSystems<systems extends SystemsInput, namespaceLabel extends string>(\n systems: systems,\n namespaceLabel: namespaceLabel,\n namespace: string,\n): resolveSystems<systems, namespaceLabel> {\n return Object.fromEntries(\n Object.entries(systems).map(([label, system]) => {\n return [label, resolveSystem({ ...system, label, namespaceLabel, namespace })];\n }),\n ) as never;\n}\n","import { SYSTEM_DEFAULTS, SYSTEM_DEPLOY_DEFAULTS } from \"./defaults\";\nimport { SystemInput } from \"./input\";\nimport { hasOwnKey, mergeIfUndefined } from \"@latticexyz/store/internal\";\nimport { ErrorMessage, narrow, requiredKeyOf, show } from \"@ark/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\" | \"namespaceLabel\" | \"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\" | \"namespaceLabel\" | \"namespace\"\n ? options[\"inNamespace\"] extends true\n ? ErrorMessage<\"Overrides of `label`, `namespaceLabel`, 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 (\n options.inNamespace &&\n (hasOwnKey(input, \"label\") || hasOwnKey(input, \"namespaceLabel\") || hasOwnKey(input, \"namespace\"))\n ) {\n throw new Error(\n \"Overrides of `label`, `namespaceLabel`, and `namespace` are not allowed for systems in this context.\",\n );\n }\n\n if (\n hasOwnKey(input, \"namespaceLabel\") &&\n typeof input.namespaceLabel === \"string\" &&\n (!hasOwnKey(input, \"namespace\") || typeof input.namespace !== \"string\") &&\n input.namespaceLabel.length > 14\n ) {\n throw new Error(\n `System \\`namespace\\` defaults to \\`namespaceLabel\\`, but must fit into a \\`bytes14\\` and \"${input.namespaceLabel}\" is too long. Provide explicit \\`namespace\\` override.`,\n );\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 namespaceLabel: undefined extends input[\"namespaceLabel\"]\n ? typeof SYSTEM_DEFAULTS.namespaceLabel\n : input[\"namespaceLabel\"];\n readonly namespace: string;\n readonly name: string;\n readonly systemId: Hex;\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 readonly deploy: show<\n mergeIfUndefined<undefined extends input[\"deploy\"] ? {} : input[\"deploy\"], SYSTEM_DEPLOY_DEFAULTS>\n >;\n }\n : never;\n\nexport function resolveSystem<input extends SystemInput>(input: input): resolveSystem<input> {\n const namespaceLabel = input.namespaceLabel ?? SYSTEM_DEFAULTS.namespaceLabel;\n // validate ensures this is length constrained\n const namespace = input.namespace ?? namespaceLabel;\n\n const label = input.label;\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 namespaceLabel,\n namespace,\n name,\n systemId,\n deploy: mergeIfUndefined(input.deploy ?? {}, SYSTEM_DEPLOY_DEFAULTS),\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","import { show, flatMorph } from \"@ark/util\";\nimport { NamespacesInput } from \"./input\";\nimport { validateNamespace, resolveNamespace } from \"./namespace\";\nimport { groupBy } from \"@latticexyz/common/utils\";\nimport { AbiTypeScope, Scope, isObject, mergeIfUndefined } from \"@latticexyz/store/internal\";\n\n// Copied from store/ts/config/v2/namespaces.ts but using world namespace validate/resolve methods\n// TODO: figure out how to dedupe these?\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 resolveNamespaces<namespaces, scope extends Scope = AbiTypeScope> = {\n readonly [label in keyof namespaces]: resolveNamespace<mergeIfUndefined<namespaces[label], { label: label }>, scope>;\n};\n\nexport function resolveNamespaces<input extends NamespacesInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope,\n): resolveNamespaces<input, scope> {\n if (!isObject(input)) {\n throw new Error(`Expected namespaces config, received ${JSON.stringify(input)}`);\n }\n\n const namespaces = flatMorph(input as NamespacesInput, (label, namespace) => [\n label,\n resolveNamespace(mergeIfUndefined(namespace, { label }), scope),\n ]);\n\n // This should probably be in `validate`, but `namespace` gets set during the resolve step above, so it's easier to validate here.\n const duplicates = Array.from(groupBy(Object.values(namespaces), (namespace) => namespace.namespace).entries())\n .filter(([, entries]) => entries.length > 1)\n .map(([namespace]) => namespace);\n if (duplicates.length > 0) {\n throw new Error(`Found namespaces defined more than once in config: ${duplicates.join(\", \")}`);\n }\n\n return namespaces as never;\n}\n\nexport function defineNamespaces<input, scope extends Scope = AbiTypeScope>(\n input: validateNamespaces<input, scope>,\n scope: scope = AbiTypeScope as never,\n): show<resolveNamespaces<input, scope>> {\n validateNamespaces(input, scope);\n return resolveNamespaces(input, scope) as never;\n}\n","import { NamespaceInput, SystemsInput } from \"./input\";\nimport {\n hasOwnKey,\n validateNamespace as validateStoreNamespace,\n resolveNamespace as resolveStoreNamespace,\n Scope,\n AbiTypeScope,\n} from \"@latticexyz/store/internal\";\nimport { resolveSystems, validateSystems } from \"./systems\";\nimport { show } from \"@ark/util\";\n\nexport type validateNamespace<input, scope extends Scope = AbiTypeScope> = {\n [key in keyof input]: key extends \"systems\" ? validateSystems<input[key]> : validateStoreNamespace<input, scope>[key];\n};\n\nexport function validateNamespace<scope extends Scope = AbiTypeScope>(\n input: unknown,\n scope: scope,\n): asserts input is NamespaceInput {\n if (hasOwnKey(input, \"systems\")) {\n validateSystems(input.systems);\n }\n validateStoreNamespace(input, scope);\n}\n\nexport type resolveNamespace<input, scope extends Scope = AbiTypeScope> = input extends NamespaceInput\n ? show<\n resolveStoreNamespace<input, scope> & {\n readonly systems: input[\"systems\"] extends SystemsInput\n ? show<resolveSystems<input[\"systems\"], resolveStoreNamespace<input, scope>[\"label\"]>>\n : {};\n }\n >\n : never;\n\nexport function resolveNamespace<const input extends NamespaceInput, scope extends Scope = AbiTypeScope>(\n input: input,\n scope: scope = AbiTypeScope as never,\n): resolveNamespace<input, scope> {\n const namespace = resolveStoreNamespace(input, scope);\n const systems = resolveSystems(input.systems ?? {}, namespace.label, namespace.namespace);\n return {\n ...namespace,\n systems,\n } as never;\n}\n","import { isObject, mergeIfUndefined } from \"@latticexyz/store/internal\";\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/internal\";\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":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,qBAAqB;AAG3B,IAAM,kBAAkB;;;ACH/B,IAAAA,mBASO;;;ACRA,IAAM,yB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A,MAC3C,aAAS,mCAAiB,MAAM,SAAS,eAAe,MAAM,OAAO,CAAC;AAAA,MACtE,QAAQ,cAAc,MAAM,MAAM;AAAA,MAClC;AAAA,IACF;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,YAAyB,OAAoE;AAC3G,gBAAc,KAAK;AACnB,SAAO,aAAa,KAAK;AAC3B;","names":["import_internal","import_internal","import_internal","validateStoreNamespace","resolveStoreNamespace","import_internal","import_internal","import_internal"]}
|
package/dist/index.d.cts
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
export { W as WorldInput, d as defineWorld } from './world-DUniZQxy.cjs';
|
2
|
+
export { W as World } from './dynamicResolution-AmVd5Qtd.cjs';
|
3
|
+
import '@ark/util';
|
4
|
+
import '@latticexyz/store/internal';
|
5
|
+
import 'viem';
|
6
|
+
import '@latticexyz/store';
|
7
|
+
|
8
|
+
declare const worldDeployedEvent = "event WorldDeployed(address indexed newContract, uint256 salt)";
|
9
|
+
declare const helloWorldEvent = "event HelloWorld(bytes32 indexed worldVersion)";
|
10
|
+
|
11
|
+
export { helloWorldEvent, worldDeployedEvent };
|
package/dist/index.js
CHANGED
@@ -1,2 +1,21 @@
|
|
1
|
-
import
|
1
|
+
import {
|
2
|
+
defineWorld
|
3
|
+
} from "./chunk-TL2M3LZH.js";
|
4
|
+
import {
|
5
|
+
init_esm_shims
|
6
|
+
} from "./chunk-AAKXFFCU.js";
|
7
|
+
import "./chunk-AAWFTQHP.js";
|
8
|
+
|
9
|
+
// ts/exports/index.ts
|
10
|
+
init_esm_shims();
|
11
|
+
|
12
|
+
// ts/worldEvents.ts
|
13
|
+
init_esm_shims();
|
14
|
+
var worldDeployedEvent = "event WorldDeployed(address indexed newContract, uint256 salt)";
|
15
|
+
var helloWorldEvent = "event HelloWorld(bytes32 indexed worldVersion)";
|
16
|
+
export {
|
17
|
+
defineWorld,
|
18
|
+
helloWorldEvent,
|
19
|
+
worldDeployedEvent
|
20
|
+
};
|
2
21
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
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":"
|
1
|
+
{"version":3,"sources":["../ts/exports/index.ts","../ts/worldEvents.ts"],"sourcesContent":["/**\n * External exports.\n *\n * Be sure we're ready to commit to these being supported and changes made backward compatible!\n */\n\nexport { helloWorldEvent, worldDeployedEvent } from \"../worldEvents\";\n\nexport { defineWorld } from \"../config/v2/world\";\nexport type { WorldInput } from \"../config/v2/input\";\nexport type { World } from \"../config/v2/output\";\n","// 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":";;;;;;;;;AAAA;;;ACAA;AACO,IAAM,qBAAqB;AAG3B,IAAM,kBAAkB;","names":[]}
|