Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion packages/abi-ts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"license": "MIT",
"type": "module",
"exports": {
"./internal": "./dist/exports/internal.js"
"./internal": {
"import": "./dist/exports/internal.js",
"require": "./dist/exports/internal.cjs"
}
},
"typesVersions": {
"*": {
Expand Down
5 changes: 4 additions & 1 deletion packages/block-logs-stream/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"typesVersions": {
"*": {
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"typesVersions": {
"*": {
Expand Down
170 changes: 86 additions & 84 deletions packages/cli/scripts/generate-test-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,96 +3,98 @@ import { defineStore } from "@latticexyz/store";
import { fileURLToPath } from "node:url";
import path from "node:path";

const configPath = fileURLToPath(import.meta.url);
(async (): Promise<void> => {
const configPath = fileURLToPath(import.meta.url);

// This config is used only for tests.
// Aside from avoiding `mud.config.ts` in cli package (could cause issues),
// this also tests that mudConfig and tablegen can work as standalone functions
const config = defineStore({
sourceDirectory: "../contracts/src",
enums: {
Enum1: ["E1", "E2", "E3"],
Enum2: ["E1"],
},
userTypes: {
TestTypeAddress: { filePath: "../contracts/src/types.sol", type: "address" },
TestTypeInt64: { filePath: "../contracts/src/types.sol", type: "int64" },
"TestTypeLibrary.TestTypeBool": { filePath: "../contracts/src/types.sol", type: "bool" },
"TestTypeLibrary.TestTypeUint128": { filePath: "../contracts/src/types.sol", type: "uint128" },
ResourceId: { filePath: "@latticexyz/store/src/ResourceId.sol", type: "bytes32" },
},
tables: {
Statics: {
schema: {
k1: "uint256",
k2: "int32",
k3: "bytes16",
k4: "address",
k5: "bool",
k6: "Enum2",
v1: "uint256",
v2: "int32",
v3: "bytes16",
v4: "address",
v5: "bool",
v6: "Enum1",
},
key: ["k1", "k2", "k3", "k4", "k5", "k6"],
// This config is used only for tests.
// Aside from avoiding `mud.config.ts` in cli package (could cause issues),
// this also tests that mudConfig and tablegen can work as standalone functions
const config = defineStore({
sourceDirectory: "../contracts/src",
enums: {
Enum1: ["E1", "E2", "E3"],
Enum2: ["E1"],
},
Dynamics1: {
schema: {
key: "bytes32",
staticB32: "bytes32[1]",
staticI32: "int32[2]",
staticU128: "uint128[3]",
staticAddrs: "address[4]",
staticBools: "bool[5]",
},
key: ["key"],
userTypes: {
TestTypeAddress: { filePath: "../contracts/src/types.sol", type: "address" },
TestTypeInt64: { filePath: "../contracts/src/types.sol", type: "int64" },
"TestTypeLibrary.TestTypeBool": { filePath: "../contracts/src/types.sol", type: "bool" },
"TestTypeLibrary.TestTypeUint128": { filePath: "../contracts/src/types.sol", type: "uint128" },
ResourceId: { filePath: "@latticexyz/store/src/ResourceId.sol", type: "bytes32" },
},
Dynamics2: {
schema: {
key: "bytes32",
u64: "uint64[]",
str: "string",
b: "bytes",
tables: {
Statics: {
schema: {
k1: "uint256",
k2: "int32",
k3: "bytes16",
k4: "address",
k5: "bool",
k6: "Enum2",
v1: "uint256",
v2: "int32",
v3: "bytes16",
v4: "address",
v5: "bool",
v6: "Enum1",
},
key: ["k1", "k2", "k3", "k4", "k5", "k6"],
},
key: ["key"],
},
Singleton: {
schema: {
v1: "int256",
v2: "uint32[2]",
v3: "uint32[2]",
v4: "uint32[1]",
Dynamics1: {
schema: {
key: "bytes32",
staticB32: "bytes32[1]",
staticI32: "int32[2]",
staticU128: "uint128[3]",
staticAddrs: "address[4]",
staticBools: "bool[5]",
},
key: ["key"],
},
key: [],
codegen: { dataStruct: false },
},
Offchain: {
type: "offchainTable",
schema: {
key: "bytes32",
value: "uint256",
Dynamics2: {
schema: {
key: "bytes32",
u64: "uint64[]",
str: "string",
b: "bytes",
},
key: ["key"],
},
key: ["key"],
},
UserTyped: {
schema: {
k1: "TestTypeAddress",
k2: "TestTypeInt64",
k3: "TestTypeLibrary.TestTypeBool",
k4: "TestTypeLibrary.TestTypeUint128",
k5: "ResourceId",
v1: "TestTypeAddress",
v2: "TestTypeInt64",
v3: "TestTypeLibrary.TestTypeBool",
v4: "TestTypeLibrary.TestTypeUint128",
v5: "ResourceId",
Singleton: {
schema: {
v1: "int256",
v2: "uint32[2]",
v3: "uint32[2]",
v4: "uint32[1]",
},
key: [],
codegen: { dataStruct: false },
},
Offchain: {
type: "offchainTable",
schema: {
key: "bytes32",
value: "uint256",
},
key: ["key"],
},
UserTyped: {
schema: {
k1: "TestTypeAddress",
k2: "TestTypeInt64",
k3: "TestTypeLibrary.TestTypeBool",
k4: "TestTypeLibrary.TestTypeUint128",
k5: "ResourceId",
v1: "TestTypeAddress",
v2: "TestTypeInt64",
v3: "TestTypeLibrary.TestTypeBool",
v4: "TestTypeLibrary.TestTypeUint128",
v5: "ResourceId",
},
key: ["k1", "k2", "k3", "k4", "k5"],
},
key: ["k1", "k2", "k3", "k4", "k5"],
},
},
});
});

await tablegen({ rootDir: path.dirname(configPath), config });
await tablegen({ rootDir: path.dirname(configPath), config });
})();
16 changes: 15 additions & 1 deletion packages/cli/src/deploy/getWorldContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import accessManagementSystemBuild from "@latticexyz/world/out/AccessManagementS
import balanceTransferSystemBuild from "@latticexyz/world/out/BalanceTransferSystem.sol/BalanceTransferSystem.json" assert { type: "json" };
import batchCallSystemBuild from "@latticexyz/world/out/BatchCallSystem.sol/BatchCallSystem.json" assert { type: "json" };
import registrationSystemBuild from "@latticexyz/world/out/RegistrationSystem.sol/RegistrationSystem.json" assert { type: "json" };
import extendedRegistrationSystemBuild from "@latticexyz/world/out/ExtendedRegistrationSystem.sol/ExtendedRegistrationSystem.json" assert { type: "json" };
import initModuleBuild from "@latticexyz/world/out/InitModule.sol/InitModule.json" assert { type: "json" };
import initModuleAbi from "@latticexyz/world/out/InitModule.sol/InitModule.abi.json" assert { type: "json" };
import { Hex, encodeDeployData, size } from "viem";
Expand Down Expand Up @@ -33,11 +34,18 @@ export function getWorldContracts(deployerAddress: Hex) {
bytecode: registrationBytecode,
});

const extendedRegistrationDeployedBytecodeSize = size(extendedRegistrationSystemBuild.deployedBytecode.object as Hex);
const extendedRegistrationBytecode = extendedRegistrationSystemBuild.bytecode.object as Hex;
const extendedRegistration = getContractAddress({
deployerAddress,
bytecode: extendedRegistrationBytecode,
});

const initModuleDeployedBytecodeSize = size(initModuleBuild.deployedBytecode.object as Hex);
const initModuleBytecode = encodeDeployData({
bytecode: initModuleBuild.bytecode.object as Hex,
abi: initModuleAbi,
args: [accessManagementSystem, balanceTransferSystem, batchCallSystem, registration],
args: [accessManagementSystem, balanceTransferSystem, batchCallSystem, registration, extendedRegistration],
});
const initModule = getContractAddress({ deployerAddress, bytecode: initModuleBytecode });

Expand Down Expand Up @@ -66,6 +74,12 @@ export function getWorldContracts(deployerAddress: Hex) {
debugLabel: "core registration system",
address: registration,
},
ExtendedRegistrationSystem: {
bytecode: extendedRegistrationBytecode,
deployedBytecodeSize: extendedRegistrationDeployedBytecodeSize,
debugLabel: "extended core registration system",
address: extendedRegistration,
},
InitModule: {
bytecode: initModuleBytecode,
deployedBytecodeSize: initModuleDeployedBytecodeSize,
Expand Down
1 change: 1 addition & 0 deletions packages/cli/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ export default defineConfig((opts) => ({
env: {
MUD_PACKAGES: JSON.stringify(mudPackages),
},
noExternal: ["@ark/util", "p-queue", "p-retry"],
}));
50 changes: 40 additions & 10 deletions packages/common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,46 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js",
"./actions": "./dist/actions.js",
"./chains": "./dist/chains.js",
"./codegen": "./dist/codegen.js",
"./errors": "./dist/errors.js",
"./foundry": "./dist/foundry.js",
"./type-utils": "./dist/type-utils.js",
"./utils": "./dist/utils.js",
"./kms": "./dist/kms.js",
"./internal": "./dist/internal.js",
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./actions": {
"import": "./dist/actions.js",
"require": "./dist/actions.cjs"
},
"./chains": {
"import": "./dist/chains.js",
"require": "./dist/chains.cjs"
},
"./codegen": {
"import": "./dist/codegen.js",
"require": "./dist/codegen.cjs"
},
"./errors": {
"import": "./dist/errors.js",
"require": "./dist/errors.cjs"
},
"./foundry": {
"import": "./dist/foundry.js",
"require": "./dist/foundry.cjs"
},
"./type-utils": {
"import": "./dist/type-utils.js",
"require": "./dist/type-utils.cjs"
},
"./utils": {
"import": "./dist/utils.js",
"require": "./dist/utils.cjs"
},
"./kms": {
"import": "./dist/kms.js",
"require": "./dist/kms.cjs"
},
"./internal": {
"import": "./dist/internal.js",
"require": "./dist/internal.cjs"
},
"./tsconfig.base.json": "./tsconfig.base.json"
},
"typesVersions": {
Expand Down
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export * from "./sendTransaction";
export * from "./spliceHex";
export * from "./transportObserver";
export * from "./writeContract";
export * from "./getFeeRef";

/** @deprecated use `getContract` instead */
export { createContract } from "./deprecated/createContract";
Expand Down
1 change: 1 addition & 0 deletions packages/common/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export default defineConfig((opts) => ({
kms: "src/exports/kms.ts",
internal: "src/exports/internal.ts",
},
noExternal: ["p-queue", "p-retry"],
}));
15 changes: 12 additions & 3 deletions packages/config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,18 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js",
"./internal": "./dist/internal.js",
"./node": "./dist/deprecated/node.js"
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
},
"./internal": {
"import": "./dist/internal.js",
"require": "./dist/internal.cjs"
},
"./node": {
"import": "./dist/deprecated/node.js",
"require": "./dist/deprecated/node.cjs"
}
},
"typesVersions": {
"*": {
Expand Down
1 change: 1 addition & 0 deletions packages/config/tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export default defineConfig((opts) => ({
internal: "src/exports/internal.ts",
"deprecated/node": "src/deprecated/node/index.ts",
},
noExternal: ["@ark/util"],
}));
5 changes: 4 additions & 1 deletion packages/dev-tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/index.js"
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"typesVersions": {
"*": {
Expand Down
10 changes: 8 additions & 2 deletions packages/entrykit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@
"license": "MIT",
"type": "module",
"exports": {
".": "./dist/tsup/exports/index.js",
"./internal": "./dist/tsup/exports/internal.js"
".": {
"import": "./dist/tsup/exports/index.js",
"require": "./dist/tsup/exports/index.cjs"
},
"./internal": {
"import": "./dist/tsup/exports/internal.js",
"require": "./dist/tsup/exports/internal.cjs"
}
},
"typesVersions": {
"*": {
Expand Down
Loading
Loading