create-dubhe 0.1.6 → 0.1.8

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 (177) hide show
  1. package/index.js +1 -1
  2. package/package.json +11 -3
  3. package/template/101/aptos-template/.prettierignore +1 -0
  4. package/template/101/aptos-template/.prettierrc +7 -7
  5. package/template/101/aptos-template/.prettierrc.json +8 -0
  6. package/template/101/aptos-template/README.md +3 -2
  7. package/template/101/aptos-template/jest.config.ts +3 -3
  8. package/template/101/aptos-template/next-i18next.config.js +4 -4
  9. package/template/101/aptos-template/next.config.js +11 -12
  10. package/template/101/aptos-template/package.json +10 -5
  11. package/template/101/aptos-template/postcss.config.js +1 -1
  12. package/template/101/aptos-template/public/locales/de/common.json +1 -1
  13. package/template/101/aptos-template/public/locales/de/footer.json +1 -1
  14. package/template/101/aptos-template/public/locales/de/second-page.json +1 -1
  15. package/template/101/aptos-template/public/locales/en/footer.json +1 -1
  16. package/template/101/aptos-template/public/locales/en/second-page.json +1 -1
  17. package/template/101/aptos-template/public/locales/zn/common.json +1 -1
  18. package/template/101/aptos-template/public/locales/zn/footer.json +1 -1
  19. package/template/101/aptos-template/public/locales/zn/second-page.json +1 -1
  20. package/template/101/aptos-template/scripts/checkBalance.ts +1 -1
  21. package/template/101/aptos-template/src/css/font-awesome.css +692 -687
  22. package/template/101/aptos-template/src/css/font-awesome.min.css +2333 -1
  23. package/template/101/aptos-template/tailwind.config.js +40 -52
  24. package/template/101/initia-template/.prettierignore +1 -0
  25. package/template/101/initia-template/.prettierrc +7 -7
  26. package/template/101/initia-template/.prettierrc.json +8 -0
  27. package/template/101/initia-template/README.md +3 -2
  28. package/template/101/initia-template/jest.config.ts +3 -3
  29. package/template/101/initia-template/next-i18next.config.js +4 -4
  30. package/template/101/initia-template/next.config.js +11 -12
  31. package/template/101/initia-template/package.json +8 -3
  32. package/template/101/initia-template/postcss.config.js +1 -1
  33. package/template/101/initia-template/public/locales/de/common.json +1 -1
  34. package/template/101/initia-template/public/locales/de/footer.json +1 -1
  35. package/template/101/initia-template/public/locales/de/second-page.json +1 -1
  36. package/template/101/initia-template/public/locales/en/footer.json +1 -1
  37. package/template/101/initia-template/public/locales/en/second-page.json +1 -1
  38. package/template/101/initia-template/public/locales/zn/common.json +1 -1
  39. package/template/101/initia-template/public/locales/zn/footer.json +1 -1
  40. package/template/101/initia-template/public/locales/zn/second-page.json +1 -1
  41. package/template/101/initia-template/src/chain/config.ts +1 -1
  42. package/template/101/initia-template/src/css/font-awesome.css +692 -687
  43. package/template/101/initia-template/src/css/font-awesome.min.css +2333 -1
  44. package/template/101/initia-template/src/pages/index.tsx +7 -9
  45. package/template/101/initia-template/tailwind.config.js +40 -52
  46. package/template/101/movement-template/.prettierignore +1 -0
  47. package/template/101/movement-template/.prettierrc +7 -7
  48. package/template/101/movement-template/.prettierrc.json +8 -0
  49. package/template/101/movement-template/README.md +3 -2
  50. package/template/101/movement-template/jest.config.ts +3 -3
  51. package/template/101/movement-template/next-i18next.config.js +4 -4
  52. package/template/101/movement-template/next.config.js +11 -12
  53. package/template/101/movement-template/package.json +10 -5
  54. package/template/101/movement-template/postcss.config.js +1 -1
  55. package/template/101/movement-template/public/locales/de/common.json +1 -1
  56. package/template/101/movement-template/public/locales/de/footer.json +1 -1
  57. package/template/101/movement-template/public/locales/de/second-page.json +1 -1
  58. package/template/101/movement-template/public/locales/en/footer.json +1 -1
  59. package/template/101/movement-template/public/locales/en/second-page.json +1 -1
  60. package/template/101/movement-template/public/locales/zn/common.json +1 -1
  61. package/template/101/movement-template/public/locales/zn/footer.json +1 -1
  62. package/template/101/movement-template/public/locales/zn/second-page.json +1 -1
  63. package/template/101/movement-template/src/css/font-awesome.css +692 -687
  64. package/template/101/movement-template/src/css/font-awesome.min.css +2333 -1
  65. package/template/101/movement-template/tailwind.config.js +40 -52
  66. package/template/101/rooch-template/.prettierignore +1 -0
  67. package/template/101/rooch-template/.prettierrc +7 -7
  68. package/template/101/rooch-template/.prettierrc.json +8 -0
  69. package/template/101/rooch-template/README.md +3 -2
  70. package/template/101/rooch-template/jest.config.ts +3 -3
  71. package/template/101/rooch-template/next-i18next.config.js +4 -4
  72. package/template/101/rooch-template/next.config.js +11 -12
  73. package/template/101/rooch-template/package.json +8 -3
  74. package/template/101/rooch-template/postcss.config.js +1 -1
  75. package/template/101/rooch-template/public/locales/de/common.json +1 -1
  76. package/template/101/rooch-template/public/locales/de/footer.json +1 -1
  77. package/template/101/rooch-template/public/locales/de/second-page.json +1 -1
  78. package/template/101/rooch-template/public/locales/en/footer.json +1 -1
  79. package/template/101/rooch-template/public/locales/en/second-page.json +1 -1
  80. package/template/101/rooch-template/public/locales/zn/common.json +1 -1
  81. package/template/101/rooch-template/public/locales/zn/footer.json +1 -1
  82. package/template/101/rooch-template/public/locales/zn/second-page.json +1 -1
  83. package/template/101/rooch-template/src/chain/config.ts +1 -1
  84. package/template/101/rooch-template/src/css/font-awesome.css +692 -687
  85. package/template/101/rooch-template/src/css/font-awesome.min.css +2333 -1
  86. package/template/101/rooch-template/src/pages/index.tsx +7 -9
  87. package/template/101/rooch-template/tailwind.config.js +40 -52
  88. package/template/101/sui-template/.prettierignore +1 -0
  89. package/template/101/sui-template/.prettierrc.json +8 -0
  90. package/template/101/sui-template/README.md +4 -2
  91. package/template/101/sui-template/contracts/counter/sources/codegen/dapp/metadata.move +1 -1
  92. package/template/101/sui-template/contracts/counter/sources/codegen/dapp/schema.move +2 -2
  93. package/template/101/sui-template/contracts/counter/sources/codegen/dapp/system.move +7 -7
  94. package/template/101/sui-template/contracts/counter/sources/codegen/data/increment_event.move +1 -1
  95. package/template/101/sui-template/contracts/counter/sources/codegen/errors.move +3 -3
  96. package/template/101/sui-template/contracts/counter/sources/codegen/events.move +4 -4
  97. package/template/101/sui-template/contracts/counter/sources/codegen/genesis.move +5 -5
  98. package/template/101/sui-template/contracts/counter/sources/codegen/schema.move +9 -1
  99. package/template/101/sui-template/contracts/counter/sources/scripts/deploy_hook.move +2 -2
  100. package/template/101/sui-template/contracts/counter/sources/scripts/migrate.move +1 -1
  101. package/template/101/sui-template/contracts/counter/sources/systems/counter.move +3 -3
  102. package/template/101/sui-template/contracts/counter/sources/tests/counter.move +3 -3
  103. package/template/101/sui-template/contracts/counter/sources/tests/init.move +3 -3
  104. package/template/101/sui-template/dubhe.config.ts +4 -4
  105. package/template/101/sui-template/package.json +8 -7
  106. package/template/cocos/aptos-template/README.md +2 -1
  107. package/template/cocos/aptos-template/assets/Scripts/aptos.ts +15 -15
  108. package/template/cocos/aptos-template/assets/Scripts/chain/config.ts +5 -5
  109. package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts +8 -8
  110. package/template/cocos/aptos-template/assets/lib/obelisk.js +23107 -19762
  111. package/template/cocos/aptos-template/package.json +37 -37
  112. package/template/cocos/aptos-template/scripts/formatAccount.ts +18 -18
  113. package/template/cocos/aptos-template/scripts/generateAccount.ts +2 -2
  114. package/template/cocos/aptos-template/scripts/storeConfig.ts +37 -37
  115. package/template/cocos/aptos-template/tsconfig.json +2 -2
  116. package/template/cocos/sui-template/README.md +2 -1
  117. package/template/cocos/sui-template/assets/Scripts/chain/config.ts +3 -7
  118. package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts +9 -9
  119. package/template/cocos/sui-template/assets/Scripts/sui.ts +87 -103
  120. package/template/cocos/sui-template/docker-compose.yaml +10 -4
  121. package/template/cocos/sui-template/package.json +25 -25
  122. package/template/cocos/sui-template/scripts/generateAccount.ts +38 -38
  123. package/template/cocos/sui-template/scripts/storeConfig.ts +36 -41
  124. package/template/cocos/sui-template/tsconfig.json +3 -10
  125. package/template/contract/sui-template/dubhe.config.ts +3 -3
  126. package/template/contract/sui-template/package.json +28 -28
  127. package/template/contract/sui-template/tsconfig.json +3 -13
  128. package/template/nextjs/aptos-template/.prettierignore +1 -0
  129. package/template/nextjs/aptos-template/.prettierrc +7 -7
  130. package/template/nextjs/aptos-template/.prettierrc.json +8 -0
  131. package/template/nextjs/aptos-template/README.md +2 -1
  132. package/template/nextjs/aptos-template/jest.config.ts +3 -3
  133. package/template/nextjs/aptos-template/next-i18next.config.js +4 -4
  134. package/template/nextjs/aptos-template/next.config.js +11 -12
  135. package/template/nextjs/aptos-template/package.json +11 -8
  136. package/template/nextjs/aptos-template/postcss.config.js +1 -1
  137. package/template/nextjs/aptos-template/public/locales/de/common.json +1 -1
  138. package/template/nextjs/aptos-template/public/locales/de/footer.json +1 -1
  139. package/template/nextjs/aptos-template/public/locales/de/second-page.json +1 -1
  140. package/template/nextjs/aptos-template/public/locales/en/footer.json +1 -1
  141. package/template/nextjs/aptos-template/public/locales/en/second-page.json +1 -1
  142. package/template/nextjs/aptos-template/public/locales/zn/common.json +1 -1
  143. package/template/nextjs/aptos-template/public/locales/zn/footer.json +1 -1
  144. package/template/nextjs/aptos-template/public/locales/zn/second-page.json +1 -1
  145. package/template/nextjs/aptos-template/src/components/Animation.tsx +60 -70
  146. package/template/nextjs/aptos-template/src/components/Container.tsx +2 -8
  147. package/template/nextjs/aptos-template/src/components/footer/index.tsx +124 -135
  148. package/template/nextjs/aptos-template/src/components/head/index.tsx +14 -14
  149. package/template/nextjs/aptos-template/src/components/header/index.tsx +143 -157
  150. package/template/nextjs/aptos-template/src/components/pop_up_box/index.tsx +150 -138
  151. package/template/nextjs/aptos-template/src/css/font-awesome.css +692 -687
  152. package/template/nextjs/aptos-template/src/css/font-awesome.min.css +2333 -1
  153. package/template/nextjs/aptos-template/src/jotai/index.tsx +9 -10
  154. package/template/nextjs/aptos-template/src/pages/_app.tsx +16 -16
  155. package/template/nextjs/aptos-template/src/pages/index.tsx +7 -10
  156. package/template/nextjs/aptos-template/tailwind.config.js +44 -55
  157. package/template/nextjs/aptos-template/tsconfig.json +3 -13
  158. package/template/nextjs/sui-template/.prettierignore +1 -0
  159. package/template/nextjs/sui-template/.prettierrc.json +8 -0
  160. package/template/nextjs/sui-template/README.md +4 -2
  161. package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp/metadata.move +1 -1
  162. package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp/schema.move +2 -2
  163. package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp/system.move +7 -7
  164. package/template/nextjs/sui-template/contracts/counter/sources/codegen/data/increment_event.move +1 -1
  165. package/template/nextjs/sui-template/contracts/counter/sources/codegen/errors.move +3 -3
  166. package/template/nextjs/sui-template/contracts/counter/sources/codegen/events.move +4 -4
  167. package/template/nextjs/sui-template/contracts/counter/sources/codegen/genesis.move +5 -5
  168. package/template/nextjs/sui-template/contracts/counter/sources/codegen/schema.move +9 -1
  169. package/template/nextjs/sui-template/contracts/counter/sources/scripts/deploy_hook.move +2 -2
  170. package/template/nextjs/sui-template/contracts/counter/sources/scripts/migrate.move +1 -1
  171. package/template/nextjs/sui-template/contracts/counter/sources/systems/counter.move +3 -3
  172. package/template/nextjs/sui-template/contracts/counter/sources/tests/counter.move +3 -3
  173. package/template/nextjs/sui-template/contracts/counter/sources/tests/init.move +3 -3
  174. package/template/nextjs/sui-template/dubhe.config.ts +4 -4
  175. package/template/nextjs/sui-template/next.config.mjs +1 -2
  176. package/template/nextjs/sui-template/package.json +9 -8
  177. package/template/nextjs/sui-template/src/chain/config.ts +2 -2
@@ -1,39 +1,39 @@
1
1
  {
2
- "name": "dubhe-cocos-template",
3
- "uuid": "ba0d698f-d890-4886-831d-0920a44b3236",
4
- "creator": {
5
- "version": "3.8.0"
6
- },
7
- "scripts": {
8
- "dev": "pnpm dubhe hello && pnpm run localnode && sleep 15 && ts-node scripts/generateAccount.ts && pnpm dubhe faucet --network local && pnpm dubhe publish --network local --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts local && tail -f localnode.nohup.out",
9
- "dev:movement": "pnpm dubhe hello && pnpm run start-movement-template",
10
- "start-movement-template": "ts-node scripts/formatAccount.ts && pnpm dubhe publish --network movementdevnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts movementdevnet",
11
- "faucet-localnet": "pnpm dubhe faucet --network local",
12
- "faucet-devnet": "pnpm dubhe faucet --network devnet",
13
- "faucet-testnet": "pnpm dubhe faucet --network testnet",
14
- "world-publsih-localnet": "pnpm dubhe publish --network local --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts local",
15
- "world-publsih-devnet": "pnpm dubhe publish --network devnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts devnet",
16
- "world-publsih-testnet": "pnpm dubhe publish --network testnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts testnet",
17
- "world-publsih-mainnet": "pnpm dubhe publish --network mainnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts mainnet",
18
- "world-upgrade-localnet": "pnpm dubhe upgrade --network local --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts local",
19
- "world-upgrade-devnet": "pnpm dubhe upgrade --network devnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts devnet",
20
- "world-upgrade-testnet": "pnpm dubhe upgrade --network testnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts testnet",
21
- "world-upgrade-mainnet": "pnpm dubhe upgrade --network mainnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts mainnet",
22
- "localnode": "nohup pnpm dubhe localnode > localnode.nohup.out &",
23
- "worldgen": "pnpm dubhe schemagen ./assets/Scripts/dubhe.config.ts",
24
- "storeConfig": "ts-node scripts/storeConfig.ts",
25
- "generateAccount": "ts-node scripts/generateAccount.ts"
26
- },
27
- "dependencies": {
28
- "@0xobelisk/aptos-common": "^0.0.7",
29
- "@0xobelisk/aptos-client": "^0.0.13",
30
- "@0xobelisk/aptos-cli": "^0.0.10",
31
- "aptos": "^1.20.0",
32
- "dotenv": "^16.0.3"
33
- },
34
- "devDependencies": {
35
- "@types/node": "18.16.16",
36
- "ts-node": "^10.9.1",
37
- "typescript": "^5.1.6"
38
- }
2
+ "name": "dubhe-cocos-template",
3
+ "uuid": "ba0d698f-d890-4886-831d-0920a44b3236",
4
+ "creator": {
5
+ "version": "3.8.0"
6
+ },
7
+ "scripts": {
8
+ "dev": "pnpm dubhe hello && pnpm run localnode && sleep 15 && ts-node scripts/generateAccount.ts && pnpm dubhe faucet --network local && pnpm dubhe publish --network local --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts local && tail -f localnode.nohup.out",
9
+ "dev:movement": "pnpm dubhe hello && pnpm run start-movement-template",
10
+ "start-movement-template": "ts-node scripts/formatAccount.ts && pnpm dubhe publish --network movementdevnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts movementdevnet",
11
+ "faucet-localnet": "pnpm dubhe faucet --network local",
12
+ "faucet-devnet": "pnpm dubhe faucet --network devnet",
13
+ "faucet-testnet": "pnpm dubhe faucet --network testnet",
14
+ "world-publsih-localnet": "pnpm dubhe publish --network local --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts local",
15
+ "world-publsih-devnet": "pnpm dubhe publish --network devnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts devnet",
16
+ "world-publsih-testnet": "pnpm dubhe publish --network testnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts testnet",
17
+ "world-publsih-mainnet": "pnpm dubhe publish --network mainnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts mainnet",
18
+ "world-upgrade-localnet": "pnpm dubhe upgrade --network local --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts local",
19
+ "world-upgrade-devnet": "pnpm dubhe upgrade --network devnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts devnet",
20
+ "world-upgrade-testnet": "pnpm dubhe upgrade --network testnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts testnet",
21
+ "world-upgrade-mainnet": "pnpm dubhe upgrade --network mainnet --configPath ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts mainnet",
22
+ "localnode": "nohup pnpm dubhe localnode > localnode.nohup.out &",
23
+ "worldgen": "pnpm dubhe schemagen ./assets/Scripts/dubhe.config.ts",
24
+ "storeConfig": "ts-node scripts/storeConfig.ts",
25
+ "generateAccount": "ts-node scripts/generateAccount.ts"
26
+ },
27
+ "dependencies": {
28
+ "@0xobelisk/aptos-common": "^0.0.8",
29
+ "@0xobelisk/aptos-client": "^0.0.19",
30
+ "@0xobelisk/aptos-cli": "^0.0.16",
31
+ "aptos": "^1.20.0",
32
+ "dotenv": "^16.0.3"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "18.16.16",
36
+ "ts-node": "^10.9.1",
37
+ "typescript": "^5.1.6"
38
+ }
39
39
  }
@@ -4,32 +4,32 @@ import * as dotenv from 'dotenv';
4
4
  dotenv.config();
5
5
 
6
6
  function generateAccount() {
7
- const PRIVATE_KEY = process.env.PRIVATE_KEY;
7
+ const PRIVATE_KEY = process.env.PRIVATE_KEY;
8
8
 
9
- if (PRIVATE_KEY === undefined) {
10
- console.log('Missing PRIVATE_KEY in .env');
11
- process.exit(0);
12
- }
9
+ if (PRIVATE_KEY === undefined) {
10
+ console.log('Missing PRIVATE_KEY in .env');
11
+ process.exit(0);
12
+ }
13
13
 
14
- const keypair = AptosAccount.fromAptosAccountObject({
15
- privateKeyHex: PRIVATE_KEY,
16
- });
17
- const privateKey = keypair.toPrivateKeyObject().privateKeyHex;
14
+ const keypair = AptosAccount.fromAptosAccountObject({
15
+ privateKeyHex: PRIVATE_KEY
16
+ });
17
+ const privateKey = keypair.toPrivateKeyObject().privateKeyHex;
18
18
 
19
- const path = process.cwd();
20
- const chainFolderPath = `${path}/src/chain`;
21
- fs.mkdirSync(chainFolderPath, { recursive: true });
19
+ const path = process.cwd();
20
+ const chainFolderPath = `${path}/src/chain`;
21
+ fs.mkdirSync(chainFolderPath, { recursive: true });
22
22
 
23
- // fs.writeFileSync(`${path}/.env`, `PRIVATE_KEY=${privateKey}`);
23
+ // fs.writeFileSync(`${path}/.env`, `PRIVATE_KEY=${privateKey}`);
24
24
 
25
- fs.writeFileSync(
26
- `${path}/src/chain/key.ts`,
27
- `export const PRIVATEKEY = '${privateKey}';
25
+ fs.writeFileSync(
26
+ `${path}/src/chain/key.ts`,
27
+ `export const PRIVATEKEY = '${privateKey}';
28
28
  export const ACCOUNT = '${keypair.address().toString()}';
29
29
  `
30
- );
30
+ );
31
31
 
32
- console.log(`Format env Account: ${keypair.address().toString()}`);
32
+ console.log(`Format env Account: ${keypair.address().toString()}`);
33
33
  }
34
34
 
35
35
  generateAccount();
@@ -1,5 +1,5 @@
1
- import { AptosAccount } from "aptos";
2
- import * as fs from "fs";
1
+ import { AptosAccount } from 'aptos';
2
+ import * as fs from 'fs';
3
3
 
4
4
  function generateAccount() {
5
5
  const keypair = new AptosAccount();
@@ -5,34 +5,34 @@ import { dubheConfig } from '../assets/Scripts/dubhe.config';
5
5
  import { dirname } from 'path';
6
6
 
7
7
  type DeploymentJsonType = {
8
- projectName: string;
9
- network:
10
- | 'mainnet'
11
- | 'testnet'
12
- | 'devnet'
13
- | 'local'
14
- | 'movementtestnet'
15
- | 'movementdevnet'
16
- | 'movementlocal';
17
- packageId: string;
18
- version: number;
8
+ projectName: string;
9
+ network:
10
+ | 'mainnet'
11
+ | 'testnet'
12
+ | 'devnet'
13
+ | 'local'
14
+ | 'movementtestnet'
15
+ | 'movementdevnet'
16
+ | 'movementlocal';
17
+ packageId: string;
18
+ version: number;
19
19
  };
20
20
 
21
21
  async function getDeploymentJson(projectPath: string, network: string) {
22
- try {
23
- const data = await fsAsync.readFile(
24
- `${projectPath}/.history/aptos_${network}/latest.json`,
25
- 'utf8'
26
- );
27
- return JSON.parse(data) as DeploymentJsonType;
28
- } catch {
29
- console.log('store config failed.');
30
- exit;
31
- }
22
+ try {
23
+ const data = await fsAsync.readFile(
24
+ `${projectPath}/.history/aptos_${network}/latest.json`,
25
+ 'utf8'
26
+ );
27
+ return JSON.parse(data) as DeploymentJsonType;
28
+ } catch {
29
+ console.log('store config failed.');
30
+ exit;
31
+ }
32
32
  }
33
33
 
34
34
  function storeConfig(network: string, packageId: string) {
35
- let code = `import { NetworkType } from '@0xobelisk/aptos-client';
35
+ let code = `import { NetworkType } from '@0xobelisk/aptos-client';
36
36
 
37
37
  const NETWORK = '${network}' as NetworkType;
38
38
 
@@ -40,29 +40,29 @@ const PACKAGE_ID = '${packageId}';
40
40
 
41
41
  export { NETWORK, PACKAGE_ID };
42
42
  `;
43
- const path = process.cwd();
44
- writeOutput(code, `${path}/assets/Scripts/chain/config.ts`, 'storeConfig');
43
+ const path = process.cwd();
44
+ writeOutput(code, `${path}/assets/Scripts/chain/config.ts`, 'storeConfig');
45
45
  }
46
46
 
47
47
  async function writeOutput(
48
- output: string,
49
- fullOutputPath: string,
50
- logPrefix?: string
48
+ output: string,
49
+ fullOutputPath: string,
50
+ logPrefix?: string
51
51
  ): Promise<void> {
52
- mkdirSync(dirname(fullOutputPath), { recursive: true });
52
+ mkdirSync(dirname(fullOutputPath), { recursive: true });
53
53
 
54
- writeFileSync(fullOutputPath, output);
55
- if (logPrefix !== undefined) {
56
- console.log(`${logPrefix}: ${fullOutputPath}`);
57
- }
54
+ writeFileSync(fullOutputPath, output);
55
+ if (logPrefix !== undefined) {
56
+ console.log(`${logPrefix}: ${fullOutputPath}`);
57
+ }
58
58
  }
59
59
 
60
60
  async function main() {
61
- const path = process.cwd();
62
- const network = process.argv[2];
63
- const contractPath = `${path}/contracts/${dubheConfig.name}`;
64
- const deployment = await getDeploymentJson(contractPath, network);
65
- storeConfig(deployment.network, deployment.packageId);
61
+ const path = process.cwd();
62
+ const network = process.argv[2];
63
+ const contractPath = `${path}/contracts/${dubheConfig.name}`;
64
+ const deployment = await getDeploymentJson(contractPath, network);
65
+ storeConfig(deployment.network, deployment.packageId);
66
66
  }
67
67
 
68
68
  main();
@@ -6,7 +6,7 @@
6
6
  "allowJs": true,
7
7
  "experimentalDecorators": true,
8
8
  "skipLibCheck": true,
9
- "resolveJsonModule": true,
9
+ "resolveJsonModule": true
10
10
  },
11
- "exclude": ["node_modules", "library", "local", "temp", "build", "settings",],
11
+ "exclude": ["node_modules", "library", "local", "temp", "build", "settings"]
12
12
  }
@@ -1,11 +1,12 @@
1
1
  ## How to use
2
+
2
3
  ```bash
3
4
 
4
5
  1 install sui <https://docs.sui.io/build/install>
5
6
  2 import project by cocos create IDE
6
7
  3 pnpm i
7
8
  4 pnpm run dev
8
- 5 start your cocos project
9
+ 5 start your cocos project
9
10
  ```
10
11
 
11
12
  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)).
@@ -2,11 +2,7 @@ type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
2
2
 
3
3
  const NETWORK: NetworkType = 'localnet';
4
4
 
5
- const PACKAGE_ID = '0x8eb4a5f43d92d8b95cfab98d421897744881f7bde2c8b1a26417e5f23b6d0f6d'
6
- const WORLD_ID = '0x6c6abaf48f31bdff8de2c8c23f0ce86d8a8c400274094dcd17c25fd29b36dbe0'
5
+ const PACKAGE_ID = '0x8eb4a5f43d92d8b95cfab98d421897744881f7bde2c8b1a26417e5f23b6d0f6d';
6
+ const WORLD_ID = '0x6c6abaf48f31bdff8de2c8c23f0ce86d8a8c400274094dcd17c25fd29b36dbe0';
7
7
 
8
- export {
9
- NETWORK,
10
- PACKAGE_ID,
11
- WORLD_ID,
12
- }
8
+ export { NETWORK, PACKAGE_ID, WORLD_ID };
@@ -1,13 +1,13 @@
1
1
  import { DubheConfig } from '@0xobelisk/sui-common';
2
2
 
3
3
  export const dubheConfig = {
4
- name: 'counter',
5
- description: 'counter',
6
- systems: ['counter_system'],
7
- schemas: {
8
- counter: {
9
- valueType: 'u64',
10
- defaultValue: 0,
11
- },
12
- },
4
+ name: 'counter',
5
+ description: 'counter',
6
+ systems: ['counter_system'],
7
+ schemas: {
8
+ counter: {
9
+ valueType: 'u64',
10
+ defaultValue: 0
11
+ }
12
+ }
13
13
  } as DubheConfig;
@@ -6,115 +6,99 @@ const { ccclass, property } = _decorator;
6
6
 
7
7
  @ccclass('sui')
8
8
  export class sui extends Component {
9
- async start() {
10
- this.sui_account_create();
11
- }
9
+ async start() {
10
+ this.sui_account_create();
11
+ }
12
12
 
13
- async sui_account_create() {
14
- // @ts-ignore
15
- const dubhe_sdk = window.dubhe;
16
- const decode = JSON.parse(sys.localStorage.getItem('userWalletData'));
17
- if (decode == null) {
18
- const keypair = new dubhe_sdk.Ed25519Keypair();
19
- const wallet = keypair.export();
20
- const code = JSON.stringify(wallet);
21
- sys.localStorage.setItem('userWalletData', code);
22
- const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
23
- const dubhe = new dubhe_sdk.Dubhe({
24
- networkType: NETWORK,
25
- packageId: PACKAGE_ID,
26
- metadata: metadata,
27
- });
28
- const address = keypair.getPublicKey().toSuiAddress();
29
- await dubhe.requestFaucet(address, NETWORK);
30
- const component_name = Object.keys(dubheConfig.schemas)[0];
31
- const component_value = await dubhe.getEntity(
32
- WORLD_ID,
33
- component_name
34
- );
35
- console.log(component_value);
36
- } else {
37
- const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
38
- const dubhe = new dubhe_sdk.Dubhe({
39
- networkType: NETWORK,
40
- packageId: PACKAGE_ID,
41
- metadata: metadata,
42
- });
43
- const component_name = Object.keys(dubheConfig.schemas)[0];
44
- const component_value = await dubhe.getEntity(
45
- WORLD_ID,
46
- component_name
47
- );
48
- const counter_node = find('Canvas/Camera/counter');
49
- const label = counter_node.getComponent(
50
- 'cc.Label'
51
- ) as LabelComponent;
52
- label.string = `Counter: ${component_value}`;
53
- }
54
- }
13
+ async sui_account_create() {
14
+ // @ts-ignore
15
+ const dubhe_sdk = window.dubhe;
16
+ const decode = JSON.parse(sys.localStorage.getItem('userWalletData'));
17
+ if (decode == null) {
18
+ const keypair = new dubhe_sdk.Ed25519Keypair();
19
+ const wallet = keypair.export();
20
+ const code = JSON.stringify(wallet);
21
+ sys.localStorage.setItem('userWalletData', code);
22
+ const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
23
+ const dubhe = new dubhe_sdk.Dubhe({
24
+ networkType: NETWORK,
25
+ packageId: PACKAGE_ID,
26
+ metadata: metadata
27
+ });
28
+ const address = keypair.getPublicKey().toSuiAddress();
29
+ await dubhe.requestFaucet(address, NETWORK);
30
+ const component_name = Object.keys(dubheConfig.schemas)[0];
31
+ const component_value = await dubhe.getEntity(WORLD_ID, component_name);
32
+ console.log(component_value);
33
+ } else {
34
+ const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
35
+ const dubhe = new dubhe_sdk.Dubhe({
36
+ networkType: NETWORK,
37
+ packageId: PACKAGE_ID,
38
+ metadata: metadata
39
+ });
40
+ const component_name = Object.keys(dubheConfig.schemas)[0];
41
+ const component_value = await dubhe.getEntity(WORLD_ID, component_name);
42
+ const counter_node = find('Canvas/Camera/counter');
43
+ const label = counter_node.getComponent('cc.Label') as LabelComponent;
44
+ label.string = `Counter: ${component_value}`;
45
+ }
46
+ }
55
47
 
56
- async export_wallet() {
57
- // @ts-ignore
58
- const dubhe_sdk = window.dubhe;
59
- const fromB64 = dubhe_sdk.fromB64;
60
- const decode = JSON.parse(sys.localStorage.getItem('userWalletData'));
61
- const decode_private_key = decode.privateKey;
62
- const base_64_privkey = fromB64(decode_private_key);
63
- const keypair = dubhe_sdk.Ed25519Keypair.fromSecretKey(
64
- base_64_privkey,
65
- {
66
- skipValidation: false,
67
- }
68
- );
69
- const address = keypair.getPublicKey().toSuiAddress();
70
- console.log(address);
71
- const hex_privkey = Array.prototype.map
72
- .call(base_64_privkey, x => ('00' + x.toString(16)).slice(-2))
73
- .join('');
74
- return hex_privkey;
75
- }
48
+ async export_wallet() {
49
+ // @ts-ignore
50
+ const dubhe_sdk = window.dubhe;
51
+ const fromB64 = dubhe_sdk.fromB64;
52
+ const decode = JSON.parse(sys.localStorage.getItem('userWalletData'));
53
+ const decode_private_key = decode.privateKey;
54
+ const base_64_privkey = fromB64(decode_private_key);
55
+ const keypair = dubhe_sdk.Ed25519Keypair.fromSecretKey(base_64_privkey, {
56
+ skipValidation: false
57
+ });
58
+ const address = keypair.getPublicKey().toSuiAddress();
59
+ console.log(address);
60
+ const hex_privkey = Array.prototype.map
61
+ .call(base_64_privkey, (x) => ('00' + x.toString(16)).slice(-2))
62
+ .join('');
63
+ return hex_privkey;
64
+ }
76
65
 
77
- async gameStart() {
78
- // @ts-ignore
79
- const dubhe_sdk = window.dubhe;
80
- const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
81
- console.log(metadata);
66
+ async gameStart() {
67
+ // @ts-ignore
68
+ const dubhe_sdk = window.dubhe;
69
+ const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
70
+ console.log(metadata);
82
71
 
83
- const privateKey = await this.export_wallet();
84
- // new dubhe class
85
- const dubhe = new dubhe_sdk.Dubhe({
86
- networkType: NETWORK,
87
- packageId: PACKAGE_ID,
88
- metadata: metadata,
89
- secretKey: privateKey,
90
- });
72
+ const privateKey = await this.export_wallet();
73
+ // new dubhe class
74
+ const dubhe = new dubhe_sdk.Dubhe({
75
+ networkType: NETWORK,
76
+ packageId: PACKAGE_ID,
77
+ metadata: metadata,
78
+ secretKey: privateKey
79
+ });
91
80
 
92
- const tx = new dubhe_sdk.TransactionBlock();
93
- const world = tx.pure(WORLD_ID);
81
+ const tx = new dubhe_sdk.TransactionBlock();
82
+ const world = tx.pure(WORLD_ID);
94
83
 
95
- const params = [world];
84
+ const params = [world];
96
85
 
97
- const result = await dubhe.tx.counter_system.inc(tx, params);
98
- console.log(result);
99
- setTimeout(async () => {
100
- const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
101
- const dubhe = new dubhe_sdk.Dubhe({
102
- networkType: NETWORK,
103
- packageId: PACKAGE_ID,
104
- metadata: metadata,
105
- });
106
- const component_name = Object.keys(dubheConfig.schemas)[0];
107
- const component_value = await dubhe.getEntity(
108
- WORLD_ID,
109
- component_name
110
- );
111
- const counter_node = find('Canvas/Camera/counter');
112
- const label = counter_node.getComponent(
113
- 'cc.Label'
114
- ) as LabelComponent;
115
- label.string = `Counter: ${component_value}`;
116
- }, 100);
117
- }
86
+ const result = await dubhe.tx.counter_system.inc(tx, params);
87
+ console.log(result);
88
+ setTimeout(async () => {
89
+ const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
90
+ const dubhe = new dubhe_sdk.Dubhe({
91
+ networkType: NETWORK,
92
+ packageId: PACKAGE_ID,
93
+ metadata: metadata
94
+ });
95
+ const component_name = Object.keys(dubheConfig.schemas)[0];
96
+ const component_value = await dubhe.getEntity(WORLD_ID, component_name);
97
+ const counter_node = find('Canvas/Camera/counter');
98
+ const label = counter_node.getComponent('cc.Label') as LabelComponent;
99
+ label.string = `Counter: ${component_value}`;
100
+ }, 100);
101
+ }
118
102
 
119
- update(deltaTime: number) {}
103
+ update(deltaTime: number) {}
120
104
  }
@@ -1,5 +1,4 @@
1
-
2
- version: "3"
1
+ version: '3'
3
2
 
4
3
  services:
5
4
  sui-test-validator-node:
@@ -10,9 +9,16 @@ services:
10
9
  ports:
11
10
  - 9000:9000
12
11
  - 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"]
12
+ command:
13
+ [
14
+ '/opt/sui/bin/sui-test-validator',
15
+ '--fullnode-rpc-addr',
16
+ '0.0.0.0:9000',
17
+ '--faucet-addr',
18
+ '0.0.0.0:9123'
19
+ ]
14
20
  healthcheck:
15
- test: ["CMD", "curl", "-f", "http://sui-test-validator-node:9123"]
21
+ test: ['CMD', 'curl', '-f', 'http://sui-test-validator-node:9123']
16
22
  interval: 3s
17
23
  timeout: 5s
18
24
  retries: 10
@@ -1,27 +1,27 @@
1
1
  {
2
- "name": "dubhe-cocos-template",
3
- "uuid": "ba0d698f-d890-4886-831d-0920a44b3236",
4
- "creator": {
5
- "version": "3.8.0"
6
- },
7
- "scripts": {
8
- "dev": "pnpm dubhe hello && pnpm start-template",
9
- "start-template": "pnpm generateAccount && pnpm faucet && pnpm dapp-publish && pnpm storeConfig",
10
- "faucet": "pnpm dubhe faucet --network testnet",
11
- "schemagen": "pnpm dubhe schemagen --config-path ./dubhe.config.ts",
12
- "dapp-publish": "pnpm dubhe publish --network testnet --config-path ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts testnet",
13
- "upgrade": "pnpm dubhe upgrade --network testnet && ts-node scripts/storeConfig.ts testnet",
14
- "storeConfig": "ts-node scripts/storeConfig.ts testnet",
15
- "generateAccount": "ts-node scripts/generateAccount.ts"
16
- },
17
- "dependencies": {
18
- "@0xobelisk/sui-cli": "^0.5.34",
19
- "@0xobelisk/sui-client": "^0.5.30",
20
- "@0xobelisk/sui-common": "^0.5.23"
21
- },
22
- "devDependencies": {
23
- "@types/node": "18.16.16",
24
- "ts-node": "^10.9.1",
25
- "typescript": "^5.1.6"
26
- }
2
+ "name": "dubhe-cocos-template",
3
+ "uuid": "ba0d698f-d890-4886-831d-0920a44b3236",
4
+ "creator": {
5
+ "version": "3.8.0"
6
+ },
7
+ "scripts": {
8
+ "dev": "pnpm dubhe hello && pnpm start-template",
9
+ "start-template": "pnpm generateAccount && pnpm faucet && pnpm dapp-publish && pnpm storeConfig",
10
+ "faucet": "pnpm dubhe faucet --network testnet",
11
+ "schemagen": "pnpm dubhe schemagen --config-path ./dubhe.config.ts",
12
+ "dapp-publish": "pnpm dubhe publish --network testnet --config-path ./assets/Scripts/dubhe.config.ts && ts-node scripts/storeConfig.ts testnet",
13
+ "upgrade": "pnpm dubhe upgrade --network testnet && ts-node scripts/storeConfig.ts testnet",
14
+ "storeConfig": "ts-node scripts/storeConfig.ts testnet",
15
+ "generateAccount": "ts-node scripts/generateAccount.ts"
16
+ },
17
+ "dependencies": {
18
+ "@0xobelisk/sui-cli": "^0.5.34",
19
+ "@0xobelisk/sui-client": "^0.5.30",
20
+ "@0xobelisk/sui-common": "^0.5.23"
21
+ },
22
+ "devDependencies": {
23
+ "@types/node": "18.16.16",
24
+ "ts-node": "^10.9.1",
25
+ "typescript": "^5.1.6"
26
+ }
27
27
  }