create-dubhe 0.0.1
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/LICENSE +21 -0
- package/README.md +9 -0
- package/dist/index.mjs +100 -0
- package/index.js +3 -0
- package/package.json +46 -0
- package/template/101/aptos-template/.dockerignore +7 -0
- package/template/101/aptos-template/.eslintrc.json +3 -0
- package/template/101/aptos-template/.prettierrc +8 -0
- package/template/101/aptos-template/Dockerfile +56 -0
- package/template/101/aptos-template/LICENSE +674 -0
- package/template/101/aptos-template/README.md +14 -0
- package/template/101/aptos-template/contracts/counter/Move.toml +16 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
- package/template/101/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
- package/template/101/aptos-template/contracts/counter/sources/entity_key.move +31 -0
- package/template/101/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
- package/template/101/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
- package/template/101/aptos-template/dubhe.config.ts +13 -0
- package/template/101/aptos-template/jest.config.ts +17 -0
- package/template/101/aptos-template/next-env.d.ts +5 -0
- package/template/101/aptos-template/next-i18next.config.js +6 -0
- package/template/101/aptos-template/next.config.js +15 -0
- package/template/101/aptos-template/package.json +83 -0
- package/template/101/aptos-template/postcss.config.js +6 -0
- package/template/101/aptos-template/public/discord.svg +9 -0
- package/template/101/aptos-template/public/fail.svg +12 -0
- package/template/101/aptos-template/public/favicon.ico +0 -0
- package/template/101/aptos-template/public/locales/de/common.json +8 -0
- package/template/101/aptos-template/public/locales/de/footer.json +3 -0
- package/template/101/aptos-template/public/locales/de/second-page.json +5 -0
- package/template/101/aptos-template/public/locales/en/common.json +8 -0
- package/template/101/aptos-template/public/locales/en/footer.json +3 -0
- package/template/101/aptos-template/public/locales/en/second-page.json +5 -0
- package/template/101/aptos-template/public/locales/zn/common.json +8 -0
- package/template/101/aptos-template/public/locales/zn/footer.json +3 -0
- package/template/101/aptos-template/public/locales/zn/second-page.json +5 -0
- package/template/101/aptos-template/public/logo.svg +1 -0
- package/template/101/aptos-template/public/medium.svg +9 -0
- package/template/101/aptos-template/public/successful.svg +11 -0
- package/template/101/aptos-template/public/telegram.svg +9 -0
- package/template/101/aptos-template/public/twitter.svg +9 -0
- package/template/101/aptos-template/scripts/formatAccount.ts +35 -0
- package/template/101/aptos-template/scripts/generateAccount.ts +25 -0
- package/template/101/aptos-template/scripts/storeConfig.ts +54 -0
- package/template/101/aptos-template/src/chain/config.ts +7 -0
- package/template/101/aptos-template/src/css/font-awesome.css +2337 -0
- package/template/101/aptos-template/src/css/font-awesome.min.css +4 -0
- package/template/101/aptos-template/src/fonts/FontAwesome.otf +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/101/aptos-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/101/aptos-template/src/jotai/index.tsx +12 -0
- package/template/101/aptos-template/src/pages/_app.tsx +9 -0
- package/template/101/aptos-template/src/pages/home/index.tsx +78 -0
- package/template/101/aptos-template/src/pages/index.tsx +12 -0
- package/template/101/aptos-template/tailwind.config.js +56 -0
- package/template/101/aptos-template/tsconfig.json +25 -0
- package/template/101/sui-template/.dockerignore +7 -0
- package/template/101/sui-template/.eslintrc.json +3 -0
- package/template/101/sui-template/.prettierrc +8 -0
- package/template/101/sui-template/Dockerfile +52 -0
- package/template/101/sui-template/LICENSE +674 -0
- package/template/101/sui-template/README.md +14 -0
- package/template/101/sui-template/contracts/counter/Move.toml +13 -0
- package/template/101/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
- package/template/101/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
- package/template/101/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
- package/template/101/sui-template/contracts/counter/sources/system/counter.move +11 -0
- package/template/101/sui-template/docker-compose.yaml +29 -0
- package/template/101/sui-template/dubhe.config.ts +14 -0
- package/template/101/sui-template/jest.config.ts +17 -0
- package/template/101/sui-template/localnet/dubhe-framework/Move.toml +39 -0
- package/template/101/sui-template/localnet/dubhe-framework/README.md +18 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/access_control.move +35 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/events.move +23 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/resource_id.move +22 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/resource_types.move +18 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/schema.move +36 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move +73 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move +96 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/storages/double_map.move +156 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/storages/map.move +159 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/storages/value.move +100 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/systems/dapps.move +90 -0
- package/template/101/sui-template/localnet/dubhe-framework/sources/world.move +81 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/dapp.move +16 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/init.move +6 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/obelisk_framework_tests.move +19 -0
- package/template/101/sui-template/localnet/dubhe-framework/tests/storage.move +398 -0
- package/template/101/sui-template/next-env.d.ts +5 -0
- package/template/101/sui-template/next-i18next.config.js +6 -0
- package/template/101/sui-template/next.config.js +15 -0
- package/template/101/sui-template/package.json +82 -0
- package/template/101/sui-template/postcss.config.js +6 -0
- package/template/101/sui-template/public/discord.svg +9 -0
- package/template/101/sui-template/public/fail.svg +12 -0
- package/template/101/sui-template/public/favicon.ico +0 -0
- package/template/101/sui-template/public/locales/de/common.json +8 -0
- package/template/101/sui-template/public/locales/de/footer.json +3 -0
- package/template/101/sui-template/public/locales/de/second-page.json +5 -0
- package/template/101/sui-template/public/locales/en/common.json +8 -0
- package/template/101/sui-template/public/locales/en/footer.json +3 -0
- package/template/101/sui-template/public/locales/en/second-page.json +5 -0
- package/template/101/sui-template/public/locales/zn/common.json +8 -0
- package/template/101/sui-template/public/locales/zn/footer.json +3 -0
- package/template/101/sui-template/public/locales/zn/second-page.json +5 -0
- package/template/101/sui-template/public/logo.svg +1 -0
- package/template/101/sui-template/public/medium.svg +9 -0
- package/template/101/sui-template/public/successful.svg +11 -0
- package/template/101/sui-template/public/telegram.svg +9 -0
- package/template/101/sui-template/public/twitter.svg +9 -0
- package/template/101/sui-template/scripts/checkBalance.ts +40 -0
- package/template/101/sui-template/scripts/deployment/common.ts +60 -0
- package/template/101/sui-template/scripts/deployment/localnet/deploy.ts +42 -0
- package/template/101/sui-template/scripts/deployment/testnet/deploy.ts +48 -0
- package/template/101/sui-template/scripts/deployment/types.ts +13 -0
- package/template/101/sui-template/scripts/framework/common.ts +17 -0
- package/template/101/sui-template/scripts/framework/deploy.ts +199 -0
- package/template/101/sui-template/scripts/framework/parse-history.ts +76 -0
- package/template/101/sui-template/scripts/framework/types.ts +8 -0
- package/template/101/sui-template/scripts/generateAccount.ts +55 -0
- package/template/101/sui-template/scripts/storeConfig.ts +61 -0
- package/template/101/sui-template/scripts/waitNode.ts +9 -0
- package/template/101/sui-template/src/chain/config.ts +7 -0
- package/template/101/sui-template/src/css/font-awesome.css +2337 -0
- package/template/101/sui-template/src/css/font-awesome.min.css +4 -0
- package/template/101/sui-template/src/fonts/FontAwesome.otf +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/101/sui-template/src/jotai/index.tsx +12 -0
- package/template/101/sui-template/src/pages/_app.tsx +9 -0
- package/template/101/sui-template/src/pages/home/index.tsx +82 -0
- package/template/101/sui-template/src/pages/index.tsx +14 -0
- package/template/101/sui-template/tailwind.config.js +56 -0
- package/template/101/sui-template/tsconfig.json +25 -0
- package/template/cocos/aptos-template/.creator/asset-template/typescript/Custom Script Template Help Documentation.url +2 -0
- package/template/cocos/aptos-template/README.md +11 -0
- package/template/cocos/aptos-template/assets/Scripts/aptos.ts +87 -0
- package/template/cocos/aptos-template/assets/Scripts/aptos.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/chain/config.ts +12 -0
- package/template/cocos/aptos-template/assets/Scripts/chain/config.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/chain/key.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/chain.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts +13 -0
- package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts.meta +9 -0
- package/template/cocos/aptos-template/assets/Scripts.meta +9 -0
- package/template/cocos/aptos-template/assets/lib/dubhe.js +22281 -0
- package/template/cocos/aptos-template/assets/lib/obelisk.js +22281 -0
- package/template/cocos/aptos-template/assets/lib/obelisk.js.meta +15 -0
- package/template/cocos/aptos-template/assets/lib.meta +12 -0
- package/template/cocos/aptos-template/assets/main.scene +875 -0
- package/template/cocos/aptos-template/assets/main.scene.meta +11 -0
- package/template/cocos/aptos-template/contracts/counter/Move.toml +16 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
- package/template/cocos/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
- package/template/cocos/aptos-template/contracts/counter/sources/entity_key.move +31 -0
- package/template/cocos/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
- package/template/cocos/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
- package/template/cocos/aptos-template/package.json +39 -0
- package/template/cocos/aptos-template/scripts/formatAccount.ts +35 -0
- package/template/cocos/aptos-template/scripts/generateAccount.ts +25 -0
- package/template/cocos/aptos-template/scripts/storeConfig.ts +68 -0
- package/template/cocos/aptos-template/settings/v2/packages/builder.json +3 -0
- package/template/cocos/aptos-template/settings/v2/packages/cocos-service.json +23 -0
- package/template/cocos/aptos-template/settings/v2/packages/device.json +3 -0
- package/template/cocos/aptos-template/settings/v2/packages/engine.json +150 -0
- package/template/cocos/aptos-template/settings/v2/packages/information.json +23 -0
- package/template/cocos/aptos-template/settings/v2/packages/program.json +3 -0
- package/template/cocos/aptos-template/settings/v2/packages/project.json +3 -0
- package/template/cocos/aptos-template/tsconfig.json +12 -0
- package/template/cocos/sui-template/.creator/asset-template/typescript/Custom Script Template Help Documentation.url +2 -0
- package/template/cocos/sui-template/README.md +11 -0
- package/template/cocos/sui-template/assets/Scripts/chain/config.ts +12 -0
- package/template/cocos/sui-template/assets/Scripts/chain/config.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/chain/key.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/chain.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts +13 -0
- package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts/sui.ts +120 -0
- package/template/cocos/sui-template/assets/Scripts/sui.ts.meta +9 -0
- package/template/cocos/sui-template/assets/Scripts.meta +12 -0
- package/template/cocos/sui-template/assets/lib/dubhe.js +55694 -0
- package/template/cocos/sui-template/assets/lib/dubhe.js.meta +15 -0
- package/template/cocos/sui-template/assets/lib.meta +12 -0
- package/template/cocos/sui-template/assets/main.scene +875 -0
- package/template/cocos/sui-template/assets/main.scene.meta +11 -0
- package/template/cocos/sui-template/contracts/counter/Move.toml +13 -0
- package/template/cocos/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
- package/template/cocos/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
- package/template/cocos/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
- package/template/cocos/sui-template/contracts/counter/sources/system/counter.move +11 -0
- package/template/cocos/sui-template/docker-compose.yaml +18 -0
- package/template/cocos/sui-template/package.json +27 -0
- package/template/cocos/sui-template/scripts/generateAccount.ts +55 -0
- package/template/cocos/sui-template/scripts/storeConfig.ts +75 -0
- package/template/cocos/sui-template/settings/v2/packages/builder.json +3 -0
- package/template/cocos/sui-template/settings/v2/packages/cocos-service.json +23 -0
- package/template/cocos/sui-template/settings/v2/packages/device.json +3 -0
- package/template/cocos/sui-template/settings/v2/packages/engine.json +150 -0
- package/template/cocos/sui-template/settings/v2/packages/information.json +23 -0
- package/template/cocos/sui-template/settings/v2/packages/program.json +3 -0
- package/template/cocos/sui-template/settings/v2/packages/project.json +3 -0
- package/template/cocos/sui-template/tsconfig.json +19 -0
- package/template/nextjs/aptos-template/.dockerignore +7 -0
- package/template/nextjs/aptos-template/.eslintrc.json +3 -0
- package/template/nextjs/aptos-template/.prettierrc +8 -0
- package/template/nextjs/aptos-template/Dockerfile +56 -0
- package/template/nextjs/aptos-template/LICENSE +674 -0
- package/template/nextjs/aptos-template/README.md +13 -0
- package/template/nextjs/aptos-template/contracts/counter/Move.toml +16 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/entity_key.move +31 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
- package/template/nextjs/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
- package/template/nextjs/aptos-template/dubhe.config.ts +13 -0
- package/template/nextjs/aptos-template/jest.config.ts +17 -0
- package/template/nextjs/aptos-template/next-env.d.ts +5 -0
- package/template/nextjs/aptos-template/next-i18next.config.js +6 -0
- package/template/nextjs/aptos-template/next.config.js +15 -0
- package/template/nextjs/aptos-template/package.json +82 -0
- package/template/nextjs/aptos-template/postcss.config.js +6 -0
- package/template/nextjs/aptos-template/public/discord.svg +9 -0
- package/template/nextjs/aptos-template/public/fail.svg +12 -0
- package/template/nextjs/aptos-template/public/favicon.ico +0 -0
- package/template/nextjs/aptos-template/public/locales/de/common.json +8 -0
- package/template/nextjs/aptos-template/public/locales/de/footer.json +3 -0
- package/template/nextjs/aptos-template/public/locales/de/second-page.json +5 -0
- package/template/nextjs/aptos-template/public/locales/en/common.json +8 -0
- package/template/nextjs/aptos-template/public/locales/en/footer.json +3 -0
- package/template/nextjs/aptos-template/public/locales/en/second-page.json +5 -0
- package/template/nextjs/aptos-template/public/locales/zn/common.json +8 -0
- package/template/nextjs/aptos-template/public/locales/zn/footer.json +3 -0
- package/template/nextjs/aptos-template/public/locales/zn/second-page.json +5 -0
- package/template/nextjs/aptos-template/public/logo.svg +1 -0
- package/template/nextjs/aptos-template/public/medium.svg +9 -0
- package/template/nextjs/aptos-template/public/successful.svg +11 -0
- package/template/nextjs/aptos-template/public/telegram.svg +9 -0
- package/template/nextjs/aptos-template/public/twitter.svg +9 -0
- package/template/nextjs/aptos-template/scripts/formatAccount.ts +35 -0
- package/template/nextjs/aptos-template/scripts/generateAccount.ts +25 -0
- package/template/nextjs/aptos-template/scripts/storeConfig.ts +54 -0
- package/template/nextjs/aptos-template/src/chain/config.ts +7 -0
- package/template/nextjs/aptos-template/src/components/Animation.tsx +80 -0
- package/template/nextjs/aptos-template/src/components/Container.tsx +11 -0
- package/template/nextjs/aptos-template/src/components/footer/index.tsx +138 -0
- package/template/nextjs/aptos-template/src/components/head/index.tsx +14 -0
- package/template/nextjs/aptos-template/src/components/header/index.tsx +173 -0
- package/template/nextjs/aptos-template/src/components/pop_up_box/index.tsx +149 -0
- package/template/nextjs/aptos-template/src/css/font-awesome.css +2337 -0
- package/template/nextjs/aptos-template/src/css/font-awesome.min.css +4 -0
- package/template/nextjs/aptos-template/src/fonts/FontAwesome.otf +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/nextjs/aptos-template/src/jotai/index.tsx +13 -0
- package/template/nextjs/aptos-template/src/pages/_app.tsx +32 -0
- package/template/nextjs/aptos-template/src/pages/home/index.tsx +112 -0
- package/template/nextjs/aptos-template/src/pages/index.tsx +15 -0
- package/template/nextjs/aptos-template/tailwind.config.js +59 -0
- package/template/nextjs/aptos-template/tsconfig.json +35 -0
- package/template/nextjs/sui-template/.dockerignore +7 -0
- package/template/nextjs/sui-template/.eslintrc.json +3 -0
- package/template/nextjs/sui-template/.prettierrc +8 -0
- package/template/nextjs/sui-template/Dockerfile +52 -0
- package/template/nextjs/sui-template/LICENSE +674 -0
- package/template/nextjs/sui-template/README.md +13 -0
- package/template/nextjs/sui-template/contracts/counter/Move.toml +13 -0
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
- package/template/nextjs/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
- package/template/nextjs/sui-template/contracts/counter/sources/system/counter.move +11 -0
- package/template/nextjs/sui-template/docker-compose.yaml +29 -0
- package/template/nextjs/sui-template/dubhe.config.ts +14 -0
- package/template/nextjs/sui-template/jest.config.ts +17 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/Move.toml +39 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/README.md +18 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/access_control.move +35 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/events.move +23 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/resource_id.move +22 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/resource_types.move +18 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schema.move +36 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move +73 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move +96 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/double_map.move +156 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/map.move +159 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/value.move +100 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/systems/dapps.move +90 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/sources/world.move +81 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/dapp.move +16 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/init.move +6 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/obelisk_framework_tests.move +19 -0
- package/template/nextjs/sui-template/localnet/dubhe-framework/tests/storage.move +398 -0
- package/template/nextjs/sui-template/next-env.d.ts +5 -0
- package/template/nextjs/sui-template/next-i18next.config.js +6 -0
- package/template/nextjs/sui-template/next.config.js +15 -0
- package/template/nextjs/sui-template/package.json +84 -0
- package/template/nextjs/sui-template/postcss.config.js +6 -0
- package/template/nextjs/sui-template/public/discord.svg +9 -0
- package/template/nextjs/sui-template/public/fail.svg +12 -0
- package/template/nextjs/sui-template/public/favicon.ico +0 -0
- package/template/nextjs/sui-template/public/locales/de/common.json +8 -0
- package/template/nextjs/sui-template/public/locales/de/footer.json +3 -0
- package/template/nextjs/sui-template/public/locales/de/second-page.json +5 -0
- package/template/nextjs/sui-template/public/locales/en/common.json +8 -0
- package/template/nextjs/sui-template/public/locales/en/footer.json +3 -0
- package/template/nextjs/sui-template/public/locales/en/second-page.json +5 -0
- package/template/nextjs/sui-template/public/locales/zn/common.json +8 -0
- package/template/nextjs/sui-template/public/locales/zn/footer.json +3 -0
- package/template/nextjs/sui-template/public/locales/zn/second-page.json +5 -0
- package/template/nextjs/sui-template/public/logo.svg +1 -0
- package/template/nextjs/sui-template/public/medium.svg +9 -0
- package/template/nextjs/sui-template/public/successful.svg +11 -0
- package/template/nextjs/sui-template/public/telegram.svg +9 -0
- package/template/nextjs/sui-template/public/twitter.svg +9 -0
- package/template/nextjs/sui-template/scripts/checkBalance.ts +40 -0
- package/template/nextjs/sui-template/scripts/deployment/common.ts +60 -0
- package/template/nextjs/sui-template/scripts/deployment/localnet/deploy.ts +42 -0
- package/template/nextjs/sui-template/scripts/deployment/testnet/deploy.ts +48 -0
- package/template/nextjs/sui-template/scripts/deployment/types.ts +13 -0
- package/template/nextjs/sui-template/scripts/framework/common.ts +17 -0
- package/template/nextjs/sui-template/scripts/framework/deploy.ts +199 -0
- package/template/nextjs/sui-template/scripts/framework/parse-history.ts +76 -0
- package/template/nextjs/sui-template/scripts/framework/types.ts +8 -0
- package/template/nextjs/sui-template/scripts/generateAccount.ts +55 -0
- package/template/nextjs/sui-template/scripts/storeConfig.ts +61 -0
- package/template/nextjs/sui-template/scripts/waitNode.ts +9 -0
- package/template/nextjs/sui-template/src/chain/config.ts +7 -0
- package/template/nextjs/sui-template/src/components/Animation.tsx +80 -0
- package/template/nextjs/sui-template/src/components/Container.tsx +11 -0
- package/template/nextjs/sui-template/src/components/footer/index.tsx +138 -0
- package/template/nextjs/sui-template/src/components/head/index.tsx +14 -0
- package/template/nextjs/sui-template/src/components/header/index.tsx +173 -0
- package/template/nextjs/sui-template/src/components/pop_up_box/index.tsx +149 -0
- package/template/nextjs/sui-template/src/css/font-awesome.css +2337 -0
- package/template/nextjs/sui-template/src/css/font-awesome.min.css +4 -0
- package/template/nextjs/sui-template/src/fonts/FontAwesome.otf +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.svg +2671 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/nextjs/sui-template/src/jotai/index.tsx +13 -0
- package/template/nextjs/sui-template/src/pages/_app.tsx +32 -0
- package/template/nextjs/sui-template/src/pages/home/index.tsx +147 -0
- package/template/nextjs/sui-template/src/pages/index.tsx +15 -0
- package/template/nextjs/sui-template/tailwind.config.js +56 -0
- package/template/nextjs/sui-template/tsconfig.json +35 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
## How to use
|
|
2
|
+
```bash
|
|
3
|
+
1 install sui <https://docs.sui.io/build/install>
|
|
4
|
+
2 cd dubhe-nextjs-template folder
|
|
5
|
+
3 pnpm install
|
|
6
|
+
4 open new window && npm run localnode
|
|
7
|
+
4 open new window && npm run start-template
|
|
8
|
+
5 set WorldId:<value> to src/chain/config.ts
|
|
9
|
+
6 set PackageId:<value> to src/chain/config.ts
|
|
10
|
+
7 npm run dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Deploy it to the cloud with [Vercel](https://vercel.com/new?utm_source=github&utm_medium=readme&utm_campaign=next-example) ([Documentation](https://nextjs.org/docs/deployment)).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "counter"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
edition = "2024.beta"
|
|
5
|
+
|
|
6
|
+
[dependencies]
|
|
7
|
+
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.36.2" }
|
|
8
|
+
Dubhe = { git = "https://github.com/0xobelisk/dubhe.git", subdir = "packages/dubhe-framework", rev = "main" }
|
|
9
|
+
|
|
10
|
+
[addresses]
|
|
11
|
+
sui = "0x2"
|
|
12
|
+
dubhe = "0x1736475f476c5dec96f33c03c778843f572239d3a887d795eef66d2836484c28"
|
|
13
|
+
counter = "0x0"
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
#[allow(unused_use)]
|
|
4
|
+
|
|
5
|
+
/* Autogenerated file. Do not edit manually. */
|
|
6
|
+
|
|
7
|
+
module counter::dapp_key {
|
|
8
|
+
|
|
9
|
+
/// Authorization token for the app.
|
|
10
|
+
|
|
11
|
+
public struct DappKey has drop {}
|
|
12
|
+
|
|
13
|
+
public(package) fun new(): DappKey {
|
|
14
|
+
DappKey { }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright (c) Obelisk Labs, Inc.
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
#[allow(unused_use)]
|
|
4
|
+
|
|
5
|
+
/* Autogenerated file. Do not edit manually. */
|
|
6
|
+
|
|
7
|
+
module counter::counter_schema {
|
|
8
|
+
|
|
9
|
+
use std::ascii::String;
|
|
10
|
+
|
|
11
|
+
use std::type_name;
|
|
12
|
+
|
|
13
|
+
use dubhe::dapps_system;
|
|
14
|
+
|
|
15
|
+
use dubhe::dapps_schema::Dapps;
|
|
16
|
+
|
|
17
|
+
use dubhe::storage_value::{Self, StorageValue};
|
|
18
|
+
|
|
19
|
+
use dubhe::storage_map::{Self, StorageMap};
|
|
20
|
+
|
|
21
|
+
use dubhe::storage_double_map::{Self, StorageDoubleMap};
|
|
22
|
+
|
|
23
|
+
use counter::dapp_key::DappKey;
|
|
24
|
+
|
|
25
|
+
public struct Counter has key, store {
|
|
26
|
+
id: UID,
|
|
27
|
+
value: StorageValue<u32>,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public fun borrow_value(self: &Counter): &StorageValue<u32> {
|
|
31
|
+
&self.value
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public(package) fun borrow_mut_value(self: &mut Counter): &mut StorageValue<u32> {
|
|
35
|
+
&mut self.value
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public fun register(dapps: &mut Dapps, ctx: &mut TxContext): Counter {
|
|
39
|
+
let package_id = dapps_system::current_package_id<DappKey>();
|
|
40
|
+
assert!(dapps.borrow_metadata().contains_key(package_id), 0);
|
|
41
|
+
assert!(dapps.borrow_admin().get(package_id) == ctx.sender(), 0);
|
|
42
|
+
let schema = type_name::get<Counter>().into_string();
|
|
43
|
+
assert!(!dapps.borrow_schemas().get(package_id).contains(&schema), 0);
|
|
44
|
+
dapps_system::add_schema<Counter>(dapps, package_id, ctx);
|
|
45
|
+
Counter {
|
|
46
|
+
id: object::new(ctx),
|
|
47
|
+
value: storage_value::new(),
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
#[allow(lint(share_owned))]
|
|
2
|
+
|
|
3
|
+
module counter::deploy_hook {
|
|
4
|
+
|
|
5
|
+
use dubhe::dapps_schema::Dapps;
|
|
6
|
+
|
|
7
|
+
use dubhe::dapps_system;
|
|
8
|
+
|
|
9
|
+
use counter::dapp_key::DappKey;
|
|
10
|
+
|
|
11
|
+
use std::ascii;
|
|
12
|
+
|
|
13
|
+
use sui::clock::Clock;
|
|
14
|
+
|
|
15
|
+
use sui::transfer::public_share_object;
|
|
16
|
+
|
|
17
|
+
#[test_only]
|
|
18
|
+
|
|
19
|
+
use dubhe::dapps_schema;
|
|
20
|
+
|
|
21
|
+
#[test_only]
|
|
22
|
+
|
|
23
|
+
use sui::clock;
|
|
24
|
+
|
|
25
|
+
#[test_only]
|
|
26
|
+
|
|
27
|
+
use sui::test_scenario;
|
|
28
|
+
|
|
29
|
+
#[test_only]
|
|
30
|
+
|
|
31
|
+
use sui::test_scenario::Scenario;
|
|
32
|
+
|
|
33
|
+
public entry fun run(dapps: &mut Dapps, clock: &Clock, ctx: &mut TxContext) {
|
|
34
|
+
// Register the dapp to dubhe.
|
|
35
|
+
dapps_system::register<DappKey>(
|
|
36
|
+
dapps,
|
|
37
|
+
ascii::string(b"counter"),
|
|
38
|
+
ascii::string(b"counter"),
|
|
39
|
+
clock,
|
|
40
|
+
ctx
|
|
41
|
+
);
|
|
42
|
+
let mut counter = counter::counter_schema::register(dapps, ctx);
|
|
43
|
+
// Logic that needs to be automated once the contract is deployed
|
|
44
|
+
counter.borrow_mut_value().set(0);
|
|
45
|
+
|
|
46
|
+
// Share the dapp object with the public
|
|
47
|
+
public_share_object(counter);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[test_only]
|
|
51
|
+
|
|
52
|
+
public fun deploy_hook_for_testing(): (Scenario, Dapps) {
|
|
53
|
+
let mut scenario = test_scenario::begin(@0xA);
|
|
54
|
+
{
|
|
55
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
56
|
+
dapps_schema::init_dapps_for_testing(ctx);
|
|
57
|
+
test_scenario::next_tx(&mut scenario,@0xA);
|
|
58
|
+
};
|
|
59
|
+
let mut dapps = test_scenario::take_shared<Dapps>(&scenario);
|
|
60
|
+
let ctx = test_scenario::ctx(&mut scenario);
|
|
61
|
+
let clock = clock::create_for_testing(ctx);
|
|
62
|
+
run(&mut dapps, &clock, ctx);
|
|
63
|
+
clock::destroy_for_testing(clock);
|
|
64
|
+
test_scenario::next_tx(&mut scenario,@0xA);
|
|
65
|
+
(scenario, dapps)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module counter::counter_system {
|
|
2
|
+
use counter::counter_schema::Counter;
|
|
3
|
+
|
|
4
|
+
public entry fun inc(counter: &mut Counter) {
|
|
5
|
+
counter.borrow_mut_value().mutate!(|value| *value = *value + 1);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
public fun get(counter: &Counter): u32 {
|
|
9
|
+
counter.borrow_value().get()
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
version: "3"
|
|
3
|
+
|
|
4
|
+
services:
|
|
5
|
+
sui-test-validator-node:
|
|
6
|
+
image: vladilenaksana/sui-test-validator:v0.0.3
|
|
7
|
+
restart: always
|
|
8
|
+
volumes:
|
|
9
|
+
- ./:/app
|
|
10
|
+
ports:
|
|
11
|
+
- 9000:9000
|
|
12
|
+
- 9123:9123
|
|
13
|
+
command: ["/opt/sui/bin/sui-test-validator", "--fullnode-rpc-addr", "0.0.0.0:9000", "--faucet-addr", "0.0.0.0:9123"]
|
|
14
|
+
healthcheck:
|
|
15
|
+
test: ["CMD", "curl", "-f", "http://sui-test-validator-node:9123"]
|
|
16
|
+
interval: 3s
|
|
17
|
+
timeout: 5s
|
|
18
|
+
retries: 10
|
|
19
|
+
|
|
20
|
+
# webapp:
|
|
21
|
+
# build:
|
|
22
|
+
# context: .
|
|
23
|
+
# dockerfile: ./Dockerfile
|
|
24
|
+
# ports:
|
|
25
|
+
# - 3000:3000
|
|
26
|
+
# depends_on:
|
|
27
|
+
# "sui-test-validator-node":
|
|
28
|
+
# condition: service_healthy
|
|
29
|
+
# restart: always
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { DubheConfig } from '@0xobelisk/sui-common';
|
|
2
|
+
|
|
3
|
+
export const dubheConfig = {
|
|
4
|
+
name: 'counter',
|
|
5
|
+
description: 'counter',
|
|
6
|
+
systems: ['counter'],
|
|
7
|
+
schemas: {
|
|
8
|
+
counter: {
|
|
9
|
+
structure: {
|
|
10
|
+
value: "StorageValue<u32>"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
} as DubheConfig;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { InitialOptionsTsJest } from 'ts-jest/dist/types'
|
|
2
|
+
|
|
3
|
+
const config: InitialOptionsTsJest = {
|
|
4
|
+
preset: 'ts-jest',
|
|
5
|
+
setupFilesAfterEnv: ['<rootDir>/setupTests.ts'],
|
|
6
|
+
transform: {
|
|
7
|
+
'.+\\.(css|styl|less|sass|scss)$': 'jest-css-modules-transform',
|
|
8
|
+
},
|
|
9
|
+
testEnvironment: 'jsdom',
|
|
10
|
+
globals: {
|
|
11
|
+
'ts-jest': {
|
|
12
|
+
tsconfig: 'tsconfig.test.json',
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default config
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "Dubhe"
|
|
3
|
+
edition = "2024.alpha" # edition = "legacy" to use legacy (pre-2024) Move
|
|
4
|
+
published-at = "0x1736475f476c5dec96f33c03c778843f572239d3a887d795eef66d2836484c28"
|
|
5
|
+
# license = "" # e.g., "MIT", "GPL", "Apache 2.0"
|
|
6
|
+
# authors = ["..."] # e.g., ["Joe Smith (joesmith@noemail.com)", "John Snow (johnsnow@noemail.com)"]
|
|
7
|
+
|
|
8
|
+
[dependencies]
|
|
9
|
+
Sui = { git = "https://github.com/MystenLabs/sui.git", subdir = "crates/sui-framework/packages/sui-framework", rev = "mainnet-v1.36.2" }
|
|
10
|
+
|
|
11
|
+
# For remote import, use the `{ git = "...", subdir = "...", rev = "..." }`.
|
|
12
|
+
# Revision can be a branch, a tag, and a commit hash.
|
|
13
|
+
# MyRemotePackage = { git = "https://some.remote/host.git", subdir = "remote/path", rev = "main" }
|
|
14
|
+
|
|
15
|
+
# For local dependencies use `local = path`. Path is relative to the package root
|
|
16
|
+
# Local = { local = "../path/to" }
|
|
17
|
+
|
|
18
|
+
# To resolve a version conflict and force a specific version for dependency
|
|
19
|
+
# override use `override = true`
|
|
20
|
+
# Override = { local = "../conflicting/version", override = true }
|
|
21
|
+
|
|
22
|
+
[addresses]
|
|
23
|
+
dubhe = "0x1736475f476c5dec96f33c03c778843f572239d3a887d795eef66d2836484c28"
|
|
24
|
+
#dubhe = "0x0"
|
|
25
|
+
|
|
26
|
+
# Named addresses will be accessible in Move as `@name`. They're also exported:
|
|
27
|
+
# for example, `std = "0x1"` is exported by the Standard Library.
|
|
28
|
+
# alice = "0xA11CE"
|
|
29
|
+
|
|
30
|
+
[dev-dependencies]
|
|
31
|
+
# The dev-dependencies section allows overriding dependencies for `--test` and
|
|
32
|
+
# `--dev` modes. You can introduce test-only dependencies here.
|
|
33
|
+
# Local = { local = "../path/to/dev-build" }
|
|
34
|
+
|
|
35
|
+
[dev-addresses]
|
|
36
|
+
# The dev-addresses section allows overwriting named addresses for the `--test`
|
|
37
|
+
# and `--dev` modes.
|
|
38
|
+
# alice = "0xB0B"
|
|
39
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
## Dubhe Framework
|
|
2
|
+
|
|
3
|
+
### Testnet
|
|
4
|
+
```txt
|
|
5
|
+
PackageID: 0xf68ab6ceb5cfce6a73d76e5ef64f28d3cbe684413c80232871b31a9df0e09496
|
|
6
|
+
Version: 1
|
|
7
|
+
Digest: HwpoK2ZUoxsDzFyeszWzdcAm4aLi5g2CxBq3JBodxA16
|
|
8
|
+
Modules: access_control, events, resource_id, resource_tyeps, schema, world
|
|
9
|
+
|
|
10
|
+
ObjectID: 0x9f4cd3e0aa5587b2d9191fa20ea877a0d66c6eb6a4f49ec34328122b29d1d9c6
|
|
11
|
+
ObjectType: 0x2::package::UpgradeCap
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```shell
|
|
15
|
+
# upgrade
|
|
16
|
+
sui client upgrade --gas-budget 1000000000 --upgrade-capability 0x9f4cd3e0aa5587b2d9191fa20ea877a0d66c6eb6a4f49ec34328122b29d1d9c6
|
|
17
|
+
```
|
|
18
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
module dubhe::access_control {
|
|
2
|
+
use dubhe::world::{AdminCap, World};
|
|
3
|
+
use sui::dynamic_field as df;
|
|
4
|
+
|
|
5
|
+
const ENotAdmin: u64 = 4;
|
|
6
|
+
const EAppNotAuthorized: u64 = 5;
|
|
7
|
+
|
|
8
|
+
public struct AppKey<phantom App: drop> has copy, store, drop {}
|
|
9
|
+
|
|
10
|
+
/// Authorize an application to access protected features of the World.
|
|
11
|
+
public fun authorize_app<App: drop>(admin_cap: &AdminCap, world: &mut World) {
|
|
12
|
+
assert!(world.admin() == object::id(admin_cap), ENotAdmin);
|
|
13
|
+
df::add(world.mut_uid(), AppKey<App>{}, true);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/// Deauthorize an application by removing its authorization key.
|
|
17
|
+
public fun deauthorize_app<App: drop>(admin_cap: &AdminCap, world: &mut World): bool {
|
|
18
|
+
assert!(world.admin() == object::id(admin_cap), ENotAdmin);
|
|
19
|
+
df::remove(world.mut_uid(), AppKey<App>{})
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Check if an application is authorized to access protected features of
|
|
23
|
+
/// the World.
|
|
24
|
+
public fun is_app_authorized<App: drop>(world: &World): bool {
|
|
25
|
+
df::exists_(world.uid(), AppKey<App>{})
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/// Assert that an application is authorized to access protected features of
|
|
29
|
+
/// the World. Aborts with `EAppNotAuthorized` if not.
|
|
30
|
+
public fun assert_app_is_authorized<App: drop>(world: &World) {
|
|
31
|
+
assert!(is_app_authorized<App>(world), EAppNotAuthorized);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
module dubhe::events {
|
|
2
|
+
use sui::event;
|
|
3
|
+
|
|
4
|
+
public struct SchemaSetRecord<T: copy + drop> has copy, drop {
|
|
5
|
+
_dubhe_schema_id: vector<u8>,
|
|
6
|
+
_dubhe_schema_type: u8,
|
|
7
|
+
_dubhe_entity_key: Option<address>,
|
|
8
|
+
data: T
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public struct SchemaRemoveRecord has copy, drop {
|
|
12
|
+
_dubhe_schema_id: vector<u8>,
|
|
13
|
+
_dubhe_entity_key: address
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
public fun emit_set<T: copy + drop>(_dubhe_schema_id: vector<u8>, _dubhe_schema_type: u8, _dubhe_entity_key: Option<address>, data: T) {
|
|
17
|
+
event::emit(SchemaSetRecord { _dubhe_schema_id, _dubhe_schema_type, _dubhe_entity_key, data})
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public fun emit_remove(_dubhe_schema_id: vector<u8>, _dubhe_entity_key: address) {
|
|
21
|
+
event::emit(SchemaRemoveRecord { _dubhe_schema_id, _dubhe_entity_key })
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
module dubhe::resource_id {
|
|
2
|
+
|
|
3
|
+
public fun encode(type_id: vector<u8>, namespace: vector<u8>, name: vector<u8>) : vector<u8> {
|
|
4
|
+
let mut resource_id: vector<u8> = vector[];
|
|
5
|
+
vector::append(&mut resource_id, type_id);
|
|
6
|
+
vector::append(&mut resource_id, namespace);
|
|
7
|
+
vector::append(&mut resource_id, name);
|
|
8
|
+
resource_id
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public fun offchain_schema() : vector<u8> {
|
|
12
|
+
b"os"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public fun system() : vector<u8> {
|
|
16
|
+
b"sy"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public fun namespace() : vector<u8> {
|
|
20
|
+
b"ns"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module dubhe::resource_tyeps {
|
|
2
|
+
|
|
3
|
+
public fun schema() : vector<u8> {
|
|
4
|
+
b"sc"
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
public fun offchain_schema() : vector<u8> {
|
|
8
|
+
b"os"
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
public fun system() : vector<u8> {
|
|
12
|
+
b"sy"
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public fun namespace() : vector<u8> {
|
|
16
|
+
b"ns"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module dubhe::schema {
|
|
2
|
+
use std::ascii::{string};
|
|
3
|
+
use sui::bag::{Self};
|
|
4
|
+
use dubhe::world::{World, AdminCap};
|
|
5
|
+
use dubhe::access_control;
|
|
6
|
+
|
|
7
|
+
/// Schema does not exist
|
|
8
|
+
const ESchemaDoesNotExist: u64 = 0;
|
|
9
|
+
/// Schema already exists
|
|
10
|
+
const ESchemaAlreadyExists: u64 = 1;
|
|
11
|
+
/// Not the right admin for this world
|
|
12
|
+
const ENotAdmin: u64 = 2;
|
|
13
|
+
|
|
14
|
+
public fun get<T : store>(world: &World, _dubhe_schema_id: vector<u8>): &T {
|
|
15
|
+
assert!(bag::contains(world.schemas(), _dubhe_schema_id), ESchemaDoesNotExist);
|
|
16
|
+
bag::borrow<vector<u8>, T>(world.schemas(), _dubhe_schema_id)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
public fun add<T : store>(_dubhe_world: &mut World, _dubhe_schema_id: vector<u8>, schema: T, admin_cap: &AdminCap){
|
|
20
|
+
assert!(_dubhe_world.admin() == object::id(admin_cap), ENotAdmin);
|
|
21
|
+
assert!(!bag::contains(_dubhe_world.schemas(), _dubhe_schema_id), ESchemaAlreadyExists);
|
|
22
|
+
vector::push_back(_dubhe_world.mut_schema_names(), string(_dubhe_schema_id));
|
|
23
|
+
bag::add<vector<u8>,T>(_dubhe_world.mut_schemas(), _dubhe_schema_id, schema);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public fun contains(_dubhe_world: &mut World, _dubhe_schema_id: vector<u8>): bool {
|
|
27
|
+
bag::contains(_dubhe_world.schemas(), _dubhe_schema_id)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// === Protected features ===
|
|
31
|
+
public fun get_mut<T : store, App: drop>(_: App, world: &mut World, _dubhe_schema_id: vector<u8>): &mut T {
|
|
32
|
+
access_control::assert_app_is_authorized<App>(world);
|
|
33
|
+
assert!(bag::contains(world.schemas(), _dubhe_schema_id), ESchemaDoesNotExist);
|
|
34
|
+
bag::borrow_mut<vector<u8>, T>(world.mut_schemas(), _dubhe_schema_id)
|
|
35
|
+
}
|
|
36
|
+
}
|
package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
module dubhe::dapps_schema {
|
|
2
|
+
use std::ascii::String;
|
|
3
|
+
use dubhe::storage_map;
|
|
4
|
+
use sui::transfer::public_share_object;
|
|
5
|
+
use dubhe::dapp_metadata::DappMetadata;
|
|
6
|
+
use dubhe::storage_map::StorageMap;
|
|
7
|
+
|
|
8
|
+
public struct Dapps has key, store {
|
|
9
|
+
id: UID,
|
|
10
|
+
admin: StorageMap<address, address>,
|
|
11
|
+
version: StorageMap<address, u32>,
|
|
12
|
+
metadata: StorageMap<address, DappMetadata>,
|
|
13
|
+
schemas: StorageMap<address, vector<String>>,
|
|
14
|
+
safe_mode: StorageMap<address, bool>
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
public(package) fun borrow_mut_version(self: &mut Dapps): &mut StorageMap<address, u32> {
|
|
19
|
+
&mut self.version
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public(package) fun borrow_mut_admin(self: &mut Dapps): &mut StorageMap<address, address> {
|
|
23
|
+
&mut self.admin
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
public(package) fun borrow_mut_metadata(self: &mut Dapps): &mut StorageMap<address, DappMetadata> {
|
|
27
|
+
&mut self.metadata
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public(package) fun borrow_mut_schemas(self: &mut Dapps): &mut StorageMap<address, vector<String>> {
|
|
31
|
+
&mut self.schemas
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public(package) fun borrow_mut_safe_mode(self: &mut Dapps): &mut StorageMap<address, bool> {
|
|
35
|
+
&mut self.safe_mode
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public fun borrow_admin(self: &Dapps): &StorageMap<address, address> {
|
|
39
|
+
&self.admin
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
public fun borrow_version(self: &Dapps): &StorageMap<address, u32> {
|
|
43
|
+
&self.version
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
public fun borrow_metadata(self: &Dapps): &StorageMap<address, DappMetadata> {
|
|
47
|
+
&self.metadata
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public fun borrow_schemas(self: &Dapps): &StorageMap<address, vector<String>> {
|
|
51
|
+
&self.schemas
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public fun borrow_safe_mode(self: &Dapps): &StorageMap<address, bool> {
|
|
55
|
+
&self.safe_mode
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
fun init(ctx: &mut TxContext) {
|
|
59
|
+
public_share_object(Dapps {
|
|
60
|
+
id: object::new(ctx),
|
|
61
|
+
admin: storage_map::new(),
|
|
62
|
+
version: storage_map::new(),
|
|
63
|
+
metadata: storage_map::new(),
|
|
64
|
+
schemas: storage_map::new(),
|
|
65
|
+
safe_mode: storage_map::new()
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
#[test_only]
|
|
70
|
+
public fun init_dapps_for_testing(ctx: &mut TxContext){
|
|
71
|
+
init(ctx)
|
|
72
|
+
}
|
|
73
|
+
}
|
package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
module dubhe::dapp_metadata {
|
|
2
|
+
use std::ascii::String;
|
|
3
|
+
|
|
4
|
+
public struct DappMetadata has drop, copy, store {
|
|
5
|
+
name: String,
|
|
6
|
+
description: String,
|
|
7
|
+
icon_url: String,
|
|
8
|
+
website_url: String,
|
|
9
|
+
created_at: u64,
|
|
10
|
+
partners: vector<String>,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
public fun new(
|
|
14
|
+
name: String,
|
|
15
|
+
description: String,
|
|
16
|
+
icon_url: String,
|
|
17
|
+
website_url: String,
|
|
18
|
+
created_at: u64,
|
|
19
|
+
partners: vector<String>,
|
|
20
|
+
): DappMetadata {
|
|
21
|
+
DappMetadata {
|
|
22
|
+
name,
|
|
23
|
+
description,
|
|
24
|
+
icon_url,
|
|
25
|
+
website_url,
|
|
26
|
+
created_at,
|
|
27
|
+
partners,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public fun set(
|
|
32
|
+
self: &mut DappMetadata,
|
|
33
|
+
name: String,
|
|
34
|
+
description: String,
|
|
35
|
+
icon_url: String,
|
|
36
|
+
website_url: String,
|
|
37
|
+
created_at: u64,
|
|
38
|
+
partners: vector<String>,
|
|
39
|
+
) {
|
|
40
|
+
self.name = name;
|
|
41
|
+
self.description = description;
|
|
42
|
+
self.icon_url = icon_url;
|
|
43
|
+
self.website_url = website_url;
|
|
44
|
+
self.created_at = created_at;
|
|
45
|
+
self.partners = partners;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public fun set_name(self: &mut DappMetadata, name: String) {
|
|
49
|
+
self.name = name;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public fun set_description(self: &mut DappMetadata, description: String) {
|
|
53
|
+
self.description = description;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public fun set_icon_url(self: &mut DappMetadata, icon_url: String) {
|
|
57
|
+
self.icon_url = icon_url;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public fun set_website_url(self: &mut DappMetadata, website_url: String) {
|
|
61
|
+
self.website_url = website_url;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public fun set_created_at(self: &mut DappMetadata, created_at: u64) {
|
|
65
|
+
self.created_at = created_at;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
public fun set_partners(self: &mut DappMetadata, partners: vector<String>) {
|
|
69
|
+
self.partners = partners;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public fun get_name(self: DappMetadata): String {
|
|
73
|
+
self.name
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
public fun get_description(self: DappMetadata): String {
|
|
77
|
+
self.description
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public fun get_icon_url(self: DappMetadata): String {
|
|
81
|
+
self.icon_url
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public fun get_website_url(self: DappMetadata): String {
|
|
85
|
+
self.website_url
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public fun get_created_at(self: DappMetadata): u64 {
|
|
89
|
+
self.created_at
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public fun get_partners(self: DappMetadata): vector<String> {
|
|
93
|
+
self.partners
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|