create-dubhe 0.1.2 → 0.1.5
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/package.json +1 -1
- package/template/101/sui-template/.prettierrc +7 -7
- package/template/101/sui-template/README.md +8 -9
- package/template/101/sui-template/contracts/counter/.history/sui_localnet/latest.json +11 -0
- package/template/101/sui-template/contracts/counter/Move.lock +45 -0
- package/template/101/sui-template/dubhe.config.ts +11 -11
- package/template/101/sui-template/eslint.config.mjs +14 -0
- package/template/101/sui-template/next.config.ts +7 -0
- package/template/101/sui-template/package.json +23 -40
- package/template/101/sui-template/pnpm-lock.yaml +8133 -0
- package/template/101/sui-template/postcss.config.mjs +8 -0
- package/template/101/sui-template/src/app/favicon.ico +0 -0
- package/template/101/sui-template/src/app/globals.css +21 -0
- package/template/101/sui-template/src/app/layout.tsx +34 -0
- package/template/101/sui-template/src/app/page.tsx +106 -0
- package/template/101/sui-template/src/app/state/index.tsx +5 -0
- package/template/101/sui-template/src/chain/config.ts +2 -2
- package/template/101/sui-template/tailwind.config.ts +18 -0
- package/template/101/sui-template/tsconfig.json +11 -8
- package/template/contract/sui-template/package.json +1 -1
- package/template/nextjs/sui-template/.prettierrc +7 -7
- package/template/nextjs/sui-template/README.md +8 -8
- package/template/nextjs/sui-template/contracts/counter/.history/sui_localnet/latest.json +11 -0
- package/template/nextjs/sui-template/contracts/counter/Move.lock +52 -0
- package/template/nextjs/sui-template/contracts/counter/Move.toml +1 -1
- package/template/nextjs/sui-template/dubhe.config.ts +11 -11
- package/template/nextjs/sui-template/eslint.config.mjs +14 -0
- package/template/nextjs/sui-template/next.config.mjs +5 -0
- package/template/nextjs/sui-template/package.json +25 -41
- package/template/nextjs/sui-template/pnpm-lock.yaml +9002 -0
- package/template/nextjs/sui-template/postcss.config.mjs +8 -0
- package/template/nextjs/sui-template/src/app/favicon.ico +0 -0
- package/template/nextjs/sui-template/src/app/globals.css +21 -0
- package/template/nextjs/sui-template/src/app/layout.tsx +35 -0
- package/template/nextjs/sui-template/src/app/page.tsx +151 -0
- package/template/nextjs/sui-template/src/{pages/_app.tsx → app/providers.tsx} +6 -12
- package/template/nextjs/sui-template/src/app/state/index.tsx +5 -0
- package/template/nextjs/sui-template/src/chain/config.ts +3 -3
- package/template/nextjs/sui-template/tailwind.config.ts +18 -0
- package/template/nextjs/sui-template/tsconfig.json +13 -15
- package/template/101/sui-template/.dockerignore +0 -7
- package/template/101/sui-template/.eslintrc.json +0 -3
- package/template/101/sui-template/Dockerfile +0 -52
- package/template/101/sui-template/LICENSE +0 -674
- package/template/101/sui-template/jest.config.ts +0 -17
- package/template/101/sui-template/next-env.d.ts +0 -5
- package/template/101/sui-template/next-i18next.config.js +0 -6
- package/template/101/sui-template/next.config.js +0 -15
- package/template/101/sui-template/postcss.config.js +0 -6
- package/template/101/sui-template/public/discord.svg +0 -9
- package/template/101/sui-template/public/fail.svg +0 -12
- package/template/101/sui-template/public/favicon.ico +0 -0
- package/template/101/sui-template/public/locales/de/common.json +0 -8
- package/template/101/sui-template/public/locales/de/footer.json +0 -3
- package/template/101/sui-template/public/locales/de/second-page.json +0 -5
- package/template/101/sui-template/public/locales/en/common.json +0 -8
- package/template/101/sui-template/public/locales/en/footer.json +0 -3
- package/template/101/sui-template/public/locales/en/second-page.json +0 -5
- package/template/101/sui-template/public/locales/zn/common.json +0 -8
- package/template/101/sui-template/public/locales/zn/footer.json +0 -3
- package/template/101/sui-template/public/locales/zn/second-page.json +0 -5
- package/template/101/sui-template/public/logo.svg +0 -1
- package/template/101/sui-template/public/medium.svg +0 -9
- package/template/101/sui-template/public/successful.svg +0 -11
- package/template/101/sui-template/public/telegram.svg +0 -9
- package/template/101/sui-template/public/twitter.svg +0 -9
- package/template/101/sui-template/src/css/font-awesome.css +0 -2337
- package/template/101/sui-template/src/css/font-awesome.min.css +0 -4
- package/template/101/sui-template/src/fonts/FontAwesome.otf +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.svg +0 -2671
- package/template/101/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/101/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/101/sui-template/src/jotai/index.tsx +0 -12
- package/template/101/sui-template/src/pages/_app.tsx +0 -15
- package/template/101/sui-template/src/pages/home/index.tsx +0 -117
- package/template/101/sui-template/src/pages/index.tsx +0 -12
- package/template/101/sui-template/tailwind.config.js +0 -56
- package/template/nextjs/sui-template/.dockerignore +0 -7
- package/template/nextjs/sui-template/.eslintrc.json +0 -3
- package/template/nextjs/sui-template/Dockerfile +0 -52
- package/template/nextjs/sui-template/LICENSE +0 -674
- package/template/nextjs/sui-template/jest.config.ts +0 -17
- package/template/nextjs/sui-template/next-env.d.ts +0 -5
- package/template/nextjs/sui-template/next-i18next.config.js +0 -6
- package/template/nextjs/sui-template/next.config.js +0 -15
- package/template/nextjs/sui-template/postcss.config.js +0 -6
- package/template/nextjs/sui-template/public/discord.svg +0 -9
- package/template/nextjs/sui-template/public/fail.svg +0 -12
- package/template/nextjs/sui-template/public/favicon.ico +0 -0
- package/template/nextjs/sui-template/public/locales/de/common.json +0 -8
- package/template/nextjs/sui-template/public/locales/de/footer.json +0 -3
- package/template/nextjs/sui-template/public/locales/de/second-page.json +0 -5
- package/template/nextjs/sui-template/public/locales/en/common.json +0 -8
- package/template/nextjs/sui-template/public/locales/en/footer.json +0 -3
- package/template/nextjs/sui-template/public/locales/en/second-page.json +0 -5
- package/template/nextjs/sui-template/public/locales/zn/common.json +0 -8
- package/template/nextjs/sui-template/public/locales/zn/footer.json +0 -3
- package/template/nextjs/sui-template/public/locales/zn/second-page.json +0 -5
- package/template/nextjs/sui-template/public/logo.svg +0 -1
- package/template/nextjs/sui-template/public/medium.svg +0 -9
- package/template/nextjs/sui-template/public/successful.svg +0 -11
- package/template/nextjs/sui-template/public/telegram.svg +0 -9
- package/template/nextjs/sui-template/public/twitter.svg +0 -9
- package/template/nextjs/sui-template/src/components/Animation.tsx +0 -80
- package/template/nextjs/sui-template/src/components/Container.tsx +0 -11
- package/template/nextjs/sui-template/src/components/footer/index.tsx +0 -138
- package/template/nextjs/sui-template/src/components/head/index.tsx +0 -14
- package/template/nextjs/sui-template/src/components/header/index.tsx +0 -173
- package/template/nextjs/sui-template/src/components/pop_up_box/index.tsx +0 -149
- package/template/nextjs/sui-template/src/css/font-awesome.css +0 -2337
- package/template/nextjs/sui-template/src/css/font-awesome.min.css +0 -4
- package/template/nextjs/sui-template/src/fonts/FontAwesome.otf +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.eot +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.svg +0 -2671
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.ttf +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff +0 -0
- package/template/nextjs/sui-template/src/fonts/fontawesome-webfont.woff2 +0 -0
- package/template/nextjs/sui-template/src/jotai/index.tsx +0 -13
- package/template/nextjs/sui-template/src/pages/home/index.tsx +0 -172
- package/template/nextjs/sui-template/src/pages/index.tsx +0 -15
- package/template/nextjs/sui-template/tailwind.config.js +0 -56
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { atom } from 'jotai';
|
|
2
|
-
|
|
3
|
-
const SellPopUpBoxState = atom(false);
|
|
4
|
-
const SellState = atom({
|
|
5
|
-
type: '',
|
|
6
|
-
hash: '',
|
|
7
|
-
state: false,
|
|
8
|
-
});
|
|
9
|
-
const OpenBoxState = atom(false);
|
|
10
|
-
const Value = atom('');
|
|
11
|
-
|
|
12
|
-
export { SellPopUpBoxState, SellState, OpenBoxState, Value };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import 'tailwindcss/tailwind.css';
|
|
2
|
-
import '../css/font-awesome.css';
|
|
3
|
-
import type { AppProps } from 'next/app';
|
|
4
|
-
import { Toaster } from 'sonner';
|
|
5
|
-
|
|
6
|
-
function MyApp({ Component, pageProps }: AppProps) {
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<Toaster />
|
|
10
|
-
<Component {...pageProps} />
|
|
11
|
-
</>
|
|
12
|
-
);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export default MyApp;
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
loadMetadata,
|
|
3
|
-
Dubhe,
|
|
4
|
-
Transaction,
|
|
5
|
-
TransactionResult,
|
|
6
|
-
DevInspectResults,
|
|
7
|
-
NetworkType,
|
|
8
|
-
} from '@0xobelisk/sui-client';
|
|
9
|
-
import { useEffect, useState } from 'react';
|
|
10
|
-
import { useAtom } from 'jotai';
|
|
11
|
-
import { Value } from '../../jotai';
|
|
12
|
-
import { useRouter } from 'next/router';
|
|
13
|
-
import { SCHEMA_ID, NETWORK, PACKAGE_ID } from '../../chain/config';
|
|
14
|
-
import { PRIVATEKEY } from '../../chain/key';
|
|
15
|
-
import { toast } from 'sonner';
|
|
16
|
-
|
|
17
|
-
function getExplorerUrl(network: NetworkType, digest: string) {
|
|
18
|
-
switch (network) {
|
|
19
|
-
case 'testnet':
|
|
20
|
-
return `https://explorer.polymedia.app/txblock/${digest}?network=${network}`;
|
|
21
|
-
case 'mainnet':
|
|
22
|
-
return `https://suiscan.xyz/tx/${digest}`;
|
|
23
|
-
case 'devnet':
|
|
24
|
-
return `https://explorer.polymedia.app/txblock/${digest}?network=${network}`;
|
|
25
|
-
case 'localnet':
|
|
26
|
-
return `https://explorer.polymedia.app/txblock/${digest}?network=local`;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const Home = () => {
|
|
31
|
-
const router = useRouter();
|
|
32
|
-
const [value, setValue] = useAtom(Value);
|
|
33
|
-
const [loading, setLoading] = useState(false);
|
|
34
|
-
|
|
35
|
-
const query_counter_value = async () => {
|
|
36
|
-
const metadata = await loadMetadata(NETWORK, PACKAGE_ID);
|
|
37
|
-
const dubhe = new Dubhe({
|
|
38
|
-
networkType: NETWORK,
|
|
39
|
-
packageId: PACKAGE_ID,
|
|
40
|
-
metadata: metadata,
|
|
41
|
-
});
|
|
42
|
-
const tx = new Transaction();
|
|
43
|
-
const query_value = (await dubhe.query.schema.get_value({
|
|
44
|
-
tx,
|
|
45
|
-
params: [tx.object(SCHEMA_ID)],
|
|
46
|
-
})) as DevInspectResults;
|
|
47
|
-
console.log('Counter value:', dubhe.view(query_value)[0]);
|
|
48
|
-
setValue(dubhe.view(query_value)[0]);
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
const counter = async () => {
|
|
52
|
-
setLoading(true);
|
|
53
|
-
try {
|
|
54
|
-
const metadata = await loadMetadata(NETWORK, PACKAGE_ID);
|
|
55
|
-
const dubhe = new Dubhe({
|
|
56
|
-
networkType: NETWORK,
|
|
57
|
-
packageId: PACKAGE_ID,
|
|
58
|
-
metadata: metadata,
|
|
59
|
-
secretKey: PRIVATEKEY,
|
|
60
|
-
});
|
|
61
|
-
const tx = new Transaction();
|
|
62
|
-
(await dubhe.tx.counter_system.inc({
|
|
63
|
-
tx,
|
|
64
|
-
params: [tx.object(SCHEMA_ID), tx.pure.u32(1)],
|
|
65
|
-
isRaw: true,
|
|
66
|
-
})) as TransactionResult;
|
|
67
|
-
const response = await dubhe.signAndSendTxn(tx);
|
|
68
|
-
if (response.effects.status.status == 'success') {
|
|
69
|
-
setTimeout(async () => {
|
|
70
|
-
await query_counter_value();
|
|
71
|
-
console.log(response);
|
|
72
|
-
console.log(response.digest);
|
|
73
|
-
toast('Transfer Successful', {
|
|
74
|
-
description: new Date().toUTCString(),
|
|
75
|
-
action: {
|
|
76
|
-
label: 'Check in Explorer',
|
|
77
|
-
onClick: () => window.open(getExplorerUrl(NETWORK, response.digest), '_blank'),
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
setLoading(false);
|
|
81
|
-
}, 200);
|
|
82
|
-
}
|
|
83
|
-
} catch (error) {
|
|
84
|
-
toast.error('Transaction failed. Please try again.');
|
|
85
|
-
setLoading(false);
|
|
86
|
-
console.error(error);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
if (router.isReady) {
|
|
92
|
-
query_counter_value();
|
|
93
|
-
}
|
|
94
|
-
}, [router.isReady]);
|
|
95
|
-
return (
|
|
96
|
-
<div className="max-w-7xl mx-auto text-center py-12 px-4 sm:px-6 lg:py-16 lg:px-8 flex-6">
|
|
97
|
-
<div className="flex flex-col gap-6 mt-12">
|
|
98
|
-
<div className="flex flex-col gap-4">
|
|
99
|
-
You account already have some sui from {NETWORK}
|
|
100
|
-
<div className="flex flex-col gap-6 text-2xl text-green-600 mt-6 ">Counter: {value}</div>
|
|
101
|
-
<div className="flex flex-col gap-6">
|
|
102
|
-
<button
|
|
103
|
-
type="button"
|
|
104
|
-
className="mx-auto px-5 py-3 border border-transparent text-base font-medium rounded-md text-white bg-indigo-600 hover:bg-indigo-700"
|
|
105
|
-
onClick={() => counter()}
|
|
106
|
-
disabled={loading}
|
|
107
|
-
>
|
|
108
|
-
{loading ? 'Processing...' : 'Increment'}
|
|
109
|
-
</button>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
);
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
export default Home;
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const defaultTheme = require('tailwindcss/defaultTheme')
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
|
|
5
|
-
content: ['./src/**/*.{js,ts,jsx,tsx}'],
|
|
6
|
-
darkMode: 'media', // or 'media' or 'class'
|
|
7
|
-
theme: {
|
|
8
|
-
extend: {
|
|
9
|
-
spacing: {
|
|
10
|
-
"70":"17rem",
|
|
11
|
-
'78':'18rem',
|
|
12
|
-
'82': '20rem',
|
|
13
|
-
'90': '22rem',
|
|
14
|
-
'93': '23rem',
|
|
15
|
-
'97': '25rem',
|
|
16
|
-
'98': '27rem',
|
|
17
|
-
'99': "30rem",
|
|
18
|
-
"new":"34rem",
|
|
19
|
-
"new-1":"39rem",
|
|
20
|
-
"100":"43rem",
|
|
21
|
-
"105":"46rem",
|
|
22
|
-
"106":"48rem",
|
|
23
|
-
},
|
|
24
|
-
colors: {
|
|
25
|
-
transparent: 'transparent',
|
|
26
|
-
current: 'currentColor',
|
|
27
|
-
custom:{
|
|
28
|
-
DEFAULT:'#8861D1',
|
|
29
|
-
light:"#8861D1",
|
|
30
|
-
dark:"#8861D1",
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
screens: {
|
|
35
|
-
'3xl': '1700px',
|
|
36
|
-
},
|
|
37
|
-
fontFamily: {
|
|
38
|
-
sans: ['Inter var', ...defaultTheme.fontFamily.sans],
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
},
|
|
46
|
-
plugins: [
|
|
47
|
-
|
|
48
|
-
require('@tailwindcss/line-clamp'),
|
|
49
|
-
require('tailwind-scrollbar'),
|
|
50
|
-
],
|
|
51
|
-
variants: {
|
|
52
|
-
scrollbar: ['rounded']
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
# Install dependencies only when needed
|
|
2
|
-
FROM node:18-alpine AS deps
|
|
3
|
-
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
|
4
|
-
RUN apk add --no-cache libc6-compat
|
|
5
|
-
WORKDIR /app
|
|
6
|
-
|
|
7
|
-
# If using npm with a `package-lock.json` comment out above and use below instead
|
|
8
|
-
COPY package.json package-lock.json ./
|
|
9
|
-
RUN npm ci
|
|
10
|
-
|
|
11
|
-
# Rebuild the source code only when needed
|
|
12
|
-
FROM node:18-alpine AS builder
|
|
13
|
-
WORKDIR /app
|
|
14
|
-
COPY --from=deps /app/node_modules ./node_modules
|
|
15
|
-
COPY . .
|
|
16
|
-
|
|
17
|
-
# Next.js collects completely anonymous telemetry data about general usage.
|
|
18
|
-
# Learn more here: https://nextjs.org/telemetry
|
|
19
|
-
# Uncomment the following line in case you want to disable telemetry during the build.
|
|
20
|
-
# ENV NEXT_TELEMETRY_DISABLED 1
|
|
21
|
-
|
|
22
|
-
# If using npm comment out above and use below instead
|
|
23
|
-
RUN npm run build
|
|
24
|
-
|
|
25
|
-
# Production image, copy all the files and run next
|
|
26
|
-
FROM node:18-alpine AS runner
|
|
27
|
-
WORKDIR /app
|
|
28
|
-
|
|
29
|
-
ENV NODE_ENV production
|
|
30
|
-
# Uncomment the following line in case you want to disable telemetry during runtime.
|
|
31
|
-
# ENV NEXT_TELEMETRY_DISABLED 1
|
|
32
|
-
|
|
33
|
-
RUN addgroup --system --gid 1001 nodejs
|
|
34
|
-
RUN adduser --system --uid 1001 nextjs
|
|
35
|
-
|
|
36
|
-
# You only need to copy next.config.js if you are NOT using the default configuration
|
|
37
|
-
# COPY --from=builder /app/next.config.js ./
|
|
38
|
-
COPY --from=builder /app/public ./public
|
|
39
|
-
COPY --from=builder /app/package.json ./package.json
|
|
40
|
-
|
|
41
|
-
# Automatically leverage output traces to reduce image size
|
|
42
|
-
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
|
43
|
-
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
|
44
|
-
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
|
45
|
-
|
|
46
|
-
USER nextjs
|
|
47
|
-
|
|
48
|
-
EXPOSE 3000
|
|
49
|
-
|
|
50
|
-
ENV PORT 3000
|
|
51
|
-
|
|
52
|
-
CMD ["node", "server.js"]
|