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.
- package/index.js +1 -1
- package/package.json +11 -3
- package/template/101/aptos-template/.prettierignore +1 -0
- package/template/101/aptos-template/.prettierrc +7 -7
- package/template/101/aptos-template/.prettierrc.json +8 -0
- package/template/101/aptos-template/README.md +3 -2
- package/template/101/aptos-template/jest.config.ts +3 -3
- package/template/101/aptos-template/next-i18next.config.js +4 -4
- package/template/101/aptos-template/next.config.js +11 -12
- package/template/101/aptos-template/package.json +10 -5
- package/template/101/aptos-template/postcss.config.js +1 -1
- package/template/101/aptos-template/public/locales/de/common.json +1 -1
- package/template/101/aptos-template/public/locales/de/footer.json +1 -1
- package/template/101/aptos-template/public/locales/de/second-page.json +1 -1
- package/template/101/aptos-template/public/locales/en/footer.json +1 -1
- package/template/101/aptos-template/public/locales/en/second-page.json +1 -1
- package/template/101/aptos-template/public/locales/zn/common.json +1 -1
- package/template/101/aptos-template/public/locales/zn/footer.json +1 -1
- package/template/101/aptos-template/public/locales/zn/second-page.json +1 -1
- package/template/101/aptos-template/scripts/checkBalance.ts +1 -1
- package/template/101/aptos-template/src/css/font-awesome.css +692 -687
- package/template/101/aptos-template/src/css/font-awesome.min.css +2333 -1
- package/template/101/aptos-template/tailwind.config.js +40 -52
- package/template/101/initia-template/.prettierignore +1 -0
- package/template/101/initia-template/.prettierrc +7 -7
- package/template/101/initia-template/.prettierrc.json +8 -0
- package/template/101/initia-template/README.md +3 -2
- package/template/101/initia-template/jest.config.ts +3 -3
- package/template/101/initia-template/next-i18next.config.js +4 -4
- package/template/101/initia-template/next.config.js +11 -12
- package/template/101/initia-template/package.json +8 -3
- package/template/101/initia-template/postcss.config.js +1 -1
- package/template/101/initia-template/public/locales/de/common.json +1 -1
- package/template/101/initia-template/public/locales/de/footer.json +1 -1
- package/template/101/initia-template/public/locales/de/second-page.json +1 -1
- package/template/101/initia-template/public/locales/en/footer.json +1 -1
- package/template/101/initia-template/public/locales/en/second-page.json +1 -1
- package/template/101/initia-template/public/locales/zn/common.json +1 -1
- package/template/101/initia-template/public/locales/zn/footer.json +1 -1
- package/template/101/initia-template/public/locales/zn/second-page.json +1 -1
- package/template/101/initia-template/src/chain/config.ts +1 -1
- package/template/101/initia-template/src/css/font-awesome.css +692 -687
- package/template/101/initia-template/src/css/font-awesome.min.css +2333 -1
- package/template/101/initia-template/src/pages/index.tsx +7 -9
- package/template/101/initia-template/tailwind.config.js +40 -52
- package/template/101/movement-template/.prettierignore +1 -0
- package/template/101/movement-template/.prettierrc +7 -7
- package/template/101/movement-template/.prettierrc.json +8 -0
- package/template/101/movement-template/README.md +3 -2
- package/template/101/movement-template/jest.config.ts +3 -3
- package/template/101/movement-template/next-i18next.config.js +4 -4
- package/template/101/movement-template/next.config.js +11 -12
- package/template/101/movement-template/package.json +10 -5
- package/template/101/movement-template/postcss.config.js +1 -1
- package/template/101/movement-template/public/locales/de/common.json +1 -1
- package/template/101/movement-template/public/locales/de/footer.json +1 -1
- package/template/101/movement-template/public/locales/de/second-page.json +1 -1
- package/template/101/movement-template/public/locales/en/footer.json +1 -1
- package/template/101/movement-template/public/locales/en/second-page.json +1 -1
- package/template/101/movement-template/public/locales/zn/common.json +1 -1
- package/template/101/movement-template/public/locales/zn/footer.json +1 -1
- package/template/101/movement-template/public/locales/zn/second-page.json +1 -1
- package/template/101/movement-template/src/css/font-awesome.css +692 -687
- package/template/101/movement-template/src/css/font-awesome.min.css +2333 -1
- package/template/101/movement-template/tailwind.config.js +40 -52
- package/template/101/rooch-template/.prettierignore +1 -0
- package/template/101/rooch-template/.prettierrc +7 -7
- package/template/101/rooch-template/.prettierrc.json +8 -0
- package/template/101/rooch-template/README.md +3 -2
- package/template/101/rooch-template/jest.config.ts +3 -3
- package/template/101/rooch-template/next-i18next.config.js +4 -4
- package/template/101/rooch-template/next.config.js +11 -12
- package/template/101/rooch-template/package.json +8 -3
- package/template/101/rooch-template/postcss.config.js +1 -1
- package/template/101/rooch-template/public/locales/de/common.json +1 -1
- package/template/101/rooch-template/public/locales/de/footer.json +1 -1
- package/template/101/rooch-template/public/locales/de/second-page.json +1 -1
- package/template/101/rooch-template/public/locales/en/footer.json +1 -1
- package/template/101/rooch-template/public/locales/en/second-page.json +1 -1
- package/template/101/rooch-template/public/locales/zn/common.json +1 -1
- package/template/101/rooch-template/public/locales/zn/footer.json +1 -1
- package/template/101/rooch-template/public/locales/zn/second-page.json +1 -1
- package/template/101/rooch-template/src/chain/config.ts +1 -1
- package/template/101/rooch-template/src/css/font-awesome.css +692 -687
- package/template/101/rooch-template/src/css/font-awesome.min.css +2333 -1
- package/template/101/rooch-template/src/pages/index.tsx +7 -9
- package/template/101/rooch-template/tailwind.config.js +40 -52
- package/template/101/sui-template/.prettierignore +1 -0
- package/template/101/sui-template/.prettierrc.json +8 -0
- package/template/101/sui-template/README.md +4 -2
- package/template/101/sui-template/contracts/counter/sources/codegen/dapp/metadata.move +1 -1
- package/template/101/sui-template/contracts/counter/sources/codegen/dapp/schema.move +2 -2
- package/template/101/sui-template/contracts/counter/sources/codegen/dapp/system.move +7 -7
- package/template/101/sui-template/contracts/counter/sources/codegen/data/increment_event.move +1 -1
- package/template/101/sui-template/contracts/counter/sources/codegen/errors.move +3 -3
- package/template/101/sui-template/contracts/counter/sources/codegen/events.move +4 -4
- package/template/101/sui-template/contracts/counter/sources/codegen/genesis.move +5 -5
- package/template/101/sui-template/contracts/counter/sources/codegen/schema.move +9 -1
- package/template/101/sui-template/contracts/counter/sources/scripts/deploy_hook.move +2 -2
- package/template/101/sui-template/contracts/counter/sources/scripts/migrate.move +1 -1
- package/template/101/sui-template/contracts/counter/sources/systems/counter.move +3 -3
- package/template/101/sui-template/contracts/counter/sources/tests/counter.move +3 -3
- package/template/101/sui-template/contracts/counter/sources/tests/init.move +3 -3
- package/template/101/sui-template/dubhe.config.ts +4 -4
- package/template/101/sui-template/package.json +8 -7
- package/template/cocos/aptos-template/README.md +2 -1
- package/template/cocos/aptos-template/assets/Scripts/aptos.ts +15 -15
- package/template/cocos/aptos-template/assets/Scripts/chain/config.ts +5 -5
- package/template/cocos/aptos-template/assets/Scripts/dubhe.config.ts +8 -8
- package/template/cocos/aptos-template/assets/lib/obelisk.js +23107 -19762
- package/template/cocos/aptos-template/package.json +37 -37
- package/template/cocos/aptos-template/scripts/formatAccount.ts +18 -18
- package/template/cocos/aptos-template/scripts/generateAccount.ts +2 -2
- package/template/cocos/aptos-template/scripts/storeConfig.ts +37 -37
- package/template/cocos/aptos-template/tsconfig.json +2 -2
- package/template/cocos/sui-template/README.md +2 -1
- package/template/cocos/sui-template/assets/Scripts/chain/config.ts +3 -7
- package/template/cocos/sui-template/assets/Scripts/dubhe.config.ts +9 -9
- package/template/cocos/sui-template/assets/Scripts/sui.ts +87 -103
- package/template/cocos/sui-template/docker-compose.yaml +10 -4
- package/template/cocos/sui-template/package.json +25 -25
- package/template/cocos/sui-template/scripts/generateAccount.ts +38 -38
- package/template/cocos/sui-template/scripts/storeConfig.ts +36 -41
- package/template/cocos/sui-template/tsconfig.json +3 -10
- package/template/contract/sui-template/dubhe.config.ts +3 -3
- package/template/contract/sui-template/package.json +28 -28
- package/template/contract/sui-template/tsconfig.json +3 -13
- package/template/nextjs/aptos-template/.prettierignore +1 -0
- package/template/nextjs/aptos-template/.prettierrc +7 -7
- package/template/nextjs/aptos-template/.prettierrc.json +8 -0
- package/template/nextjs/aptos-template/README.md +2 -1
- package/template/nextjs/aptos-template/jest.config.ts +3 -3
- package/template/nextjs/aptos-template/next-i18next.config.js +4 -4
- package/template/nextjs/aptos-template/next.config.js +11 -12
- package/template/nextjs/aptos-template/package.json +11 -8
- package/template/nextjs/aptos-template/postcss.config.js +1 -1
- package/template/nextjs/aptos-template/public/locales/de/common.json +1 -1
- package/template/nextjs/aptos-template/public/locales/de/footer.json +1 -1
- package/template/nextjs/aptos-template/public/locales/de/second-page.json +1 -1
- package/template/nextjs/aptos-template/public/locales/en/footer.json +1 -1
- package/template/nextjs/aptos-template/public/locales/en/second-page.json +1 -1
- package/template/nextjs/aptos-template/public/locales/zn/common.json +1 -1
- package/template/nextjs/aptos-template/public/locales/zn/footer.json +1 -1
- package/template/nextjs/aptos-template/public/locales/zn/second-page.json +1 -1
- package/template/nextjs/aptos-template/src/components/Animation.tsx +60 -70
- package/template/nextjs/aptos-template/src/components/Container.tsx +2 -8
- package/template/nextjs/aptos-template/src/components/footer/index.tsx +124 -135
- package/template/nextjs/aptos-template/src/components/head/index.tsx +14 -14
- package/template/nextjs/aptos-template/src/components/header/index.tsx +143 -157
- package/template/nextjs/aptos-template/src/components/pop_up_box/index.tsx +150 -138
- package/template/nextjs/aptos-template/src/css/font-awesome.css +692 -687
- package/template/nextjs/aptos-template/src/css/font-awesome.min.css +2333 -1
- package/template/nextjs/aptos-template/src/jotai/index.tsx +9 -10
- package/template/nextjs/aptos-template/src/pages/_app.tsx +16 -16
- package/template/nextjs/aptos-template/src/pages/index.tsx +7 -10
- package/template/nextjs/aptos-template/tailwind.config.js +44 -55
- package/template/nextjs/aptos-template/tsconfig.json +3 -13
- package/template/nextjs/sui-template/.prettierignore +1 -0
- package/template/nextjs/sui-template/.prettierrc.json +8 -0
- package/template/nextjs/sui-template/README.md +4 -2
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp/metadata.move +1 -1
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp/schema.move +2 -2
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/dapp/system.move +7 -7
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/data/increment_event.move +1 -1
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/errors.move +3 -3
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/events.move +4 -4
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/genesis.move +5 -5
- package/template/nextjs/sui-template/contracts/counter/sources/codegen/schema.move +9 -1
- package/template/nextjs/sui-template/contracts/counter/sources/scripts/deploy_hook.move +2 -2
- package/template/nextjs/sui-template/contracts/counter/sources/scripts/migrate.move +1 -1
- package/template/nextjs/sui-template/contracts/counter/sources/systems/counter.move +3 -3
- package/template/nextjs/sui-template/contracts/counter/sources/tests/counter.move +3 -3
- package/template/nextjs/sui-template/contracts/counter/sources/tests/init.move +3 -3
- package/template/nextjs/sui-template/dubhe.config.ts +4 -4
- package/template/nextjs/sui-template/next.config.mjs +1 -2
- package/template/nextjs/sui-template/package.json +9 -8
- package/template/nextjs/sui-template/src/chain/config.ts +2 -2
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import type { NextPage } from 'next';
|
|
2
|
-
import Home from
|
|
2
|
+
import Home from './home';
|
|
3
3
|
|
|
4
4
|
const IndexPage: NextPage = () => {
|
|
5
5
|
return (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
)
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default IndexPage
|
|
13
|
-
|
|
6
|
+
<main>
|
|
7
|
+
<Home />
|
|
8
|
+
</main>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
14
11
|
|
|
12
|
+
export default IndexPage;
|
|
@@ -1,56 +1,44 @@
|
|
|
1
|
-
const defaultTheme = require('tailwindcss/defaultTheme')
|
|
1
|
+
const defaultTheme = require('tailwindcss/defaultTheme');
|
|
2
2
|
|
|
3
3
|
module.exports = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
dark:"#8861D1",
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
screens: {
|
|
35
|
-
'3xl': '1700px',
|
|
36
|
-
},
|
|
37
|
-
fontFamily: {
|
|
38
|
-
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
|
|
39
|
-
},
|
|
40
|
-
|
|
4
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
5
|
+
darkMode: 'media', // or 'media' or 'class'
|
|
6
|
+
theme: {
|
|
7
|
+
extend: {
|
|
8
|
+
spacing: {
|
|
9
|
+
70: '17rem',
|
|
10
|
+
78: '18rem',
|
|
11
|
+
82: '20rem',
|
|
12
|
+
90: '22rem',
|
|
13
|
+
93: '23rem',
|
|
14
|
+
97: '25rem',
|
|
15
|
+
98: '27rem',
|
|
16
|
+
99: '30rem',
|
|
17
|
+
new: '34rem',
|
|
18
|
+
'new-1': '39rem',
|
|
19
|
+
100: '43rem',
|
|
20
|
+
105: '46rem',
|
|
21
|
+
106: '48rem',
|
|
22
|
+
},
|
|
23
|
+
colors: {
|
|
24
|
+
transparent: 'transparent',
|
|
25
|
+
current: 'currentColor',
|
|
26
|
+
custom: {
|
|
27
|
+
DEFAULT: '#8861D1',
|
|
28
|
+
light: '#8861D1',
|
|
29
|
+
dark: '#8861D1',
|
|
41
30
|
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
},
|
|
32
|
+
screens: {
|
|
33
|
+
'3xl': '1700px',
|
|
34
|
+
},
|
|
35
|
+
fontFamily: {
|
|
36
|
+
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
|
|
37
|
+
},
|
|
45
38
|
},
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
scrollbar: ['rounded']
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
39
|
+
},
|
|
40
|
+
plugins: [require('@tailwindcss/line-clamp'), require('tailwind-scrollbar')],
|
|
41
|
+
variants: {
|
|
42
|
+
scrollbar: ['rounded'],
|
|
43
|
+
},
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pnpm-lock.yaml
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
## How to use
|
|
2
|
+
|
|
2
3
|
```bash
|
|
3
4
|
1. install sui <https://docs.sui.io/build/install>
|
|
4
|
-
2. cd dubhe-101-template folder
|
|
5
|
+
2. cd dubhe-101-template folder
|
|
5
6
|
3. pnpm install
|
|
6
7
|
4. open new window && pnpm start:localnet
|
|
7
8
|
5. open new window && pnpm dev
|
|
8
9
|
```
|
|
9
10
|
|
|
10
11
|
Environment: node.js (v18.20.0+) ([download](https://nodejs.org/en/download/))
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
> Please use `node -v` check your node version
|
|
12
14
|
|
|
13
15
|
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)).
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module counter::
|
|
1
|
+
module counter::counter_dapp_system {
|
|
2
2
|
|
|
3
3
|
use std::ascii::String;
|
|
4
4
|
|
|
@@ -8,11 +8,11 @@ module counter::dapp_system {
|
|
|
8
8
|
|
|
9
9
|
use sui::clock::Clock;
|
|
10
10
|
|
|
11
|
-
use counter::
|
|
11
|
+
use counter::counter_dapp_schema;
|
|
12
12
|
|
|
13
|
-
use counter::
|
|
13
|
+
use counter::counter_dapp_metadata;
|
|
14
14
|
|
|
15
|
-
use counter::
|
|
15
|
+
use counter::counter_dapp_schema::Dapp;
|
|
16
16
|
|
|
17
17
|
public struct DappKey has drop {}
|
|
18
18
|
|
|
@@ -21,10 +21,10 @@ module counter::dapp_system {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
public(package) fun create(name: String, description: String, clock: &Clock, ctx: &mut TxContext): Dapp {
|
|
24
|
-
let mut dapp =
|
|
24
|
+
let mut dapp = counter_dapp_schema::create(ctx);
|
|
25
25
|
assert!(!dapp.borrow_metadata().contains(), 0);
|
|
26
26
|
dapp.metadata().set(
|
|
27
|
-
|
|
27
|
+
counter_dapp_metadata::new(
|
|
28
28
|
name,
|
|
29
29
|
description,
|
|
30
30
|
ascii::string(b""),
|
|
@@ -55,7 +55,7 @@ module counter::dapp_system {
|
|
|
55
55
|
assert!(admin == option::some(ctx.sender()), 0);
|
|
56
56
|
let created_at = dapp.metadata().get().get_created_at();
|
|
57
57
|
dapp.metadata().set(
|
|
58
|
-
|
|
58
|
+
counter_dapp_metadata::new(
|
|
59
59
|
name,
|
|
60
60
|
description,
|
|
61
61
|
icon_url,
|
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
/* Autogenerated file. Do not edit manually. */
|
|
6
6
|
|
|
7
|
-
module counter::
|
|
7
|
+
module counter::counter_errors {
|
|
8
8
|
|
|
9
9
|
#[error]
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const INVALID_INCREMENT: vector<u8> = b"Number can't be incremented, must be more than 0";
|
|
12
12
|
|
|
13
13
|
public fun invalid_increment_error(condition: bool) {
|
|
14
|
-
assert!(condition,
|
|
14
|
+
assert!(condition, INVALID_INCREMENT)
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
/* Autogenerated file. Do not edit manually. */
|
|
6
6
|
|
|
7
|
-
module counter::
|
|
7
|
+
module counter::counter_events {
|
|
8
8
|
|
|
9
9
|
use std::ascii::{String, string};
|
|
10
10
|
|
|
11
|
-
use counter::
|
|
11
|
+
use counter::counter_increment_event::IncrementEvent;
|
|
12
12
|
|
|
13
|
-
use counter::
|
|
13
|
+
use counter::counter_increment_event;
|
|
14
14
|
|
|
15
15
|
public fun increment_event(value: u32) {
|
|
16
16
|
dubhe::storage_event::emit_set_record<IncrementEvent, IncrementEvent, IncrementEvent>(
|
|
17
17
|
string(b"increment_event"),
|
|
18
18
|
option::none(),
|
|
19
19
|
option::none(),
|
|
20
|
-
option::some(
|
|
20
|
+
option::some(counter_increment_event::new(value))
|
|
21
21
|
)
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
#[allow(lint(share_owned))]module counter::
|
|
1
|
+
#[allow(lint(share_owned))]module counter::counter_genesis {
|
|
2
2
|
|
|
3
3
|
use std::ascii::string;
|
|
4
4
|
|
|
5
5
|
use sui::clock::Clock;
|
|
6
6
|
|
|
7
|
-
use counter::
|
|
7
|
+
use counter::counter_dapp_system;
|
|
8
8
|
|
|
9
9
|
public entry fun run(clock: &Clock, ctx: &mut TxContext) {
|
|
10
10
|
// Create a dapp.
|
|
11
|
-
let mut dapp =
|
|
11
|
+
let mut dapp = counter_dapp_system::create(string(b"counter"),string(b"counter contract"), clock , ctx);
|
|
12
12
|
// Create schemas
|
|
13
|
-
let mut schema = counter::
|
|
13
|
+
let mut schema = counter::counter_schema::create(ctx);
|
|
14
14
|
// Logic that needs to be automated once the contract is deployed
|
|
15
|
-
counter::
|
|
15
|
+
counter::counter_deploy_hook::run(&mut schema, ctx);
|
|
16
16
|
// Authorize schemas and public share objects
|
|
17
17
|
dapp.add_schema(schema);
|
|
18
18
|
sui::transfer::public_share_object(dapp);
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
/* Autogenerated file. Do not edit manually. */
|
|
6
6
|
|
|
7
|
-
module counter::
|
|
7
|
+
module counter::counter_schema {
|
|
8
8
|
|
|
9
9
|
use std::ascii::String;
|
|
10
10
|
|
|
@@ -42,6 +42,14 @@
|
|
|
42
42
|
Schema { id }
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
public(package) fun id(self: &mut Schema): &mut UID {
|
|
46
|
+
&mut self.id
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public(package) fun borrow_id(self: &Schema): &UID {
|
|
50
|
+
&self.id
|
|
51
|
+
}
|
|
52
|
+
|
|
45
53
|
public fun migrate(_schema: &mut Schema, _cap: &UpgradeCap, _ctx: &mut TxContext) {}
|
|
46
54
|
|
|
47
55
|
// ======================================== View Functions ========================================
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
/* Autogenerated file. Do not edit manually. */
|
|
6
6
|
|
|
7
|
-
module counter::
|
|
7
|
+
module counter::counter_deploy_hook {
|
|
8
8
|
|
|
9
|
-
use counter::
|
|
9
|
+
use counter::counter_schema::Schema;
|
|
10
10
|
|
|
11
11
|
public(package) fun run(_schema: &mut Schema, _ctx: &mut TxContext) {
|
|
12
12
|
_schema.value().set(0);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module counter::counter_system {
|
|
2
|
-
use counter::
|
|
3
|
-
use counter::
|
|
4
|
-
use counter::
|
|
2
|
+
use counter::counter_schema::Schema;
|
|
3
|
+
use counter::counter_events::increment_event;
|
|
4
|
+
use counter::counter_errors::invalid_increment_error;
|
|
5
5
|
|
|
6
6
|
public entry fun inc(scheam: &mut Schema, number: u32) {
|
|
7
7
|
// Check if the increment value is valid.
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
module counter::counter_test {
|
|
3
3
|
use sui::test_scenario;
|
|
4
4
|
use counter::counter_system;
|
|
5
|
-
use counter::
|
|
6
|
-
use counter::
|
|
5
|
+
use counter::counter_init_test;
|
|
6
|
+
use counter::counter_schema::Schema;
|
|
7
7
|
|
|
8
8
|
#[test]
|
|
9
9
|
public fun inc() {
|
|
10
|
-
let (scenario, dapp) =
|
|
10
|
+
let (scenario, dapp) = counter_init_test::deploy_dapp_for_testing(@0xA);
|
|
11
11
|
|
|
12
12
|
let mut schema = test_scenario::take_shared<Schema>(&scenario);
|
|
13
13
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#[test_only]module counter::
|
|
1
|
+
#[test_only]module counter::counter_init_test {
|
|
2
2
|
|
|
3
|
-
use counter::
|
|
3
|
+
use counter::counter_dapp_schema::Dapp;
|
|
4
4
|
|
|
5
5
|
use sui::clock;
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
let mut scenario = test_scenario::begin(sender);
|
|
13
13
|
let ctx = test_scenario::ctx(&mut scenario);
|
|
14
14
|
let clock = clock::create_for_testing(ctx);
|
|
15
|
-
counter::
|
|
15
|
+
counter::counter_genesis::run(&clock, ctx);
|
|
16
16
|
clock::destroy_for_testing(clock);
|
|
17
17
|
test_scenario::next_tx(&mut scenario,sender);
|
|
18
18
|
let dapp = test_scenario::take_shared<Dapp>(&scenario);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { DubheConfig } from '@0xobelisk/sui-common';
|
|
1
|
+
import { DubheConfig, storage } from '@0xobelisk/sui-common';
|
|
2
2
|
|
|
3
3
|
export const dubheConfig = {
|
|
4
4
|
name: 'counter',
|
|
5
5
|
description: 'counter contract',
|
|
6
6
|
schemas: {
|
|
7
|
-
value: '
|
|
7
|
+
value: storage('u32'),
|
|
8
8
|
},
|
|
9
9
|
events: {
|
|
10
|
-
|
|
10
|
+
increment: { value: 'u32' },
|
|
11
11
|
},
|
|
12
12
|
errors: {
|
|
13
|
-
|
|
13
|
+
invalid_increment: "Number can't be incremented, must be more than 0",
|
|
14
14
|
},
|
|
15
15
|
} as DubheConfig;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"format": "prettier --write .",
|
|
10
10
|
"format:check": "prettier --check .",
|
|
11
11
|
"type-check": "tsc --noEmit",
|
|
12
|
-
"validate": "pnpm
|
|
12
|
+
"validate": "pnpm format:check && pnpm type-check",
|
|
13
13
|
"start:localnet": "pnpm dubhe node",
|
|
14
14
|
"faucet": "pnpm dubhe faucet --network",
|
|
15
15
|
"deploy": "pnpm dubhe publish --network",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"prod:mainnet": "pnpm config:store mainnet && pnpm next"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@0xobelisk/sui-cli": "^1.1.
|
|
39
|
-
"@0xobelisk/sui-client": "^1.1.
|
|
40
|
-
"@0xobelisk/sui-common": "^1.1.
|
|
41
|
-
"@0xobelisk/sui-indexer": "^1.1.
|
|
38
|
+
"@0xobelisk/sui-cli": "^1.1.6",
|
|
39
|
+
"@0xobelisk/sui-client": "^1.1.10",
|
|
40
|
+
"@0xobelisk/sui-common": "^1.1.7",
|
|
41
|
+
"@0xobelisk/sui-indexer": "^1.1.13",
|
|
42
42
|
"jotai": "^1.7.2",
|
|
43
43
|
"dotenv": "^16.4.5",
|
|
44
44
|
"react": "^19.0.0",
|
|
@@ -53,9 +53,10 @@
|
|
|
53
53
|
"@types/react-dom": "^19",
|
|
54
54
|
"postcss": "^8",
|
|
55
55
|
"tailwindcss": "^3.4.1",
|
|
56
|
-
"eslint": "^9",
|
|
57
56
|
"eslint-config-next": "15.1.6",
|
|
58
57
|
"@eslint/eslintrc": "^3",
|
|
59
|
-
"
|
|
58
|
+
"eslint": "^8.56.0",
|
|
59
|
+
"eslint-config-prettier": "^9.1.0",
|
|
60
|
+
"prettier": "3.3.3"
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
## How to use
|
|
2
|
+
|
|
2
3
|
```bash
|
|
3
4
|
|
|
4
5
|
1 install aptos <https://aptos.dev>
|
|
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)).
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { _decorator, Component, find, LabelComponent, sys } from
|
|
2
|
-
import { dubheConfig } from
|
|
3
|
-
import { NETWORK, PACKAGE_ID } from
|
|
1
|
+
import { _decorator, Component, find, LabelComponent, sys } from 'cc';
|
|
2
|
+
import { dubheConfig } from './dubhe.config';
|
|
3
|
+
import { NETWORK, PACKAGE_ID } from './chain/config';
|
|
4
4
|
|
|
5
5
|
const { ccclass, property } = _decorator;
|
|
6
6
|
|
|
7
|
-
@ccclass(
|
|
7
|
+
@ccclass('aptos')
|
|
8
8
|
export class aptos extends Component {
|
|
9
9
|
async start() {
|
|
10
10
|
this.aptos_account_create();
|
|
@@ -13,17 +13,17 @@ export class aptos extends Component {
|
|
|
13
13
|
async aptos_account_create() {
|
|
14
14
|
// @ts-ignore
|
|
15
15
|
const dubhe_sdk = window.dubhe;
|
|
16
|
-
const decode = JSON.parse(sys.localStorage.getItem(
|
|
16
|
+
const decode = JSON.parse(sys.localStorage.getItem('userWalletData'));
|
|
17
17
|
if (decode == null) {
|
|
18
18
|
const keypair = new dubhe_sdk.AptosAccount();
|
|
19
19
|
const wallet = keypair.toPrivateKeyObject();
|
|
20
20
|
const code = JSON.stringify(wallet);
|
|
21
|
-
sys.localStorage.setItem(
|
|
21
|
+
sys.localStorage.setItem('userWalletData', code);
|
|
22
22
|
const metadata = await dubhe_sdk.loadMetadata(NETWORK, PACKAGE_ID);
|
|
23
23
|
const dubhe = new dubhe_sdk.Dubhe({
|
|
24
24
|
networkType: NETWORK,
|
|
25
25
|
packageId: PACKAGE_ID,
|
|
26
|
-
metadata: metadata
|
|
26
|
+
metadata: metadata
|
|
27
27
|
});
|
|
28
28
|
const address = keypair.address().toString();
|
|
29
29
|
await dubhe.requestFaucet(NETWORK, address);
|
|
@@ -35,18 +35,18 @@ export class aptos extends Component {
|
|
|
35
35
|
const dubhe = new dubhe_sdk.Dubhe({
|
|
36
36
|
networkType: NETWORK,
|
|
37
37
|
packageId: PACKAGE_ID,
|
|
38
|
-
metadata: metadata
|
|
38
|
+
metadata: metadata
|
|
39
39
|
});
|
|
40
40
|
const component_name = Object.keys(dubheConfig.schemas)[0];
|
|
41
41
|
const component_value = await dubhe.getEntity(component_name);
|
|
42
|
-
const counter_node = find(
|
|
43
|
-
const label = counter_node.getComponent(
|
|
42
|
+
const counter_node = find('Canvas/Camera/counter');
|
|
43
|
+
const label = counter_node.getComponent('cc.Label') as LabelComponent;
|
|
44
44
|
label.string = `Counter: ${component_value}`;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
async export_wallet() {
|
|
49
|
-
const keypair = JSON.parse(sys.localStorage.getItem(
|
|
49
|
+
const keypair = JSON.parse(sys.localStorage.getItem('userWalletData'));
|
|
50
50
|
|
|
51
51
|
return keypair.privateKeyHex;
|
|
52
52
|
}
|
|
@@ -63,7 +63,7 @@ export class aptos extends Component {
|
|
|
63
63
|
networkType: NETWORK,
|
|
64
64
|
packageId: PACKAGE_ID,
|
|
65
65
|
metadata: metadata,
|
|
66
|
-
secretKey: privateKey
|
|
66
|
+
secretKey: privateKey
|
|
67
67
|
});
|
|
68
68
|
|
|
69
69
|
const response = await dubhe.tx.counter_system.increase();
|
|
@@ -73,12 +73,12 @@ export class aptos extends Component {
|
|
|
73
73
|
const dubhe = new dubhe_sdk.Dubhe({
|
|
74
74
|
networkType: NETWORK,
|
|
75
75
|
packageId: PACKAGE_ID,
|
|
76
|
-
metadata: metadata
|
|
76
|
+
metadata: metadata
|
|
77
77
|
});
|
|
78
78
|
const component_name = Object.keys(dubheConfig.schemas)[0];
|
|
79
79
|
const component_value = await dubhe.getEntity(component_name);
|
|
80
|
-
const counter_node = find(
|
|
81
|
-
const label = counter_node.getComponent(
|
|
80
|
+
const counter_node = find('Canvas/Camera/counter');
|
|
81
|
+
const label = counter_node.getComponent('cc.Label') as LabelComponent;
|
|
82
82
|
label.string = `Counter: ${component_value}`;
|
|
83
83
|
}, 1000);
|
|
84
84
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { DubheConfig } from
|
|
1
|
+
import { DubheConfig } from '@0xobelisk/aptos-common';
|
|
2
2
|
|
|
3
3
|
export const dubheConfig = {
|
|
4
|
-
name:
|
|
5
|
-
description:
|
|
6
|
-
systems: [
|
|
4
|
+
name: 'counter',
|
|
5
|
+
description: 'counter',
|
|
6
|
+
systems: ['counter_system'],
|
|
7
7
|
schemas: {
|
|
8
8
|
counter: {
|
|
9
|
-
valueType:
|
|
10
|
-
defaultValue: 0
|
|
11
|
-
}
|
|
12
|
-
}
|
|
9
|
+
valueType: 'u64',
|
|
10
|
+
defaultValue: 0
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
13
|
} as DubheConfig;
|