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
package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
/// Unit tests — UserStorage creation and registration
|
|
2
|
+
///
|
|
3
|
+
/// Covers:
|
|
4
|
+
/// create_user_storage: initial state, registration recorded, duplicate abort
|
|
5
|
+
/// canonical_owner is set correctly on creation
|
|
6
|
+
/// session fields initialized to zero/empty
|
|
7
|
+
#[test_only]
|
|
8
|
+
module dubhe::user_storage_test;
|
|
9
|
+
|
|
10
|
+
use dubhe::dapp_service::{Self, DappHub, DappStorage};
|
|
11
|
+
use dubhe::dapp_system;
|
|
12
|
+
use sui::test_scenario;
|
|
13
|
+
|
|
14
|
+
public struct UsTestKey has copy, drop {}
|
|
15
|
+
|
|
16
|
+
const USER: address = @0x1234;
|
|
17
|
+
|
|
18
|
+
// ─── Helpers ──────────────────────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
fun setup(scenario: &mut test_scenario::Scenario): (DappHub, DappStorage) {
|
|
21
|
+
let ctx = test_scenario::ctx(scenario);
|
|
22
|
+
(
|
|
23
|
+
dapp_system::create_dapp_hub_for_testing(ctx),
|
|
24
|
+
dapp_system::create_dapp_storage_for_testing<UsTestKey>(ctx),
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
29
|
+
// Initial state
|
|
30
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
31
|
+
|
|
32
|
+
#[test]
|
|
33
|
+
fun test_initial_write_counts_are_zero() {
|
|
34
|
+
let mut scenario = test_scenario::begin(USER);
|
|
35
|
+
{
|
|
36
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
37
|
+
let us = dapp_service::create_user_storage_for_testing<UsTestKey>(USER, ctx);
|
|
38
|
+
|
|
39
|
+
assert!(dapp_service::write_count(&us) == 0);
|
|
40
|
+
assert!(dapp_service::settled_count(&us) == 0);
|
|
41
|
+
assert!(dapp_service::unsettled_count(&us) == 0);
|
|
42
|
+
|
|
43
|
+
dapp_service::destroy_user_storage(us);
|
|
44
|
+
};
|
|
45
|
+
scenario.end();
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#[test]
|
|
49
|
+
fun test_canonical_owner_set_on_creation() {
|
|
50
|
+
let mut scenario = test_scenario::begin(USER);
|
|
51
|
+
{
|
|
52
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
53
|
+
let us = dapp_service::create_user_storage_for_testing<UsTestKey>(USER, ctx);
|
|
54
|
+
assert!(dapp_service::canonical_owner(&us) == USER);
|
|
55
|
+
dapp_service::destroy_user_storage(us);
|
|
56
|
+
};
|
|
57
|
+
scenario.end();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
#[test]
|
|
61
|
+
fun test_session_fields_cleared_on_creation() {
|
|
62
|
+
let mut scenario = test_scenario::begin(USER);
|
|
63
|
+
{
|
|
64
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
65
|
+
let us = dapp_service::create_user_storage_for_testing<UsTestKey>(USER, ctx);
|
|
66
|
+
assert!(dapp_service::session_key(&us) == @0x0);
|
|
67
|
+
assert!(dapp_service::session_expires_at(&us) == 0);
|
|
68
|
+
dapp_service::destroy_user_storage(us);
|
|
69
|
+
};
|
|
70
|
+
scenario.end();
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
74
|
+
// create_user_storage (via dapp_system) — registration guard
|
|
75
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
76
|
+
|
|
77
|
+
#[test]
|
|
78
|
+
fun test_create_user_storage_registers_address() {
|
|
79
|
+
let sender = @0xABC;
|
|
80
|
+
let mut scenario = test_scenario::begin(sender);
|
|
81
|
+
{
|
|
82
|
+
let (dh, mut ds) = setup(&mut scenario);
|
|
83
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
84
|
+
|
|
85
|
+
assert!(!dapp_service::has_registered_user_storage(&ds, sender));
|
|
86
|
+
dapp_system::create_user_storage(UsTestKey {}, &dh, &mut ds, ctx);
|
|
87
|
+
assert!(dapp_service::has_registered_user_storage(&ds, sender));
|
|
88
|
+
|
|
89
|
+
dapp_system::destroy_dapp_hub(dh);
|
|
90
|
+
dapp_system::destroy_dapp_storage(ds);
|
|
91
|
+
};
|
|
92
|
+
scenario.end();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
#[test]
|
|
96
|
+
#[expected_failure]
|
|
97
|
+
fun test_create_user_storage_twice_aborts() {
|
|
98
|
+
let sender = @0xABC;
|
|
99
|
+
let mut scenario = test_scenario::begin(sender);
|
|
100
|
+
{
|
|
101
|
+
let (dh, mut ds) = setup(&mut scenario);
|
|
102
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
103
|
+
|
|
104
|
+
dapp_system::create_user_storage(UsTestKey {}, &dh, &mut ds, ctx);
|
|
105
|
+
// Second call from the same address must abort with user_storage_already_exists.
|
|
106
|
+
dapp_system::create_user_storage(UsTestKey {}, &dh, &mut ds, ctx);
|
|
107
|
+
|
|
108
|
+
dapp_system::destroy_dapp_hub(dh);
|
|
109
|
+
dapp_system::destroy_dapp_storage(ds);
|
|
110
|
+
};
|
|
111
|
+
scenario.end();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
#[test]
|
|
115
|
+
fun test_different_users_can_each_create_one_user_storage() {
|
|
116
|
+
let user_a = @0xAAAA;
|
|
117
|
+
let user_b = @0xBBBB;
|
|
118
|
+
|
|
119
|
+
let mut scenario = test_scenario::begin(user_a);
|
|
120
|
+
{
|
|
121
|
+
let (dh, mut ds) = setup(&mut scenario);
|
|
122
|
+
|
|
123
|
+
// user_a creates their storage.
|
|
124
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
125
|
+
dapp_system::create_user_storage(UsTestKey {}, &dh, &mut ds, ctx);
|
|
126
|
+
assert!(dapp_service::has_registered_user_storage(&ds, user_a));
|
|
127
|
+
|
|
128
|
+
// user_b creates theirs in a new tx.
|
|
129
|
+
test_scenario::next_tx(&mut scenario, user_b);
|
|
130
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
131
|
+
dapp_system::create_user_storage(UsTestKey {}, &dh, &mut ds, ctx);
|
|
132
|
+
assert!(dapp_service::has_registered_user_storage(&ds, user_b));
|
|
133
|
+
|
|
134
|
+
dapp_system::destroy_dapp_hub(dh);
|
|
135
|
+
dapp_system::destroy_dapp_storage(ds);
|
|
136
|
+
};
|
|
137
|
+
scenario.end();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
141
|
+
// Suspended DApp guard
|
|
142
|
+
// ═══════════════════════════════════════════════════════════════════════════════
|
|
143
|
+
|
|
144
|
+
#[test]
|
|
145
|
+
fun test_create_user_storage_succeeds_after_registration_check() {
|
|
146
|
+
let sender = @0xABC;
|
|
147
|
+
let mut scenario = test_scenario::begin(sender);
|
|
148
|
+
{
|
|
149
|
+
let (dh, mut ds) = setup(&mut scenario);
|
|
150
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
151
|
+
|
|
152
|
+
// Must succeed.
|
|
153
|
+
dapp_system::create_user_storage(UsTestKey {}, &dh, &mut ds, ctx);
|
|
154
|
+
assert!(dapp_service::has_registered_user_storage(&ds, sender));
|
|
155
|
+
|
|
156
|
+
dapp_system::destroy_dapp_hub(dh);
|
|
157
|
+
dapp_system::destroy_dapp_storage(ds);
|
|
158
|
+
};
|
|
159
|
+
scenario.end();
|
|
160
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
module dubhe::dubhe_math {
|
|
2
2
|
use std::u128;
|
|
3
3
|
use std::u64;
|
|
4
|
+
use dubhe::error;
|
|
4
5
|
|
|
5
6
|
public fun min(x: u256, y: u256): u256 {
|
|
6
7
|
if (x < y) x else y
|
|
@@ -9,12 +10,12 @@ module dubhe::dubhe_math {
|
|
|
9
10
|
public fun safe_mul(a: u256, b: u256): u256 {
|
|
10
11
|
if (a == 0 || b == 0) return 0;
|
|
11
12
|
let c = a * b;
|
|
12
|
-
|
|
13
|
+
error::math_overflow(c / a == b);
|
|
13
14
|
c
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
public fun safe_div(a: u256, b: u256): u256 {
|
|
17
|
-
|
|
18
|
+
error::division_by_zero(b != 0);
|
|
18
19
|
a / b
|
|
19
20
|
}
|
|
20
21
|
|
|
@@ -108,7 +109,7 @@ module dubhe::dubhe_math {
|
|
|
108
109
|
}
|
|
109
110
|
|
|
110
111
|
public(package) fun windows(x: &vector<u256>, size: u64): vector<vector<u256>> {
|
|
111
|
-
|
|
112
|
+
error::invalid_window_size(size > 0);
|
|
112
113
|
|
|
113
114
|
let length = vector::length(x);
|
|
114
115
|
let mut result = vector::empty<vector<u256>>();
|
package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move
CHANGED
|
@@ -29,11 +29,11 @@ module dubhe::type_info {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
public fun get_package_id<T>(): address {
|
|
32
|
-
let type_name = type_name::
|
|
32
|
+
let type_name = type_name::with_defining_ids<T>().address_string();
|
|
33
33
|
address::from_ascii_bytes(type_name.as_bytes())
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
public fun get_type_name_string<T>(): String {
|
|
37
|
-
type_name::
|
|
37
|
+
type_name::with_defining_ids<T>().into_string()
|
|
38
38
|
}
|
|
39
39
|
}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
"description": "Simple starter template",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"gen": "pnpm dubhe
|
|
7
|
+
"gen": "pnpm dubhe generate"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@0xobelisk/sui-cli": "{{dubhe-version}}",
|
|
11
11
|
"@0xobelisk/sui-client": "{{dubhe-version}}",
|
|
12
12
|
"@0xobelisk/sui-common": "{{dubhe-version}}",
|
|
13
|
-
"
|
|
14
|
-
"
|
|
13
|
+
"chalk": "^4.1.2",
|
|
14
|
+
"dotenv": "^16.4.5"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
17
|
"@types/node": "^22.16.0",
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Generated by move; do not edit
|
|
2
|
+
# This file should be checked in.
|
|
2
3
|
|
|
3
4
|
[move]
|
|
4
|
-
version =
|
|
5
|
-
manifest_digest = "9E441545FB5525E6DED36D5515A5D25F03199A6CD5699C95CF663AFB76CAB789"
|
|
6
|
-
deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
|
|
7
|
-
dependencies = [
|
|
8
|
-
{ id = "Sui", name = "Sui" },
|
|
9
|
-
]
|
|
5
|
+
version = 4
|
|
10
6
|
|
|
11
|
-
[
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
[pinned.mainnet.Dubhe]
|
|
8
|
+
source = { root = true }
|
|
9
|
+
use_environment = "mainnet"
|
|
10
|
+
manifest_digest = "2AF62652675929717F20B988B31D3936712B319F150E7B7E069948FF27B34E0E"
|
|
11
|
+
deps = { Sui = "Sui" }
|
|
14
12
|
|
|
15
|
-
[
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
[pinned.mainnet.MoveStdlib]
|
|
14
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
15
|
+
use_environment = "mainnet"
|
|
16
|
+
manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
|
|
17
|
+
deps = {}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
[pinned.mainnet.Sui]
|
|
20
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
21
|
+
use_environment = "mainnet"
|
|
22
|
+
manifest_digest = "CD547CB1ACCE0880C835DAED2D8FFCB91D56C833AE5240D3AA5B918398263195"
|
|
23
|
+
deps = { MoveStdlib = "MoveStdlib" }
|
|
22
24
|
|
|
23
|
-
[
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
[pinned.testnet.Dubhe]
|
|
26
|
+
source = { root = true }
|
|
27
|
+
use_environment = "testnet"
|
|
28
|
+
manifest_digest = "B50A32218E466AACB70E7FB4A9B0991CFCF16B50B77AA0D5FBEC6A0730F28D67"
|
|
29
|
+
deps = { Sui = "Sui" }
|
|
27
30
|
|
|
28
|
-
[
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
[pinned.testnet.MoveStdlib]
|
|
32
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
33
|
+
use_environment = "testnet"
|
|
34
|
+
manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
|
|
35
|
+
deps = {}
|
|
33
36
|
|
|
34
|
-
[
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
[pinned.testnet.Sui]
|
|
38
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
39
|
+
use_environment = "testnet"
|
|
40
|
+
manifest_digest = "7AFB66695545775FBFBB2D3078ADFD084244D5002392E837FDE21D9EA1C6D01C"
|
|
41
|
+
deps = { MoveStdlib = "MoveStdlib" }
|
|
@@ -4,11 +4,16 @@ edition = "2024"
|
|
|
4
4
|
version = "1.0.0"
|
|
5
5
|
license = "apache2.0"
|
|
6
6
|
authors = ["Obelisk Labs"]
|
|
7
|
-
published-at = "
|
|
7
|
+
published-at = "0x1a79c1611ab49723b388510813553ad912d96a4f1a9ed5fdbdb57e446c6fe946"
|
|
8
8
|
|
|
9
9
|
[dependencies]
|
|
10
|
-
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.
|
|
10
|
+
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.68.1", override = true }
|
|
11
11
|
|
|
12
12
|
[addresses]
|
|
13
|
-
dubhe = "
|
|
13
|
+
dubhe = "0x1a79c1611ab49723b388510813553ad912d96a4f1a9ed5fdbdb57e446c6fe946"
|
|
14
|
+
|
|
15
|
+
[environments]
|
|
16
|
+
testnet = "4c78adac"
|
|
17
|
+
mainnet = "35834a8a"
|
|
18
|
+
localnet = "d3e1a0e6"
|
|
14
19
|
|
|
@@ -1,32 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
use
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module dubhe::dapp_key {
|
|
7
|
+
use std::type_name;
|
|
8
|
+
use sui::address;
|
|
9
|
+
use std::ascii::String;
|
|
10
|
+
|
|
11
|
+
/// DappKey — package-level authorization token for this DApp.
|
|
12
|
+
///
|
|
13
|
+
/// SECURITY: `new()` is intentionally `public(package)`.
|
|
14
|
+
/// Only code compiled into this package can construct a DappKey instance.
|
|
15
|
+
/// All framework write functions (`set_record`, `set_field`,
|
|
16
|
+
/// `take_record`, `create_user_storage`, …) require `_auth: DappKey`
|
|
17
|
+
/// as proof that the call originated from inside this package — an
|
|
18
|
+
/// external PTB cannot fabricate that proof.
|
|
19
|
+
///
|
|
20
|
+
/// NEVER change `new()` to `public`, and never accept a DappKey
|
|
21
|
+
/// value as a parameter from an external caller. Either mistake removes
|
|
22
|
+
/// every package-level access guard, allowing any PTB to write arbitrary
|
|
23
|
+
/// user data or register UserStorages without going through the DApp's
|
|
24
|
+
/// own entry functions.
|
|
25
|
+
|
|
26
|
+
public struct DappKey has copy, drop {}
|
|
27
|
+
|
|
28
|
+
/// Constructs an authorization token. Callable only from within this package.
|
|
29
|
+
/// Pass the result as `_auth` to any framework function that requires it.
|
|
30
|
+
public(package) fun new(): DappKey {
|
|
31
|
+
DappKey {}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public fun to_string(): String {
|
|
35
|
+
type_name::with_defining_ids<DappKey>().into_string()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public fun package_id(): address {
|
|
39
|
+
let package_id_str = type_name::with_defining_ids<DappKey>().address_string();
|
|
40
|
+
address::from_ascii_bytes(package_id_str.as_bytes())
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public fun eq<DappKey1: copy + drop, DappKey2: copy + drop>(_: &DappKey1, _: &DappKey2): bool {
|
|
44
|
+
type_name::with_defining_ids<DappKey1>() == type_name::with_defining_ids<DappKey2>()
|
|
45
|
+
}
|
|
32
46
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
/* Autogenerated file. Do not edit manually. */
|
|
5
|
+
|
|
6
|
+
module dubhe::error {
|
|
7
|
+
#[error]
|
|
8
|
+
const ENoPermission: vector<u8> = b"No permission";
|
|
9
|
+
public fun no_permission(condition: bool) { assert!(condition, ENoPermission) }
|
|
10
|
+
|
|
11
|
+
#[error]
|
|
12
|
+
const ENotLatestVersion: vector<u8> = b"Not latest version";
|
|
13
|
+
public fun not_latest_version(condition: bool) { assert!(condition, ENotLatestVersion) }
|
|
14
|
+
|
|
15
|
+
#[error]
|
|
16
|
+
const EDappPaused: vector<u8> = b"Dapp is paused";
|
|
17
|
+
public fun dapp_paused(condition: bool) { assert!(condition, EDappPaused) }
|
|
18
|
+
|
|
19
|
+
#[error]
|
|
20
|
+
const EInvalidPackageId: vector<u8> = b"Invalid package id";
|
|
21
|
+
public fun invalid_package_id(condition: bool) { assert!(condition, EInvalidPackageId) }
|
|
22
|
+
|
|
23
|
+
#[error]
|
|
24
|
+
const EInvalidVersion: vector<u8> = b"Invalid version";
|
|
25
|
+
public fun invalid_version(condition: bool) { assert!(condition, EInvalidVersion) }
|
|
26
|
+
|
|
27
|
+
#[error]
|
|
28
|
+
const EDappAlreadyInitialized: vector<u8> = b"Dapp already initialized";
|
|
29
|
+
public fun dapp_already_initialized(condition: bool) { assert!(condition, EDappAlreadyInitialized) }
|
|
30
|
+
|
|
31
|
+
#[error]
|
|
32
|
+
const EInsufficientCredit: vector<u8> = b"Insufficient credit";
|
|
33
|
+
public fun insufficient_credit(condition: bool) { assert!(condition, EInsufficientCredit) }
|
|
34
|
+
|
|
35
|
+
#[error]
|
|
36
|
+
const ENoPendingOwnershipTransfer: vector<u8> = b"No pending ownership transfer";
|
|
37
|
+
public fun no_pending_ownership_transfer(condition: bool) { assert!(condition, ENoPendingOwnershipTransfer) }
|
|
38
|
+
|
|
39
|
+
#[error]
|
|
40
|
+
const EUserDebtLimitExceeded: vector<u8> = b"User debt limit exceeded";
|
|
41
|
+
public fun user_debt_limit_exceeded(condition: bool) { assert!(condition, EUserDebtLimitExceeded) }
|
|
42
|
+
|
|
43
|
+
#[error]
|
|
44
|
+
const EDappKeyMismatch: vector<u8> = b"Dapp key mismatch";
|
|
45
|
+
public fun dapp_key_mismatch(condition: bool) { assert!(condition, EDappKeyMismatch) }
|
|
46
|
+
|
|
47
|
+
#[error]
|
|
48
|
+
const ENoActiveSession: vector<u8> = b"No active session";
|
|
49
|
+
public fun no_active_session(condition: bool) { assert!(condition, ENoActiveSession) }
|
|
50
|
+
|
|
51
|
+
#[error]
|
|
52
|
+
const ENotCanonicalOwner: vector<u8> = b"Not canonical owner";
|
|
53
|
+
public fun not_canonical_owner(condition: bool) { assert!(condition, ENotCanonicalOwner) }
|
|
54
|
+
|
|
55
|
+
#[error]
|
|
56
|
+
const EUserStorageAlreadyExists: vector<u8> = b"User storage already exists";
|
|
57
|
+
public fun user_storage_already_exists(condition: bool) { assert!(condition, EUserStorageAlreadyExists) }
|
|
58
|
+
|
|
59
|
+
#[error]
|
|
60
|
+
const EInvalidSessionKey: vector<u8> = b"Invalid session key";
|
|
61
|
+
public fun invalid_session_key(condition: bool) { assert!(condition, EInvalidSessionKey) }
|
|
62
|
+
|
|
63
|
+
#[error]
|
|
64
|
+
const EInvalidSessionDuration: vector<u8> = b"Invalid session duration";
|
|
65
|
+
public fun invalid_session_duration(condition: bool) { assert!(condition, EInvalidSessionDuration) }
|
|
66
|
+
|
|
67
|
+
#[error]
|
|
68
|
+
const EWrongPaymentCoinType: vector<u8> = b"Wrong payment coin type";
|
|
69
|
+
public fun wrong_payment_coin_type(condition: bool) { assert!(condition, EWrongPaymentCoinType) }
|
|
70
|
+
|
|
71
|
+
#[error]
|
|
72
|
+
const ENoPendingCoinTypeChange: vector<u8> = b"No pending coin type change";
|
|
73
|
+
public fun no_pending_coin_type_change(condition: bool) { assert!(condition, ENoPendingCoinTypeChange) }
|
|
74
|
+
|
|
75
|
+
#[error]
|
|
76
|
+
const ECoinTypeChangeNotReady: vector<u8> = b"Coin type change not ready";
|
|
77
|
+
public fun coin_type_change_not_ready(condition: bool) { assert!(condition, ECoinTypeChangeNotReady) }
|
|
78
|
+
|
|
79
|
+
#[error]
|
|
80
|
+
const EWrongSettlementMode: vector<u8> = b"Wrong settlement mode";
|
|
81
|
+
public fun wrong_settlement_mode(condition: bool) { assert!(condition, EWrongSettlementMode) }
|
|
82
|
+
|
|
83
|
+
#[error]
|
|
84
|
+
const ERevenueShareExceedsMax: vector<u8> = b"Invalid revenue share bps";
|
|
85
|
+
public fun revenue_share_exceeds_max(condition: bool) { assert!(condition, ERevenueShareExceedsMax) }
|
|
86
|
+
|
|
87
|
+
#[error]
|
|
88
|
+
const ENoRevenueToWithdraw: vector<u8> = b"No revenue to withdraw";
|
|
89
|
+
public fun no_revenue_to_withdraw(condition: bool) { assert!(condition, ENoRevenueToWithdraw) }
|
|
90
|
+
|
|
91
|
+
#[error]
|
|
92
|
+
const ESceneExpired: vector<u8> = b"Scene has expired";
|
|
93
|
+
public fun scene_expired(condition: bool) { assert!(condition, ESceneExpired) }
|
|
94
|
+
|
|
95
|
+
#[error]
|
|
96
|
+
const ENotSceneParticipant: vector<u8> = b"Not a scene participant";
|
|
97
|
+
public fun not_scene_participant(condition: bool) { assert!(condition, ENotSceneParticipant) }
|
|
98
|
+
|
|
99
|
+
#[error]
|
|
100
|
+
const EEntityNotFound: vector<u8> = b"Entity not found";
|
|
101
|
+
public fun entity_not_found(condition: bool) { assert!(condition, EEntityNotFound) }
|
|
102
|
+
|
|
103
|
+
#[error]
|
|
104
|
+
const EEntityIdAlreadyExists: vector<u8> = b"Entity id already exists";
|
|
105
|
+
public fun entity_id_already_exists(condition: bool) { assert!(condition, EEntityIdAlreadyExists) }
|
|
106
|
+
|
|
107
|
+
#[error]
|
|
108
|
+
const EInsufficientBalance: vector<u8> = b"Insufficient balance";
|
|
109
|
+
public fun insufficient_balance(condition: bool) { assert!(condition, EInsufficientBalance) }
|
|
110
|
+
|
|
111
|
+
#[error]
|
|
112
|
+
const EParticipantsStillPresent: vector<u8> = b"Cannot destroy scene while participants are still present";
|
|
113
|
+
public fun participants_still_present(condition: bool) { assert!(condition, EParticipantsStillPresent) }
|
|
114
|
+
|
|
115
|
+
#[error]
|
|
116
|
+
const EWriteLimitOutOfRange: vector<u8> = b"Write limit out of range";
|
|
117
|
+
public fun write_limit_out_of_range(condition: bool) { assert!(condition, EWriteLimitOutOfRange) }
|
|
118
|
+
|
|
119
|
+
#[error]
|
|
120
|
+
const ESceneFull: vector<u8> = b"Scene has reached its maximum participant limit";
|
|
121
|
+
public fun scene_full(condition: bool) { assert!(condition, ESceneFull) }
|
|
122
|
+
|
|
123
|
+
#[error]
|
|
124
|
+
const EMarketplaceFeeExceedsMax: vector<u8> = b"Marketplace fee bps cannot exceed 10000";
|
|
125
|
+
public fun marketplace_fee_exceeds_max(condition: bool) { assert!(condition, EMarketplaceFeeExceedsMax) }
|
|
126
|
+
|
|
127
|
+
#[error]
|
|
128
|
+
const ENotParticipant: vector<u8> = b"Sender is not a participant or invitee";
|
|
129
|
+
public fun not_participant(condition: bool) { assert!(condition, ENotParticipant) }
|
|
130
|
+
|
|
131
|
+
#[error]
|
|
132
|
+
const EInvitationExpired: vector<u8> = b"Invitation window has expired";
|
|
133
|
+
public fun invitation_expired(condition: bool) { assert!(condition, EInvitationExpired) }
|
|
134
|
+
|
|
135
|
+
#[error]
|
|
136
|
+
const EInvalidKey: vector<u8> = b"Invalid record key";
|
|
137
|
+
public fun invalid_key(condition: bool) { assert!(condition, EInvalidKey) }
|
|
138
|
+
|
|
139
|
+
#[error]
|
|
140
|
+
const ELengthMismatch: vector<u8> = b"Field names and values length mismatch";
|
|
141
|
+
public fun length_mismatch(condition: bool) { assert!(condition, ELengthMismatch) }
|
|
142
|
+
|
|
143
|
+
#[error]
|
|
144
|
+
const EInvalidEvmAddress: vector<u8> = b"Invalid EVM address length";
|
|
145
|
+
public fun invalid_evm_address(condition: bool) { assert!(condition, EInvalidEvmAddress) }
|
|
146
|
+
|
|
147
|
+
#[error]
|
|
148
|
+
const EInvalidSolanaAddress: vector<u8> = b"Invalid Solana address length";
|
|
149
|
+
public fun invalid_solana_address(condition: bool) { assert!(condition, EInvalidSolanaAddress) }
|
|
150
|
+
|
|
151
|
+
#[error]
|
|
152
|
+
const EMathOverflow: vector<u8> = b"Arithmetic overflow";
|
|
153
|
+
public fun math_overflow(condition: bool) { assert!(condition, EMathOverflow) }
|
|
154
|
+
|
|
155
|
+
#[error]
|
|
156
|
+
const EDivisionByZero: vector<u8> = b"Division by zero";
|
|
157
|
+
public fun division_by_zero(condition: bool) { assert!(condition, EDivisionByZero) }
|
|
158
|
+
|
|
159
|
+
#[error]
|
|
160
|
+
const EInvalidWindowSize: vector<u8> = b"Window size must be greater than zero";
|
|
161
|
+
public fun invalid_window_size(condition: bool) { assert!(condition, EInvalidWindowSize) }
|
|
162
|
+
|
|
163
|
+
#[error]
|
|
164
|
+
const EInsufficientPayment: vector<u8> = b"Insufficient payment for listing price";
|
|
165
|
+
public fun insufficient_payment(condition: bool) { assert!(condition, EInsufficientPayment) }
|
|
166
|
+
|
|
167
|
+
#[error]
|
|
168
|
+
const EItemAlreadyOwned: vector<u8> = b"Buyer already owns an item with this key";
|
|
169
|
+
public fun item_already_owned(condition: bool) { assert!(condition, EItemAlreadyOwned) }
|
|
170
|
+
}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
#[allow(lint(share_owned))]
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
use dubhe::dapp_key;
|
|
5
|
-
use dubhe::dapp_system;
|
|
6
|
-
use std::ascii::string;
|
|
1
|
+
#[allow(lint(share_owned))]
|
|
2
|
+
module dubhe::genesis {
|
|
3
|
+
use dubhe::dapp_service::DappHub;
|
|
7
4
|
|
|
8
|
-
|
|
9
|
-
//
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
// The framework genesis initialises the DappHub state via deploy_hook.
|
|
6
|
+
// No DappStorage is created for the framework itself — the framework is
|
|
7
|
+
// infrastructure, not a DApp.
|
|
8
|
+
public fun run(dapp_hub: &mut DappHub, ctx: &mut TxContext) {
|
|
9
|
+
dubhe::deploy_hook::run(dapp_hub, ctx);
|
|
10
|
+
}
|
|
12
11
|
|
|
13
|
-
//
|
|
14
|
-
dubhe
|
|
15
|
-
|
|
12
|
+
// Called during framework upgrades to run any custom migration logic.
|
|
13
|
+
// `dubhe upgrade` rewrites the region between the separator comments.
|
|
14
|
+
public(package) fun migrate(_dapp_hub: &mut DappHub, _ctx: &mut TxContext) {
|
|
15
|
+
// ==========================================
|
|
16
|
+
// Add custom migration logic here.
|
|
17
|
+
// ==========================================
|
|
18
|
+
}
|
|
16
19
|
}
|
|
@@ -1,18 +1,12 @@
|
|
|
1
|
-
#[test_only]
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
use sui::test_scenario::Scenario;
|
|
5
|
-
use dubhe::dapp_service::DappHub;
|
|
1
|
+
#[test_only]
|
|
2
|
+
|
|
3
|
+
module dubhe::init_test {
|
|
6
4
|
use dubhe::dapp_system;
|
|
7
5
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
dubhe::genesis::run(&mut dapp_hub, &clock, ctx);
|
|
14
|
-
clock::destroy_for_testing(clock);
|
|
15
|
-
test_scenario::next_tx(scenario, ctx.sender());
|
|
16
|
-
dapp_hub
|
|
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)
|
|
17
10
|
}
|
|
11
|
+
|
|
18
12
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
module dubhe::account_key;
|
|
2
2
|
|
|
3
3
|
use std::ascii::String;
|
|
4
|
-
use std::bcs;
|
|
5
4
|
use std::type_name;
|
|
6
|
-
use sui::address;
|
|
7
5
|
|
|
8
6
|
public struct AccountData has key, store { id: UID }
|
|
9
7
|
|
|
@@ -27,6 +25,6 @@ public struct AccountKey has copy, drop, store {
|
|
|
27
25
|
public(package) fun new_account_key<DappKey: copy + drop>(address: String): AccountKey {
|
|
28
26
|
AccountKey {
|
|
29
27
|
address: address,
|
|
30
|
-
package_id: type_name::
|
|
28
|
+
package_id: type_name::with_defining_ids<DappKey>().address_string(),
|
|
31
29
|
}
|
|
32
30
|
}
|