create-mud 2.2.17-f88e48e47ceb4a29a3862a3f3b85891490952f0e → 2.2.17-ffefc8f000769d5ca625dd19290007a853a21788
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/README.md +2 -4
- package/bin/cli.js +4 -0
- package/dist/cli.d.ts +2 -1
- package/dist/cli.js +9 -2
- package/dist/cli.js.map +1 -1
- package/package.json +17 -11
- package/templates/react/mprocs.yaml +21 -0
- package/templates/react/package.json +31 -0
- package/{dist/templates/threejs → templates/react}/packages/client/index.html +2 -2
- package/templates/react/packages/client/postcss.config.cjs +6 -0
- package/templates/react/packages/client/src/game/useKeyboardMovement.ts +26 -0
- package/templates/react/packages/client/src/index.tsx +19 -0
- package/templates/react/packages/client/src/mud/Explorer.tsx +32 -0
- package/{dist/templates → templates}/react/packages/client/src/mud/Synced.tsx +1 -1
- package/templates/react/packages/client/src/mud/useWorldContract.ts +44 -0
- package/templates/react/packages/client/src/ui/AsyncButton.tsx +41 -0
- package/templates/react/packages/client/src/ui/ErrorFallback.tsx +58 -0
- package/templates/react/packages/client/src/ui/icons/ArrowDownIcon.tsx +22 -0
- package/templates/react/packages/client/src/ui/icons/MUDIcon.tsx +25 -0
- package/templates/react/packages/client/src/wagmiConfig.ts +49 -0
- package/templates/react/packages/client/tailwind.config.ts +10 -0
- package/templates/react/packages/client/tsconfig.json +11 -0
- package/{dist/templates/threejs → templates/react}/packages/client/vite.config.ts +2 -7
- package/templates/react/packages/contracts/.env +11 -0
- package/{dist/templates → templates}/react/packages/contracts/mud.config.ts +0 -7
- package/{dist/templates/vanilla → templates/react}/packages/contracts/package.json +1 -0
- package/{dist/templates/vanilla → templates/react}/packages/contracts/script/PostDeploy.s.sol +1 -5
- package/{dist/templates/vanilla/packages/contracts/src/codegen/index.sol → templates/react/packages/contracts/src/codegen/common.sol} +6 -1
- package/{dist/templates → templates}/react/packages/contracts/test/MoveTest.t.sol +0 -2
- package/templates/react/packages/contracts/test/WorldTest.t.sol +16 -0
- package/templates/react/packages/contracts/worlds.json +5 -0
- package/{dist/templates → templates}/react-ecs/packages/client/package.json +16 -9
- package/templates/react-ecs/packages/client/src/App.tsx +74 -0
- package/templates/react-ecs/packages/client/src/Providers.tsx +29 -0
- package/templates/react-ecs/packages/client/src/common.ts +27 -0
- package/templates/react-ecs/packages/client/src/game/GameMap.tsx +112 -0
- package/templates/react-ecs/packages/client/src/mud/Synced.tsx +14 -0
- package/templates/react-ecs/packages/client/src/mud/recs.ts +6 -0
- package/templates/react-ecs/packages/client/src/mud/useSyncStatus.ts +17 -0
- package/{dist/templates/threejs → templates/react-ecs}/packages/contracts/.env +1 -1
- package/templates/react-ecs/packages/contracts/mud.config.ts +18 -0
- package/templates/react-ecs/packages/contracts/out/IWorld.sol/IWorld.abi.json +2039 -0
- package/templates/react-ecs/packages/contracts/src/Entity.sol +20 -0
- package/templates/react-ecs/packages/contracts/src/MoveSystem.sol +30 -0
- package/templates/react-ecs/packages/contracts/src/SpawnSystem.sol +18 -0
- package/templates/react-ecs/packages/contracts/src/codegen/index.sol +8 -0
- package/{dist/templates/vanilla/packages/contracts/src/codegen/tables/Counter.sol → templates/react-ecs/packages/contracts/src/codegen/tables/EntityCount.sol} +35 -35
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Owner.sol +202 -0
- package/templates/react-ecs/packages/contracts/src/codegen/tables/Position.sol +321 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/IMoveSystem.sol +16 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/ISpawnSystem.sol +15 -0
- package/templates/react-ecs/packages/contracts/src/codegen/world/IWorld.sol +17 -0
- package/templates/react-ecs/packages/contracts/src/createEntity.sol +11 -0
- package/templates/react-ecs/packages/contracts/test/MoveTest.t.sol +39 -0
- package/{dist/templates/react → templates/react-ecs}/packages/contracts/test/WorldTest.t.sol +0 -5
- package/dist/templates/phaser/gitignore +0 -7
- package/dist/templates/phaser/packages/art/gitignore +0 -0
- package/dist/templates/phaser/packages/client/gitignore +0 -3
- package/dist/templates/phaser/packages/contracts/gitignore +0 -9
- package/dist/templates/react/gitignore +0 -16
- package/dist/templates/react/packages/client/gitignore +0 -1
- package/dist/templates/react/packages/contracts/gitignore +0 -13
- package/dist/templates/react-ecs/gitignore +0 -7
- package/dist/templates/react-ecs/package.json +0 -32
- package/dist/templates/react-ecs/packages/client/gitignore +0 -3
- package/dist/templates/react-ecs/packages/client/src/App.tsx +0 -29
- package/dist/templates/react-ecs/packages/client/src/mud/createSystemCalls.ts +0 -51
- package/dist/templates/react-ecs/packages/client/src/mud/getNetworkConfig.ts +0 -77
- package/dist/templates/react-ecs/packages/contracts/gitignore +0 -9
- package/dist/templates/threejs/gitignore +0 -7
- package/dist/templates/threejs/packages/client/gitignore +0 -3
- package/dist/templates/threejs/packages/client/src/MUDContext.tsx +0 -21
- package/dist/templates/threejs/packages/client/src/index.tsx +0 -34
- package/dist/templates/threejs/packages/contracts/gitignore +0 -9
- package/dist/templates/vanilla/gitignore +0 -7
- package/dist/templates/vanilla/mprocs.yaml +0 -13
- package/dist/templates/vanilla/packages/client/gitignore +0 -3
- package/dist/templates/vanilla/packages/client/src/mud/createClientComponents.ts +0 -21
- package/dist/templates/vanilla/packages/client/src/mud/setup.ts +0 -21
- package/dist/templates/vanilla/packages/client/src/mud/setupNetwork.ts +0 -106
- package/dist/templates/vanilla/packages/client/src/mud/supportedChains.ts +0 -20
- package/dist/templates/vanilla/packages/client/src/mud/world.ts +0 -3
- package/dist/templates/vanilla/packages/client/tsconfig.json +0 -11
- package/dist/templates/vanilla/packages/contracts/.env +0 -11
- package/dist/templates/vanilla/packages/contracts/gitignore +0 -9
- package/dist/templates/vanilla/packages/contracts/mud.config.ts +0 -13
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -13
- package/dist/templates/vanilla/packages/contracts/src/codegen/world/IWorld.sol +0 -16
- package/dist/templates/vanilla/packages/contracts/src/systems/IncrementSystem.sol +0 -14
- package/dist/templates/vanilla/packages/contracts/test/CounterTest.t.sol +0 -31
- package/dist/templates/vanilla/packages/contracts/worlds.json +0 -5
- /package/{dist/templates → templates}/phaser/.eslintrc +0 -0
- /package/{dist/templates → templates}/phaser/.gitattributes +0 -0
- /package/{dist/templates → templates}/phaser/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/phaser/.vscode/settings.json +0 -0
- /package/{dist/templates → templates}/phaser/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/phaser/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/README.md +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/config-sprites.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/scripts/cli.mjs +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/scripts/export-tiled-types.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/3.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/4.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/attack/5.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/death/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/0.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/1.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/2.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/sprites/golem/idle/3.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/tilesets/images/world.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/art/tilesets/world.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/.env +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/.eslintrc +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/atlases/atlas.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/public/assets/tilesets/world.png +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/artTypes/world.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/index.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/network/createNetworkLayer.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/configurePhaser.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/constants.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/createPhaserLayer.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createCamera.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/createMapSystem.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/index.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/layers/phaser/systems/registerSystems.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/store.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/App.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/BootScreen.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingBar.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/LoadingScreen.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/LoadingScreen/index.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/PhaserLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/UIRoot.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/Wrapper.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/useNetworkLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePhaserLayer.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/hooks/usePromiseValue.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/ClickWrapper.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/src/ui/theme/SpriteImage.tsx +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/tsconfig.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/client/vite.config.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.env +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/worlds.json +0 -0
- /package/{dist/templates → templates}/phaser/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/phaser/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/phaser/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react/.eslintrc +0 -0
- /package/{dist/templates → templates}/react/.gitattributes +0 -0
- /package/{dist/templates → templates}/react/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/react/.vscode/settings.json +0 -0
- /package/{dist/templates → templates}/react/packages/client/.env +0 -0
- /package/{dist/templates → templates}/react/packages/client/.eslintrc +0 -0
- /package/{dist/templates → templates}/react/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/App.tsx +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/Providers.tsx +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/common.ts +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/game/GameMap.tsx +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/mud/stash.ts +0 -0
- /package/{dist/templates → templates}/react/packages/client/src/mud/useSyncStatus.ts +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/out/IWorld.sol/IWorld.abi.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/MoveSystem.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/react/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/react/tsconfig.json +0 -0
- /package/{dist/templates → templates}/react-ecs/.eslintrc +0 -0
- /package/{dist/templates → templates}/react-ecs/.gitattributes +0 -0
- /package/{dist/templates → templates}/react-ecs/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/react-ecs/.vscode/settings.json +0 -0
- /package/{dist/templates/react → templates/react-ecs}/mprocs.yaml +0 -0
- /package/{dist/templates/react → templates/react-ecs}/package.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/client/.env +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/client/.eslintrc +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/index.html +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/postcss.config.cjs +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/game/useKeyboardMovement.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/index.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/mud/Explorer.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/mud/useWorldContract.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/AsyncButton.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/ErrorFallback.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/icons/ArrowDownIcon.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/ui/icons/MUDIcon.tsx +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/src/wagmiConfig.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/tailwind.config.ts +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/client/vite.config.ts +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/src/codegen/common.sol +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates/react → templates/react-ecs}/packages/contracts/worlds.json +0 -0
- /package/{dist/templates → templates}/react-ecs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/react-ecs/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/react-ecs/tsconfig.json +0 -0
- /package/{dist/templates → templates}/threejs/.eslintrc +0 -0
- /package/{dist/templates → templates}/threejs/.gitattributes +0 -0
- /package/{dist/templates → templates}/threejs/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/threejs/.vscode/settings.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/threejs/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/.env +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/.eslintrc +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/App.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/MUDContext.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/index.tsx +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/client/src/useKeyboardMovement.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/contracts/.env +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/tables/Position.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/world/IMoveSystem.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/src/systems/MoveSystem.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/test/WorldTest.t.sol +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates/react-ecs → templates/threejs}/packages/contracts/worlds.json +0 -0
- /package/{dist/templates → templates}/threejs/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/threejs/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/threejs/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/.eslintrc +0 -0
- /package/{dist/templates → templates}/vanilla/.gitattributes +0 -0
- /package/{dist/templates → templates}/vanilla/.vscode/extensions.json +0 -0
- /package/{dist/templates → templates}/vanilla/.vscode/settings.json +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/mprocs.yaml +0 -0
- /package/{dist/templates → templates}/vanilla/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/.env +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/index.html +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/index.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/createClientComponents.ts +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/mud/createSystemCalls.ts +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/src/mud/getNetworkConfig.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setup.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/client/src/mud/setupNetwork.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/supportedChains.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/src/mud/world.ts +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/client/tsconfig.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/client/vite.config.ts +0 -0
- /package/{dist/templates/react → templates/vanilla}/packages/contracts/.env +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/.prettierrc +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/.solhint.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/foundry.toml +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/mud.config.ts +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/package.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/remappings.txt +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/script/PostDeploy.s.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/index.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/tables/Counter.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IIncrementSystem.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/codegen/world/IWorld.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/src/systems/IncrementSystem.sol +0 -0
- /package/{dist/templates/react-ecs → templates/vanilla}/packages/contracts/test/CounterTest.t.sol +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/tsconfig.json +0 -0
- /package/{dist/templates/threejs → templates/vanilla}/packages/contracts/worlds.json +0 -0
- /package/{dist/templates → templates}/vanilla/packages/contracts/worlds.json.d.ts +0 -0
- /package/{dist/templates → templates}/vanilla/pnpm-workspace.yaml +0 -0
- /package/{dist/templates → templates}/vanilla/tsconfig.json +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
type Entity is bytes32;
|
|
5
|
+
|
|
6
|
+
using EntityInstance for Entity global;
|
|
7
|
+
|
|
8
|
+
library EntityInstance {
|
|
9
|
+
function unwrap(Entity entity) internal pure returns (bytes32) {
|
|
10
|
+
return Entity.unwrap(entity);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function equals(Entity a, Entity b) internal pure returns (bool) {
|
|
14
|
+
return Entity.unwrap(a) == Entity.unwrap(b);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function isEmpty(Entity entity) internal pure returns (bool) {
|
|
18
|
+
return Entity.unwrap(entity) == 0;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
import { System } from "@latticexyz/world/src/System.sol";
|
|
5
|
+
|
|
6
|
+
import { Direction } from "./codegen/common.sol";
|
|
7
|
+
import { Owner } from "./codegen/tables/Owner.sol";
|
|
8
|
+
import { Position, PositionData } from "./codegen/tables/Position.sol";
|
|
9
|
+
import { Entity } from "./Entity.sol";
|
|
10
|
+
|
|
11
|
+
contract MoveSystem is System {
|
|
12
|
+
function move(Entity entity, Direction direction) public {
|
|
13
|
+
address owner = Owner.get(entity);
|
|
14
|
+
require(owner == _msgSender(), "You cannot move this entity.");
|
|
15
|
+
|
|
16
|
+
PositionData memory position = Position.get(entity);
|
|
17
|
+
|
|
18
|
+
if (direction == Direction.North) {
|
|
19
|
+
position.y += 1;
|
|
20
|
+
} else if (direction == Direction.East) {
|
|
21
|
+
position.x += 1;
|
|
22
|
+
} else if (direction == Direction.South) {
|
|
23
|
+
position.y -= 1;
|
|
24
|
+
} else if (direction == Direction.West) {
|
|
25
|
+
position.x -= 1;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Position.set(entity, position);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
import { System } from "@latticexyz/world/src/System.sol";
|
|
5
|
+
|
|
6
|
+
import { Direction } from "./codegen/common.sol";
|
|
7
|
+
import { Owner } from "./codegen/tables/Owner.sol";
|
|
8
|
+
import { Position } from "./codegen/tables/Position.sol";
|
|
9
|
+
import { Entity } from "./Entity.sol";
|
|
10
|
+
import { createEntity } from "./createEntity.sol";
|
|
11
|
+
|
|
12
|
+
contract SpawnSystem is System {
|
|
13
|
+
function spawn() public returns (Entity entity) {
|
|
14
|
+
entity = createEntity();
|
|
15
|
+
Owner.set(entity, _msgSender());
|
|
16
|
+
Position.set(entity, 0, 0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
import { EntityCount } from "./tables/EntityCount.sol";
|
|
7
|
+
import { Owner } from "./tables/Owner.sol";
|
|
8
|
+
import { Position, PositionData } from "./tables/Position.sol";
|
|
@@ -16,17 +16,17 @@ import { Schema } from "@latticexyz/store/src/Schema.sol";
|
|
|
16
16
|
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
|
17
17
|
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
18
18
|
|
|
19
|
-
library
|
|
20
|
-
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "
|
|
21
|
-
ResourceId constant _tableId = ResourceId.wrap(
|
|
19
|
+
library EntityCount {
|
|
20
|
+
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "EntityCount", typeId: RESOURCE_TABLE });`
|
|
21
|
+
ResourceId constant _tableId = ResourceId.wrap(0x74626170700000000000000000000000456e74697479436f756e740000000000);
|
|
22
22
|
|
|
23
23
|
FieldLayout constant _fieldLayout =
|
|
24
|
-
FieldLayout.wrap(
|
|
24
|
+
FieldLayout.wrap(0x0020010020000000000000000000000000000000000000000000000000000000);
|
|
25
25
|
|
|
26
26
|
// Hex-encoded key schema of ()
|
|
27
27
|
Schema constant _keySchema = Schema.wrap(0x0000000000000000000000000000000000000000000000000000000000000000);
|
|
28
|
-
// Hex-encoded value schema of (
|
|
29
|
-
Schema constant _valueSchema = Schema.wrap(
|
|
28
|
+
// Hex-encoded value schema of (uint256)
|
|
29
|
+
Schema constant _valueSchema = Schema.wrap(0x002001001f000000000000000000000000000000000000000000000000000000);
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* @notice Get the table's key field names.
|
|
@@ -42,7 +42,7 @@ library Counter {
|
|
|
42
42
|
*/
|
|
43
43
|
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
|
44
44
|
fieldNames = new string[](1);
|
|
45
|
-
fieldNames[0] = "
|
|
45
|
+
fieldNames[0] = "count";
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -60,79 +60,79 @@ library Counter {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
/**
|
|
63
|
-
* @notice Get
|
|
63
|
+
* @notice Get count.
|
|
64
64
|
*/
|
|
65
|
-
function
|
|
65
|
+
function getCount() internal view returns (uint256 count) {
|
|
66
66
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
67
67
|
|
|
68
68
|
bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
69
|
-
return (
|
|
69
|
+
return (uint256(bytes32(_blob)));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/**
|
|
73
|
-
* @notice Get
|
|
73
|
+
* @notice Get count.
|
|
74
74
|
*/
|
|
75
|
-
function
|
|
75
|
+
function _getCount() internal view returns (uint256 count) {
|
|
76
76
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
77
77
|
|
|
78
78
|
bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
79
|
-
return (
|
|
79
|
+
return (uint256(bytes32(_blob)));
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
|
-
* @notice Get
|
|
83
|
+
* @notice Get count.
|
|
84
84
|
*/
|
|
85
|
-
function get() internal view returns (
|
|
85
|
+
function get() internal view returns (uint256 count) {
|
|
86
86
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
87
87
|
|
|
88
88
|
bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
89
|
-
return (
|
|
89
|
+
return (uint256(bytes32(_blob)));
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
/**
|
|
93
|
-
* @notice Get
|
|
93
|
+
* @notice Get count.
|
|
94
94
|
*/
|
|
95
|
-
function _get() internal view returns (
|
|
95
|
+
function _get() internal view returns (uint256 count) {
|
|
96
96
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
97
97
|
|
|
98
98
|
bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
99
|
-
return (
|
|
99
|
+
return (uint256(bytes32(_blob)));
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
|
-
* @notice Set
|
|
103
|
+
* @notice Set count.
|
|
104
104
|
*/
|
|
105
|
-
function
|
|
105
|
+
function setCount(uint256 count) internal {
|
|
106
106
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
107
107
|
|
|
108
|
-
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
108
|
+
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
/**
|
|
112
|
-
* @notice Set
|
|
112
|
+
* @notice Set count.
|
|
113
113
|
*/
|
|
114
|
-
function
|
|
114
|
+
function _setCount(uint256 count) internal {
|
|
115
115
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
116
116
|
|
|
117
|
-
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
117
|
+
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
|
-
* @notice Set
|
|
121
|
+
* @notice Set count.
|
|
122
122
|
*/
|
|
123
|
-
function set(
|
|
123
|
+
function set(uint256 count) internal {
|
|
124
124
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
125
125
|
|
|
126
|
-
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
126
|
+
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
* @notice Set
|
|
130
|
+
* @notice Set count.
|
|
131
131
|
*/
|
|
132
|
-
function _set(
|
|
132
|
+
function _set(uint256 count) internal {
|
|
133
133
|
bytes32[] memory _keyTuple = new bytes32[](0);
|
|
134
134
|
|
|
135
|
-
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((
|
|
135
|
+
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((count)), _fieldLayout);
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
@@ -157,8 +157,8 @@ library Counter {
|
|
|
157
157
|
* @notice Tightly pack static (fixed length) data using this table's schema.
|
|
158
158
|
* @return The static data, encoded into a sequence of bytes.
|
|
159
159
|
*/
|
|
160
|
-
function encodeStatic(
|
|
161
|
-
return abi.encodePacked(
|
|
160
|
+
function encodeStatic(uint256 count) internal pure returns (bytes memory) {
|
|
161
|
+
return abi.encodePacked(count);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
/**
|
|
@@ -167,8 +167,8 @@ library Counter {
|
|
|
167
167
|
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
|
168
168
|
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
|
169
169
|
*/
|
|
170
|
-
function encode(
|
|
171
|
-
bytes memory _staticData = encodeStatic(
|
|
170
|
+
function encode(uint256 count) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
|
171
|
+
bytes memory _staticData = encodeStatic(count);
|
|
172
172
|
|
|
173
173
|
EncodedLengths _encodedLengths;
|
|
174
174
|
bytes memory _dynamicData;
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
pragma solidity >=0.8.24;
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
// Import store internals
|
|
7
|
+
import { IStore } from "@latticexyz/store/src/IStore.sol";
|
|
8
|
+
import { StoreSwitch } from "@latticexyz/store/src/StoreSwitch.sol";
|
|
9
|
+
import { StoreCore } from "@latticexyz/store/src/StoreCore.sol";
|
|
10
|
+
import { Bytes } from "@latticexyz/store/src/Bytes.sol";
|
|
11
|
+
import { Memory } from "@latticexyz/store/src/Memory.sol";
|
|
12
|
+
import { SliceLib } from "@latticexyz/store/src/Slice.sol";
|
|
13
|
+
import { EncodeArray } from "@latticexyz/store/src/tightcoder/EncodeArray.sol";
|
|
14
|
+
import { FieldLayout } from "@latticexyz/store/src/FieldLayout.sol";
|
|
15
|
+
import { Schema } from "@latticexyz/store/src/Schema.sol";
|
|
16
|
+
import { EncodedLengths, EncodedLengthsLib } from "@latticexyz/store/src/EncodedLengths.sol";
|
|
17
|
+
import { ResourceId } from "@latticexyz/store/src/ResourceId.sol";
|
|
18
|
+
|
|
19
|
+
// Import user types
|
|
20
|
+
import { Entity } from "../../Entity.sol";
|
|
21
|
+
|
|
22
|
+
library Owner {
|
|
23
|
+
// Hex below is the result of `WorldResourceIdLib.encode({ namespace: "app", name: "Owner", typeId: RESOURCE_TABLE });`
|
|
24
|
+
ResourceId constant _tableId = ResourceId.wrap(0x746261707000000000000000000000004f776e65720000000000000000000000);
|
|
25
|
+
|
|
26
|
+
FieldLayout constant _fieldLayout =
|
|
27
|
+
FieldLayout.wrap(0x0014010014000000000000000000000000000000000000000000000000000000);
|
|
28
|
+
|
|
29
|
+
// Hex-encoded key schema of (bytes32)
|
|
30
|
+
Schema constant _keySchema = Schema.wrap(0x002001005f000000000000000000000000000000000000000000000000000000);
|
|
31
|
+
// Hex-encoded value schema of (address)
|
|
32
|
+
Schema constant _valueSchema = Schema.wrap(0x0014010061000000000000000000000000000000000000000000000000000000);
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @notice Get the table's key field names.
|
|
36
|
+
* @return keyNames An array of strings with the names of key fields.
|
|
37
|
+
*/
|
|
38
|
+
function getKeyNames() internal pure returns (string[] memory keyNames) {
|
|
39
|
+
keyNames = new string[](1);
|
|
40
|
+
keyNames[0] = "id";
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @notice Get the table's value field names.
|
|
45
|
+
* @return fieldNames An array of strings with the names of value fields.
|
|
46
|
+
*/
|
|
47
|
+
function getFieldNames() internal pure returns (string[] memory fieldNames) {
|
|
48
|
+
fieldNames = new string[](1);
|
|
49
|
+
fieldNames[0] = "owner";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @notice Register the table with its config.
|
|
54
|
+
*/
|
|
55
|
+
function register() internal {
|
|
56
|
+
StoreSwitch.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* @notice Register the table with its config.
|
|
61
|
+
*/
|
|
62
|
+
function _register() internal {
|
|
63
|
+
StoreCore.registerTable(_tableId, _fieldLayout, _keySchema, _valueSchema, getKeyNames(), getFieldNames());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @notice Get owner.
|
|
68
|
+
*/
|
|
69
|
+
function getOwner(Entity id) internal view returns (address owner) {
|
|
70
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
71
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
72
|
+
|
|
73
|
+
bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
74
|
+
return (address(bytes20(_blob)));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @notice Get owner.
|
|
79
|
+
*/
|
|
80
|
+
function _getOwner(Entity id) internal view returns (address owner) {
|
|
81
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
82
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
83
|
+
|
|
84
|
+
bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
85
|
+
return (address(bytes20(_blob)));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @notice Get owner.
|
|
90
|
+
*/
|
|
91
|
+
function get(Entity id) internal view returns (address owner) {
|
|
92
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
93
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
94
|
+
|
|
95
|
+
bytes32 _blob = StoreSwitch.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
96
|
+
return (address(bytes20(_blob)));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* @notice Get owner.
|
|
101
|
+
*/
|
|
102
|
+
function _get(Entity id) internal view returns (address owner) {
|
|
103
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
104
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
105
|
+
|
|
106
|
+
bytes32 _blob = StoreCore.getStaticField(_tableId, _keyTuple, 0, _fieldLayout);
|
|
107
|
+
return (address(bytes20(_blob)));
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* @notice Set owner.
|
|
112
|
+
*/
|
|
113
|
+
function setOwner(Entity id, address owner) internal {
|
|
114
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
115
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
116
|
+
|
|
117
|
+
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @notice Set owner.
|
|
122
|
+
*/
|
|
123
|
+
function _setOwner(Entity id, address owner) internal {
|
|
124
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
125
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
126
|
+
|
|
127
|
+
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @notice Set owner.
|
|
132
|
+
*/
|
|
133
|
+
function set(Entity id, address owner) internal {
|
|
134
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
135
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
136
|
+
|
|
137
|
+
StoreSwitch.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @notice Set owner.
|
|
142
|
+
*/
|
|
143
|
+
function _set(Entity id, address owner) internal {
|
|
144
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
145
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
146
|
+
|
|
147
|
+
StoreCore.setStaticField(_tableId, _keyTuple, 0, abi.encodePacked((owner)), _fieldLayout);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @notice Delete all data for given keys.
|
|
152
|
+
*/
|
|
153
|
+
function deleteRecord(Entity id) internal {
|
|
154
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
155
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
156
|
+
|
|
157
|
+
StoreSwitch.deleteRecord(_tableId, _keyTuple);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @notice Delete all data for given keys.
|
|
162
|
+
*/
|
|
163
|
+
function _deleteRecord(Entity id) internal {
|
|
164
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
165
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
166
|
+
|
|
167
|
+
StoreCore.deleteRecord(_tableId, _keyTuple, _fieldLayout);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* @notice Tightly pack static (fixed length) data using this table's schema.
|
|
172
|
+
* @return The static data, encoded into a sequence of bytes.
|
|
173
|
+
*/
|
|
174
|
+
function encodeStatic(address owner) internal pure returns (bytes memory) {
|
|
175
|
+
return abi.encodePacked(owner);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @notice Encode all of a record's fields.
|
|
180
|
+
* @return The static (fixed length) data, encoded into a sequence of bytes.
|
|
181
|
+
* @return The lengths of the dynamic fields (packed into a single bytes32 value).
|
|
182
|
+
* @return The dynamic (variable length) data, encoded into a sequence of bytes.
|
|
183
|
+
*/
|
|
184
|
+
function encode(address owner) internal pure returns (bytes memory, EncodedLengths, bytes memory) {
|
|
185
|
+
bytes memory _staticData = encodeStatic(owner);
|
|
186
|
+
|
|
187
|
+
EncodedLengths _encodedLengths;
|
|
188
|
+
bytes memory _dynamicData;
|
|
189
|
+
|
|
190
|
+
return (_staticData, _encodedLengths, _dynamicData);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* @notice Encode keys as a bytes32 array using this table's field layout.
|
|
195
|
+
*/
|
|
196
|
+
function encodeKeyTuple(Entity id) internal pure returns (bytes32[] memory) {
|
|
197
|
+
bytes32[] memory _keyTuple = new bytes32[](1);
|
|
198
|
+
_keyTuple[0] = Entity.unwrap(id);
|
|
199
|
+
|
|
200
|
+
return _keyTuple;
|
|
201
|
+
}
|
|
202
|
+
}
|