create-dubhe 1.2.0-pre.98 → 2.0.0
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/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/package.json +16 -16
- package/templates/101/sui-template/docker-compose.testnet.yml +73 -0
- package/templates/101/sui-template/packages/client/src/app/page.tsx +545 -41
- package/templates/101/sui-template/packages/client/src/app/providers.tsx +12 -4
- package/templates/101/sui-template/packages/contracts/Pub.localnet.toml +4 -4
- package/templates/101/sui-template/packages/contracts/counter.lock.json +20 -0
- package/templates/101/sui-template/packages/contracts/deployment.ts +8 -3
- package/templates/101/sui-template/packages/contracts/dubhe.config.json +59 -13
- package/templates/101/sui-template/packages/contracts/dubhe.config.ts +1 -4
- package/templates/101/sui-template/packages/contracts/metadata.json +1015 -68
- package/templates/101/sui-template/packages/contracts/package.json +7 -4
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +45 -31
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/error.move +8 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +30 -13
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/init_test.move +19 -14
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +198 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2withkey.move +90 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/value.move +30 -20
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/user_storage_init.move +26 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/scripts/deploy_hook.move +6 -11
- package/templates/101/sui-template/packages/contracts/src/counter/sources/systems/counter.move +23 -11
- package/templates/101/sui-template/packages/contracts/src/counter/sources/tests/counter.move +15 -14
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.lock +33 -30
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.toml +8 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +45 -31
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/error.move +170 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +16 -13
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +8 -14
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +1 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +1776 -137
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/data_key.move +1 -20
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/events.move +864 -25
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +15 -16
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +0 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +25 -17
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +2802 -343
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/address.move +173 -55
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/dapp_test.move +769 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/fee_test.move +2965 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/integration_test.move +303 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/listing_test.move +1422 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/scene_session_test.move +269 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/session_test.move +624 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/storage_test.move +700 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/typed_object_test.move +177 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/typed_scene_test.move +452 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move +160 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/math.move +4 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move +2 -2
- package/templates/contract/sui-template/dubhe.config.ts +0 -1
- package/templates/contract/sui-template/package.json +3 -3
- package/templates/contract/sui-template/src/dubhe/Move.lock +33 -30
- package/templates/contract/sui-template/src/dubhe/Move.toml +8 -3
- package/templates/contract/sui-template/src/dubhe/sources/codegen/dapp_key.move +45 -31
- package/templates/contract/sui-template/src/dubhe/sources/codegen/error.move +170 -0
- package/templates/contract/sui-template/src/dubhe/sources/codegen/genesis.move +16 -13
- package/templates/contract/sui-template/src/dubhe/sources/codegen/init_test.move +8 -14
- package/templates/contract/sui-template/src/dubhe/sources/core/account_key.move +1 -3
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_service.move +1776 -137
- package/templates/contract/sui-template/src/dubhe/sources/core/data_key.move +1 -20
- package/templates/contract/sui-template/src/dubhe/sources/core/events.move +864 -25
- package/templates/contract/sui-template/src/dubhe/sources/scripts/deploy_hook.move +15 -16
- package/templates/contract/sui-template/src/dubhe/sources/scripts/migrate.move +0 -3
- package/templates/contract/sui-template/src/dubhe/sources/systems/address_system.move +25 -17
- package/templates/contract/sui-template/src/dubhe/sources/systems/dapp_system.move +2802 -343
- package/templates/contract/sui-template/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/contract/sui-template/src/dubhe/sources/tests/address.move +173 -55
- package/templates/contract/sui-template/src/dubhe/sources/tests/dapp_test.move +769 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/fee_test.move +2965 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/integration_test.move +303 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/listing_test.move +1422 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/scene_session_test.move +269 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/session_test.move +624 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/storage_test.move +700 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/typed_object_test.move +177 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/typed_scene_test.move +452 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/user_storage_test.move +160 -0
- package/templates/contract/sui-template/src/dubhe/sources/utils/math.move +4 -3
- package/templates/contract/sui-template/src/dubhe/sources/utils/type_info.move +2 -2
- package/templates/contract/sui-template/src/template/Move.toml +12 -0
- package/templates/contract/sui-template/src/template/sources/codegen/dapp_key.move +47 -0
- package/templates/contract/sui-template/src/template/sources/codegen/genesis.move +34 -0
- package/templates/contract/sui-template/src/template/sources/codegen/init_test.move +23 -0
- package/templates/contract/sui-template/src/template/sources/codegen/user_storage_init.move +27 -0
- package/templates/contract/sui-template/src/template/sources/scripts/deploy_hook.move +13 -0
- package/templates/contract/sui-template/src/template/sources/scripts/migrate.move +7 -0
- package/templates/nextjs/sui-card-duel/.gitignore_ +51 -0
- package/templates/nextjs/sui-card-duel/README.md +213 -0
- package/templates/nextjs/sui-card-duel/docker-compose.yml +34 -0
- package/templates/nextjs/sui-card-duel/mprocs.yaml +17 -0
- package/templates/nextjs/sui-card-duel/package.json +43 -0
- package/templates/nextjs/sui-card-duel/packages/client/.gitignore_ +48 -0
- package/templates/nextjs/sui-card-duel/packages/client/.prettierignore +1 -0
- package/templates/nextjs/sui-card-duel/packages/client/.prettierrc.json +8 -0
- package/templates/nextjs/sui-card-duel/packages/client/eslint.config.mjs +22 -0
- package/templates/nextjs/sui-card-duel/packages/client/next.config.mjs +8 -0
- package/templates/nextjs/sui-card-duel/packages/client/package.json +47 -0
- package/templates/nextjs/sui-card-duel/packages/client/postcss.config.mjs +8 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/admin/ArenaPanel.tsx +307 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/admin/page.tsx +622 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/brawl/[id]/page.tsx +559 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/collection/page.tsx +202 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/components/CardView.tsx +66 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/components/GameShell.tsx +294 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/components/icons.tsx +101 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/duel/[id]/page.tsx +477 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/favicon.ico +0 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/globals.css +85 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/hooks/useGame.ts +313 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/layout.tsx +24 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/leaderboard/page.tsx +123 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/lib/game.ts +77 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/lib/scenes.ts +226 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/market/page.tsx +418 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/page.tsx +427 -0
- package/templates/nextjs/sui-card-duel/packages/client/src/app/providers.tsx +69 -0
- package/templates/nextjs/sui-card-duel/packages/client/tailwind.config.ts +21 -0
- package/templates/nextjs/sui-card-duel/packages/client/tsconfig.json +30 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/.gitignore_ +51 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/.prettierignore +1 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/.prettierrc.json +8 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/Dockerfile +5 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/Pub.localnet.toml +13 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/card_duel.lock.json +66 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/docker-compose.yml +34 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/dubhe.config.ts +150 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/logs/combined.log +31383 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/package.json +49 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/config.ts +17 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-brawl.ts +270 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-duel.ts +272 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-lobby.ts +177 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-market.ts +219 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/e2e-session.ts +342 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/query-dapp-revenue.ts +95 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/seed.ts +92 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/scripts/withdraw-dapp-revenue.ts +56 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/Move.toml +15 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/dapp_key.move +46 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/enums/card_kind.move +47 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/enums/match_state.move +37 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/enums/rarity.move +37 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/error.move +126 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/genesis.move +33 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/init_test.move +23 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/objects/arena.move +137 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/permits/brawl_permit.move +125 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/permits/duel_permit.move +125 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/battle_state.move +255 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/card.move +282 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/deck.move +64 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/game_config.move +267 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/gold.move +205 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/resources/profile.move +255 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/scenes/brawl.move +313 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/scenes/duel.move +313 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/scripts/deploy_hook.move +32 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/scripts/migrate.move +7 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/arena_system.move +57 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/brawl_system.move +559 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/card_system.move +146 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/duel_system.move +515 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/market_system.move +115 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/systems/player_system.move +37 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/tests/brawl_tests.move +385 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/tests/duel_tests.move +656 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/tests/test_helpers.move +31 -0
- package/templates/nextjs/sui-card-duel/packages/contracts/sui-indexer-schema.graphql +5973 -0
- package/templates/nextjs/sui-card-duel/pnpm-workspace.yaml +2 -0
- package/templates/nextjs/sui-farm/.gitignore_ +51 -0
- package/templates/nextjs/sui-farm/README.md +15 -0
- package/templates/nextjs/sui-farm/UPGRADE_NOTES.md +97 -0
- package/templates/nextjs/sui-farm/docker-compose.yml +34 -0
- package/templates/nextjs/sui-farm/mprocs.yaml +17 -0
- package/templates/nextjs/sui-farm/package.json +43 -0
- package/templates/nextjs/sui-farm/packages/client/.gitignore_ +48 -0
- package/templates/nextjs/sui-farm/packages/client/.prettierignore +1 -0
- package/templates/nextjs/sui-farm/packages/client/.prettierrc.json +8 -0
- package/templates/nextjs/sui-farm/packages/client/eslint.config.mjs +22 -0
- package/templates/nextjs/sui-farm/packages/client/next.config.mjs +8 -0
- package/templates/nextjs/sui-farm/packages/client/package.json +47 -0
- package/templates/nextjs/sui-farm/packages/client/postcss.config.mjs +8 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/admin/page.tsx +618 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/FarmLand.tsx +526 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/FarmPlotCard.tsx +215 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/PetAvatar.tsx +868 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/PetPanel.tsx +1360 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/PlantModal.tsx +147 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/ProxyCard.tsx +684 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/RanchLand.tsx +822 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/ResourceHUD.tsx +125 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/ShopPanel.tsx +232 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/components/icons/GameIcons.tsx +574 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/favicon.ico +0 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/globals.css +423 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/hooks/useWorldPermitId.ts +66 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/layout.tsx +23 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/leaderboard/page.tsx +185 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/lib/crops.ts +97 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/market/page.tsx +763 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/page.tsx +1173 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/providers.tsx +69 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/state/index.tsx +5 -0
- package/templates/nextjs/sui-farm/packages/client/tailwind.config.ts +25 -0
- package/templates/nextjs/sui-farm/packages/client/tsconfig.json +30 -0
- package/templates/nextjs/sui-farm/packages/contracts/.gitignore_ +51 -0
- package/templates/nextjs/sui-farm/packages/contracts/.prettierignore +1 -0
- package/templates/nextjs/sui-farm/packages/contracts/.prettierrc.json +8 -0
- package/templates/nextjs/sui-farm/packages/contracts/Dockerfile +5 -0
- package/templates/nextjs/sui-farm/packages/contracts/Pub.localnet.toml +13 -0
- package/templates/nextjs/sui-farm/packages/contracts/counter.lock.json +14 -0
- package/templates/nextjs/sui-farm/packages/contracts/docker-compose.yml +34 -0
- package/templates/nextjs/sui-farm/packages/contracts/dubhe.config.ts +178 -0
- package/templates/nextjs/sui-farm/packages/contracts/harvest.lock.json +120 -0
- package/templates/nextjs/sui-farm/packages/contracts/package.json +48 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/config.ts +17 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/query-dapp-revenue.ts +95 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/read-permit.ts +72 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/seed.ts +85 -0
- package/templates/nextjs/sui-farm/packages/contracts/scripts/withdraw-dapp-revenue.ts +56 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/Move.toml +14 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/dapp_key.move +31 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/error.move +10 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/genesis.move +33 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/init_test.move +23 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/resources/counter1.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/resources/counter2.move +70 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/scripts/deploy_hook.move +8 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/scripts/migrate.move +8 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/systems/counter.move +13 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/counter/sources/tests/counter.move +28 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/Move.toml +14 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/dapp_key.move +46 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/crop_type.move +47 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/egg_type.move +42 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/pet_rarity.move +37 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/enums/pet_species.move +52 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/error.move +110 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/genesis.move +33 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/init_test.move +23 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/permits/world.move +125 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/carrot.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/carrot_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/common_egg.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/corn.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/corn_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/crow_charges.move +162 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/crow_damage.move +207 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/farm_plot.move +261 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/gold.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet.move +467 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_config.move +372 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_hatch.move +162 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_slot_index.move +83 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pet_slots.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/profile.move +162 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pumpkin.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/pumpkin_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/rare_egg.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/scarecrow.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/season_config.move +197 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/season_stats.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/seasonal_egg.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/shop_config.move +267 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/trophy.move +245 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/wheat.move +136 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/wheat_seed.move +80 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/resources/world_permit_id.move +64 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/scripts/deploy_hook.move +45 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/scripts/migrate.move +7 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/crow_system.move +96 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/farm_system.move +182 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/market_system.move +172 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/pet_system.move +495 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/season_system.move +70 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/shop_system.move +112 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/systems/world_system.move +34 -0
- package/templates/nextjs/sui-farm/packages/contracts/src/harvest/sources/tests/farm_tests.move +1192 -0
- package/templates/nextjs/sui-farm/pnpm-workspace.yaml +2 -0
- package/templates/nextjs/sui-template/packages/client/src/app/components/ProxyCard.tsx +683 -0
- package/templates/nextjs/sui-template/packages/client/src/app/page.tsx +510 -5
- package/templates/nextjs/sui-template/packages/client/src/app/providers.tsx +13 -5
- package/templates/nextjs/sui-template/packages/contracts/Pub.localnet.toml +4 -4
- package/templates/nextjs/sui-template/packages/contracts/counter.lock.json +14 -0
- package/templates/nextjs/sui-template/packages/contracts/deployment.ts +8 -3
- package/templates/nextjs/sui-template/packages/contracts/dubhe.config.json +9 -9
- package/templates/nextjs/sui-template/packages/contracts/dubhe.config.ts +0 -4
- package/templates/nextjs/sui-template/packages/contracts/metadata.json +180 -124
- package/templates/nextjs/sui-template/packages/contracts/package.json +8 -4
- package/templates/nextjs/sui-template/packages/contracts/src/counter/Move.toml +4 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +45 -31
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/error.move +10 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +30 -13
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/init_test.move +19 -14
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter1.move +30 -20
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +35 -24
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/user_storage_init.move +26 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/scripts/deploy_hook.move +6 -10
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/systems/counter.move +7 -20
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/tests/counter.move +14 -27
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.lock +33 -30
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.toml +8 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +45 -31
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/error.move +170 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +16 -13
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +8 -14
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +1 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +1776 -137
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/data_key.move +1 -20
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/events.move +864 -25
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +15 -16
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +0 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +25 -17
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +2802 -343
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/address.move +173 -55
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/dapp_test.move +769 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/fee_test.move +2965 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/integration_test.move +303 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/listing_test.move +1422 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/scene_session_test.move +269 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/session_test.move +624 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/storage_test.move +700 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/typed_object_test.move +177 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/typed_scene_test.move +452 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move +160 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/utils/math.move +4 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move +2 -2
- package/templates/101/sui-template/packages/contracts/src/counter/Move.lock +0 -41
- package/templates/101/sui-template/packages/contracts/src/counter/Published.toml +0 -9
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/errors.move +0 -12
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +0 -140
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -186
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -306
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -396
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -246
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +0 -29
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/session_system.move +0 -44
- package/templates/contract/sui-template/src/dubhe/sources/codegen/errors.move +0 -140
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -186
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -306
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -396
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -246
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_store.move +0 -29
- package/templates/contract/sui-template/src/dubhe/sources/systems/session_system.move +0 -44
- package/templates/nextjs/sui-template/packages/contracts/src/counter/Move.lock +0 -47
- package/templates/nextjs/sui-template/packages/contracts/src/counter/Published.toml +0 -9
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/errors.move +0 -12
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +0 -140
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -186
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -306
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -396
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -246
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +0 -29
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/session_system.move +0 -44
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module card_duel::card_kind {
|
|
7
|
+
use sui::bcs::{BCS, to_bytes, peel_enum_tag};
|
|
8
|
+
|
|
9
|
+
public enum CardKind has copy, drop, store {
|
|
10
|
+
Fireball,Heal,None,Shield,Strike
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public fun new_fireball(): CardKind {
|
|
14
|
+
CardKind::Fireball
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public fun new_heal(): CardKind {
|
|
18
|
+
CardKind::Heal
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public fun new_none(): CardKind {
|
|
22
|
+
CardKind::None
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public fun new_shield(): CardKind {
|
|
26
|
+
CardKind::Shield
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public fun new_strike(): CardKind {
|
|
30
|
+
CardKind::Strike
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
public fun encode(self: CardKind): vector<u8> {
|
|
34
|
+
to_bytes(&self)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public fun decode(bytes: &mut BCS): CardKind {
|
|
38
|
+
match(peel_enum_tag(bytes)) {
|
|
39
|
+
0 => CardKind::Fireball,
|
|
40
|
+
1 => CardKind::Heal,
|
|
41
|
+
2 => CardKind::None,
|
|
42
|
+
3 => CardKind::Shield,
|
|
43
|
+
4 => CardKind::Strike,
|
|
44
|
+
_ => abort,
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module card_duel::match_state {
|
|
7
|
+
use sui::bcs::{BCS, to_bytes, peel_enum_tag};
|
|
8
|
+
|
|
9
|
+
public enum MatchState has copy, drop, store {
|
|
10
|
+
Active,Finished,Waiting
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public fun new_active(): MatchState {
|
|
14
|
+
MatchState::Active
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public fun new_finished(): MatchState {
|
|
18
|
+
MatchState::Finished
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public fun new_waiting(): MatchState {
|
|
22
|
+
MatchState::Waiting
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public fun encode(self: MatchState): vector<u8> {
|
|
26
|
+
to_bytes(&self)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public fun decode(bytes: &mut BCS): MatchState {
|
|
30
|
+
match(peel_enum_tag(bytes)) {
|
|
31
|
+
0 => MatchState::Active,
|
|
32
|
+
1 => MatchState::Finished,
|
|
33
|
+
2 => MatchState::Waiting,
|
|
34
|
+
_ => abort,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module card_duel::rarity {
|
|
7
|
+
use sui::bcs::{BCS, to_bytes, peel_enum_tag};
|
|
8
|
+
|
|
9
|
+
public enum Rarity has copy, drop, store {
|
|
10
|
+
Common,Epic,Rare
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public fun new_common(): Rarity {
|
|
14
|
+
Rarity::Common
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
public fun new_epic(): Rarity {
|
|
18
|
+
Rarity::Epic
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
public fun new_rare(): Rarity {
|
|
22
|
+
Rarity::Rare
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public fun encode(self: Rarity): vector<u8> {
|
|
26
|
+
to_bytes(&self)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public fun decode(bytes: &mut BCS): Rarity {
|
|
30
|
+
match(peel_enum_tag(bytes)) {
|
|
31
|
+
0 => Rarity::Common,
|
|
32
|
+
1 => Rarity::Epic,
|
|
33
|
+
2 => Rarity::Rare,
|
|
34
|
+
_ => abort,
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/error.move
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module card_duel::error {
|
|
7
|
+
#[error]
|
|
8
|
+
const EAlreadyRegistered: vector<u8> = b"Player already registered";
|
|
9
|
+
public fun already_registered(condition: bool) { assert!(condition, EAlreadyRegistered) }
|
|
10
|
+
|
|
11
|
+
#[error]
|
|
12
|
+
const ENotRegistered: vector<u8> = b"Player not registered";
|
|
13
|
+
public fun not_registered(condition: bool) { assert!(condition, ENotRegistered) }
|
|
14
|
+
|
|
15
|
+
#[error]
|
|
16
|
+
const EInsufficientGold: vector<u8> = b"Not enough gold";
|
|
17
|
+
public fun insufficient_gold(condition: bool) { assert!(condition, EInsufficientGold) }
|
|
18
|
+
|
|
19
|
+
#[error]
|
|
20
|
+
const ECardNotFound: vector<u8> = b"Card not owned";
|
|
21
|
+
public fun card_not_found(condition: bool) { assert!(condition, ECardNotFound) }
|
|
22
|
+
|
|
23
|
+
#[error]
|
|
24
|
+
const EInvalidCardKind: vector<u8> = b"Invalid card kind";
|
|
25
|
+
public fun invalid_card_kind(condition: bool) { assert!(condition, EInvalidCardKind) }
|
|
26
|
+
|
|
27
|
+
#[error]
|
|
28
|
+
const EDeckWrongSize: vector<u8> = b"Battle deck must contain exactly 5 cards";
|
|
29
|
+
public fun deck_wrong_size(condition: bool) { assert!(condition, EDeckWrongSize) }
|
|
30
|
+
|
|
31
|
+
#[error]
|
|
32
|
+
const EDeckDuplicateCard: vector<u8> = b"Battle deck contains duplicate cards";
|
|
33
|
+
public fun deck_duplicate_card(condition: bool) { assert!(condition, EDeckDuplicateCard) }
|
|
34
|
+
|
|
35
|
+
#[error]
|
|
36
|
+
const ECardNotInDeck: vector<u8> = b"Card is not in your battle deck";
|
|
37
|
+
public fun card_not_in_deck(condition: bool) { assert!(condition, ECardNotInDeck) }
|
|
38
|
+
|
|
39
|
+
#[error]
|
|
40
|
+
const ECardAlreadyUsed: vector<u8> = b"Card already used in this match";
|
|
41
|
+
public fun card_already_used(condition: bool) { assert!(condition, ECardAlreadyUsed) }
|
|
42
|
+
|
|
43
|
+
#[error]
|
|
44
|
+
const EAlreadyInMatch: vector<u8> = b"Already in an active match";
|
|
45
|
+
public fun already_in_match(condition: bool) { assert!(condition, EAlreadyInMatch) }
|
|
46
|
+
|
|
47
|
+
#[error]
|
|
48
|
+
const ENotInMatch: vector<u8> = b"Not in an active match";
|
|
49
|
+
public fun not_in_match(condition: bool) { assert!(condition, ENotInMatch) }
|
|
50
|
+
|
|
51
|
+
#[error]
|
|
52
|
+
const EWrongMatch: vector<u8> = b"Storage does not belong to this match";
|
|
53
|
+
public fun wrong_match(condition: bool) { assert!(condition, EWrongMatch) }
|
|
54
|
+
|
|
55
|
+
#[error]
|
|
56
|
+
const EMatchNotWaiting: vector<u8> = b"Match is not waiting for an opponent";
|
|
57
|
+
public fun match_not_waiting(condition: bool) { assert!(condition, EMatchNotWaiting) }
|
|
58
|
+
|
|
59
|
+
#[error]
|
|
60
|
+
const EMatchNotActive: vector<u8> = b"Match is not active";
|
|
61
|
+
public fun match_not_active(condition: bool) { assert!(condition, EMatchNotActive) }
|
|
62
|
+
|
|
63
|
+
#[error]
|
|
64
|
+
const EMatchNotFinished: vector<u8> = b"Match is not finished";
|
|
65
|
+
public fun match_not_finished(condition: bool) { assert!(condition, EMatchNotFinished) }
|
|
66
|
+
|
|
67
|
+
#[error]
|
|
68
|
+
const ENotMatchWinner: vector<u8> = b"Caller is not the winner of this match";
|
|
69
|
+
public fun not_match_winner(condition: bool) { assert!(condition, ENotMatchWinner) }
|
|
70
|
+
|
|
71
|
+
#[error]
|
|
72
|
+
const ENotYourTurn: vector<u8> = b"Not your turn";
|
|
73
|
+
public fun not_your_turn(condition: bool) { assert!(condition, ENotYourTurn) }
|
|
74
|
+
|
|
75
|
+
#[error]
|
|
76
|
+
const ENotInvited: vector<u8> = b"Caller is not the invited opponent";
|
|
77
|
+
public fun not_invited(condition: bool) { assert!(condition, ENotInvited) }
|
|
78
|
+
|
|
79
|
+
#[error]
|
|
80
|
+
const ENotChallenger: vector<u8> = b"Only the challenger can do this";
|
|
81
|
+
public fun not_challenger(condition: bool) { assert!(condition, ENotChallenger) }
|
|
82
|
+
|
|
83
|
+
#[error]
|
|
84
|
+
const ECannotPlaySelf: vector<u8> = b"Cannot start a match against yourself";
|
|
85
|
+
public fun cannot_play_self(condition: bool) { assert!(condition, ECannotPlaySelf) }
|
|
86
|
+
|
|
87
|
+
#[error]
|
|
88
|
+
const EInvalidStake: vector<u8> = b"Stake must be greater than zero";
|
|
89
|
+
public fun invalid_stake(condition: bool) { assert!(condition, EInvalidStake) }
|
|
90
|
+
|
|
91
|
+
#[error]
|
|
92
|
+
const ETurnNotTimedOut: vector<u8> = b"Current turn has not timed out yet";
|
|
93
|
+
public fun turn_not_timed_out(condition: bool) { assert!(condition, ETurnNotTimedOut) }
|
|
94
|
+
|
|
95
|
+
#[error]
|
|
96
|
+
const ETargetNotAlive: vector<u8> = b"Target is not alive in this brawl";
|
|
97
|
+
public fun target_not_alive(condition: bool) { assert!(condition, ETargetNotAlive) }
|
|
98
|
+
|
|
99
|
+
#[error]
|
|
100
|
+
const EBrawlNotHost: vector<u8> = b"Only the room host can do this";
|
|
101
|
+
public fun brawl_not_host(condition: bool) { assert!(condition, EBrawlNotHost) }
|
|
102
|
+
|
|
103
|
+
#[error]
|
|
104
|
+
const EBrawlFull: vector<u8> = b"Brawl room is full";
|
|
105
|
+
public fun brawl_full(condition: bool) { assert!(condition, EBrawlFull) }
|
|
106
|
+
|
|
107
|
+
#[error]
|
|
108
|
+
const EBrawlTooFewPlayers: vector<u8> = b"Need at least 2 players to start";
|
|
109
|
+
public fun brawl_too_few_players(condition: bool) { assert!(condition, EBrawlTooFewPlayers) }
|
|
110
|
+
|
|
111
|
+
#[error]
|
|
112
|
+
const EBrawlInvalidMaxPlayers: vector<u8> = b"Max players must be between 2 and 8";
|
|
113
|
+
public fun brawl_invalid_max_players(condition: bool) { assert!(condition, EBrawlInvalidMaxPlayers) }
|
|
114
|
+
|
|
115
|
+
#[error]
|
|
116
|
+
const EAlreadyJoined: vector<u8> = b"Already joined this brawl";
|
|
117
|
+
public fun already_joined(condition: bool) { assert!(condition, EAlreadyJoined) }
|
|
118
|
+
|
|
119
|
+
#[error]
|
|
120
|
+
const ENotInBrawl: vector<u8> = b"Caller has not joined this brawl";
|
|
121
|
+
public fun not_in_brawl(condition: bool) { assert!(condition, ENotInBrawl) }
|
|
122
|
+
|
|
123
|
+
#[error]
|
|
124
|
+
const EHostCannotLeave: vector<u8> = b"The host must cancel the room instead of leaving";
|
|
125
|
+
public fun host_cannot_leave(condition: bool) { assert!(condition, EHostCannotLeave) }
|
|
126
|
+
}
|
package/templates/nextjs/sui-card-duel/packages/contracts/src/card_duel/sources/codegen/genesis.move
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#[allow(lint(share_owned))]
|
|
2
|
+
module card_duel::genesis {
|
|
3
|
+
use sui::clock::Clock;
|
|
4
|
+
use dubhe::dapp_service::{DappHub, DappStorage};
|
|
5
|
+
use card_duel::dapp_key;
|
|
6
|
+
use dubhe::dapp_system;
|
|
7
|
+
use std::ascii::string;
|
|
8
|
+
|
|
9
|
+
// The one-shot guard is enforced inside dapp_system::create_dapp, which
|
|
10
|
+
// records the DappKey type in DappHub before returning DappStorage.
|
|
11
|
+
// genesis.move does not need to carry its own guard.
|
|
12
|
+
public fun run(dapp_hub: &mut DappHub, clock: &Clock, ctx: &mut TxContext) {
|
|
13
|
+
// create_dapp aborts with dapp_already_initialized_error on repeated calls.
|
|
14
|
+
let dapp_key = dapp_key::new();
|
|
15
|
+
let mut ds = dapp_system::create_dapp(dapp_key, dapp_hub, string(b"card_duel"), string(b"Card Duel - Full-chain PvP card battle game (1v1 duels + multiplayer brawls)"), 1, clock, ctx);
|
|
16
|
+
|
|
17
|
+
// Set up initial DApp state (e.g. default resource values).
|
|
18
|
+
card_duel::deploy_hook::run(&mut ds, ctx);
|
|
19
|
+
|
|
20
|
+
// Share DappStorage so every transaction can access it.
|
|
21
|
+
transfer::public_share_object(ds);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Called during contract upgrades to register newly added resource tables
|
|
25
|
+
// and run any custom migration logic. `dubhe upgrade` rewrites the region
|
|
26
|
+
// between the separator comments; do not edit that block manually.
|
|
27
|
+
public(package) fun migrate(_dapp_hub: &mut DappHub, _dapp_storage: &mut DappStorage, _ctx: &mut TxContext) {
|
|
28
|
+
// ==========================================
|
|
29
|
+
// Add custom migration logic here (e.g. initialise new resource defaults).
|
|
30
|
+
// migrate_to_vN in migrate.move calls this function automatically.
|
|
31
|
+
// ==========================================
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#[test_only]
|
|
2
|
+
|
|
3
|
+
module card_duel::init_test {
|
|
4
|
+
use dubhe::dapp_system;
|
|
5
|
+
|
|
6
|
+
/// Create a DappHub for testing without sharing it.
|
|
7
|
+
/// Suitable for unit tests that need a DappHub context.
|
|
8
|
+
public fun create_dapp_hub_for_testing(ctx: &mut TxContext): dubhe::dapp_service::DappHub {
|
|
9
|
+
dapp_system::create_dapp_hub_for_testing(ctx)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/// Create a DappStorage for this DApp without sharing it.
|
|
13
|
+
/// Suitable for unit tests that exercise global-resource functions.
|
|
14
|
+
public fun create_dapp_storage_for_testing(ctx: &mut TxContext): dubhe::dapp_service::DappStorage {
|
|
15
|
+
dubhe::dapp_system::create_dapp_storage_for_testing<card_duel::dapp_key::DappKey>(ctx)
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/// Create a UserStorage for `owner` without sharing it.
|
|
19
|
+
/// Suitable for unit tests that exercise user-level resource functions.
|
|
20
|
+
public fun create_user_storage_for_testing(owner: address, ctx: &mut TxContext): dubhe::dapp_service::UserStorage {
|
|
21
|
+
dubhe::dapp_system::create_user_storage_for_testing<card_duel::dapp_key::DappKey>(owner, ctx)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module card_duel::arena {
|
|
7
|
+
use dubhe::dapp_service::DappStorage;
|
|
8
|
+
use card_duel::dapp_key;
|
|
9
|
+
use card_duel::dapp_key::DappKey;
|
|
10
|
+
use std::ascii::String;
|
|
11
|
+
use card_duel::duel;
|
|
12
|
+
use card_duel::brawl;
|
|
13
|
+
|
|
14
|
+
// ─── Error constants ───────────────────────────────────────────────────
|
|
15
|
+
#[error]
|
|
16
|
+
const EInsufficientAmount: vector<u8> = b"Insufficient amount";
|
|
17
|
+
#[error]
|
|
18
|
+
const EWrongEntityId: vector<u8> = b"Wrong entity id";
|
|
19
|
+
#[error]
|
|
20
|
+
const ENoPermission: vector<u8> = b"Caller does not have permission";
|
|
21
|
+
|
|
22
|
+
const TYPE_TAG: vector<u8> = b"arena";
|
|
23
|
+
|
|
24
|
+
// ─── Phantom marker type ───────────────────────────────────────────────
|
|
25
|
+
/// Phantom type that distinguishes ArenaStorage from other ObjectStorage types
|
|
26
|
+
/// at the Move compiler level, preserving compile-time type safety.
|
|
27
|
+
/// All functions use ObjectStorage<Arena> directly in their signatures.
|
|
28
|
+
public struct Arena has copy, drop {}
|
|
29
|
+
|
|
30
|
+
// ─── ID / entity accessors ─────────────────────────────────────────────
|
|
31
|
+
|
|
32
|
+
public fun entity_id(storage: &dubhe::dapp_service::ObjectStorage<Arena>): vector<u8> {
|
|
33
|
+
*dubhe::dapp_service::object_storage_entity_id(storage)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
public fun assert_arena_id(storage: &dubhe::dapp_service::ObjectStorage<Arena>, expected: vector<u8>) {
|
|
38
|
+
assert!(*dubhe::dapp_service::object_storage_entity_id(storage) == expected, EWrongEntityId);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// ─── Field accessors (own fields) ──────────────────────────────────────
|
|
42
|
+
|
|
43
|
+
public fun get_name(storage: &dubhe::dapp_service::ObjectStorage<Arena>): String {
|
|
44
|
+
dubhe::dapp_system::get_object_field<Arena, String>(storage, b"name")
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
public(package) fun set_name(storage: &mut dubhe::dapp_service::ObjectStorage<Arena>, value: String) {
|
|
48
|
+
dubhe::dapp_system::set_object_field<DappKey, Arena, String>(
|
|
49
|
+
dapp_key::new(), storage, b"name", value
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
public fun get_season(storage: &dubhe::dapp_service::ObjectStorage<Arena>): u8 {
|
|
54
|
+
dubhe::dapp_system::get_object_field<Arena, u8>(storage, b"season")
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public(package) fun set_season(storage: &mut dubhe::dapp_service::ObjectStorage<Arena>, value: u8) {
|
|
58
|
+
dubhe::dapp_system::set_object_field<DappKey, Arena, u8>(
|
|
59
|
+
dapp_key::new(), storage, b"season", value
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ─── Bag accessors for accepted resources ─────────────────────────────
|
|
64
|
+
|
|
65
|
+
public fun get_gold(storage: &dubhe::dapp_service::ObjectStorage<Arena>): u64 {
|
|
66
|
+
if (dubhe::dapp_system::has_object_field<Arena, u64>(storage, b"gold")) {
|
|
67
|
+
dubhe::dapp_system::get_object_field<Arena, u64>(storage, b"gold")
|
|
68
|
+
} else { 0 }
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
public(package) fun add_gold(storage: &mut dubhe::dapp_service::ObjectStorage<Arena>, amount: u64) {
|
|
72
|
+
let current = get_gold(storage);
|
|
73
|
+
dubhe::dapp_system::set_object_field<DappKey, Arena, u64>(
|
|
74
|
+
dapp_key::new(), storage, b"gold", current + amount
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
public(package) fun sub_gold(storage: &mut dubhe::dapp_service::ObjectStorage<Arena>, amount: u64) {
|
|
79
|
+
let current = get_gold(storage);
|
|
80
|
+
assert!(current >= amount, EInsufficientAmount);
|
|
81
|
+
dubhe::dapp_system::set_object_field<DappKey, Arena, u64>(
|
|
82
|
+
dapp_key::new(), storage, b"gold", current - amount
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ─── acceptsFrom: cross-storage transfer functions ─────────────────────
|
|
87
|
+
|
|
88
|
+
/// Transfer gold (fungible) from duel into this arena.
|
|
89
|
+
public(package) fun transfer_duel_to_arena_gold(
|
|
90
|
+
source_permit: &dubhe::dapp_service::ScenePermit<card_duel::duel_permit::DuelPermit>,
|
|
91
|
+
from: &mut dubhe::dapp_service::SceneStorage<card_duel::duel::Duel>,
|
|
92
|
+
to: &mut dubhe::dapp_service::ObjectStorage<Arena>,
|
|
93
|
+
user_storage: &dubhe::dapp_service::UserStorage,
|
|
94
|
+
amount: u64,
|
|
95
|
+
ctx: &TxContext,
|
|
96
|
+
|
|
97
|
+
) {
|
|
98
|
+
duel::sub_gold(source_permit, from, user_storage, amount, ctx);
|
|
99
|
+
add_gold(to, amount);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/// Transfer gold (fungible) from brawl into this arena.
|
|
103
|
+
public(package) fun transfer_brawl_to_arena_gold(
|
|
104
|
+
source_permit: &dubhe::dapp_service::ScenePermit<card_duel::brawl_permit::BrawlPermit>,
|
|
105
|
+
from: &mut dubhe::dapp_service::SceneStorage<card_duel::brawl::Brawl>,
|
|
106
|
+
to: &mut dubhe::dapp_service::ObjectStorage<Arena>,
|
|
107
|
+
user_storage: &dubhe::dapp_service::UserStorage,
|
|
108
|
+
amount: u64,
|
|
109
|
+
ctx: &TxContext,
|
|
110
|
+
|
|
111
|
+
) {
|
|
112
|
+
brawl::sub_gold(source_permit, from, user_storage, amount, ctx);
|
|
113
|
+
add_gold(to, amount);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// ─── Lifecycle entry functions ─────────────────────────────────────────
|
|
117
|
+
public(package) fun create_arena(
|
|
118
|
+
dapp_storage: &mut DappStorage,
|
|
119
|
+
entity_id: vector<u8>,
|
|
120
|
+
ctx: &mut TxContext,
|
|
121
|
+
) {
|
|
122
|
+
assert!(ctx.sender() == dubhe::dapp_service::dapp_admin(dapp_storage), ENoPermission);
|
|
123
|
+
dubhe::dapp_system::create_and_share_typed_object<DappKey, Arena>(
|
|
124
|
+
dapp_key::new(), dapp_storage, TYPE_TAG, entity_id, ctx
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public(package) fun destroy_arena(
|
|
129
|
+
dapp_storage: &mut DappStorage,
|
|
130
|
+
storage: dubhe::dapp_service::ObjectStorage<Arena>,
|
|
131
|
+
_ctx: &TxContext,
|
|
132
|
+
) {
|
|
133
|
+
dubhe::dapp_system::destroy_typed_object<DappKey, Arena>(
|
|
134
|
+
dapp_key::new(), dapp_storage, storage
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module card_duel::brawl_permit {
|
|
7
|
+
use dubhe::dapp_service::{Self, DappStorage};
|
|
8
|
+
use card_duel::dapp_key;
|
|
9
|
+
use card_duel::dapp_key::DappKey;
|
|
10
|
+
|
|
11
|
+
const PERMIT_TYPE: vector<u8> = b"brawl_permit";
|
|
12
|
+
|
|
13
|
+
#[error]
|
|
14
|
+
const EPermitNotExpiredYet: vector<u8> = b"Scene permit is still active";
|
|
15
|
+
|
|
16
|
+
/// Phantom type that distinguishes this permit from others at compile time.
|
|
17
|
+
public struct BrawlPermit has copy, drop {}
|
|
18
|
+
|
|
19
|
+
public fun meta(permit: &dubhe::dapp_service::ScenePermit<BrawlPermit>): &dubhe::dapp_service::PermitMetadata {
|
|
20
|
+
dapp_service::scene_permit_meta(permit)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public fun is_active(permit: &dubhe::dapp_service::ScenePermit<BrawlPermit>, now_ms: u64): bool {
|
|
24
|
+
dapp_service::is_scene_active(dapp_service::scene_permit_meta(permit), now_ms)
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
public fun is_participant(permit: &dubhe::dapp_service::ScenePermit<BrawlPermit>, addr: address): bool {
|
|
28
|
+
dubhe::dapp_system::is_scene_permit_participant<BrawlPermit>(permit, addr)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public(package) fun new_brawl_permit(
|
|
32
|
+
dapp_storage: &DappStorage,
|
|
33
|
+
participants: vector<address>,
|
|
34
|
+
expires_at: std::option::Option<u64>,
|
|
35
|
+
max_participants: std::option::Option<u64>,
|
|
36
|
+
ctx: &mut TxContext,
|
|
37
|
+
): dubhe::dapp_service::ScenePermit<BrawlPermit> {
|
|
38
|
+
dubhe::dapp_system::new_scene_permit<DappKey, BrawlPermit>(
|
|
39
|
+
dapp_key::new(), dapp_storage, PERMIT_TYPE, participants, expires_at, max_participants, ctx
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public(package) fun new_brawl_permit_with_invitations(
|
|
44
|
+
dapp_storage: &DappStorage,
|
|
45
|
+
invitees: vector<address>,
|
|
46
|
+
invites_expire_at: std::option::Option<u64>,
|
|
47
|
+
scene_expires_at: std::option::Option<u64>,
|
|
48
|
+
max_participants: std::option::Option<u64>,
|
|
49
|
+
ctx: &mut TxContext,
|
|
50
|
+
): dubhe::dapp_service::ScenePermit<BrawlPermit> {
|
|
51
|
+
dubhe::dapp_system::new_scene_permit_with_invitations<DappKey, BrawlPermit>(
|
|
52
|
+
dapp_key::new(), dapp_storage, PERMIT_TYPE, invitees, invites_expire_at, scene_expires_at, max_participants, ctx
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public(package) fun share_brawl_permit(permit: dubhe::dapp_service::ScenePermit<BrawlPermit>) {
|
|
57
|
+
dubhe::dapp_system::share_scene_permit<DappKey, BrawlPermit>(
|
|
58
|
+
dapp_key::new(), permit
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public(package) fun create_brawl_permit(
|
|
63
|
+
dapp_storage: &DappStorage,
|
|
64
|
+
participants: vector<address>,
|
|
65
|
+
expires_at: std::option::Option<u64>,
|
|
66
|
+
max_participants: std::option::Option<u64>,
|
|
67
|
+
ctx: &mut TxContext,
|
|
68
|
+
) {
|
|
69
|
+
dubhe::dapp_system::create_and_share_scene_permit<DappKey, BrawlPermit>(
|
|
70
|
+
dapp_key::new(), dapp_storage, PERMIT_TYPE, participants, expires_at, max_participants, ctx
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public(package) fun create_brawl_permit_with_invitations(
|
|
75
|
+
dapp_storage: &DappStorage,
|
|
76
|
+
invitees: vector<address>,
|
|
77
|
+
invites_expire_at: std::option::Option<u64>,
|
|
78
|
+
scene_expires_at: std::option::Option<u64>,
|
|
79
|
+
max_participants: std::option::Option<u64>,
|
|
80
|
+
ctx: &mut TxContext,
|
|
81
|
+
) {
|
|
82
|
+
dubhe::dapp_system::create_and_share_scene_permit_with_invitations<DappKey, BrawlPermit>(
|
|
83
|
+
dapp_key::new(), dapp_storage, PERMIT_TYPE, invitees, invites_expire_at, scene_expires_at, max_participants, ctx
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
public(package) fun accept_brawl_permit(
|
|
88
|
+
permit: &mut dubhe::dapp_service::ScenePermit<BrawlPermit>,
|
|
89
|
+
user_storage: &dubhe::dapp_service::UserStorage,
|
|
90
|
+
ctx: &TxContext,
|
|
91
|
+
) {
|
|
92
|
+
dubhe::dapp_system::accept_scene_permit_invitation<DappKey, BrawlPermit>(
|
|
93
|
+
dapp_key::new(), permit, user_storage, ctx
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public(package) fun join_brawl_permit(
|
|
98
|
+
permit: &mut dubhe::dapp_service::ScenePermit<BrawlPermit>,
|
|
99
|
+
user_storage: &dubhe::dapp_service::UserStorage,
|
|
100
|
+
ctx: &TxContext,
|
|
101
|
+
) {
|
|
102
|
+
dubhe::dapp_system::join_scene_permit<DappKey, BrawlPermit>(dapp_key::new(), permit, user_storage, ctx);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
public(package) fun leave_brawl_permit(
|
|
106
|
+
permit: &mut dubhe::dapp_service::ScenePermit<BrawlPermit>,
|
|
107
|
+
user_storage: &dubhe::dapp_service::UserStorage,
|
|
108
|
+
ctx: &TxContext,
|
|
109
|
+
) {
|
|
110
|
+
dubhe::dapp_system::leave_scene_permit<DappKey, BrawlPermit>(dapp_key::new(), permit, user_storage, ctx);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
public(package) fun expire_brawl_permit(
|
|
114
|
+
permit: dubhe::dapp_service::ScenePermit<BrawlPermit>,
|
|
115
|
+
ctx: &TxContext,
|
|
116
|
+
) {
|
|
117
|
+
assert!(
|
|
118
|
+
!dapp_service::is_scene_active(dapp_service::scene_permit_meta(&permit), ctx.epoch_timestamp_ms()),
|
|
119
|
+
EPermitNotExpiredYet
|
|
120
|
+
);
|
|
121
|
+
dubhe::dapp_system::destroy_scene_permit<DappKey, BrawlPermit>(
|
|
122
|
+
dapp_key::new(), permit
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|