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.
Files changed (361) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +9 -0
  3. package/dist/index.mjs +100 -0
  4. package/index.js +3 -0
  5. package/package.json +46 -0
  6. package/template/101/aptos-template/.dockerignore +7 -0
  7. package/template/101/aptos-template/.eslintrc.json +3 -0
  8. package/template/101/aptos-template/.prettierrc +8 -0
  9. package/template/101/aptos-template/Dockerfile +56 -0
  10. package/template/101/aptos-template/LICENSE +674 -0
  11. package/template/101/aptos-template/README.md +14 -0
  12. package/template/101/aptos-template/contracts/counter/Move.toml +16 -0
  13. package/template/101/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
  14. package/template/101/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
  15. package/template/101/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
  16. package/template/101/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
  17. package/template/101/aptos-template/contracts/counter/sources/entity_key.move +31 -0
  18. package/template/101/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
  19. package/template/101/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
  20. package/template/101/aptos-template/dubhe.config.ts +13 -0
  21. package/template/101/aptos-template/jest.config.ts +17 -0
  22. package/template/101/aptos-template/next-env.d.ts +5 -0
  23. package/template/101/aptos-template/next-i18next.config.js +6 -0
  24. package/template/101/aptos-template/next.config.js +15 -0
  25. package/template/101/aptos-template/package.json +83 -0
  26. package/template/101/aptos-template/postcss.config.js +6 -0
  27. package/template/101/aptos-template/public/discord.svg +9 -0
  28. package/template/101/aptos-template/public/fail.svg +12 -0
  29. package/template/101/aptos-template/public/favicon.ico +0 -0
  30. package/template/101/aptos-template/public/locales/de/common.json +8 -0
  31. package/template/101/aptos-template/public/locales/de/footer.json +3 -0
  32. package/template/101/aptos-template/public/locales/de/second-page.json +5 -0
  33. package/template/101/aptos-template/public/locales/en/common.json +8 -0
  34. package/template/101/aptos-template/public/locales/en/footer.json +3 -0
  35. package/template/101/aptos-template/public/locales/en/second-page.json +5 -0
  36. package/template/101/aptos-template/public/locales/zn/common.json +8 -0
  37. package/template/101/aptos-template/public/locales/zn/footer.json +3 -0
  38. package/template/101/aptos-template/public/locales/zn/second-page.json +5 -0
  39. package/template/101/aptos-template/public/logo.svg +1 -0
  40. package/template/101/aptos-template/public/medium.svg +9 -0
  41. package/template/101/aptos-template/public/successful.svg +11 -0
  42. package/template/101/aptos-template/public/telegram.svg +9 -0
  43. package/template/101/aptos-template/public/twitter.svg +9 -0
  44. package/template/101/aptos-template/scripts/formatAccount.ts +35 -0
  45. package/template/101/aptos-template/scripts/generateAccount.ts +25 -0
  46. package/template/101/aptos-template/scripts/storeConfig.ts +54 -0
  47. package/template/101/aptos-template/src/chain/config.ts +7 -0
  48. package/template/101/aptos-template/src/css/font-awesome.css +2337 -0
  49. package/template/101/aptos-template/src/css/font-awesome.min.css +4 -0
  50. package/template/101/aptos-template/src/fonts/FontAwesome.otf +0 -0
  51. package/template/101/aptos-template/src/fonts/fontawesome-webfont.eot +0 -0
  52. package/template/101/aptos-template/src/fonts/fontawesome-webfont.svg +2671 -0
  53. package/template/101/aptos-template/src/fonts/fontawesome-webfont.ttf +0 -0
  54. package/template/101/aptos-template/src/fonts/fontawesome-webfont.woff +0 -0
  55. package/template/101/aptos-template/src/fonts/fontawesome-webfont.woff2 +0 -0
  56. package/template/101/aptos-template/src/jotai/index.tsx +12 -0
  57. package/template/101/aptos-template/src/pages/_app.tsx +9 -0
  58. package/template/101/aptos-template/src/pages/home/index.tsx +78 -0
  59. package/template/101/aptos-template/src/pages/index.tsx +12 -0
  60. package/template/101/aptos-template/tailwind.config.js +56 -0
  61. package/template/101/aptos-template/tsconfig.json +25 -0
  62. package/template/101/sui-template/.dockerignore +7 -0
  63. package/template/101/sui-template/.eslintrc.json +3 -0
  64. package/template/101/sui-template/.prettierrc +8 -0
  65. package/template/101/sui-template/Dockerfile +52 -0
  66. package/template/101/sui-template/LICENSE +674 -0
  67. package/template/101/sui-template/README.md +14 -0
  68. package/template/101/sui-template/contracts/counter/Move.toml +13 -0
  69. package/template/101/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
  70. package/template/101/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
  71. package/template/101/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
  72. package/template/101/sui-template/contracts/counter/sources/system/counter.move +11 -0
  73. package/template/101/sui-template/docker-compose.yaml +29 -0
  74. package/template/101/sui-template/dubhe.config.ts +14 -0
  75. package/template/101/sui-template/jest.config.ts +17 -0
  76. package/template/101/sui-template/localnet/dubhe-framework/Move.toml +39 -0
  77. package/template/101/sui-template/localnet/dubhe-framework/README.md +18 -0
  78. package/template/101/sui-template/localnet/dubhe-framework/sources/access_control.move +35 -0
  79. package/template/101/sui-template/localnet/dubhe-framework/sources/events.move +23 -0
  80. package/template/101/sui-template/localnet/dubhe-framework/sources/resource_id.move +22 -0
  81. package/template/101/sui-template/localnet/dubhe-framework/sources/resource_types.move +18 -0
  82. package/template/101/sui-template/localnet/dubhe-framework/sources/schema.move +36 -0
  83. package/template/101/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move +73 -0
  84. package/template/101/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move +96 -0
  85. package/template/101/sui-template/localnet/dubhe-framework/sources/storages/double_map.move +156 -0
  86. package/template/101/sui-template/localnet/dubhe-framework/sources/storages/map.move +159 -0
  87. package/template/101/sui-template/localnet/dubhe-framework/sources/storages/value.move +100 -0
  88. package/template/101/sui-template/localnet/dubhe-framework/sources/systems/dapps.move +90 -0
  89. package/template/101/sui-template/localnet/dubhe-framework/sources/world.move +81 -0
  90. package/template/101/sui-template/localnet/dubhe-framework/tests/dapp.move +16 -0
  91. package/template/101/sui-template/localnet/dubhe-framework/tests/init.move +6 -0
  92. package/template/101/sui-template/localnet/dubhe-framework/tests/obelisk_framework_tests.move +19 -0
  93. package/template/101/sui-template/localnet/dubhe-framework/tests/storage.move +398 -0
  94. package/template/101/sui-template/next-env.d.ts +5 -0
  95. package/template/101/sui-template/next-i18next.config.js +6 -0
  96. package/template/101/sui-template/next.config.js +15 -0
  97. package/template/101/sui-template/package.json +82 -0
  98. package/template/101/sui-template/postcss.config.js +6 -0
  99. package/template/101/sui-template/public/discord.svg +9 -0
  100. package/template/101/sui-template/public/fail.svg +12 -0
  101. package/template/101/sui-template/public/favicon.ico +0 -0
  102. package/template/101/sui-template/public/locales/de/common.json +8 -0
  103. package/template/101/sui-template/public/locales/de/footer.json +3 -0
  104. package/template/101/sui-template/public/locales/de/second-page.json +5 -0
  105. package/template/101/sui-template/public/locales/en/common.json +8 -0
  106. package/template/101/sui-template/public/locales/en/footer.json +3 -0
  107. package/template/101/sui-template/public/locales/en/second-page.json +5 -0
  108. package/template/101/sui-template/public/locales/zn/common.json +8 -0
  109. package/template/101/sui-template/public/locales/zn/footer.json +3 -0
  110. package/template/101/sui-template/public/locales/zn/second-page.json +5 -0
  111. package/template/101/sui-template/public/logo.svg +1 -0
  112. package/template/101/sui-template/public/medium.svg +9 -0
  113. package/template/101/sui-template/public/successful.svg +11 -0
  114. package/template/101/sui-template/public/telegram.svg +9 -0
  115. package/template/101/sui-template/public/twitter.svg +9 -0
  116. package/template/101/sui-template/scripts/checkBalance.ts +40 -0
  117. package/template/101/sui-template/scripts/deployment/common.ts +60 -0
  118. package/template/101/sui-template/scripts/deployment/localnet/deploy.ts +42 -0
  119. package/template/101/sui-template/scripts/deployment/testnet/deploy.ts +48 -0
  120. package/template/101/sui-template/scripts/deployment/types.ts +13 -0
  121. package/template/101/sui-template/scripts/framework/common.ts +17 -0
  122. package/template/101/sui-template/scripts/framework/deploy.ts +199 -0
  123. package/template/101/sui-template/scripts/framework/parse-history.ts +76 -0
  124. package/template/101/sui-template/scripts/framework/types.ts +8 -0
  125. package/template/101/sui-template/scripts/generateAccount.ts +55 -0
  126. package/template/101/sui-template/scripts/storeConfig.ts +61 -0
  127. package/template/101/sui-template/scripts/waitNode.ts +9 -0
  128. package/template/101/sui-template/src/chain/config.ts +7 -0
  129. package/template/101/sui-template/src/css/font-awesome.css +2337 -0
  130. package/template/101/sui-template/src/css/font-awesome.min.css +4 -0
  131. package/template/101/sui-template/src/fonts/FontAwesome.otf +0 -0
  132. package/template/101/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
  133. package/template/101/sui-template/src/fonts/fontawesome-webfont.svg +2671 -0
  134. package/template/101/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
  135. package/template/101/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
  136. package/template/101/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
  137. package/template/101/sui-template/src/jotai/index.tsx +12 -0
  138. package/template/101/sui-template/src/pages/_app.tsx +9 -0
  139. package/template/101/sui-template/src/pages/home/index.tsx +82 -0
  140. package/template/101/sui-template/src/pages/index.tsx +14 -0
  141. package/template/101/sui-template/tailwind.config.js +56 -0
  142. package/template/101/sui-template/tsconfig.json +25 -0
  143. package/template/cocos/aptos-template/.creator/asset-template/typescript/Custom Script Template Help Documentation.url +2 -0
  144. package/template/cocos/aptos-template/README.md +11 -0
  145. package/template/cocos/aptos-template/assets/Scripts/aptos.ts +87 -0
  146. package/template/cocos/aptos-template/assets/Scripts/aptos.ts.meta +9 -0
  147. package/template/cocos/aptos-template/assets/Scripts/chain/config.ts +12 -0
  148. package/template/cocos/aptos-template/assets/Scripts/chain/config.ts.meta +9 -0
  149. package/template/cocos/aptos-template/assets/Scripts/chain/key.ts.meta +9 -0
  150. package/template/cocos/aptos-template/assets/Scripts/chain.meta +9 -0
  151. package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts +13 -0
  152. package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts.meta +9 -0
  153. package/template/cocos/aptos-template/assets/Scripts.meta +9 -0
  154. package/template/cocos/aptos-template/assets/lib/dubhe.js +22281 -0
  155. package/template/cocos/aptos-template/assets/lib/obelisk.js +22281 -0
  156. package/template/cocos/aptos-template/assets/lib/obelisk.js.meta +15 -0
  157. package/template/cocos/aptos-template/assets/lib.meta +12 -0
  158. package/template/cocos/aptos-template/assets/main.scene +875 -0
  159. package/template/cocos/aptos-template/assets/main.scene.meta +11 -0
  160. package/template/cocos/aptos-template/contracts/counter/Move.toml +16 -0
  161. package/template/cocos/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
  162. package/template/cocos/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
  163. package/template/cocos/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
  164. package/template/cocos/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
  165. package/template/cocos/aptos-template/contracts/counter/sources/entity_key.move +31 -0
  166. package/template/cocos/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
  167. package/template/cocos/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
  168. package/template/cocos/aptos-template/package.json +39 -0
  169. package/template/cocos/aptos-template/scripts/formatAccount.ts +35 -0
  170. package/template/cocos/aptos-template/scripts/generateAccount.ts +25 -0
  171. package/template/cocos/aptos-template/scripts/storeConfig.ts +68 -0
  172. package/template/cocos/aptos-template/settings/v2/packages/builder.json +3 -0
  173. package/template/cocos/aptos-template/settings/v2/packages/cocos-service.json +23 -0
  174. package/template/cocos/aptos-template/settings/v2/packages/device.json +3 -0
  175. package/template/cocos/aptos-template/settings/v2/packages/engine.json +150 -0
  176. package/template/cocos/aptos-template/settings/v2/packages/information.json +23 -0
  177. package/template/cocos/aptos-template/settings/v2/packages/program.json +3 -0
  178. package/template/cocos/aptos-template/settings/v2/packages/project.json +3 -0
  179. package/template/cocos/aptos-template/tsconfig.json +12 -0
  180. package/template/cocos/sui-template/.creator/asset-template/typescript/Custom Script Template Help Documentation.url +2 -0
  181. package/template/cocos/sui-template/README.md +11 -0
  182. package/template/cocos/sui-template/assets/Scripts/chain/config.ts +12 -0
  183. package/template/cocos/sui-template/assets/Scripts/chain/config.ts.meta +9 -0
  184. package/template/cocos/sui-template/assets/Scripts/chain/key.ts.meta +9 -0
  185. package/template/cocos/sui-template/assets/Scripts/chain.meta +9 -0
  186. package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts +13 -0
  187. package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts.meta +9 -0
  188. package/template/cocos/sui-template/assets/Scripts/sui.ts +120 -0
  189. package/template/cocos/sui-template/assets/Scripts/sui.ts.meta +9 -0
  190. package/template/cocos/sui-template/assets/Scripts.meta +12 -0
  191. package/template/cocos/sui-template/assets/lib/dubhe.js +55694 -0
  192. package/template/cocos/sui-template/assets/lib/dubhe.js.meta +15 -0
  193. package/template/cocos/sui-template/assets/lib.meta +12 -0
  194. package/template/cocos/sui-template/assets/main.scene +875 -0
  195. package/template/cocos/sui-template/assets/main.scene.meta +11 -0
  196. package/template/cocos/sui-template/contracts/counter/Move.toml +13 -0
  197. package/template/cocos/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
  198. package/template/cocos/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
  199. package/template/cocos/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
  200. package/template/cocos/sui-template/contracts/counter/sources/system/counter.move +11 -0
  201. package/template/cocos/sui-template/docker-compose.yaml +18 -0
  202. package/template/cocos/sui-template/package.json +27 -0
  203. package/template/cocos/sui-template/scripts/generateAccount.ts +55 -0
  204. package/template/cocos/sui-template/scripts/storeConfig.ts +75 -0
  205. package/template/cocos/sui-template/settings/v2/packages/builder.json +3 -0
  206. package/template/cocos/sui-template/settings/v2/packages/cocos-service.json +23 -0
  207. package/template/cocos/sui-template/settings/v2/packages/device.json +3 -0
  208. package/template/cocos/sui-template/settings/v2/packages/engine.json +150 -0
  209. package/template/cocos/sui-template/settings/v2/packages/information.json +23 -0
  210. package/template/cocos/sui-template/settings/v2/packages/program.json +3 -0
  211. package/template/cocos/sui-template/settings/v2/packages/project.json +3 -0
  212. package/template/cocos/sui-template/tsconfig.json +19 -0
  213. package/template/nextjs/aptos-template/.dockerignore +7 -0
  214. package/template/nextjs/aptos-template/.eslintrc.json +3 -0
  215. package/template/nextjs/aptos-template/.prettierrc +8 -0
  216. package/template/nextjs/aptos-template/Dockerfile +56 -0
  217. package/template/nextjs/aptos-template/LICENSE +674 -0
  218. package/template/nextjs/aptos-template/README.md +13 -0
  219. package/template/nextjs/aptos-template/contracts/counter/Move.toml +16 -0
  220. package/template/nextjs/aptos-template/contracts/counter/sources/codegen/eps/events.move +34 -0
  221. package/template/nextjs/aptos-template/contracts/counter/sources/codegen/eps/world.move +65 -0
  222. package/template/nextjs/aptos-template/contracts/counter/sources/codegen/init.move +17 -0
  223. package/template/nextjs/aptos-template/contracts/counter/sources/codegen/schemas/counter.move +59 -0
  224. package/template/nextjs/aptos-template/contracts/counter/sources/entity_key.move +31 -0
  225. package/template/nextjs/aptos-template/contracts/counter/sources/script/deploy_hook.move +19 -0
  226. package/template/nextjs/aptos-template/contracts/counter/sources/system/counter_system.move +11 -0
  227. package/template/nextjs/aptos-template/dubhe.config.ts +13 -0
  228. package/template/nextjs/aptos-template/jest.config.ts +17 -0
  229. package/template/nextjs/aptos-template/next-env.d.ts +5 -0
  230. package/template/nextjs/aptos-template/next-i18next.config.js +6 -0
  231. package/template/nextjs/aptos-template/next.config.js +15 -0
  232. package/template/nextjs/aptos-template/package.json +82 -0
  233. package/template/nextjs/aptos-template/postcss.config.js +6 -0
  234. package/template/nextjs/aptos-template/public/discord.svg +9 -0
  235. package/template/nextjs/aptos-template/public/fail.svg +12 -0
  236. package/template/nextjs/aptos-template/public/favicon.ico +0 -0
  237. package/template/nextjs/aptos-template/public/locales/de/common.json +8 -0
  238. package/template/nextjs/aptos-template/public/locales/de/footer.json +3 -0
  239. package/template/nextjs/aptos-template/public/locales/de/second-page.json +5 -0
  240. package/template/nextjs/aptos-template/public/locales/en/common.json +8 -0
  241. package/template/nextjs/aptos-template/public/locales/en/footer.json +3 -0
  242. package/template/nextjs/aptos-template/public/locales/en/second-page.json +5 -0
  243. package/template/nextjs/aptos-template/public/locales/zn/common.json +8 -0
  244. package/template/nextjs/aptos-template/public/locales/zn/footer.json +3 -0
  245. package/template/nextjs/aptos-template/public/locales/zn/second-page.json +5 -0
  246. package/template/nextjs/aptos-template/public/logo.svg +1 -0
  247. package/template/nextjs/aptos-template/public/medium.svg +9 -0
  248. package/template/nextjs/aptos-template/public/successful.svg +11 -0
  249. package/template/nextjs/aptos-template/public/telegram.svg +9 -0
  250. package/template/nextjs/aptos-template/public/twitter.svg +9 -0
  251. package/template/nextjs/aptos-template/scripts/formatAccount.ts +35 -0
  252. package/template/nextjs/aptos-template/scripts/generateAccount.ts +25 -0
  253. package/template/nextjs/aptos-template/scripts/storeConfig.ts +54 -0
  254. package/template/nextjs/aptos-template/src/chain/config.ts +7 -0
  255. package/template/nextjs/aptos-template/src/components/Animation.tsx +80 -0
  256. package/template/nextjs/aptos-template/src/components/Container.tsx +11 -0
  257. package/template/nextjs/aptos-template/src/components/footer/index.tsx +138 -0
  258. package/template/nextjs/aptos-template/src/components/head/index.tsx +14 -0
  259. package/template/nextjs/aptos-template/src/components/header/index.tsx +173 -0
  260. package/template/nextjs/aptos-template/src/components/pop_up_box/index.tsx +149 -0
  261. package/template/nextjs/aptos-template/src/css/font-awesome.css +2337 -0
  262. package/template/nextjs/aptos-template/src/css/font-awesome.min.css +4 -0
  263. package/template/nextjs/aptos-template/src/fonts/FontAwesome.otf +0 -0
  264. package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.eot +0 -0
  265. package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.svg +2671 -0
  266. package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.ttf +0 -0
  267. package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.woff +0 -0
  268. package/template/nextjs/aptos-template/src/fonts/fontawesome-webfont.woff2 +0 -0
  269. package/template/nextjs/aptos-template/src/jotai/index.tsx +13 -0
  270. package/template/nextjs/aptos-template/src/pages/_app.tsx +32 -0
  271. package/template/nextjs/aptos-template/src/pages/home/index.tsx +112 -0
  272. package/template/nextjs/aptos-template/src/pages/index.tsx +15 -0
  273. package/template/nextjs/aptos-template/tailwind.config.js +59 -0
  274. package/template/nextjs/aptos-template/tsconfig.json +35 -0
  275. package/template/nextjs/sui-template/.dockerignore +7 -0
  276. package/template/nextjs/sui-template/.eslintrc.json +3 -0
  277. package/template/nextjs/sui-template/.prettierrc +8 -0
  278. package/template/nextjs/sui-template/Dockerfile +52 -0
  279. package/template/nextjs/sui-template/LICENSE +674 -0
  280. package/template/nextjs/sui-template/README.md +13 -0
  281. package/template/nextjs/sui-template/contracts/counter/Move.toml +13 -0
  282. package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp_key.move +16 -0
  283. package/template/nextjs/sui-template/contracts/counter/sources/codegen/schemas/counter.move +50 -0
  284. package/template/nextjs/sui-template/contracts/counter/sources/script/deploy_hook.move +67 -0
  285. package/template/nextjs/sui-template/contracts/counter/sources/system/counter.move +11 -0
  286. package/template/nextjs/sui-template/docker-compose.yaml +29 -0
  287. package/template/nextjs/sui-template/dubhe.config.ts +14 -0
  288. package/template/nextjs/sui-template/jest.config.ts +17 -0
  289. package/template/nextjs/sui-template/localnet/dubhe-framework/Move.toml +39 -0
  290. package/template/nextjs/sui-template/localnet/dubhe-framework/README.md +18 -0
  291. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/access_control.move +35 -0
  292. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/events.move +23 -0
  293. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/resource_id.move +22 -0
  294. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/resource_types.move +18 -0
  295. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schema.move +36 -0
  296. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/dapps.move +73 -0
  297. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/schemas/dapps/metadata.move +96 -0
  298. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/double_map.move +156 -0
  299. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/map.move +159 -0
  300. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/storages/value.move +100 -0
  301. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/systems/dapps.move +90 -0
  302. package/template/nextjs/sui-template/localnet/dubhe-framework/sources/world.move +81 -0
  303. package/template/nextjs/sui-template/localnet/dubhe-framework/tests/dapp.move +16 -0
  304. package/template/nextjs/sui-template/localnet/dubhe-framework/tests/init.move +6 -0
  305. package/template/nextjs/sui-template/localnet/dubhe-framework/tests/obelisk_framework_tests.move +19 -0
  306. package/template/nextjs/sui-template/localnet/dubhe-framework/tests/storage.move +398 -0
  307. package/template/nextjs/sui-template/next-env.d.ts +5 -0
  308. package/template/nextjs/sui-template/next-i18next.config.js +6 -0
  309. package/template/nextjs/sui-template/next.config.js +15 -0
  310. package/template/nextjs/sui-template/package.json +84 -0
  311. package/template/nextjs/sui-template/postcss.config.js +6 -0
  312. package/template/nextjs/sui-template/public/discord.svg +9 -0
  313. package/template/nextjs/sui-template/public/fail.svg +12 -0
  314. package/template/nextjs/sui-template/public/favicon.ico +0 -0
  315. package/template/nextjs/sui-template/public/locales/de/common.json +8 -0
  316. package/template/nextjs/sui-template/public/locales/de/footer.json +3 -0
  317. package/template/nextjs/sui-template/public/locales/de/second-page.json +5 -0
  318. package/template/nextjs/sui-template/public/locales/en/common.json +8 -0
  319. package/template/nextjs/sui-template/public/locales/en/footer.json +3 -0
  320. package/template/nextjs/sui-template/public/locales/en/second-page.json +5 -0
  321. package/template/nextjs/sui-template/public/locales/zn/common.json +8 -0
  322. package/template/nextjs/sui-template/public/locales/zn/footer.json +3 -0
  323. package/template/nextjs/sui-template/public/locales/zn/second-page.json +5 -0
  324. package/template/nextjs/sui-template/public/logo.svg +1 -0
  325. package/template/nextjs/sui-template/public/medium.svg +9 -0
  326. package/template/nextjs/sui-template/public/successful.svg +11 -0
  327. package/template/nextjs/sui-template/public/telegram.svg +9 -0
  328. package/template/nextjs/sui-template/public/twitter.svg +9 -0
  329. package/template/nextjs/sui-template/scripts/checkBalance.ts +40 -0
  330. package/template/nextjs/sui-template/scripts/deployment/common.ts +60 -0
  331. package/template/nextjs/sui-template/scripts/deployment/localnet/deploy.ts +42 -0
  332. package/template/nextjs/sui-template/scripts/deployment/testnet/deploy.ts +48 -0
  333. package/template/nextjs/sui-template/scripts/deployment/types.ts +13 -0
  334. package/template/nextjs/sui-template/scripts/framework/common.ts +17 -0
  335. package/template/nextjs/sui-template/scripts/framework/deploy.ts +199 -0
  336. package/template/nextjs/sui-template/scripts/framework/parse-history.ts +76 -0
  337. package/template/nextjs/sui-template/scripts/framework/types.ts +8 -0
  338. package/template/nextjs/sui-template/scripts/generateAccount.ts +55 -0
  339. package/template/nextjs/sui-template/scripts/storeConfig.ts +61 -0
  340. package/template/nextjs/sui-template/scripts/waitNode.ts +9 -0
  341. package/template/nextjs/sui-template/src/chain/config.ts +7 -0
  342. package/template/nextjs/sui-template/src/components/Animation.tsx +80 -0
  343. package/template/nextjs/sui-template/src/components/Container.tsx +11 -0
  344. package/template/nextjs/sui-template/src/components/footer/index.tsx +138 -0
  345. package/template/nextjs/sui-template/src/components/head/index.tsx +14 -0
  346. package/template/nextjs/sui-template/src/components/header/index.tsx +173 -0
  347. package/template/nextjs/sui-template/src/components/pop_up_box/index.tsx +149 -0
  348. package/template/nextjs/sui-template/src/css/font-awesome.css +2337 -0
  349. package/template/nextjs/sui-template/src/css/font-awesome.min.css +4 -0
  350. package/template/nextjs/sui-template/src/fonts/FontAwesome.otf +0 -0
  351. package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
  352. package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.svg +2671 -0
  353. package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
  354. package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
  355. package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
  356. package/template/nextjs/sui-template/src/jotai/index.tsx +13 -0
  357. package/template/nextjs/sui-template/src/pages/_app.tsx +32 -0
  358. package/template/nextjs/sui-template/src/pages/home/index.tsx +147 -0
  359. package/template/nextjs/sui-template/src/pages/index.tsx +15 -0
  360. package/template/nextjs/sui-template/tailwind.config.js +56 -0
  361. 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
+ }
@@ -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
+ }
@@ -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
+ }