create-dubhe 1.2.0-pre.55 → 1.2.0-pre.56

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.
Files changed (138) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/cli.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/101/sui-template/packages/contracts/src/dubhe/Move.lock +0 -56
  5. package/templates/101/sui-template/packages/contracts/src/dubhe/Move.toml +0 -13
  6. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +0 -35
  7. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/account_status.move +0 -39
  8. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_status.move +0 -34
  9. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_type.move +0 -44
  10. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +0 -256
  11. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +0 -64
  12. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +0 -22
  13. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_account.move +0 -219
  14. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_metadata.move +0 -577
  15. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_pools.move +0 -320
  16. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/bridge_config.move +0 -222
  17. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/bridge_deposit.move +0 -236
  18. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/bridge_withdraw.move +0 -271
  19. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -208
  20. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -335
  21. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -470
  22. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_asset_id.move +0 -86
  23. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -283
  24. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/wrapper_assets.move +0 -102
  25. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +0 -237
  26. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +0 -188
  27. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/events.move +0 -58
  28. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/table_id.move +0 -37
  29. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/table_metadata.move +0 -56
  30. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +0 -65
  31. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +0 -8
  32. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/assets/assets.move +0 -452
  33. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/assets/functions.move +0 -163
  34. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/bridge.move +0 -63
  35. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +0 -339
  36. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dex/dex.move +0 -236
  37. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dex/functions.move +0 -276
  38. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dubhe.move +0 -52
  39. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/entity_id.move +0 -13
  40. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/gov.move +0 -54
  41. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/wrapper.move +0 -69
  42. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/assets.move +0 -462
  43. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/bridge.move +0 -55
  44. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/dex.move +0 -454
  45. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/math.move +0 -12
  46. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/wrapper.move +0 -50
  47. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/math.move +0 -128
  48. package/templates/101/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move +0 -39
  49. package/templates/contract/sui-template/src/dubhe/Move.lock +0 -56
  50. package/templates/contract/sui-template/src/dubhe/Move.toml +0 -13
  51. package/templates/contract/sui-template/src/dubhe/sources/codegen/dapp_key.move +0 -35
  52. package/templates/contract/sui-template/src/dubhe/sources/codegen/enums/account_status.move +0 -39
  53. package/templates/contract/sui-template/src/dubhe/sources/codegen/enums/asset_status.move +0 -34
  54. package/templates/contract/sui-template/src/dubhe/sources/codegen/enums/asset_type.move +0 -44
  55. package/templates/contract/sui-template/src/dubhe/sources/codegen/errors.move +0 -256
  56. package/templates/contract/sui-template/src/dubhe/sources/codegen/genesis.move +0 -64
  57. package/templates/contract/sui-template/src/dubhe/sources/codegen/init_test.move +0 -22
  58. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_account.move +0 -219
  59. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_metadata.move +0 -577
  60. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_pools.move +0 -320
  61. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/bridge_config.move +0 -222
  62. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/bridge_deposit.move +0 -236
  63. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/bridge_withdraw.move +0 -271
  64. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -208
  65. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -335
  66. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -470
  67. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dubhe_asset_id.move +0 -86
  68. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -283
  69. package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/wrapper_assets.move +0 -102
  70. package/templates/contract/sui-template/src/dubhe/sources/core/dapp_service.move +0 -237
  71. package/templates/contract/sui-template/src/dubhe/sources/core/dapp_store.move +0 -188
  72. package/templates/contract/sui-template/src/dubhe/sources/core/events.move +0 -58
  73. package/templates/contract/sui-template/src/dubhe/sources/core/table_id.move +0 -37
  74. package/templates/contract/sui-template/src/dubhe/sources/core/table_metadata.move +0 -56
  75. package/templates/contract/sui-template/src/dubhe/sources/scripts/deploy_hook.move +0 -65
  76. package/templates/contract/sui-template/src/dubhe/sources/scripts/migrate.move +0 -8
  77. package/templates/contract/sui-template/src/dubhe/sources/systems/assets/assets.move +0 -452
  78. package/templates/contract/sui-template/src/dubhe/sources/systems/assets/functions.move +0 -163
  79. package/templates/contract/sui-template/src/dubhe/sources/systems/bridge.move +0 -63
  80. package/templates/contract/sui-template/src/dubhe/sources/systems/dapp_system.move +0 -339
  81. package/templates/contract/sui-template/src/dubhe/sources/systems/dex/dex.move +0 -236
  82. package/templates/contract/sui-template/src/dubhe/sources/systems/dex/functions.move +0 -276
  83. package/templates/contract/sui-template/src/dubhe/sources/systems/dubhe.move +0 -52
  84. package/templates/contract/sui-template/src/dubhe/sources/systems/entity_id.move +0 -13
  85. package/templates/contract/sui-template/src/dubhe/sources/systems/gov.move +0 -54
  86. package/templates/contract/sui-template/src/dubhe/sources/systems/wrapper.move +0 -69
  87. package/templates/contract/sui-template/src/dubhe/sources/tests/assets.move +0 -462
  88. package/templates/contract/sui-template/src/dubhe/sources/tests/bridge.move +0 -55
  89. package/templates/contract/sui-template/src/dubhe/sources/tests/dex.move +0 -454
  90. package/templates/contract/sui-template/src/dubhe/sources/tests/math.move +0 -12
  91. package/templates/contract/sui-template/src/dubhe/sources/tests/wrapper.move +0 -50
  92. package/templates/contract/sui-template/src/dubhe/sources/utils/math.move +0 -128
  93. package/templates/contract/sui-template/src/dubhe/sources/utils/type_info.move +0 -39
  94. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.lock +0 -56
  95. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.toml +0 -13
  96. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +0 -35
  97. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/account_status.move +0 -39
  98. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_status.move +0 -34
  99. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_type.move +0 -44
  100. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +0 -256
  101. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +0 -64
  102. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +0 -22
  103. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_account.move +0 -219
  104. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_metadata.move +0 -577
  105. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_pools.move +0 -320
  106. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/bridge_config.move +0 -222
  107. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/bridge_deposit.move +0 -236
  108. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/bridge_withdraw.move +0 -271
  109. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +0 -208
  110. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +0 -335
  111. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +0 -470
  112. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_asset_id.move +0 -86
  113. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +0 -283
  114. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/wrapper_assets.move +0 -102
  115. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +0 -237
  116. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +0 -188
  117. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/events.move +0 -58
  118. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/table_id.move +0 -37
  119. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/table_metadata.move +0 -56
  120. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +0 -65
  121. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +0 -8
  122. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/assets/assets.move +0 -452
  123. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/assets/functions.move +0 -163
  124. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/bridge.move +0 -63
  125. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +0 -339
  126. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dex/dex.move +0 -236
  127. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dex/functions.move +0 -276
  128. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dubhe.move +0 -52
  129. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/entity_id.move +0 -13
  130. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/gov.move +0 -54
  131. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/wrapper.move +0 -69
  132. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/assets.move +0 -462
  133. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/bridge.move +0 -55
  134. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/dex.move +0 -454
  135. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/math.move +0 -12
  136. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/wrapper.move +0 -50
  137. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/utils/math.move +0 -128
  138. package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/utils/type_info.move +0 -39
package/dist/cli.js CHANGED
@@ -62,7 +62,7 @@ var CHAINS = [
62
62
  // package.json
63
63
  var package_default = {
64
64
  name: "create-dubhe",
65
- version: "1.2.0-pre.55",
65
+ version: "1.2.0-pre.56",
66
66
  type: "module",
67
67
  license: "MIT",
68
68
  author: "team@obelisk.build",
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 defaultTargetDir = 'dubhe-template-project';\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.55\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"team@obelisk.build\",\n \"bin\": \"bin/cli.js\",\n \"files\": [\n \"bin\",\n \"dist\",\n \"templates\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"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 \"copy-templates\": \"tsx ./scripts/copy-templates.ts\",\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 \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"type-check\": \"tsc --noEmit\",\n \"validate\": \"pnpm format:check && pnpm type-check\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/0xobelisk/dubhe.git\"\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/yargs-interactive\": \"^2.1.6\",\n \"@types/cross-spawn\": \"^6.0.2\",\n \"@types/minimist\": \"^1.2.2\",\n \"@types/prompts\": \"^2.4.3\",\n \"cross-spawn\": \"^7.0.3\",\n \"kolorist\": \"^1.7.0\",\n \"prompts\": \"^2.4.2\",\n \"tsc\": \"^2.0.4\",\n \"esmify\": \"^2.1.1\",\n \"browserify\": \"^17.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-prettier\": \"^9.1.0\",\n \"prettier\": \"3.3.3\"\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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,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 defaultTargetDir = 'dubhe-template-project';\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.56\",\n \"type\": \"module\",\n \"license\": \"MIT\",\n \"author\": \"team@obelisk.build\",\n \"bin\": \"bin/cli.js\",\n \"files\": [\n \"bin\",\n \"dist\",\n \"templates\"\n ],\n \"scripts\": {\n \"dev\": \"tsup --watch\",\n \"build\": \"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 \"copy-templates\": \"tsx ./scripts/copy-templates.ts\",\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 \"format\": \"prettier --write .\",\n \"format:check\": \"prettier --check .\",\n \"type-check\": \"tsc --noEmit\",\n \"validate\": \"pnpm format:check && pnpm type-check\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"engines\": {\n \"node\": \">=22.0.0\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/0xobelisk/dubhe.git\"\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/yargs-interactive\": \"^2.1.6\",\n \"@types/cross-spawn\": \"^6.0.2\",\n \"@types/minimist\": \"^1.2.2\",\n \"@types/prompts\": \"^2.4.3\",\n \"cross-spawn\": \"^7.0.3\",\n \"kolorist\": \"^1.7.0\",\n \"prompts\": \"^2.4.2\",\n \"tsc\": \"^2.0.4\",\n \"esmify\": \"^2.1.1\",\n \"browserify\": \"^17.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-prettier\": \"^9.1.0\",\n \"prettier\": \"3.3.3\"\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;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,oBAAoB,CAAC,UAAU,WAAW;AAAA,EAC5C;AAAA,EACA;AAAA,IACE,OAAO;AAAA,IACP,aAAa;AAAA,IACb,OAAO;AAAA,IACP,oBAAoB,CAAC,UAA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ED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-dubhe",
3
- "version": "1.2.0-pre.55",
3
+ "version": "1.2.0-pre.56",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": "team@obelisk.build",
@@ -1,56 +0,0 @@
1
- # @generated by Move, please check-in and do not edit manually.
2
-
3
- [move]
4
- version = 3
5
- manifest_digest = "F67D57D8267A12BCCF8A98B2566F9B6A8DF5853272672F0EACE1F23EDF0CEAFD"
6
- deps_digest = "F8BBB0CCB2491CA29A3DF03D6F92277A4F3574266507ACD77214D37ECA3F3082"
7
- dependencies = [
8
- { id = "Sui", name = "Sui" },
9
- ]
10
-
11
- [[move.package]]
12
- id = "MoveStdlib"
13
- source = { git = "https://github.com/MystenLabs/sui.git", rev = "mainnet-v1.46.3", subdir = "crates/sui-framework/packages/move-stdlib" }
14
-
15
- [[move.package]]
16
- id = "Sui"
17
- source = { git = "https://github.com/MystenLabs/sui.git", rev = "mainnet-v1.46.3", subdir = "crates/sui-framework/packages/sui-framework" }
18
-
19
- dependencies = [
20
- { id = "MoveStdlib", name = "MoveStdlib" },
21
- ]
22
-
23
- [move.toolchain-version]
24
- compiler-version = "1.40.1"
25
- edition = "2024"
26
- flavor = "sui"
27
-
28
-
29
- [env.testnet]
30
- chain-id = "4c78adac"
31
- original-published-id = "0xe2a38ae55a486bcaf79658cde76894207cada4d64d3cb1b2b06c6c12c10d5d5b"
32
- latest-published-id = "0xa6477a6bf50e2389383b34a76d59ccfbec766ff2decefe38e1d8436ef8a9b245"
33
- published-version = "3"
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50
-
51
-
52
- [env.localnet]
53
- chain-id = "7b439c64"
54
- original-published-id = "0x4727fa99ca6aa1f426572107ba49a39ee266a6e60d4891d1c8039fb76bfa423b"
55
- latest-published-id = "0x3fd12dfbd15beb9dfb34b01022cd86b55d35fca7a570dd3309635a2e37b5c8b1"
56
- published-version = "2"
@@ -1,13 +0,0 @@
1
- [package]
2
- name = "Dubhe"
3
- edition = "2024"
4
- version = "1.0.0"
5
- license = "apache2.0"
6
- authors = ["Obelisk Labs"]
7
-
8
- [dependencies]
9
- Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.46.3" }
10
-
11
- [addresses]
12
- dubhe = "0x1024"
13
-
@@ -1,35 +0,0 @@
1
- // Copyright (c) Obelisk Labs, Inc.
2
- // SPDX-License-Identifier: Apache-2.0
3
- #[allow(unused_use)]
4
-
5
- /* Autogenerated file. Do not edit manually. */
6
-
7
- module dubhe::dapp_key {
8
-
9
- use std::type_name;
10
-
11
- use sui::address;
12
-
13
- use std::ascii::String;
14
-
15
- /// Authorization token for the app.
16
-
17
- public struct DappKey has copy, drop {}
18
-
19
- public(package) fun new(): DappKey {
20
- DappKey { }
21
- }
22
-
23
- public fun to_string(): String {
24
- type_name::get<DappKey>().into_string()
25
- }
26
-
27
- public fun package_id(): address {
28
- let package_id_str = type_name::get<DappKey>().get_address();
29
- address::from_ascii_bytes(package_id_str.as_bytes())
30
- }
31
-
32
- public fun eq<DappKey1: copy + drop, DappKey2: copy + drop>(_: &DappKey1, _: &DappKey2): bool {
33
- type_name::get<DappKey1>() == type_name::get<DappKey2>()
34
- }
35
- }
@@ -1,39 +0,0 @@
1
- // Copyright (c) Obelisk Labs, Inc.
2
- // SPDX-License-Identifier: Apache-2.0
3
- #[allow(unused_use)]
4
-
5
- /* Autogenerated file. Do not edit manually. */
6
-
7
- module dubhe::account_status {
8
-
9
- use sui::bcs::{BCS, to_bytes, peel_enum_tag};
10
-
11
- public enum AccountStatus has copy, drop, store {
12
- Blocked,Frozen,Liquid
13
- }
14
-
15
- public fun new_blocked(): AccountStatus {
16
- AccountStatus::Blocked
17
- }
18
-
19
- public fun new_frozen(): AccountStatus {
20
- AccountStatus::Frozen
21
- }
22
-
23
- public fun new_liquid(): AccountStatus {
24
- AccountStatus::Liquid
25
- }
26
-
27
- public fun encode(self: AccountStatus): vector<u8> {
28
- to_bytes(&self)
29
- }
30
-
31
- public fun decode(bytes: &mut BCS): AccountStatus {
32
- match(peel_enum_tag(bytes)) {
33
- 0 => AccountStatus::Blocked,
34
- 1 => AccountStatus::Frozen,
35
- 2 => AccountStatus::Liquid,
36
- _ => abort,
37
- }
38
- }
39
- }
@@ -1,34 +0,0 @@
1
- // Copyright (c) Obelisk Labs, Inc.
2
- // SPDX-License-Identifier: Apache-2.0
3
- #[allow(unused_use)]
4
-
5
- /* Autogenerated file. Do not edit manually. */
6
-
7
- module dubhe::asset_status {
8
-
9
- use sui::bcs::{BCS, to_bytes, peel_enum_tag};
10
-
11
- public enum AssetStatus has copy, drop, store {
12
- Frozen,Liquid
13
- }
14
-
15
- public fun new_frozen(): AssetStatus {
16
- AssetStatus::Frozen
17
- }
18
-
19
- public fun new_liquid(): AssetStatus {
20
- AssetStatus::Liquid
21
- }
22
-
23
- public fun encode(self: AssetStatus): vector<u8> {
24
- to_bytes(&self)
25
- }
26
-
27
- public fun decode(bytes: &mut BCS): AssetStatus {
28
- match(peel_enum_tag(bytes)) {
29
- 0 => AssetStatus::Frozen,
30
- 1 => AssetStatus::Liquid,
31
- _ => abort,
32
- }
33
- }
34
- }
@@ -1,44 +0,0 @@
1
- // Copyright (c) Obelisk Labs, Inc.
2
- // SPDX-License-Identifier: Apache-2.0
3
- #[allow(unused_use)]
4
-
5
- /* Autogenerated file. Do not edit manually. */
6
-
7
- module dubhe::asset_type {
8
-
9
- use sui::bcs::{BCS, to_bytes, peel_enum_tag};
10
-
11
- public enum AssetType has copy, drop, store {
12
- Lp,Package,Private,Wrapped
13
- }
14
-
15
- public fun new_lp(): AssetType {
16
- AssetType::Lp
17
- }
18
-
19
- public fun new_package(): AssetType {
20
- AssetType::Package
21
- }
22
-
23
- public fun new_private(): AssetType {
24
- AssetType::Private
25
- }
26
-
27
- public fun new_wrapped(): AssetType {
28
- AssetType::Wrapped
29
- }
30
-
31
- public fun encode(self: AssetType): vector<u8> {
32
- to_bytes(&self)
33
- }
34
-
35
- public fun decode(bytes: &mut BCS): AssetType {
36
- match(peel_enum_tag(bytes)) {
37
- 0 => AssetType::Lp,
38
- 1 => AssetType::Package,
39
- 2 => AssetType::Private,
40
- 3 => AssetType::Wrapped,
41
- _ => abort,
42
- }
43
- }
44
- }
@@ -1,256 +0,0 @@
1
- // Copyright (c) Obelisk Labs, Inc.
2
- // SPDX-License-Identifier: Apache-2.0
3
- #[allow(unused_use)]
4
-
5
- /* Autogenerated file. Do not edit manually. */
6
-
7
- module dubhe::errors {
8
-
9
- #[error]
10
-
11
- const ASSET_NOT_FOUND: vector<u8> = b"Asset not found";
12
-
13
- public fun asset_not_found_error(condition: bool) {
14
- assert!(condition, ASSET_NOT_FOUND)
15
- }
16
-
17
- #[error]
18
-
19
- const ASSET_ALREADY_FROZEN: vector<u8> = b"Asset already frozen";
20
-
21
- public fun asset_already_frozen_error(condition: bool) {
22
- assert!(condition, ASSET_ALREADY_FROZEN)
23
- }
24
-
25
- #[error]
26
-
27
- const INVALID_SENDER: vector<u8> = b"Invalid sender";
28
-
29
- public fun invalid_sender_error(condition: bool) {
30
- assert!(condition, INVALID_SENDER)
31
- }
32
-
33
- #[error]
34
-
35
- const INVALID_RECEIVER: vector<u8> = b"Invalid receiver";
36
-
37
- public fun invalid_receiver_error(condition: bool) {
38
- assert!(condition, INVALID_RECEIVER)
39
- }
40
-
41
- #[error]
42
-
43
- const INVALID_METADATA: vector<u8> = b"Invalid metadata";
44
-
45
- public fun invalid_metadata_error(condition: bool) {
46
- assert!(condition, INVALID_METADATA)
47
- }
48
-
49
- #[error]
50
-
51
- const ACCOUNT_NOT_FOUND: vector<u8> = b"Account not found";
52
-
53
- public fun account_not_found_error(condition: bool) {
54
- assert!(condition, ACCOUNT_NOT_FOUND)
55
- }
56
-
57
- #[error]
58
-
59
- const ACCOUNT_BLOCKED: vector<u8> = b"Account is blocked";
60
-
61
- public fun account_blocked_error(condition: bool) {
62
- assert!(condition, ACCOUNT_BLOCKED)
63
- }
64
-
65
- #[error]
66
-
67
- const ACCOUNT_FROZEN: vector<u8> = b"Account is frozen";
68
-
69
- public fun account_frozen_error(condition: bool) {
70
- assert!(condition, ACCOUNT_FROZEN)
71
- }
72
-
73
- #[error]
74
-
75
- const BALANCE_TOO_LOW: vector<u8> = b"Balance too low";
76
-
77
- public fun balance_too_low_error(condition: bool) {
78
- assert!(condition, BALANCE_TOO_LOW)
79
- }
80
-
81
- #[error]
82
-
83
- const OVERFLOWS: vector<u8> = b"Operation overflows";
84
-
85
- public fun overflows_error(condition: bool) {
86
- assert!(condition, OVERFLOWS)
87
- }
88
-
89
- #[error]
90
-
91
- const NO_PERMISSION: vector<u8> = b"No permission";
92
-
93
- public fun no_permission_error(condition: bool) {
94
- assert!(condition, NO_PERMISSION)
95
- }
96
-
97
- #[error]
98
-
99
- const NOT_MINTABLE: vector<u8> = b"Asset is not mintable";
100
-
101
- public fun not_mintable_error(condition: bool) {
102
- assert!(condition, NOT_MINTABLE)
103
- }
104
-
105
- #[error]
106
-
107
- const NOT_BURNABLE: vector<u8> = b"Asset is not burnable";
108
-
109
- public fun not_burnable_error(condition: bool) {
110
- assert!(condition, NOT_BURNABLE)
111
- }
112
-
113
- #[error]
114
-
115
- const NOT_FREEZABLE: vector<u8> = b"Asset is not freezable";
116
-
117
- public fun not_freezable_error(condition: bool) {
118
- assert!(condition, NOT_FREEZABLE)
119
- }
120
-
121
- #[error]
122
-
123
- const BELOW_MIN_AMOUNT: vector<u8> = b"Amount is below minimum";
124
-
125
- public fun below_min_amount_error(condition: bool) {
126
- assert!(condition, BELOW_MIN_AMOUNT)
127
- }
128
-
129
- #[error]
130
-
131
- const LIQUIDITY_CANNOT_BE_ZERO: vector<u8> = b"Liquidity cannot be 0";
132
-
133
- public fun liquidity_cannot_be_zero_error(condition: bool) {
134
- assert!(condition, LIQUIDITY_CANNOT_BE_ZERO)
135
- }
136
-
137
- #[error]
138
-
139
- const MORE_THAN_MAX_SWAP_PATH_LEN: vector<u8> = b"More than Max";
140
-
141
- public fun more_than_max_swap_path_len_error(condition: bool) {
142
- assert!(condition, MORE_THAN_MAX_SWAP_PATH_LEN)
143
- }
144
-
145
- #[error]
146
-
147
- const MORE_THAN_RESERVE: vector<u8> = b"More than reserve";
148
-
149
- public fun more_than_reserve_error(condition: bool) {
150
- assert!(condition, MORE_THAN_RESERVE)
151
- }
152
-
153
- #[error]
154
-
155
- const SWAP_PATH_TOO_SMALL: vector<u8> = b"Swap path too small";
156
-
157
- public fun swap_path_too_small_error(condition: bool) {
158
- assert!(condition, SWAP_PATH_TOO_SMALL)
159
- }
160
-
161
- #[error]
162
-
163
- const RESERVES_CANNOT_BE_ZERO: vector<u8> = b"Reserve cannot be 0";
164
-
165
- public fun reserves_cannot_be_zero_error(condition: bool) {
166
- assert!(condition, RESERVES_CANNOT_BE_ZERO)
167
- }
168
-
169
- #[error]
170
-
171
- const AMOUNT_CANNOT_BE_ZERO: vector<u8> = b"Amount cannot be 0";
172
-
173
- public fun amount_cannot_be_zero_error(condition: bool) {
174
- assert!(condition, AMOUNT_CANNOT_BE_ZERO)
175
- }
176
-
177
- #[error]
178
-
179
- const LESS_THAN_AMOUNT_OUT_MIN: vector<u8> = b"Less than expected";
180
-
181
- public fun less_than_amount_out_min_error(condition: bool) {
182
- assert!(condition, LESS_THAN_AMOUNT_OUT_MIN)
183
- }
184
-
185
- #[error]
186
-
187
- const MORE_THAN_AMOUNT_IN_MAX: vector<u8> = b"More than expected";
188
-
189
- public fun more_than_amount_in_max_error(condition: bool) {
190
- assert!(condition, MORE_THAN_AMOUNT_IN_MAX)
191
- }
192
-
193
- #[error]
194
-
195
- const BRIDGE_NOT_OPENED: vector<u8> = b"Bridge is not opened";
196
-
197
- public fun bridge_not_opened_error(condition: bool) {
198
- assert!(condition, BRIDGE_NOT_OPENED)
199
- }
200
-
201
- #[error]
202
-
203
- const NOT_LATEST_VERSION: vector<u8> = b"Not latest version";
204
-
205
- public fun not_latest_version_error(condition: bool) {
206
- assert!(condition, NOT_LATEST_VERSION)
207
- }
208
-
209
- #[error]
210
-
211
- const DAPP_ALREADY_PAUSED: vector<u8> = b"Dapp already paused";
212
-
213
- public fun dapp_already_paused_error(condition: bool) {
214
- assert!(condition, DAPP_ALREADY_PAUSED)
215
- }
216
-
217
- #[error]
218
-
219
- const INVALID_PACKAGE_ID: vector<u8> = b"Invalid package id";
220
-
221
- public fun invalid_package_id_error(condition: bool) {
222
- assert!(condition, INVALID_PACKAGE_ID)
223
- }
224
-
225
- #[error]
226
-
227
- const INVALID_VERSION: vector<u8> = b"Invalid version";
228
-
229
- public fun invalid_version_error(condition: bool) {
230
- assert!(condition, INVALID_VERSION)
231
- }
232
-
233
- #[error]
234
-
235
- const DAPP_NOT_INITIALIZED: vector<u8> = b"Dapp not initialized";
236
-
237
- public fun dapp_not_initialized_error(condition: bool) {
238
- assert!(condition, DAPP_NOT_INITIALIZED)
239
- }
240
-
241
- #[error]
242
-
243
- const DAPP_ALREADY_INITIALIZED: vector<u8> = b"Dapp already initialized";
244
-
245
- public fun dapp_already_initialized_error(condition: bool) {
246
- assert!(condition, DAPP_ALREADY_INITIALIZED)
247
- }
248
-
249
- #[error]
250
-
251
- const INSUFFICIENT_CREDIT: vector<u8> = b"Insufficient credit";
252
-
253
- public fun insufficient_credit_error(condition: bool) {
254
- assert!(condition, INSUFFICIENT_CREDIT)
255
- }
256
- }
@@ -1,64 +0,0 @@
1
- #[allow(lint(share_owned))]module dubhe::genesis {
2
-
3
- use sui::clock::Clock;
4
-
5
- use dubhe::dapp_service::DappHub;
6
-
7
- use dubhe::dapp_key;
8
-
9
- use dubhe::dapp_system;
10
-
11
- use dubhe::dubhe_asset_id;
12
-
13
- use dubhe::dubhe_config;
14
-
15
- use dubhe::asset_metadata;
16
-
17
- use dubhe::asset_account;
18
-
19
- use dubhe::asset_pools;
20
-
21
- use dubhe::bridge_config;
22
-
23
- use dubhe::bridge_withdraw;
24
-
25
- use dubhe::bridge_deposit;
26
-
27
- use dubhe::wrapper_assets;
28
-
29
- use dubhe::dapp_metadata;
30
-
31
- use dubhe::dapp_fee_config;
32
-
33
- use dubhe::dapp_fee_state;
34
-
35
- public entry fun run(dapp_hub: &mut DappHub, clock: &Clock, ctx: &mut TxContext) {
36
- // Create Dapp
37
- let dapp_key = dapp_key::new();
38
- dapp_system::create_dapp(dapp_hub, dapp_key, b"dubhe", b"Dubhe Protocol", clock, ctx);
39
- // Register tables
40
- dubhe_asset_id::register_table(dapp_hub, ctx);
41
- dubhe_config::register_table(dapp_hub, ctx);
42
- asset_metadata::register_table(dapp_hub, ctx);
43
- asset_account::register_table(dapp_hub, ctx);
44
- asset_pools::register_table(dapp_hub, ctx);
45
- bridge_config::register_table(dapp_hub, ctx);
46
- bridge_withdraw::register_table(dapp_hub, ctx);
47
- bridge_deposit::register_table(dapp_hub, ctx);
48
- wrapper_assets::register_table(dapp_hub, ctx);
49
- dapp_metadata::register_table(dapp_hub, ctx);
50
- dapp_fee_config::register_table(dapp_hub, ctx);
51
- dapp_fee_state::register_table(dapp_hub, ctx);
52
- // Logic that needs to be automated once the contract is deployed
53
- dubhe::deploy_hook::run(dapp_hub, ctx);
54
- }
55
-
56
- public(package) fun upgrade(dapp_hub: &mut DappHub, new_package_id: address, new_version: u32, ctx: &mut TxContext) {
57
- // Upgrade Dapp
58
- let dapp_key = dapp_key::new();
59
- dapp_system::upgrade_dapp(dapp_hub, dapp_key, new_package_id, new_version, ctx);
60
- // Register new tables
61
- // ==========================================
62
- // ==========================================
63
- }
64
- }
@@ -1,22 +0,0 @@
1
- #[test_only]module dubhe::init_test {
2
-
3
- use sui::clock;
4
-
5
- use sui::test_scenario;
6
-
7
- use sui::test_scenario::Scenario;
8
-
9
- use dubhe::dapp_service::DappHub;
10
-
11
- use dubhe::dapp_system;
12
-
13
- public fun deploy_dapp_for_testing(scenario: &mut Scenario): DappHub {
14
- let ctx = test_scenario::ctx(scenario);
15
- let clock = clock::create_for_testing(ctx);
16
- let mut dapp_hub = dapp_system::create_dapp_hub_for_testing(ctx);
17
- dubhe::genesis::run(&mut dapp_hub, &clock, ctx);
18
- clock::destroy_for_testing(clock);
19
- test_scenario::next_tx(scenario, ctx.sender());
20
- dapp_hub
21
- }
22
- }