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,42 @@
1
+ import chalk from 'chalk';
2
+ import { deployFramework } from '../../framework/deploy';
3
+ import { validateAndUpdatePackageId } from '../../framework/parse-history';
4
+ import { deployContract } from '../common';
5
+
6
+ async function delay(ms: number) {
7
+ await new Promise(resolve => setTimeout(resolve, ms));
8
+ }
9
+
10
+ async function main() {
11
+ try {
12
+ // 1. Deploy framework contract
13
+ console.log(chalk.blue('\n🏗️ Deploying framework contract...'));
14
+ await deployFramework();
15
+ console.log(chalk.green(' ✅ Framework contract deployed successfully'));
16
+ await delay(1000);
17
+
18
+ // 2. Parse framework information
19
+ console.log(chalk.blue('\n🔍 Parsing framework information...'));
20
+ const deploymentData = await validateAndUpdatePackageId();
21
+ console.log(chalk.green(' ✅ Framework information parsed successfully'));
22
+ await delay(1000);
23
+
24
+ // 3. Deploy contract
25
+ const dappsObjectId = deploymentData.dappsObjectId;
26
+ await deployContract('localnet', dappsObjectId);
27
+ console.log(chalk.green('\n✅ All operations completed successfully'));
28
+ } catch (error) {
29
+ console.error(chalk.red(`\n❌ Execution failed: ${error}`));
30
+ process.exit(1);
31
+ }
32
+ }
33
+
34
+ // Use IIFE (Immediately Invoked Function Expression) to ensure async code executes correctly
35
+ (async () => {
36
+ try {
37
+ await main();
38
+ } catch (error) {
39
+ console.error(chalk.red(`\n❌ Main program execution failed: ${error}`));
40
+ process.exit(1);
41
+ }
42
+ })();
@@ -0,0 +1,48 @@
1
+ import chalk from 'chalk';
2
+ import { deployContract } from '../common';
3
+ import { dubheConfig } from '../../../dubhe.config';
4
+ import fs from 'fs/promises';
5
+ import path from 'path';
6
+
7
+ const TESTNET_FRAMEWORK_ID = '0x1736475f476c5dec96f33c03c778843f572239d3a887d795eef66d2836484c28';
8
+
9
+ async function updateDubheMoveToml(projectName: string) {
10
+ try {
11
+ console.log(chalk.blue(`\n🔍 Updating Move.toml...`));
12
+ const moveTomlPath = path.join(process.cwd(), `contracts/${projectName}/Move.toml`);
13
+ let content = await fs.readFile(moveTomlPath, 'utf8');
14
+
15
+ content = content.replace(
16
+ /Dubhe = \{[^}]+\}/,
17
+ `Dubhe = { git = "https://github.com/0xobelisk/dubhe.git", subdir = "packages/dubhe-framework", rev = "main" }`,
18
+ );
19
+
20
+ content = content.replace(/^dubhe\s+=\s+"0x[0-9a-fA-F]+"/m, `dubhe = "${TESTNET_FRAMEWORK_ID}"`);
21
+
22
+ await fs.writeFile(moveTomlPath, content);
23
+ console.log(chalk.green(' ✅ Move.toml updated successfully'));
24
+ } catch (error) {
25
+ throw new Error(`Failed to update Move.toml: ${error}`);
26
+ }
27
+ }
28
+
29
+ async function main() {
30
+ try {
31
+ await updateDubheMoveToml(dubheConfig.name);
32
+ await deployContract('testnet');
33
+ console.log(chalk.green('\n✅ All operations completed successfully'));
34
+ } catch (error) {
35
+ console.error(chalk.red(`\n❌ Execution failed: ${error}`));
36
+ process.exit(1);
37
+ }
38
+ }
39
+
40
+ // Use IIFE (Immediately Invoked Function Expression) to ensure async code executes correctly
41
+ (async () => {
42
+ try {
43
+ await main();
44
+ } catch (error) {
45
+ console.error(chalk.red(`\n❌ Main program execution failed: ${error}`));
46
+ process.exit(1);
47
+ }
48
+ })();
@@ -0,0 +1,13 @@
1
+ export type schema = {
2
+ name: string;
3
+ objectId: string;
4
+ };
5
+
6
+ export type DeploymentJsonType = {
7
+ projectName: string;
8
+ network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
9
+ packageId: string;
10
+ schemas: schema[];
11
+ upgradeCap: string;
12
+ version: number;
13
+ };
@@ -0,0 +1,17 @@
1
+ import * as fsAsync from 'fs/promises';
2
+ import { FrameworkDeploymentJsonType } from './types';
3
+
4
+ export async function getFrameworkDeploymentJson(
5
+ projectPath: string,
6
+ network: string,
7
+ ): Promise<FrameworkDeploymentJsonType> {
8
+ try {
9
+ const data = await fsAsync.readFile(
10
+ `${projectPath}/localnet/dubhe-framework/.history/sui_${network}/latest.json`,
11
+ 'utf8',
12
+ );
13
+ return JSON.parse(data) as FrameworkDeploymentJsonType;
14
+ } catch {
15
+ throw new Error('Failed to read deployment history file');
16
+ }
17
+ }
@@ -0,0 +1,199 @@
1
+ import { Dubhe, loadMetadata, Transaction } from '@0xobelisk/sui-client';
2
+ import { execSync } from 'child_process';
3
+ import * as fsAsync from 'fs/promises';
4
+ import { mkdirSync, writeFileSync } from 'fs';
5
+ import { dirname } from 'path';
6
+ import chalk from 'chalk';
7
+ import { FrameworkDeploymentJsonType } from './types';
8
+ import { getFrameworkDeploymentJson } from './common';
9
+ import dotenv from 'dotenv';
10
+ dotenv.config();
11
+
12
+ export async function writeOutput(output: string, fullOutputPath: string, logPrefix?: string): Promise<void> {
13
+ mkdirSync(dirname(fullOutputPath), { recursive: true });
14
+
15
+ writeFileSync(fullOutputPath, output);
16
+ if (logPrefix !== undefined) {
17
+ console.log(`${logPrefix}: ${fullOutputPath}`);
18
+ }
19
+ }
20
+
21
+ export function saveContractData(
22
+ projectName: string,
23
+ network: 'mainnet' | 'testnet' | 'devnet' | 'localnet',
24
+ packageId: string,
25
+ upgradeCap: string,
26
+ dappsObjectId: string,
27
+ version: number,
28
+ ) {
29
+ const DeploymentData: FrameworkDeploymentJsonType = {
30
+ projectName,
31
+ network,
32
+ packageId,
33
+ upgradeCap,
34
+ dappsObjectId,
35
+ version,
36
+ };
37
+
38
+ const path = process.cwd();
39
+ const storeDeploymentData = JSON.stringify(DeploymentData, null, 2);
40
+ writeOutput(
41
+ storeDeploymentData,
42
+ `${path}/localnet/dubhe-framework/.history/sui_${network}/latest.json`,
43
+ 'Updated deployment log',
44
+ );
45
+ }
46
+
47
+ async function updateFrameworkMoveToml(frameworkPath: string, packageId: string | null = null) {
48
+ const moveTomlPath = `${frameworkPath}/Move.toml`;
49
+
50
+ try {
51
+ let content = await fsAsync.readFile(moveTomlPath, 'utf8');
52
+
53
+ if (packageId === null) {
54
+ // Pre-deployment: Reset addresses to 0x0
55
+ content = content.replace(/^published-at = "0x[0-9a-fA-F]+"/m, 'published-at = "0x0"');
56
+ content = content.replace(/^dubhe = "0x[0-9a-fA-F]+"/m, 'dubhe = "0x0"');
57
+ console.log(chalk.blue('Reset dubhe-framework addresses in Move.toml to 0x0'));
58
+ } else {
59
+ // Post-deployment: Update to new packageId
60
+ content = content.replace(/^published-at = "0x[0-9a-fA-F]+"/m, `published-at = "${packageId}"`);
61
+ content = content.replace(/^dubhe = "0x[0-9a-fA-F]+"/m, `dubhe = "${packageId}"`);
62
+ console.log(chalk.blue(`Updated dubhe-framework addresses in Move.toml to ${packageId}`));
63
+ }
64
+
65
+ await fsAsync.writeFile(moveTomlPath, content);
66
+ } catch (error) {
67
+ console.error(chalk.red(`Failed to update Move.toml: ${error}`));
68
+ throw error;
69
+ }
70
+ }
71
+
72
+ export async function deployFramework() {
73
+ const network = 'localnet';
74
+ const path = process.cwd();
75
+ const name = 'dubhe_framework';
76
+ const frameworkPath = `${path}/localnet/dubhe-framework`;
77
+
78
+ try {
79
+ // Try to get historical deployment information
80
+ const deploymentData = await getFrameworkDeploymentJson(path, network);
81
+
82
+ // Check if the contract exists
83
+ try {
84
+ const metadata = await loadMetadata(network, deploymentData.packageId);
85
+ if (metadata) {
86
+ console.log(chalk.yellow('Framework contract already deployed on local network'));
87
+ return; // Contract already exists, return directly
88
+ }
89
+ } catch (error) {
90
+ console.log(
91
+ chalk.yellow('Previous deployment found but contract not accessible, proceeding with new deployment'),
92
+ );
93
+ }
94
+ } catch (error) {
95
+ console.log(chalk.yellow('No previous deployment found, proceeding with new deployment'));
96
+ }
97
+
98
+ // Reset Move.toml addresses before compilation
99
+ await updateFrameworkMoveToml(frameworkPath);
100
+
101
+ // Check for private key in environment variables
102
+ const privateKey = process.env.PRIVATE_KEY;
103
+ if (!privateKey) {
104
+ throw new Error('Missing PRIVATE_KEY environment variable');
105
+ }
106
+
107
+ // Initialize Dubhe client
108
+ const dubhe = new Dubhe({
109
+ networkType: network,
110
+ secretKey: privateKey,
111
+ });
112
+ const keypair = dubhe.getKeypair();
113
+
114
+ const balance = await dubhe.getBalance();
115
+ console.log(chalk.blue(`Deployer Balance: ${(Number(balance.totalBalance) / 1_000_000_000).toFixed(4)} SUI`));
116
+
117
+ if (BigInt(balance.totalBalance) < BigInt(1000000000)) {
118
+ console.log(chalk.yellow('Balance is less than 1 SUI, requesting from faucet...'));
119
+ await dubhe.requestFaucet();
120
+ console.log(chalk.green('Successfully received SUI from faucet'));
121
+ }
122
+
123
+ // Compile and get bytecode
124
+ let modules, dependencies;
125
+ try {
126
+ const buildResult = JSON.parse(
127
+ execSync(`sui move build --dump-bytecode-as-base64 --path ${frameworkPath}`, {
128
+ encoding: 'utf-8',
129
+ }),
130
+ );
131
+ modules = buildResult.modules;
132
+ dependencies = buildResult.dependencies;
133
+ } catch (error: any) {
134
+ console.error(chalk.red('Error executing sui move build:'));
135
+ console.error(error.stdout);
136
+ process.exit(1);
137
+ }
138
+
139
+ console.log(chalk.blue(`Deployer Address: ${keypair.toSuiAddress()}`));
140
+
141
+ // Create publish transaction
142
+ const tx = new Transaction();
143
+ const [upgradeCap] = tx.publish({
144
+ modules,
145
+ dependencies,
146
+ });
147
+ tx.transferObjects([upgradeCap], keypair.toSuiAddress());
148
+
149
+ // Execute transaction
150
+ try {
151
+ const result = await dubhe.signAndSendTxn(tx);
152
+
153
+ if (result.effects?.status.status === 'failure') {
154
+ console.log(chalk.red(`Failed to execute publish`));
155
+ process.exit(1);
156
+ }
157
+
158
+ let packageId = '';
159
+ let upgradeCapId = '';
160
+ let dappsObjectId = '';
161
+
162
+ // Output deployment information
163
+ result.objectChanges!.map(object => {
164
+ if (object.type === 'published') {
165
+ console.log(chalk.blue(`Framework PackageId: ${object.packageId}`));
166
+ packageId = object.packageId;
167
+ }
168
+ if (object.type === 'created' && object.objectType === '0x2::package::UpgradeCap') {
169
+ console.log(chalk.blue(`Framework UpgradeCap: ${object.objectId}`));
170
+ upgradeCapId = object.objectId;
171
+ }
172
+ if (object.type === 'created' && object.objectType.includes('dapps_schema::Dapps')) {
173
+ console.log(chalk.blue(`Framework Dapps ObjectId: ${object.objectId}`));
174
+ dappsObjectId = object.objectId;
175
+ }
176
+ });
177
+
178
+ // Update Move.toml addresses with new packageId
179
+ await updateFrameworkMoveToml(frameworkPath, packageId);
180
+
181
+ console.log(chalk.green(`Publish transaction digest: ${result.digest}`));
182
+
183
+ // Save contract data
184
+ saveContractData(
185
+ name,
186
+ network,
187
+ packageId,
188
+ upgradeCapId,
189
+ dappsObjectId,
190
+ 1, // Initial version is 1
191
+ );
192
+ } catch (error: any) {
193
+ console.error(chalk.red(`Failed to execute publish`));
194
+ console.error(error.message);
195
+ process.exit(1);
196
+ }
197
+ }
198
+
199
+ // deployFramework();
@@ -0,0 +1,76 @@
1
+ import { loadMetadata } from '@0xobelisk/sui-client';
2
+ import { dubheConfig } from '../../dubhe.config';
3
+ import * as fsAsync from 'fs/promises';
4
+ import * as path from 'path';
5
+ import chalk from 'chalk';
6
+ import { FrameworkDeploymentJsonType } from './types';
7
+ import { getFrameworkDeploymentJson } from './common';
8
+
9
+ async function updateMoveToml(packageName: string, dubhePackageId: string) {
10
+ const moveTomlPath = path.join(process.cwd(), 'contracts', packageName, 'Move.toml');
11
+
12
+ try {
13
+ let content = await fsAsync.readFile(moveTomlPath, 'utf8');
14
+
15
+ // Update Dubhe dependency
16
+ content = content.replace(/Dubhe = \{[^}]+\}/, `Dubhe = { local = "../../localnet/dubhe-framework" }`);
17
+
18
+ // Update regex to match possible multiple spaces
19
+ content = content.replace(/^dubhe\s+=\s+"0x[0-9a-fA-F]+"/m, `dubhe = "${dubhePackageId}"`);
20
+
21
+ await fsAsync.writeFile(moveTomlPath, content);
22
+ console.log(chalk.green(`Successfully updated ${moveTomlPath}`));
23
+ } catch (error) {
24
+ console.error(chalk.red(`Failed to update Move.toml: ${error}`));
25
+ throw error;
26
+ }
27
+ }
28
+
29
+ export async function validateAndUpdatePackageId(): Promise<FrameworkDeploymentJsonType> {
30
+ const network = 'localnet';
31
+ const projectPath = process.cwd();
32
+
33
+ try {
34
+ const packageName = dubheConfig.name;
35
+
36
+ if (!packageName) {
37
+ throw new Error('Package name not found in the config file');
38
+ }
39
+
40
+ // Get historical deployment information
41
+ const deploymentData = await getFrameworkDeploymentJson(projectPath, network);
42
+
43
+ // Verify if packageId exists on chain
44
+ try {
45
+ const metadata = await loadMetadata(network, deploymentData.packageId);
46
+ if (!metadata) {
47
+ throw new Error('PackageId does not exist on chain');
48
+ }
49
+
50
+ console.log(chalk.green(`Verification successful: PackageId ${deploymentData.packageId} exists on chain`));
51
+
52
+ // Update Move.toml file
53
+ await updateMoveToml(packageName, deploymentData.packageId);
54
+
55
+ console.log(chalk.green('All updates completed successfully'));
56
+ return deploymentData;
57
+ } catch (error) {
58
+ console.error(chalk.red(`Verification failed: ${error}`));
59
+ throw error;
60
+ }
61
+ } catch (error) {
62
+ console.error(chalk.red(`Processing failed: ${error}`));
63
+ throw error;
64
+ }
65
+ }
66
+
67
+ // Export main function
68
+ export async function parseAndUpdateFramework() {
69
+ try {
70
+ const packageId = await validateAndUpdatePackageId();
71
+ return packageId;
72
+ } catch (error) {
73
+ console.error(chalk.red(`Framework update failed: ${error}`));
74
+ process.exit(1);
75
+ }
76
+ }
@@ -0,0 +1,8 @@
1
+ export type FrameworkDeploymentJsonType = {
2
+ projectName: string;
3
+ network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
4
+ packageId: string;
5
+ upgradeCap: string;
6
+ dappsObjectId: string;
7
+ version: number;
8
+ };
@@ -0,0 +1,55 @@
1
+ import { Dubhe } from '@0xobelisk/sui-client';
2
+ import * as fs from 'fs';
3
+
4
+ async function generateAccount() {
5
+ const path = process.cwd();
6
+
7
+ // Check if .env file exists and has content
8
+ let privateKey: string;
9
+ try {
10
+ const envContent = fs.readFileSync(`${path}/.env`, 'utf8');
11
+ const match = envContent.match(/PRIVATE_KEY=(.+)/);
12
+ if (match && match[1]) {
13
+ privateKey = match[1];
14
+ const dubhe = new Dubhe({ secretKey: privateKey });
15
+ const keypair = dubhe.getKeypair();
16
+
17
+ // Only update key.ts file
18
+ const chainFolderPath = `${path}/src/chain`;
19
+ fs.mkdirSync(chainFolderPath, { recursive: true });
20
+
21
+ fs.writeFileSync(
22
+ `${path}/src/chain/key.ts`,
23
+ `export const PRIVATEKEY = '${privateKey}';
24
+ export const ACCOUNT = '${keypair.toSuiAddress()}';
25
+ `,
26
+ );
27
+
28
+ console.log(`Using existing Account: ${keypair.toSuiAddress()}`);
29
+ return;
30
+ }
31
+ } catch (error) {
32
+ // .env file doesn't exist or failed to read, continue to generate new account
33
+ }
34
+
35
+ // If no existing private key, generate new account
36
+ const dubhe = new Dubhe();
37
+ const keypair = dubhe.getKeypair();
38
+ privateKey = keypair.getSecretKey();
39
+
40
+ const chainFolderPath = `${path}/src/chain`;
41
+ fs.mkdirSync(chainFolderPath, { recursive: true });
42
+
43
+ fs.writeFileSync(`${path}/.env`, `PRIVATE_KEY=${privateKey}`);
44
+
45
+ fs.writeFileSync(
46
+ `${path}/src/chain/key.ts`,
47
+ `export const PRIVATEKEY = '${privateKey}';
48
+ export const ACCOUNT = '${keypair.toSuiAddress()}';
49
+ `,
50
+ );
51
+
52
+ console.log(`Generate new Account: ${keypair.toSuiAddress()}`);
53
+ }
54
+
55
+ generateAccount();
@@ -0,0 +1,61 @@
1
+ import * as fsAsync from 'fs/promises';
2
+ import { mkdirSync, writeFileSync } from 'fs';
3
+ import { exit } from 'process';
4
+ import { dubheConfig } from '../dubhe.config';
5
+ import { dirname } from 'path';
6
+
7
+ export type schema = {
8
+ name: string;
9
+ objectId: string;
10
+ };
11
+
12
+ type DeploymentJsonType = {
13
+ projectName: string;
14
+ network: 'mainnet' | 'testnet' | 'devnet' | 'localnet';
15
+ packageId: string;
16
+ schemas: schema[];
17
+ upgradeCap: string;
18
+ version: number;
19
+ };
20
+
21
+ async function getDeploymentJson(projectPath: string, network: string) {
22
+ try {
23
+ const data = await fsAsync.readFile(`${projectPath}/.history/sui_${network}/latest.json`, 'utf8');
24
+ return JSON.parse(data) as DeploymentJsonType;
25
+ } catch {
26
+ console.log('store config failed.');
27
+ exit;
28
+ }
29
+ }
30
+
31
+ function storeConfig(network: string, packageId: string, schemas: schema[]) {
32
+ let code = `type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
33
+
34
+ export const NETWORK: NetworkType = '${network}';
35
+
36
+ export const PACKAGE_ID = '${packageId}'
37
+
38
+ ${schemas.map(schema => `export const ${schema.name.split('::')[2]}_Object_Id = '${schema.objectId}'`).join('\n')}
39
+ `;
40
+ const path = process.cwd();
41
+ writeOutput(code, `${path}/src/chain/config.ts`, 'storeConfig');
42
+ }
43
+
44
+ async function writeOutput(output: string, fullOutputPath: string, logPrefix?: string): Promise<void> {
45
+ mkdirSync(dirname(fullOutputPath), { recursive: true });
46
+
47
+ writeFileSync(fullOutputPath, output);
48
+ if (logPrefix !== undefined) {
49
+ console.log(`${logPrefix}: ${fullOutputPath}`);
50
+ }
51
+ }
52
+
53
+ async function main() {
54
+ const path = process.cwd();
55
+ const network = process.argv[2];
56
+ const contractPath = `${path}/contracts/${dubheConfig.name}`;
57
+ const deployment = await getDeploymentJson(contractPath, network);
58
+ storeConfig(deployment.network, deployment.packageId, deployment.schemas);
59
+ }
60
+
61
+ main();
@@ -0,0 +1,9 @@
1
+ import chalk from 'chalk';
2
+
3
+ async function waitNode(ms: number) {
4
+ // 1. Start local node
5
+ console.log(chalk.blue('\n🌐 Waiting for node to start...'));
6
+ return new Promise(resolve => setTimeout(resolve, ms));
7
+ }
8
+
9
+ waitNode(3000);
@@ -0,0 +1,7 @@
1
+ type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
2
+
3
+ export const NETWORK: NetworkType = 'testnet';
4
+
5
+ export const PACKAGE_ID = '0xc58411ca78d829dbc3bb104ee7e63b8c95c0b0fb110cc98332023a88c18837a6'
6
+
7
+ export const Counter_Object_Id = '0x35a38188257ee072283672fb112488737dda1a081f30f691063fd7dcd370a421'