create-dubhe 1.2.0-pre.118 → 1.2.0-pre.119
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 +1 -1
- package/templates/101/sui-template/packages/contracts/counter.lock.json +20 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +3 -4
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/error.move +0 -1
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +1 -1
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +1 -3
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2withkey.move +15 -4
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/value.move +1 -4
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/user_storage_init.move +0 -1
- package/templates/101/sui-template/packages/contracts/src/counter/sources/systems/counter.move +15 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.lock +10 -10
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.toml +4 -3
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +3 -4
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/error.move +112 -1
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +1 -1
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +939 -82
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/events.move +621 -43
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +3 -1
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +7 -8
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +1917 -231
- 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/dapp_test.move +139 -43
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/fee_test.move +1649 -451
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/integration_test.move +13 -25
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/listing_test.move +1294 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/session_test.move +66 -21
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/storage_test.move +16 -16
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/typed_object_test.move +144 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/typed_scene_test.move +442 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move +2 -26
- 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/src/dubhe/Move.lock +10 -10
- package/templates/contract/sui-template/src/dubhe/Move.toml +4 -3
- package/templates/contract/sui-template/src/dubhe/sources/codegen/dapp_key.move +3 -4
- package/templates/contract/sui-template/src/dubhe/sources/codegen/error.move +112 -1
- package/templates/contract/sui-template/src/dubhe/sources/core/account_key.move +1 -1
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_service.move +939 -82
- package/templates/contract/sui-template/src/dubhe/sources/core/events.move +621 -43
- package/templates/contract/sui-template/src/dubhe/sources/scripts/deploy_hook.move +3 -1
- package/templates/contract/sui-template/src/dubhe/sources/systems/address_system.move +7 -8
- package/templates/contract/sui-template/src/dubhe/sources/systems/dapp_system.move +1917 -231
- package/templates/contract/sui-template/src/dubhe/sources/systems/utils.move +1 -1
- package/templates/contract/sui-template/src/dubhe/sources/tests/dapp_test.move +139 -43
- package/templates/contract/sui-template/src/dubhe/sources/tests/fee_test.move +1649 -451
- package/templates/contract/sui-template/src/dubhe/sources/tests/integration_test.move +13 -25
- package/templates/contract/sui-template/src/dubhe/sources/tests/listing_test.move +1294 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/session_test.move +66 -21
- package/templates/contract/sui-template/src/dubhe/sources/tests/storage_test.move +16 -16
- package/templates/contract/sui-template/src/dubhe/sources/tests/typed_object_test.move +144 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/typed_scene_test.move +442 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/user_storage_test.move +2 -26
- 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 +1 -1
- package/templates/contract/sui-template/src/template/sources/codegen/genesis.move +1 -1
- 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 +37 -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/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/useSessionKey.ts +248 -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 +772 -0
- package/templates/nextjs/sui-farm/packages/client/src/app/page.tsx +1122 -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 +9 -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 +22 -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 +31 -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 +122 -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 +209 -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 +22 -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 +100 -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/contracts/counter.lock.json +14 -0
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +3 -4
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/error.move +0 -1
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +1 -1
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter1.move +1 -4
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +14 -4
- package/templates/nextjs/sui-template/packages/contracts/src/counter/sources/codegen/user_storage_init.move +0 -1
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.lock +10 -10
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.toml +4 -3
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +3 -4
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/error.move +112 -1
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +1 -1
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +939 -82
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/events.move +621 -43
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +3 -1
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +7 -8
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +1917 -231
- 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/dapp_test.move +139 -43
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/fee_test.move +1649 -451
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/integration_test.move +13 -25
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/listing_test.move +1294 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/session_test.move +66 -21
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/storage_test.move +16 -16
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/typed_object_test.move +144 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/typed_scene_test.move +442 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/user_storage_test.move +2 -26
- 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/nextjs/sui-template/packages/contracts/src/counter/Move.lock +0 -41
package/dist/cli.js
CHANGED
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/bin/cli.ts","../src/config/chains.ts","../package.json","../src/exists.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport glob from 'fast-glob';\nimport yargsInteractive from 'yargs-interactive';\nimport { CHAINS } from '../config/chains';\nimport packageJson from '../../package.json';\nimport { exists } from '../exists';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst cwd = process.cwd();\n\nconst init = async () => {\n // Prepare chain options\n const chainChoices = CHAINS.map(({ title, description, value }) => ({\n name: `${title} - ${description}`,\n value\n }));\n\n // Step 1: Choose project name and chain\n const firstStep = await yargsInteractive()\n .usage('$0 [args]')\n .interactive({\n interactive: { default: true },\n projectName: {\n describe: 'Name your project',\n type: 'input'\n },\n chain: {\n describe: 'Pick your chain',\n type: 'list',\n choices: chainChoices.map((c) => c.value)\n },\n dubheVersion: {\n describe: 'The version of Dubhe packages to use, defaults to latest',\n type: 'input',\n default: packageJson.version\n }\n });\n\n const { projectName, chain, dubheVersion } = firstStep;\n if (!projectName) throw new Error('No project name provided.');\n\n // Get available templates based on the selected chain\n const selectedChain = CHAINS.find((c) => c.value === chain);\n if (!selectedChain) {\n throw new Error('Invalid chain selection');\n }\n\n // Prepare platform options\n const platformChoices = selectedChain.supportedTemplates.map(({ title, description, value }) => ({\n name: `${title} - ${description}`,\n value\n }));\n\n // Step 2: Choose platform\n const secondStep = await yargsInteractive()\n .usage('$0 [args]')\n .interactive({\n interactive: { default: true },\n platform: {\n describe: 'Pick your platform',\n type: 'list',\n choices: platformChoices.map((c) => c.value)\n }\n });\n\n const { platform } = secondStep;\n\n const selectedTemplate = selectedChain.supportedTemplates.find((t) => t.value === platform);\n if (!selectedTemplate) {\n throw new Error('Invalid platform selection');\n }\n\n const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);\n const pkgManager = pkgInfo ? pkgInfo.name : 'npm';\n\n const sourceDir = path.join(\n __dirname,\n '..',\n 'templates',\n selectedTemplate.path.replace('{chain}', chain)\n );\n\n if (!(await exists(sourceDir))) {\n throw new Error(`Template directory not found: ${sourceDir}`);\n }\n\n const destDir = path.join(process.cwd(), projectName);\n if (await exists(destDir)) {\n throw new Error(`Target directory \"${destDir}\" already exists.`);\n }\n\n const files = await glob('**/*', { cwd: sourceDir, dot: true });\n\n for (const filename of files) {\n const sourceFile = path.join(sourceDir, filename);\n const destFile = path.join(destDir, filename);\n\n await fs.mkdir(path.dirname(destFile), { recursive: true });\n\n if (/package\\.json$/.test(sourceFile)) {\n const source = await fs.readFile(sourceFile, 'utf-8');\n await fs.writeFile(destFile, source.replaceAll(/{{dubhe-version}}/g, dubheVersion), 'utf-8');\n } else if (/\\.gitignore_$/.test(sourceFile)) {\n await fs.copyFile(sourceFile, destFile.replace(/_$/, ''));\n } else {\n await fs.copyFile(sourceFile, destFile);\n }\n }\n\n const cdProjectName = path.relative(cwd, destDir);\n\n const styles = {\n success: '\\x1b[32m%s\\x1b[0m',\n info: '\\x1b[36m%s\\x1b[0m',\n command: '\\x1b[33m%s\\x1b[0m',\n separator: '\\x1b[90m%s\\x1b[0m'\n };\n\n console.log('\\n' + '='.repeat(60));\n console.log(styles.success, '🎉 Project creation successful!');\n console.log(styles.info, `📁 Project location: ${destDir}`);\n console.log(styles.separator, '-'.repeat(60));\n console.log(styles.info, 'Next steps:\\n');\n\n if (destDir !== cwd) {\n console.log(\n styles.command,\n ` cd ${cdProjectName.includes(' ') ? `\"${cdProjectName}\"` : cdProjectName}`\n );\n }\n\n const actualTemplate = selectedTemplate.value;\n\n switch (actualTemplate) {\n case '101':\n case 'web':\n console.log(styles.command, ` ${pkgManager} install`);\n console.log(styles.command, ` ${pkgManager} dubhe doctor`);\n console.log(styles.command, ` ${pkgManager} run dev`);\n break;\n case 'contract':\n console.log(styles.command, ` ${pkgManager} install`);\n console.log(styles.command, ` ${pkgManager} dubhe doctor`);\n break;\n }\n\n console.log(styles.separator, '\\n' + '='.repeat(60) + '\\n');\n};\n\nfunction pkgFromUserAgent(userAgent: string | undefined) {\n if (!userAgent) return undefined;\n const pkgSpec = userAgent.split(' ')[0];\n const pkgSpecArr = pkgSpec.split('/');\n return {\n name: pkgSpecArr[0],\n version: pkgSpecArr[1]\n };\n}\n\ninit().catch((e) => {\n console.error(e);\n});\n","interface Template {\n title: string;\n description: string;\n value: string;\n path: string;\n}\n\ninterface Chain {\n title: string;\n description: string;\n value: string;\n supportedTemplates: Template[];\n}\n\nconst TEMPLATES = {\n QUICK_START: {\n title: '101',\n description: 'Quick start',\n value: '101',\n path: '101/{chain}-template'\n },\n WEB: {\n title: 'Web',\n description: 'Web template',\n value: 'web',\n path: 'nextjs/{chain}-template'\n },\n CONTRACT: {\n title: 'Contract',\n description: 'Contract template',\n value: 'contract',\n path: 'contract/{chain}-template'\n }\n} as const;\n\nexport const CHAINS: Chain[] = [\n {\n title: 'sui',\n description: 'Sui',\n value: 'sui',\n supportedTemplates: [TEMPLATES.QUICK_START, TEMPLATES.WEB, TEMPLATES.CONTRACT]\n },\n {\n title: 'aptos',\n description: 'Aptos',\n value: 'aptos',\n supportedTemplates: [TEMPLATES.QUICK_START, TEMPLATES.WEB, TEMPLATES.CONTRACT]\n },\n {\n title: 'rooch',\n description: 'Rooch',\n value: 'rooch',\n supportedTemplates: [TEMPLATES.QUICK_START]\n },\n {\n title: 'initia',\n description: 'Initia',\n value: 'initia',\n supportedTemplates: [TEMPLATES.QUICK_START]\n },\n {\n title: 'movement',\n description: 'Movement',\n value: 'movement',\n supportedTemplates: [TEMPLATES.QUICK_START]\n }\n];\n","{\n \"name\": \"create-dubhe\",\n \"version\": \"1.2.0-pre.118\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/0xobelisk/dubhe.git\"\n },\n \"license\": \"MIT\",\n \"author\": \"team@obelisk.build\",\n \"type\": \"module\",\n \"bin\": \"bin/cli.js\",\n \"files\": [\n \"bin\",\n \"dist\",\n \"templates\"\n ],\n \"scripts\": {\n \"build\": \"pnpm run type-check && pnpm run build:js\",\n \"build:js\": \"tsup && pnpm run copy-templates\",\n \"clean\": \"pnpm run clean:js\",\n \"clean:js\": \"shx rm -rf dist\",\n \"cocos-js-build\": \"cd cocos-lib-builder && npm i && browserify aptos.js -p esmify > ../templates/cocos/aptos-template/assets/lib/dubhe.js && browserify sui.js -p esmify > ../templates/cocos/sui-template/assets/lib/dubhe.js\",\n \"copy-templates\": \"tsx ./scripts/copy-templates.ts\",\n \"dev\": \"tsup --watch\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"lint\": \"eslint . --ext .ts\",\n \"type-check\": \"tsc --noEmit\",\n \"validate\": \"pnpm format:check && pnpm lint && pnpm type-check\"\n },\n \"dependencies\": {\n \"browser-resolve\": \"^2.0.0\",\n \"browser-sync\": \"^2.29.3\",\n \"fast-glob\": \"^3.3.3\",\n \"yargs-interactive\": \"^3.0.1\"\n },\n \"devDependencies\": {\n \"@types/cross-spawn\": \"^6.0.2\",\n \"@types/minimist\": \"^1.2.2\",\n \"@types/prompts\": \"^2.4.3\",\n \"@types/yargs-interactive\": \"^2.1.6\",\n \"browserify\": \"^17.0.0\",\n \"cross-spawn\": \"^7.0.3\",\n \"eslint\": \"^9.0.0\",\n \"eslint-config-prettier\": \"^9.1.0\",\n \"esmify\": \"^2.1.1\",\n \"kolorist\": \"^1.7.0\",\n \"prettier\": \"3.3.3\",\n \"prompts\": \"^2.4.2\",\n \"typescript\": \"^5.8.3\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import fs from 'node:fs/promises';\n\nexport async function exists(path: string) {\n try {\n await fs.access(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,OAAOA,SAAQ;AACf,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,sBAAsB;;;ACU7B,IAAM,YAAY;AAAA,EAChB,aAAa;AAAA,IACX,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF;AAEO,IAAM,SAAkB;AAAA,EAC7B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,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AAU;AACrD;AAAA,IACF,KAAK;AACH,cAAQ,IAAI,OAAO,SAAS,KAAK,UAAU,UAAU;AACrD,cAAQ,IAAI,OAAO,SAAS,KAAK,UAAU,eAAe;AAC1D;AAAA,EACJ;AAEA,UAAQ,IAAI,OAAO,WAAW,OAAO,IAAI,OAAO,EAAE,IAAI,IAAI;AAC5D;AAEA,SAAS,iBAAiB,WAA+B;AACvD,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,UAAU,UAAU,MAAM,GAAG,EAAE,CAAC;AACtC,QAAM,aAAa,QAAQ,MAAM,GAAG;AACpC,SAAO;AAAA,IACL,MAAM,WAAW,CAAC;AAAA,IAClB,SAAS,WAAW,CAAC;AAAA,EACvB;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,MAAM;AAClB,UAAQ,MAAM,CAAC;AACjB,CAAC;","names":["fs","path","fs"]}
|
|
1
|
+
{"version":3,"sources":["../src/bin/cli.ts","../src/config/chains.ts","../package.json","../src/exists.ts"],"sourcesContent":["import { fileURLToPath } from 'node:url';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport glob from 'fast-glob';\nimport yargsInteractive from 'yargs-interactive';\nimport { CHAINS } from '../config/chains';\nimport packageJson from '../../package.json';\nimport { exists } from '../exists';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nconst cwd = process.cwd();\n\nconst init = async () => {\n // Prepare chain options\n const chainChoices = CHAINS.map(({ title, description, value }) => ({\n name: `${title} - ${description}`,\n value\n }));\n\n // Step 1: Choose project name and chain\n const firstStep = await yargsInteractive()\n .usage('$0 [args]')\n .interactive({\n interactive: { default: true },\n projectName: {\n describe: 'Name your project',\n type: 'input'\n },\n chain: {\n describe: 'Pick your chain',\n type: 'list',\n choices: chainChoices.map((c) => c.value)\n },\n dubheVersion: {\n describe: 'The version of Dubhe packages to use, defaults to latest',\n type: 'input',\n default: packageJson.version\n }\n });\n\n const { projectName, chain, dubheVersion } = firstStep;\n if (!projectName) throw new Error('No project name provided.');\n\n // Get available templates based on the selected chain\n const selectedChain = CHAINS.find((c) => c.value === chain);\n if (!selectedChain) {\n throw new Error('Invalid chain selection');\n }\n\n // Prepare platform options\n const platformChoices = selectedChain.supportedTemplates.map(({ title, description, value }) => ({\n name: `${title} - ${description}`,\n value\n }));\n\n // Step 2: Choose platform\n const secondStep = await yargsInteractive()\n .usage('$0 [args]')\n .interactive({\n interactive: { default: true },\n platform: {\n describe: 'Pick your platform',\n type: 'list',\n choices: platformChoices.map((c) => c.value)\n }\n });\n\n const { platform } = secondStep;\n\n const selectedTemplate = selectedChain.supportedTemplates.find((t) => t.value === platform);\n if (!selectedTemplate) {\n throw new Error('Invalid platform selection');\n }\n\n const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent);\n const pkgManager = pkgInfo ? pkgInfo.name : 'npm';\n\n const sourceDir = path.join(\n __dirname,\n '..',\n 'templates',\n selectedTemplate.path.replace('{chain}', chain)\n );\n\n if (!(await exists(sourceDir))) {\n throw new Error(`Template directory not found: ${sourceDir}`);\n }\n\n const destDir = path.join(process.cwd(), projectName);\n if (await exists(destDir)) {\n throw new Error(`Target directory \"${destDir}\" already exists.`);\n }\n\n const files = await glob('**/*', { cwd: sourceDir, dot: true });\n\n for (const filename of files) {\n const sourceFile = path.join(sourceDir, filename);\n const destFile = path.join(destDir, filename);\n\n await fs.mkdir(path.dirname(destFile), { recursive: true });\n\n if (/package\\.json$/.test(sourceFile)) {\n const source = await fs.readFile(sourceFile, 'utf-8');\n await fs.writeFile(destFile, source.replaceAll(/{{dubhe-version}}/g, dubheVersion), 'utf-8');\n } else if (/\\.gitignore_$/.test(sourceFile)) {\n await fs.copyFile(sourceFile, destFile.replace(/_$/, ''));\n } else {\n await fs.copyFile(sourceFile, destFile);\n }\n }\n\n const cdProjectName = path.relative(cwd, destDir);\n\n const styles = {\n success: '\\x1b[32m%s\\x1b[0m',\n info: '\\x1b[36m%s\\x1b[0m',\n command: '\\x1b[33m%s\\x1b[0m',\n separator: '\\x1b[90m%s\\x1b[0m'\n };\n\n console.log('\\n' + '='.repeat(60));\n console.log(styles.success, '🎉 Project creation successful!');\n console.log(styles.info, `📁 Project location: ${destDir}`);\n console.log(styles.separator, '-'.repeat(60));\n console.log(styles.info, 'Next steps:\\n');\n\n if (destDir !== cwd) {\n console.log(\n styles.command,\n ` cd ${cdProjectName.includes(' ') ? `\"${cdProjectName}\"` : cdProjectName}`\n );\n }\n\n const actualTemplate = selectedTemplate.value;\n\n switch (actualTemplate) {\n case '101':\n case 'web':\n console.log(styles.command, ` ${pkgManager} install`);\n console.log(styles.command, ` ${pkgManager} dubhe doctor`);\n console.log(styles.command, ` ${pkgManager} run dev`);\n break;\n case 'contract':\n console.log(styles.command, ` ${pkgManager} install`);\n console.log(styles.command, ` ${pkgManager} dubhe doctor`);\n break;\n }\n\n console.log(styles.separator, '\\n' + '='.repeat(60) + '\\n');\n};\n\nfunction pkgFromUserAgent(userAgent: string | undefined) {\n if (!userAgent) return undefined;\n const pkgSpec = userAgent.split(' ')[0];\n const pkgSpecArr = pkgSpec.split('/');\n return {\n name: pkgSpecArr[0],\n version: pkgSpecArr[1]\n };\n}\n\ninit().catch((e) => {\n console.error(e);\n});\n","interface Template {\n title: string;\n description: string;\n value: string;\n path: string;\n}\n\ninterface Chain {\n title: string;\n description: string;\n value: string;\n supportedTemplates: Template[];\n}\n\nconst TEMPLATES = {\n QUICK_START: {\n title: '101',\n description: 'Quick start',\n value: '101',\n path: '101/{chain}-template'\n },\n WEB: {\n title: 'Web',\n description: 'Web template',\n value: 'web',\n path: 'nextjs/{chain}-template'\n },\n CONTRACT: {\n title: 'Contract',\n description: 'Contract template',\n value: 'contract',\n path: 'contract/{chain}-template'\n }\n} as const;\n\nexport const CHAINS: Chain[] = [\n {\n title: 'sui',\n description: 'Sui',\n value: 'sui',\n supportedTemplates: [TEMPLATES.QUICK_START, TEMPLATES.WEB, TEMPLATES.CONTRACT]\n },\n {\n title: 'aptos',\n description: 'Aptos',\n value: 'aptos',\n supportedTemplates: [TEMPLATES.QUICK_START, TEMPLATES.WEB, TEMPLATES.CONTRACT]\n },\n {\n title: 'rooch',\n description: 'Rooch',\n value: 'rooch',\n supportedTemplates: [TEMPLATES.QUICK_START]\n },\n {\n title: 'initia',\n description: 'Initia',\n value: 'initia',\n supportedTemplates: [TEMPLATES.QUICK_START]\n },\n {\n title: 'movement',\n description: 'Movement',\n value: 'movement',\n supportedTemplates: [TEMPLATES.QUICK_START]\n }\n];\n","{\n \"name\": \"create-dubhe\",\n \"version\": \"1.2.0-pre.119\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/0xobelisk/dubhe.git\"\n },\n \"license\": \"MIT\",\n \"author\": \"team@obelisk.build\",\n \"type\": \"module\",\n \"bin\": \"bin/cli.js\",\n \"files\": [\n \"bin\",\n \"dist\",\n \"templates\"\n ],\n \"scripts\": {\n \"build\": \"pnpm run type-check && pnpm run build:js\",\n \"build:js\": \"tsup && pnpm run copy-templates\",\n \"clean\": \"pnpm run clean:js\",\n \"clean:js\": \"shx rm -rf dist\",\n \"cocos-js-build\": \"cd cocos-lib-builder && npm i && browserify aptos.js -p esmify > ../templates/cocos/aptos-template/assets/lib/dubhe.js && browserify sui.js -p esmify > ../templates/cocos/sui-template/assets/lib/dubhe.js\",\n \"copy-templates\": \"tsx ./scripts/copy-templates.ts\",\n \"dev\": \"tsup --watch\",\n \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"lint\": \"eslint . --ext .ts\",\n \"type-check\": \"tsc --noEmit\",\n \"validate\": \"pnpm format:check && pnpm lint && pnpm type-check\"\n },\n \"dependencies\": {\n \"browser-resolve\": \"^2.0.0\",\n \"browser-sync\": \"^2.29.3\",\n \"fast-glob\": \"^3.3.3\",\n \"yargs-interactive\": \"^3.0.1\"\n },\n \"devDependencies\": {\n \"@types/cross-spawn\": \"^6.0.2\",\n \"@types/minimist\": \"^1.2.2\",\n \"@types/prompts\": \"^2.4.3\",\n \"@types/yargs-interactive\": \"^2.1.6\",\n \"browserify\": \"^17.0.0\",\n \"cross-spawn\": \"^7.0.3\",\n \"eslint\": \"^9.0.0\",\n \"eslint-config-prettier\": \"^9.1.0\",\n \"esmify\": \"^2.1.1\",\n \"kolorist\": \"^1.7.0\",\n \"prettier\": \"3.3.3\",\n \"prompts\": \"^2.4.2\",\n \"typescript\": \"^5.8.3\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n }\n}\n","import fs from 'node:fs/promises';\n\nexport async function exists(path: string) {\n try {\n await fs.access(path);\n return true;\n } catch {\n return false;\n }\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;AAC9B,OAAOA,SAAQ;AACf,OAAO,UAAU;AACjB,OAAO,UAAU;AACjB,OAAO,sBAAsB;;;ACU7B,IAAM,YAAY;AAAA,EAChB,aAAa;AAAA,IACX,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,KAAK;AAAA,IACH,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF;AAEO,IAAM,SAAkB;AAAA,EAC7B;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,oBAAoB,CAAC,UAAU,aAAa,UAAU,KAAK,UAAU,QAAQ;AAAA,EAC/E;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,oBAAoB,CAAC,UAAU,aAAa,UAAU,KAAK,UAAU,QAAQ;AAAA,EAC/E;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,oBAAoB,CAAC,UAAU,WAAW;AAAA,EAC5C;A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AAM,aAAa,QAAQ,MAAM,GAAG;AACpC,SAAO;AAAA,IACL,MAAM,WAAW,CAAC;AAAA,IAClB,SAAS,WAAW,CAAC;AAAA,EACvB;AACF;AAEA,KAAK,EAAE,MAAM,CAAC,MAAM;AAClB,UAAQ,MAAM,CAAC;AACjB,CAAC;","names":["fs","path","fs"]}
|
package/package.json
CHANGED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"resources": {
|
|
4
|
+
"value": {
|
|
5
|
+
"value": "u32"
|
|
6
|
+
},
|
|
7
|
+
"counter2": {
|
|
8
|
+
"value": "u32",
|
|
9
|
+
"data": "u64",
|
|
10
|
+
"key": "String"
|
|
11
|
+
},
|
|
12
|
+
"counter2withkey": {
|
|
13
|
+
"value": "u32",
|
|
14
|
+
"key": "String",
|
|
15
|
+
"data": "u64"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"objects": {},
|
|
19
|
+
"scenes": {}
|
|
20
|
+
}
|
package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Obelisk Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
#[allow(unused_use)]
|
|
4
3
|
|
|
5
4
|
/* Autogenerated file. Do not edit manually. */
|
|
6
5
|
|
|
@@ -18,15 +17,15 @@ module counter::dapp_key {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
public fun to_string(): String {
|
|
21
|
-
type_name::
|
|
20
|
+
type_name::with_defining_ids<DappKey>().into_string()
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
public fun package_id(): address {
|
|
25
|
-
let package_id_str = type_name::
|
|
24
|
+
let package_id_str = type_name::with_defining_ids<DappKey>().address_string();
|
|
26
25
|
address::from_ascii_bytes(package_id_str.as_bytes())
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
public fun eq<DappKey1: copy + drop, DappKey2: copy + drop>(_: &DappKey1, _: &DappKey2): bool {
|
|
30
|
-
type_name::
|
|
29
|
+
type_name::with_defining_ids<DappKey1>() == type_name::with_defining_ids<DappKey2>()
|
|
31
30
|
}
|
|
32
31
|
}
|
package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move
CHANGED
|
@@ -12,7 +12,7 @@ module counter::genesis {
|
|
|
12
12
|
public fun run(dapp_hub: &mut DappHub, clock: &Clock, ctx: &mut TxContext) {
|
|
13
13
|
// create_dapp aborts with dapp_already_initialized_error on repeated calls.
|
|
14
14
|
let dapp_key = dapp_key::new();
|
|
15
|
-
let mut ds = dapp_system::create_dapp(dapp_key, dapp_hub, string(b"counter"), string(b"counter contract"), clock, ctx);
|
|
15
|
+
let mut ds = dapp_system::create_dapp(dapp_key, dapp_hub, string(b"counter"), string(b"counter contract"), 1, clock, ctx);
|
|
16
16
|
|
|
17
17
|
// Set up initial DApp state (e.g. default resource values).
|
|
18
18
|
counter::deploy_hook::run(&mut ds, ctx);
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Obelisk Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
#[allow(unused_use)]
|
|
4
3
|
|
|
5
4
|
/* Autogenerated file. Do not edit manually. */
|
|
6
5
|
|
|
7
6
|
module counter::counter2 {
|
|
8
7
|
use sui::bcs::{to_bytes};
|
|
9
8
|
use std::ascii::{string, String, into_bytes};
|
|
10
|
-
use dubhe::
|
|
11
|
-
use dubhe::dapp_service::{Self, UserStorage};
|
|
9
|
+
use dubhe::dapp_service::UserStorage;
|
|
12
10
|
use dubhe::dapp_system;
|
|
13
11
|
use counter::dapp_key;
|
|
14
12
|
use counter::dapp_key::DappKey;
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
// Copyright (c) Obelisk Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
#[allow(unused_use)]
|
|
4
3
|
|
|
5
4
|
/* Autogenerated file. Do not edit manually. */
|
|
6
5
|
|
|
7
6
|
module counter::counter2withkey {
|
|
8
7
|
use sui::bcs::{to_bytes};
|
|
9
|
-
use std::ascii::
|
|
10
|
-
use dubhe::
|
|
11
|
-
use dubhe::dapp_service::{Self, UserStorage};
|
|
8
|
+
use std::ascii::String;
|
|
9
|
+
use dubhe::dapp_service::UserStorage;
|
|
12
10
|
use dubhe::dapp_system;
|
|
13
11
|
use counter::dapp_key;
|
|
14
12
|
use counter::dapp_key::DappKey;
|
|
@@ -76,4 +74,17 @@ module counter::counter2withkey {
|
|
|
76
74
|
value_tuple.push_back(to_bytes(&value));
|
|
77
75
|
value_tuple
|
|
78
76
|
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
// ─── keys: mint (developer provides keys; framework ensures no duplicate) ─
|
|
80
|
+
// Choosing the ID strategy (fresh address, counter, coordinate pack, etc.)
|
|
81
|
+
// is intentionally left to the caller.
|
|
82
|
+
public(package) fun mint(
|
|
83
|
+
user_storage: &mut UserStorage,
|
|
84
|
+
data: u64, key: String, value: u32,
|
|
85
|
+
ctx: &mut TxContext,
|
|
86
|
+
) {
|
|
87
|
+
ensure_has_not(user_storage, data, key);
|
|
88
|
+
set(user_storage, data, key, value, ctx);
|
|
89
|
+
}
|
|
79
90
|
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Obelisk Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
#[allow(unused_use)]
|
|
4
3
|
|
|
5
4
|
/* Autogenerated file. Do not edit manually. */
|
|
6
5
|
|
|
7
6
|
module counter::value {
|
|
8
7
|
use sui::bcs::{to_bytes};
|
|
9
|
-
use
|
|
10
|
-
use dubhe::table_id;
|
|
11
|
-
use dubhe::dapp_service::{Self, UserStorage};
|
|
8
|
+
use dubhe::dapp_service::UserStorage;
|
|
12
9
|
use dubhe::dapp_system;
|
|
13
10
|
use counter::dapp_key;
|
|
14
11
|
use counter::dapp_key::DappKey;
|
package/templates/101/sui-template/packages/contracts/src/counter/sources/systems/counter.move
CHANGED
|
@@ -2,6 +2,7 @@ module counter::counter_system {
|
|
|
2
2
|
use dubhe::dapp_service::UserStorage;
|
|
3
3
|
use counter::value;
|
|
4
4
|
|
|
5
|
+
#[allow(lint(public_entry))]
|
|
5
6
|
public entry fun inc(user_storage: &mut UserStorage, ctx: &mut TxContext) {
|
|
6
7
|
let curr = if (value::has(user_storage)) {
|
|
7
8
|
value::get(user_storage)
|
|
@@ -10,4 +11,18 @@ module counter::counter_system {
|
|
|
10
11
|
};
|
|
11
12
|
value::set(user_storage, curr + 1, ctx);
|
|
12
13
|
}
|
|
14
|
+
|
|
15
|
+
/// Guard-only entry function used for testing ensure_latest_version and
|
|
16
|
+
/// ensure_not_paused enforcement. Performs no writes.
|
|
17
|
+
#[allow(lint(public_entry))]
|
|
18
|
+
public entry fun check_version_guard(
|
|
19
|
+
dapp_storage: &dubhe::dapp_service::DappStorage,
|
|
20
|
+
_ctx: &mut TxContext
|
|
21
|
+
) {
|
|
22
|
+
dubhe::dapp_system::ensure_latest_version<counter::dapp_key::DappKey>(
|
|
23
|
+
dapp_storage,
|
|
24
|
+
counter::migrate::on_chain_version()
|
|
25
|
+
);
|
|
26
|
+
dubhe::dapp_system::ensure_not_paused<counter::dapp_key::DappKey>(dapp_storage);
|
|
27
|
+
}
|
|
13
28
|
}
|
|
@@ -7,17 +7,17 @@ version = 4
|
|
|
7
7
|
[pinned.mainnet.Dubhe]
|
|
8
8
|
source = { root = true }
|
|
9
9
|
use_environment = "mainnet"
|
|
10
|
-
manifest_digest = "
|
|
10
|
+
manifest_digest = "2AF62652675929717F20B988B31D3936712B319F150E7B7E069948FF27B34E0E"
|
|
11
11
|
deps = { Sui = "Sui" }
|
|
12
12
|
|
|
13
13
|
[pinned.mainnet.MoveStdlib]
|
|
14
|
-
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "
|
|
14
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
15
15
|
use_environment = "mainnet"
|
|
16
16
|
manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
|
|
17
17
|
deps = {}
|
|
18
18
|
|
|
19
19
|
[pinned.mainnet.Sui]
|
|
20
|
-
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "
|
|
20
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
21
21
|
use_environment = "mainnet"
|
|
22
22
|
manifest_digest = "CD547CB1ACCE0880C835DAED2D8FFCB91D56C833AE5240D3AA5B918398263195"
|
|
23
23
|
deps = { MoveStdlib = "MoveStdlib" }
|
|
@@ -25,23 +25,23 @@ deps = { MoveStdlib = "MoveStdlib" }
|
|
|
25
25
|
[pinned.testnet.Dubhe]
|
|
26
26
|
source = { root = true }
|
|
27
27
|
use_environment = "testnet"
|
|
28
|
-
manifest_digest = "
|
|
28
|
+
manifest_digest = "B50A32218E466AACB70E7FB4A9B0991CFCF16B50B77AA0D5FBEC6A0730F28D67"
|
|
29
29
|
deps = { Sui = "Sui" }
|
|
30
30
|
|
|
31
31
|
[pinned.testnet.MoveStdlib]
|
|
32
|
-
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "
|
|
32
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/move-stdlib", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
33
33
|
use_environment = "testnet"
|
|
34
34
|
manifest_digest = "C4FE4C91DE74CBF223B2E380AE40F592177D21870DC2D7EB6227D2D694E05363"
|
|
35
35
|
deps = {}
|
|
36
36
|
|
|
37
37
|
[pinned.testnet.Sui]
|
|
38
|
-
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "
|
|
38
|
+
source = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "3c0f387ebb40b8be292d3b7bd3f5bee8ad226d33" }
|
|
39
39
|
use_environment = "testnet"
|
|
40
40
|
manifest_digest = "7AFB66695545775FBFBB2D3078ADFD084244D5002392E837FDE21D9EA1C6D01C"
|
|
41
41
|
deps = { MoveStdlib = "MoveStdlib" }
|
|
42
42
|
|
|
43
|
-
[env.
|
|
44
|
-
chain-id = "
|
|
45
|
-
original-published-id = "
|
|
46
|
-
latest-published-id = "
|
|
43
|
+
[env.mainnet]
|
|
44
|
+
chain-id = "35834a8a"
|
|
45
|
+
original-published-id = "0x1a79c1611ab49723b388510813553ad912d96a4f1a9ed5fdbdb57e446c6fe946"
|
|
46
|
+
latest-published-id = "0x1a79c1611ab49723b388510813553ad912d96a4f1a9ed5fdbdb57e446c6fe946"
|
|
47
47
|
published-version = "1"
|
|
@@ -4,15 +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
14
|
|
|
15
15
|
[environments]
|
|
16
16
|
testnet = "4c78adac"
|
|
17
17
|
mainnet = "35834a8a"
|
|
18
|
+
localnet = "d3e1a0e6"
|
|
18
19
|
|
package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Obelisk Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
#[allow(unused_use)]
|
|
4
3
|
|
|
5
4
|
/* Autogenerated file. Do not edit manually. */
|
|
6
5
|
|
|
@@ -18,15 +17,15 @@ module dubhe::dapp_key {
|
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
public fun to_string(): String {
|
|
21
|
-
type_name::
|
|
20
|
+
type_name::with_defining_ids<DappKey>().into_string()
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
public fun package_id(): address {
|
|
25
|
-
let package_id_str = type_name::
|
|
24
|
+
let package_id_str = type_name::with_defining_ids<DappKey>().address_string();
|
|
26
25
|
address::from_ascii_bytes(package_id_str.as_bytes())
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
public fun eq<DappKey1: copy + drop, DappKey2: copy + drop>(_: &DappKey1, _: &DappKey2): bool {
|
|
30
|
-
type_name::
|
|
29
|
+
type_name::with_defining_ids<DappKey1>() == type_name::with_defining_ids<DappKey2>()
|
|
31
30
|
}
|
|
32
31
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright (c) Obelisk Labs, Inc.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
#[allow(unused_use)]
|
|
4
3
|
|
|
5
4
|
/* Autogenerated file. Do not edit manually. */
|
|
6
5
|
|
|
@@ -72,4 +71,116 @@ module dubhe::error {
|
|
|
72
71
|
#[error]
|
|
73
72
|
const EInvalidSessionDuration: vector<u8> = b"Invalid session duration";
|
|
74
73
|
public fun invalid_session_duration(condition: bool) { assert!(condition, EInvalidSessionDuration) }
|
|
74
|
+
|
|
75
|
+
#[error]
|
|
76
|
+
const EWrongPaymentCoinType: vector<u8> = b"Wrong payment coin type";
|
|
77
|
+
public fun wrong_payment_coin_type(condition: bool) { assert!(condition, EWrongPaymentCoinType) }
|
|
78
|
+
|
|
79
|
+
#[error]
|
|
80
|
+
const ENoPendingCoinTypeChange: vector<u8> = b"No pending coin type change";
|
|
81
|
+
public fun no_pending_coin_type_change(condition: bool) { assert!(condition, ENoPendingCoinTypeChange) }
|
|
82
|
+
|
|
83
|
+
#[error]
|
|
84
|
+
const ECoinTypeChangeNotReady: vector<u8> = b"Coin type change not ready";
|
|
85
|
+
public fun coin_type_change_not_ready(condition: bool) { assert!(condition, ECoinTypeChangeNotReady) }
|
|
86
|
+
|
|
87
|
+
#[error]
|
|
88
|
+
const EWrongSettlementMode: vector<u8> = b"Wrong settlement mode";
|
|
89
|
+
public fun wrong_settlement_mode(condition: bool) { assert!(condition, EWrongSettlementMode) }
|
|
90
|
+
|
|
91
|
+
#[error]
|
|
92
|
+
const ERevenueShareExceedsMax: vector<u8> = b"Invalid revenue share bps";
|
|
93
|
+
public fun revenue_share_exceeds_max(condition: bool) { assert!(condition, ERevenueShareExceedsMax) }
|
|
94
|
+
|
|
95
|
+
#[error]
|
|
96
|
+
const ENoRevenueToWithdraw: vector<u8> = b"No revenue to withdraw";
|
|
97
|
+
public fun no_revenue_to_withdraw(condition: bool) { assert!(condition, ENoRevenueToWithdraw) }
|
|
98
|
+
|
|
99
|
+
#[error]
|
|
100
|
+
const ESceneExpired: vector<u8> = b"Scene has expired";
|
|
101
|
+
public fun scene_expired(condition: bool) { assert!(condition, ESceneExpired) }
|
|
102
|
+
|
|
103
|
+
#[error]
|
|
104
|
+
const ENotSceneParticipant: vector<u8> = b"Not a scene participant";
|
|
105
|
+
public fun not_scene_participant(condition: bool) { assert!(condition, ENotSceneParticipant) }
|
|
106
|
+
|
|
107
|
+
#[error]
|
|
108
|
+
const ENonceAlreadyUsed: vector<u8> = b"Nonce already used";
|
|
109
|
+
public fun nonce_already_used(condition: bool) { assert!(condition, ENonceAlreadyUsed) }
|
|
110
|
+
|
|
111
|
+
#[error]
|
|
112
|
+
const EInvalidConsentSignature: vector<u8> = b"Invalid consent signature";
|
|
113
|
+
public fun invalid_consent_signature(condition: bool) { assert!(condition, EInvalidConsentSignature) }
|
|
114
|
+
|
|
115
|
+
#[error]
|
|
116
|
+
const EEntityNotFound: vector<u8> = b"Entity not found";
|
|
117
|
+
public fun entity_not_found(condition: bool) { assert!(condition, EEntityNotFound) }
|
|
118
|
+
|
|
119
|
+
#[error]
|
|
120
|
+
const EEntityIdAlreadyExists: vector<u8> = b"Entity id already exists";
|
|
121
|
+
public fun entity_id_already_exists(condition: bool) { assert!(condition, EEntityIdAlreadyExists) }
|
|
122
|
+
|
|
123
|
+
#[error]
|
|
124
|
+
const EInsufficientBalance: vector<u8> = b"Insufficient balance";
|
|
125
|
+
public fun insufficient_balance(condition: bool) { assert!(condition, EInsufficientBalance) }
|
|
126
|
+
|
|
127
|
+
#[error]
|
|
128
|
+
const EParticipantsStillPresent: vector<u8> = b"Cannot destroy scene while participants are still present";
|
|
129
|
+
public fun participants_still_present(condition: bool) { assert!(condition, EParticipantsStillPresent) }
|
|
130
|
+
|
|
131
|
+
#[error]
|
|
132
|
+
const EWriteLimitOutOfRange: vector<u8> = b"Write limit out of range";
|
|
133
|
+
public fun write_limit_out_of_range(condition: bool) { assert!(condition, EWriteLimitOutOfRange) }
|
|
134
|
+
|
|
135
|
+
#[error]
|
|
136
|
+
const ESceneFull: vector<u8> = b"Scene has reached its maximum participant limit";
|
|
137
|
+
public fun scene_full(condition: bool) { assert!(condition, ESceneFull) }
|
|
138
|
+
|
|
139
|
+
#[error]
|
|
140
|
+
const EMarketplaceFeeExceedsMax: vector<u8> = b"Marketplace fee bps cannot exceed 10000";
|
|
141
|
+
public fun marketplace_fee_exceeds_max(condition: bool) { assert!(condition, EMarketplaceFeeExceedsMax) }
|
|
142
|
+
|
|
143
|
+
#[error]
|
|
144
|
+
const ENotParticipant: vector<u8> = b"Sender is not a participant or invitee";
|
|
145
|
+
public fun not_participant(condition: bool) { assert!(condition, ENotParticipant) }
|
|
146
|
+
|
|
147
|
+
#[error]
|
|
148
|
+
const EInvitationExpired: vector<u8> = b"Invitation window has expired";
|
|
149
|
+
public fun invitation_expired(condition: bool) { assert!(condition, EInvitationExpired) }
|
|
150
|
+
|
|
151
|
+
#[error]
|
|
152
|
+
const EInvalidKey: vector<u8> = b"Invalid record key";
|
|
153
|
+
public fun invalid_key(condition: bool) { assert!(condition, EInvalidKey) }
|
|
154
|
+
|
|
155
|
+
#[error]
|
|
156
|
+
const ELengthMismatch: vector<u8> = b"Field names and values length mismatch";
|
|
157
|
+
public fun length_mismatch(condition: bool) { assert!(condition, ELengthMismatch) }
|
|
158
|
+
|
|
159
|
+
#[error]
|
|
160
|
+
const EInvalidEvmAddress: vector<u8> = b"Invalid EVM address length";
|
|
161
|
+
public fun invalid_evm_address(condition: bool) { assert!(condition, EInvalidEvmAddress) }
|
|
162
|
+
|
|
163
|
+
#[error]
|
|
164
|
+
const EInvalidSolanaAddress: vector<u8> = b"Invalid Solana address length";
|
|
165
|
+
public fun invalid_solana_address(condition: bool) { assert!(condition, EInvalidSolanaAddress) }
|
|
166
|
+
|
|
167
|
+
#[error]
|
|
168
|
+
const EMathOverflow: vector<u8> = b"Arithmetic overflow";
|
|
169
|
+
public fun math_overflow(condition: bool) { assert!(condition, EMathOverflow) }
|
|
170
|
+
|
|
171
|
+
#[error]
|
|
172
|
+
const EDivisionByZero: vector<u8> = b"Division by zero";
|
|
173
|
+
public fun division_by_zero(condition: bool) { assert!(condition, EDivisionByZero) }
|
|
174
|
+
|
|
175
|
+
#[error]
|
|
176
|
+
const EInvalidWindowSize: vector<u8> = b"Window size must be greater than zero";
|
|
177
|
+
public fun invalid_window_size(condition: bool) { assert!(condition, EInvalidWindowSize) }
|
|
178
|
+
|
|
179
|
+
#[error]
|
|
180
|
+
const EInsufficientPayment: vector<u8> = b"Insufficient payment for listing price";
|
|
181
|
+
public fun insufficient_payment(condition: bool) { assert!(condition, EInsufficientPayment) }
|
|
182
|
+
|
|
183
|
+
#[error]
|
|
184
|
+
const EItemAlreadyOwned: vector<u8> = b"Buyer already owns an item with this key";
|
|
185
|
+
public fun item_already_owned(condition: bool) { assert!(condition, EItemAlreadyOwned) }
|
|
75
186
|
}
|
package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move
CHANGED
|
@@ -25,6 +25,6 @@ public struct AccountKey has copy, drop, store {
|
|
|
25
25
|
public(package) fun new_account_key<DappKey: copy + drop>(address: String): AccountKey {
|
|
26
26
|
AccountKey {
|
|
27
27
|
address: address,
|
|
28
|
-
package_id: type_name::
|
|
28
|
+
package_id: type_name::with_defining_ids<DappKey>().address_string(),
|
|
29
29
|
}
|
|
30
30
|
}
|