create-dubhe 1.2.0-pre.93 → 1.2.0-pre.95
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/aptos-template/package.json +2 -2
- package/templates/101/initia-template/package.json +2 -2
- package/templates/101/movement-template/package.json +2 -2
- package/templates/101/rooch-template/package.json +2 -2
- package/templates/101/sui-template/package.json +2 -2
- package/templates/101/sui-template/packages/client/package.json +2 -2
- package/templates/101/sui-template/packages/contracts/dubhe.config.json +5 -35
- package/templates/101/sui-template/packages/contracts/dubhe.config.ts +2 -9
- package/templates/101/sui-template/packages/contracts/metadata.json +88 -632
- package/templates/101/sui-template/packages/contracts/src/counter/Move.lock +13 -3
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/dapp_key.move +1 -4
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/errors.move +5 -9
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/genesis.move +6 -29
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/init_test.move +0 -5
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/value.move +54 -0
- package/templates/101/sui-template/packages/contracts/src/counter/sources/scripts/deploy_hook.move +5 -1
- package/templates/101/sui-template/packages/contracts/src/counter/sources/scripts/migrate.move +4 -5
- package/templates/101/sui-template/packages/contracts/src/counter/sources/systems/counter.move +8 -12
- package/templates/101/sui-template/packages/contracts/src/counter/sources/tests/counter.move +6 -7
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.lock +10 -4
- package/templates/101/sui-template/packages/contracts/src/dubhe/Move.toml +2 -2
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +1 -4
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +133 -265
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +6 -78
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +1 -5
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +172 -206
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +284 -362
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +368 -458
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +228 -277
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +32 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +127 -152
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +29 -198
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/data_key.move +26 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/core/events.move +16 -16
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +1 -48
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +1 -9
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +3 -7
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +77 -124
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/session_system.move +44 -0
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/address.move +47 -47
- package/templates/contract/sui-template/src/dubhe/Move.lock +10 -4
- package/templates/contract/sui-template/src/dubhe/Move.toml +2 -2
- package/templates/contract/sui-template/src/dubhe/sources/codegen/dapp_key.move +1 -4
- package/templates/contract/sui-template/src/dubhe/sources/codegen/errors.move +133 -265
- package/templates/contract/sui-template/src/dubhe/sources/codegen/genesis.move +6 -78
- package/templates/contract/sui-template/src/dubhe/sources/codegen/init_test.move +1 -5
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_config.move +172 -206
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_fee_state.move +284 -362
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_metadata.move +368 -458
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dubhe_config.move +228 -277
- package/templates/contract/sui-template/src/dubhe/sources/core/account_key.move +32 -0
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_service.move +127 -152
- package/templates/contract/sui-template/src/dubhe/sources/core/dapp_store.move +29 -198
- package/templates/contract/sui-template/src/dubhe/sources/core/data_key.move +26 -0
- package/templates/contract/sui-template/src/dubhe/sources/core/events.move +16 -16
- package/templates/contract/sui-template/src/dubhe/sources/scripts/deploy_hook.move +1 -48
- package/templates/contract/sui-template/src/dubhe/sources/scripts/migrate.move +1 -9
- package/templates/contract/sui-template/src/dubhe/sources/systems/address_system.move +3 -7
- package/templates/contract/sui-template/src/dubhe/sources/systems/dapp_system.move +77 -124
- package/templates/contract/sui-template/src/dubhe/sources/systems/session_system.move +44 -0
- package/templates/contract/sui-template/src/dubhe/sources/tests/address.move +47 -47
- package/templates/nextjs/aptos-template/package.json +2 -2
- package/templates/nextjs/sui-template/package.json +2 -2
- package/templates/nextjs/sui-template/packages/client/package.json +2 -2
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.lock +10 -4
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/Move.toml +2 -2
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/dapp_key.move +1 -4
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/errors.move +133 -265
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/genesis.move +6 -78
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/init_test.move +1 -5
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_config.move +172 -206
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_fee_state.move +284 -362
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_metadata.move +368 -458
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_config.move +228 -277
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/account_key.move +32 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_service.move +127 -152
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/dapp_store.move +29 -198
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/data_key.move +26 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/core/events.move +16 -16
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/deploy_hook.move +1 -48
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/scripts/migrate.move +1 -9
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/address_system.move +3 -7
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dapp_system.move +77 -124
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/session_system.move +44 -0
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/address.move +47 -47
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/components/counter0.move +0 -99
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/components/counter1.move +0 -106
- package/templates/101/sui-template/packages/contracts/src/counter/sources/codegen/resources/counter2.move +0 -108
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/account_status.move +0 -39
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_status.move +0 -34
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_type.move +0 -44
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_account.move +0 -235
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_add_liquidity.move +0 -185
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_holder.move +0 -118
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_metadata.move +0 -527
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_pool.move +0 -336
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_remove_liquidity.move +0 -185
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_supply.move +0 -118
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_swap.move +0 -185
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_transfer.move +0 -141
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_unwrap.move +0 -165
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_wrap.move +0 -165
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_wrapper.move +0 -118
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_proxy.move +0 -208
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_asset_id.move +0 -98
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/sui_asset_id.move +0 -98
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/assets/assets.move +0 -453
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/assets/functions.move +0 -125
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dex/dex.move +0 -241
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/dex/functions.move +0 -281
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/gov.move +0 -49
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/systems/wrapper.move +0 -73
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/assets.move +0 -463
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/dex.move +0 -458
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/math.move +0 -12
- package/templates/101/sui-template/packages/contracts/src/dubhe/sources/tests/wrapper.move +0 -63
- package/templates/contract/sui-template/src/dubhe/sources/codegen/enums/account_status.move +0 -39
- package/templates/contract/sui-template/src/dubhe/sources/codegen/enums/asset_status.move +0 -34
- package/templates/contract/sui-template/src/dubhe/sources/codegen/enums/asset_type.move +0 -44
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_account.move +0 -235
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_add_liquidity.move +0 -185
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_holder.move +0 -118
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_metadata.move +0 -527
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_pool.move +0 -336
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_remove_liquidity.move +0 -185
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_supply.move +0 -118
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_swap.move +0 -185
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_transfer.move +0 -141
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_unwrap.move +0 -165
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_wrap.move +0 -165
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/asset_wrapper.move +0 -118
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dapp_proxy.move +0 -208
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/dubhe_asset_id.move +0 -98
- package/templates/contract/sui-template/src/dubhe/sources/codegen/resources/sui_asset_id.move +0 -98
- package/templates/contract/sui-template/src/dubhe/sources/systems/assets/assets.move +0 -453
- package/templates/contract/sui-template/src/dubhe/sources/systems/assets/functions.move +0 -125
- package/templates/contract/sui-template/src/dubhe/sources/systems/dex/dex.move +0 -241
- package/templates/contract/sui-template/src/dubhe/sources/systems/dex/functions.move +0 -281
- package/templates/contract/sui-template/src/dubhe/sources/systems/gov.move +0 -49
- package/templates/contract/sui-template/src/dubhe/sources/systems/wrapper.move +0 -73
- package/templates/contract/sui-template/src/dubhe/sources/tests/assets.move +0 -463
- package/templates/contract/sui-template/src/dubhe/sources/tests/dex.move +0 -458
- package/templates/contract/sui-template/src/dubhe/sources/tests/math.move +0 -12
- package/templates/contract/sui-template/src/dubhe/sources/tests/wrapper.move +0 -63
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/account_status.move +0 -39
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_status.move +0 -34
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/enums/asset_type.move +0 -44
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_account.move +0 -235
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_add_liquidity.move +0 -185
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_holder.move +0 -118
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_metadata.move +0 -527
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_pool.move +0 -336
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_remove_liquidity.move +0 -185
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_supply.move +0 -118
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_swap.move +0 -185
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_transfer.move +0 -141
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_unwrap.move +0 -165
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_wrap.move +0 -165
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/asset_wrapper.move +0 -118
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dapp_proxy.move +0 -208
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/dubhe_asset_id.move +0 -98
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/codegen/resources/sui_asset_id.move +0 -98
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/assets/assets.move +0 -453
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/assets/functions.move +0 -125
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dex/dex.move +0 -241
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/dex/functions.move +0 -281
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/gov.move +0 -49
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/systems/wrapper.move +0 -73
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/assets.move +0 -463
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/dex.move +0 -458
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/math.move +0 -12
- package/templates/nextjs/sui-template/packages/contracts/src/dubhe/sources/tests/wrapper.move +0 -63
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.93\",\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,oBA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,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.95\",\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;AAAA,EACA;AAAA,IACE,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AM,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
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dotenv": "^16.4.5",
|
|
40
40
|
"framer-motion": "^10.12.16",
|
|
41
41
|
"jotai": "^1.7.2",
|
|
42
|
-
"next": "^12.
|
|
42
|
+
"next": "^12.3.5",
|
|
43
43
|
"next-i18next": "^11.0.0",
|
|
44
44
|
"react": "18.1.0",
|
|
45
45
|
"react-dom": "18.1.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@types/react-dom": "18.2.4",
|
|
64
64
|
"autoprefixer": "^10.4.14",
|
|
65
65
|
"eslint": "^9.0.0",
|
|
66
|
-
"eslint-config-next": "13.
|
|
66
|
+
"eslint-config-next": "13.5.9",
|
|
67
67
|
"eslint-config-prettier": "^9.1.0",
|
|
68
68
|
"jest": "^29.5.0",
|
|
69
69
|
"jest-css-modules-transform": "^4.4.2",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dotenv": "^16.4.5",
|
|
40
40
|
"framer-motion": "^10.12.16",
|
|
41
41
|
"jotai": "^1.7.2",
|
|
42
|
-
"next": "^12.
|
|
42
|
+
"next": "^12.3.5",
|
|
43
43
|
"next-i18next": "^11.0.0",
|
|
44
44
|
"react": "18.1.0",
|
|
45
45
|
"react-dom": "18.1.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@types/react-dom": "18.2.4",
|
|
64
64
|
"autoprefixer": "^10.4.14",
|
|
65
65
|
"eslint": "^9.0.0",
|
|
66
|
-
"eslint-config-next": "13.
|
|
66
|
+
"eslint-config-next": "13.5.9",
|
|
67
67
|
"eslint-config-prettier": "^9.1.0",
|
|
68
68
|
"jest": "^29.5.0",
|
|
69
69
|
"jest-css-modules-transform": "^4.4.2",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"dotenv": "^16.4.5",
|
|
40
40
|
"framer-motion": "^10.12.16",
|
|
41
41
|
"jotai": "^1.7.2",
|
|
42
|
-
"next": "^12.
|
|
42
|
+
"next": "^12.3.5",
|
|
43
43
|
"next-i18next": "^11.0.0",
|
|
44
44
|
"react": "18.1.0",
|
|
45
45
|
"react-dom": "18.1.0",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"@types/react-dom": "18.2.4",
|
|
64
64
|
"autoprefixer": "^10.4.14",
|
|
65
65
|
"eslint": "^9.0.0",
|
|
66
|
-
"eslint-config-next": "13.
|
|
66
|
+
"eslint-config-next": "13.5.9",
|
|
67
67
|
"eslint-config-prettier": "^9.1.0",
|
|
68
68
|
"jest": "^29.5.0",
|
|
69
69
|
"jest-css-modules-transform": "^4.4.2",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dotenv": "^16.4.5",
|
|
39
39
|
"framer-motion": "^10.12.16",
|
|
40
40
|
"jotai": "^1.7.2",
|
|
41
|
-
"next": "^12.
|
|
41
|
+
"next": "^12.3.5",
|
|
42
42
|
"next-i18next": "^11.0.0",
|
|
43
43
|
"react": "18.1.0",
|
|
44
44
|
"react-dom": "18.1.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"@types/react-dom": "18.2.4",
|
|
63
63
|
"autoprefixer": "^10.4.14",
|
|
64
64
|
"eslint": "^9.0.0",
|
|
65
|
-
"eslint-config-next": "13.
|
|
65
|
+
"eslint-config-next": "13.5.9",
|
|
66
66
|
"eslint-config-prettier": "^9.1.0",
|
|
67
67
|
"jest": "^29.5.0",
|
|
68
68
|
"jest-css-modules-transform": "^4.4.2",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@0xobelisk/sui-common": "{{dubhe-version}}",
|
|
17
17
|
"dotenv": "^16.4.5",
|
|
18
18
|
"jotai": "^1.7.2",
|
|
19
|
-
"next": "15.
|
|
19
|
+
"next": "15.2.3",
|
|
20
20
|
"react": "^19.0.0",
|
|
21
21
|
"react-dom": "^19.0.0",
|
|
22
22
|
"sonner": "^1.5.0",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@types/react": "^19",
|
|
29
29
|
"@types/react-dom": "^19",
|
|
30
30
|
"eslint": "^9.0.0",
|
|
31
|
-
"eslint-config-next": "15.
|
|
31
|
+
"eslint-config-next": "15.2.3",
|
|
32
32
|
"eslint-config-prettier": "^9.1.0",
|
|
33
33
|
"mprocs": "^0.7.1",
|
|
34
34
|
"postcss": "^8",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"contracts": "workspace:*",
|
|
31
31
|
"dotenv": "^16.4.5",
|
|
32
32
|
"jotai": "^1.7.2",
|
|
33
|
-
"next": "15.
|
|
33
|
+
"next": "15.2.3",
|
|
34
34
|
"react": "^19.0.0",
|
|
35
35
|
"react-dom": "^19.0.0",
|
|
36
36
|
"sonner": "^1.5.0",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"@types/react": "^19",
|
|
43
43
|
"@types/react-dom": "^19",
|
|
44
44
|
"eslint": "^8.56.0",
|
|
45
|
-
"eslint-config-next": "15.
|
|
45
|
+
"eslint-config-next": "15.2.3",
|
|
46
46
|
"eslint-config-prettier": "^9.1.0",
|
|
47
47
|
"mprocs": "^0.7.1",
|
|
48
48
|
"postcss": "^8",
|
|
@@ -1,35 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"components": [
|
|
3
|
-
{
|
|
4
|
-
"counter0": {
|
|
5
|
-
"fields": [
|
|
6
|
-
{
|
|
7
|
-
"entity_id": "address"
|
|
8
|
-
}
|
|
9
|
-
],
|
|
10
|
-
"keys": [
|
|
11
|
-
"entity_id"
|
|
12
|
-
],
|
|
13
|
-
"offchain": false
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
"counter1": {
|
|
18
|
-
"fields": [
|
|
19
|
-
{
|
|
20
|
-
"entity_id": "address"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"value": "u32"
|
|
24
|
-
}
|
|
25
|
-
],
|
|
26
|
-
"keys": [
|
|
27
|
-
"entity_id"
|
|
28
|
-
],
|
|
29
|
-
"offchain": false
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
],
|
|
2
|
+
"components": [],
|
|
33
3
|
"resources": [
|
|
34
4
|
{
|
|
35
5
|
"counter2": {
|
|
@@ -75,8 +45,8 @@
|
|
|
75
45
|
}
|
|
76
46
|
],
|
|
77
47
|
"enums": [],
|
|
78
|
-
"original_package_id": "
|
|
79
|
-
"dubhe_object_id": "
|
|
80
|
-
"original_dubhe_package_id": "
|
|
81
|
-
"start_checkpoint": "
|
|
48
|
+
"original_package_id": "0x558d5e67b2860437ddfc25079543e917265fce376d6cafcde98dafd3ec6df992",
|
|
49
|
+
"dubhe_object_id": "0xdee56ac5c401c32aec8d36dc853371e8cfa66b510bcfd8ceb9c09bea18e33e26",
|
|
50
|
+
"original_dubhe_package_id": "0x952ef83ba1f48c6bedd8388db7a21da50c441b754b16491e33a63d87e70ea3bb",
|
|
51
|
+
"start_checkpoint": "181"
|
|
82
52
|
}
|
|
@@ -3,16 +3,9 @@ import { defineConfig } from '@0xobelisk/sui-common';
|
|
|
3
3
|
export const dubheConfig = defineConfig({
|
|
4
4
|
name: 'counter',
|
|
5
5
|
description: 'counter contract',
|
|
6
|
-
components: {
|
|
7
|
-
counter0: {},
|
|
8
|
-
counter1: 'u32'
|
|
9
|
-
},
|
|
6
|
+
components: {},
|
|
10
7
|
resources: {
|
|
11
|
-
|
|
12
|
-
fields: {
|
|
13
|
-
value: 'u32'
|
|
14
|
-
}
|
|
15
|
-
}
|
|
8
|
+
value: 'u32'
|
|
16
9
|
},
|
|
17
10
|
errors: {
|
|
18
11
|
invalid_increment: "Number can't be incremented, must be more than 0"
|