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,13 +1,12 @@
|
|
|
1
|
-
import {atom} from
|
|
1
|
+
import { atom } from 'jotai';
|
|
2
2
|
|
|
3
|
-
const SellPopUpBoxState = atom(false)
|
|
3
|
+
const SellPopUpBoxState = atom(false);
|
|
4
4
|
const SellState = atom({
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
})
|
|
9
|
-
const OpenBoxState = atom(false)
|
|
10
|
-
const Value = atom(
|
|
5
|
+
type: '',
|
|
6
|
+
hash: '',
|
|
7
|
+
state: false,
|
|
8
|
+
});
|
|
9
|
+
const OpenBoxState = atom(false);
|
|
10
|
+
const Value = atom('');
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
export {SellPopUpBoxState,SellState,OpenBoxState,Value}
|
|
12
|
+
export { SellPopUpBoxState, SellState, OpenBoxState, Value };
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
import type { AppProps } from 'next/app';
|
|
2
|
-
import {FC, ReactNode} from
|
|
3
|
-
import {AptosWalletAdapterProvider} from
|
|
4
|
-
import {PetraWallet} from
|
|
2
|
+
import { FC, ReactNode } from 'react';
|
|
3
|
+
import { AptosWalletAdapterProvider } from '@aptos-labs/wallet-adapter-react';
|
|
4
|
+
import { PetraWallet } from 'petra-plugin-wallet-adapter';
|
|
5
5
|
import 'tailwindcss/tailwind.css';
|
|
6
6
|
import '../css/font-awesome.css';
|
|
7
7
|
// import "@aptos-labs/wallet-adapter-ant-design/dist/index.css";
|
|
8
8
|
const WalletContextProvider: FC<{ children: ReactNode }> = ({ children }) => {
|
|
9
9
|
const wallets = [new PetraWallet()];
|
|
10
|
-
const autoConnect = true
|
|
10
|
+
const autoConnect = true;
|
|
11
11
|
return (
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
<AptosWalletAdapterProvider
|
|
13
|
+
plugins={wallets}
|
|
14
|
+
autoConnect={autoConnect}
|
|
15
|
+
onError={error => {
|
|
16
|
+
console.log('Custom error handling', error);
|
|
17
|
+
}}
|
|
18
|
+
>
|
|
19
|
+
{children}
|
|
20
|
+
</AptosWalletAdapterProvider>
|
|
21
21
|
);
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
function MyApp({ Component, pageProps }: AppProps) {
|
|
25
25
|
return (
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
<WalletContextProvider>
|
|
27
|
+
<Component {...pageProps} />
|
|
28
|
+
</WalletContextProvider>
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import type { NextPage } from 'next';
|
|
2
|
-
import Home from
|
|
3
|
-
|
|
2
|
+
import Home from './home';
|
|
4
3
|
|
|
5
4
|
const IndexPage: NextPage = () => {
|
|
6
5
|
return (
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
)
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default IndexPage
|
|
14
|
-
|
|
6
|
+
<main>
|
|
7
|
+
<Home />
|
|
8
|
+
</main>
|
|
9
|
+
);
|
|
10
|
+
};
|
|
15
11
|
|
|
12
|
+
export default IndexPage;
|
|
@@ -1,59 +1,48 @@
|
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
screens: {
|
|
38
|
-
'3xl': '1700px',
|
|
39
|
-
},
|
|
40
|
-
fontFamily: {
|
|
41
|
-
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
|
|
42
|
-
},
|
|
43
|
-
|
|
4
|
+
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
5
|
+
darkMode: 'media', // or 'media' or 'class'
|
|
6
|
+
//Aptos wallet connect color <by antd>
|
|
7
|
+
corePlugins: {
|
|
8
|
+
preflight: false,
|
|
9
|
+
},
|
|
10
|
+
theme: {
|
|
11
|
+
extend: {
|
|
12
|
+
spacing: {
|
|
13
|
+
70: '17rem',
|
|
14
|
+
78: '18rem',
|
|
15
|
+
82: '20rem',
|
|
16
|
+
90: '22rem',
|
|
17
|
+
93: '23rem',
|
|
18
|
+
97: '25rem',
|
|
19
|
+
98: '27rem',
|
|
20
|
+
99: '30rem',
|
|
21
|
+
new: '34rem',
|
|
22
|
+
'new-1': '39rem',
|
|
23
|
+
100: '43rem',
|
|
24
|
+
105: '46rem',
|
|
25
|
+
106: '48rem',
|
|
26
|
+
},
|
|
27
|
+
colors: {
|
|
28
|
+
transparent: 'transparent',
|
|
29
|
+
current: 'currentColor',
|
|
30
|
+
custom: {
|
|
31
|
+
DEFAULT: '#8861D1',
|
|
32
|
+
light: '#8861D1',
|
|
33
|
+
dark: '#8861D1',
|
|
44
34
|
},
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
},
|
|
36
|
+
screens: {
|
|
37
|
+
'3xl': '1700px',
|
|
38
|
+
},
|
|
39
|
+
fontFamily: {
|
|
40
|
+
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
|
|
41
|
+
},
|
|
48
42
|
},
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
scrollbar: ['rounded']
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
43
|
+
},
|
|
44
|
+
plugins: [require('@tailwindcss/line-clamp'), require('tailwind-scrollbar')],
|
|
45
|
+
variants: {
|
|
46
|
+
scrollbar: ['rounded'],
|
|
47
|
+
},
|
|
48
|
+
};
|
|
@@ -6,11 +6,7 @@
|
|
|
6
6
|
},
|
|
7
7
|
"compilerOptions": {
|
|
8
8
|
"target": "es6",
|
|
9
|
-
"lib": [
|
|
10
|
-
"dom",
|
|
11
|
-
"dom.iterable",
|
|
12
|
-
"esnext"
|
|
13
|
-
],
|
|
9
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
14
10
|
"allowJs": true,
|
|
15
11
|
"skipLibCheck": true,
|
|
16
12
|
"strict": false,
|
|
@@ -24,12 +20,6 @@
|
|
|
24
20
|
"jsx": "preserve",
|
|
25
21
|
"incremental": true
|
|
26
22
|
},
|
|
27
|
-
"include": [
|
|
28
|
-
|
|
29
|
-
"**/*.ts",
|
|
30
|
-
"**/*.tsx"
|
|
31
|
-
],
|
|
32
|
-
"exclude": [
|
|
33
|
-
"node_modules"
|
|
34
|
-
]
|
|
23
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
|
|
24
|
+
"exclude": ["node_modules"]
|
|
35
25
|
}
|
|
@@ -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-nextjs-template folder
|
|
5
|
+
2. cd dubhe-nextjs-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;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"format": "prettier --write .",
|
|
11
11
|
"format:check": "prettier --check .",
|
|
12
12
|
"type-check": "tsc --noEmit",
|
|
13
|
-
"validate": "pnpm
|
|
13
|
+
"validate": "pnpm format:check && pnpm type-check",
|
|
14
14
|
"start:localnet": "pnpm dubhe node",
|
|
15
15
|
"faucet": "pnpm dubhe faucet --network",
|
|
16
16
|
"deploy": "pnpm dubhe publish --network",
|
|
@@ -36,10 +36,10 @@
|
|
|
36
36
|
"prod:mainnet": "pnpm config:store mainnet && pnpm next"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@0xobelisk/sui-cli": "^1.1.
|
|
40
|
-
"@0xobelisk/sui-client": "^1.1.
|
|
41
|
-
"@0xobelisk/sui-common": "^1.1.
|
|
42
|
-
"@0xobelisk/sui-indexer": "^1.1.
|
|
39
|
+
"@0xobelisk/sui-cli": "^1.1.6",
|
|
40
|
+
"@0xobelisk/sui-client": "^1.1.10",
|
|
41
|
+
"@0xobelisk/sui-common": "^1.1.7",
|
|
42
|
+
"@0xobelisk/sui-indexer": "^1.1.13",
|
|
43
43
|
"@mysten/dapp-kit": "0.14.46",
|
|
44
44
|
"@tanstack/react-query": "^5.17.19",
|
|
45
45
|
"dotenv": "^16.4.5",
|
|
@@ -54,11 +54,12 @@
|
|
|
54
54
|
"@types/node": "^18",
|
|
55
55
|
"@types/react": "^18.3.3",
|
|
56
56
|
"@types/react-dom": "^18.3.0",
|
|
57
|
-
"eslint": "^9",
|
|
58
57
|
"eslint-config-next": "15.1.6",
|
|
59
58
|
"postcss": "^8",
|
|
60
|
-
"prettier": "^3.2.2",
|
|
61
59
|
"tailwindcss": "^3.4.1",
|
|
62
|
-
"typescript": "^5.7.2"
|
|
60
|
+
"typescript": "^5.7.2",
|
|
61
|
+
"eslint": "^8.56.0",
|
|
62
|
+
"eslint-config-prettier": "^9.1.0",
|
|
63
|
+
"prettier": "3.3.3"
|
|
63
64
|
}
|
|
64
65
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
type NetworkType = 'testnet' | 'mainnet' | 'devnet' | 'localnet';
|
|
2
2
|
|
|
3
3
|
export const NETWORK: NetworkType = 'localnet';
|
|
4
|
-
export const PACKAGE_ID = '0x6c0d1a23aefeb10bb53837dd23463420dd7c4edce6f762882ae75ea16cbd702c'
|
|
5
|
-
export const SCHEMA_ID = '0xe60a62fb4c195d3867b33ca55d536c84373c66caa603c9ace0013a5a1a86de64'
|
|
4
|
+
export const PACKAGE_ID = '0x6c0d1a23aefeb10bb53837dd23463420dd7c4edce6f762882ae75ea16cbd702c';
|
|
5
|
+
export const SCHEMA_ID = '0xe60a62fb4c195d3867b33ca55d536c84373c66caa603c9ace0013a5a1a86de64';
|