@sei-js/create-sei 0.0.2 → 0.0.4
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/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +12 -0
- package/README.md +16 -25
- package/biome.json +8 -0
- package/dist/main.js +10 -60
- package/dist/templates/next-template/.eslintrc.json +3 -0
- package/dist/templates/next-template/package.json +30 -0
- package/dist/templates/next-template/src/app/components/Homepage/Examples.tsx +257 -0
- package/dist/templates/next-template/src/app/components/Homepage/Homepage.css +154 -0
- package/dist/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +10 -36
- package/{templates/next-wagmi-template → dist/templates/next-template}/src/app/components/Web3Provider.tsx +29 -28
- package/dist/templates/next-template/src/app/components/index.ts +2 -0
- package/dist/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +2 -2
- package/dist/templates/next-template/src/app/constants/index.ts +1 -0
- package/dist/templates/next-template/src/app/index.css +184 -0
- package/dist/templates/next-template/src/app/layout.tsx +21 -0
- package/dist/templates/next-template/src/app/page.tsx +21 -0
- package/dist/templates/next-template/tsconfig.json +26 -0
- package/dist/templates/vite-template/.eslintrc.cjs +11 -0
- package/dist/templates/vite-template/package.json +33 -0
- package/dist/templates/vite-template/src/App.tsx +21 -0
- package/dist/templates/vite-template/src/components/Homepage/Examples.tsx +255 -0
- package/dist/templates/vite-template/src/components/Homepage/Homepage.css +154 -0
- package/dist/templates/vite-template/src/components/Homepage/Homepage.tsx +81 -0
- package/{templates/vite-wagmi-template → dist/templates/vite-template}/src/components/Web3Provider.tsx +29 -28
- package/dist/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +1 -1
- package/dist/templates/vite-template/src/constants/index.ts +1 -0
- package/dist/templates/vite-template/src/index.css +183 -0
- package/dist/templates/vite-template/src/main.tsx +12 -0
- package/dist/templates/vite-template/tsconfig.app.json +25 -0
- package/dist/templates/vite-template/tsconfig.json +11 -0
- package/dist/templates/vite-template/tsconfig.node.json +14 -0
- package/dist/templates/vite-template/vite.config.ts +10 -0
- package/package.json +1 -1
- package/src/main.ts +26 -87
- package/templates/next-template/.eslintrc.json +3 -0
- package/templates/next-template/package.json +30 -0
- package/templates/next-template/src/app/components/Homepage/Examples.tsx +257 -0
- package/templates/next-template/src/app/components/Homepage/Homepage.css +154 -0
- package/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +10 -36
- package/{dist/templates/next-wagmi-template → templates/next-template}/src/app/components/Web3Provider.tsx +29 -28
- package/templates/next-template/src/app/components/index.ts +2 -0
- package/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +2 -2
- package/templates/next-template/src/app/constants/index.ts +1 -0
- package/templates/next-template/src/app/index.css +184 -0
- package/templates/next-template/src/app/layout.tsx +21 -0
- package/templates/next-template/src/app/page.tsx +21 -0
- package/templates/next-template/tsconfig.json +26 -0
- package/templates/vite-template/.eslintrc.cjs +11 -0
- package/templates/vite-template/package.json +33 -0
- package/templates/vite-template/src/App.tsx +21 -0
- package/templates/vite-template/src/components/Homepage/Examples.tsx +255 -0
- package/templates/vite-template/src/components/Homepage/Homepage.css +154 -0
- package/templates/vite-template/src/components/Homepage/Homepage.tsx +81 -0
- package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/components/Web3Provider.tsx +29 -28
- package/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +1 -1
- package/templates/vite-template/src/constants/index.ts +1 -0
- package/templates/vite-template/src/index.css +183 -0
- package/templates/vite-template/src/main.tsx +12 -0
- package/templates/vite-template/tsconfig.app.json +25 -0
- package/templates/vite-template/tsconfig.json +11 -0
- package/templates/vite-template/tsconfig.node.json +14 -0
- package/templates/vite-template/vite.config.ts +10 -0
- package/tsconfig.json +18 -28
- package/dist/templates/next-cosmos-template/.eslintrc.json +0 -3
- package/dist/templates/next-cosmos-template/README.md +0 -60
- package/dist/templates/next-cosmos-template/next.config.mjs +0 -14
- package/dist/templates/next-cosmos-template/package.json +0 -31
- package/dist/templates/next-cosmos-template/public/next.svg +0 -1
- package/dist/templates/next-cosmos-template/public/vercel.svg +0 -1
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
- package/dist/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/dist/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
- package/dist/templates/next-cosmos-template/src/app/components/index.ts +0 -3
- package/dist/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
- package/dist/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
- package/dist/templates/next-cosmos-template/src/app/index.css +0 -171
- package/dist/templates/next-cosmos-template/src/app/layout.tsx +0 -21
- package/dist/templates/next-cosmos-template/src/app/page.tsx +0 -17
- package/dist/templates/next-cosmos-template/tsconfig.json +0 -26
- package/dist/templates/next-cosmos-template/yarn.lock +0 -9814
- package/dist/templates/next-wagmi-template/.eslintrc.json +0 -3
- package/dist/templates/next-wagmi-template/package.json +0 -30
- package/dist/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
- package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
- package/dist/templates/next-wagmi-template/src/app/components/index.ts +0 -2
- package/dist/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
- package/dist/templates/next-wagmi-template/src/app/index.css +0 -171
- package/dist/templates/next-wagmi-template/src/app/layout.tsx +0 -21
- package/dist/templates/next-wagmi-template/src/app/page.tsx +0 -21
- package/dist/templates/next-wagmi-template/tsconfig.json +0 -26
- package/dist/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
- package/dist/templates/vite-cosmos-template/README.md +0 -72
- package/dist/templates/vite-cosmos-template/index.html +0 -16
- package/dist/templates/vite-cosmos-template/package.json +0 -35
- package/dist/templates/vite-cosmos-template/src/App.tsx +0 -16
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
- package/dist/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/dist/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
- package/dist/templates/vite-cosmos-template/src/components/index.ts +0 -4
- package/dist/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
- package/dist/templates/vite-cosmos-template/src/constants/index.ts +0 -1
- package/dist/templates/vite-cosmos-template/src/index.css +0 -171
- package/dist/templates/vite-cosmos-template/src/main.tsx +0 -12
- package/dist/templates/vite-cosmos-template/tsconfig.app.json +0 -27
- package/dist/templates/vite-cosmos-template/tsconfig.json +0 -11
- package/dist/templates/vite-cosmos-template/tsconfig.node.json +0 -14
- package/dist/templates/vite-cosmos-template/vite.config.ts +0 -7
- package/dist/templates/vite-cosmos-template/yarn.lock +0 -9323
- package/dist/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
- package/dist/templates/vite-wagmi-template/package.json +0 -33
- package/dist/templates/vite-wagmi-template/src/App.tsx +0 -22
- package/dist/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
- package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
- package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
- package/dist/templates/vite-wagmi-template/src/constants/index.ts +0 -1
- package/dist/templates/vite-wagmi-template/src/index.css +0 -170
- package/dist/templates/vite-wagmi-template/src/main.tsx +0 -12
- package/dist/templates/vite-wagmi-template/tsconfig.app.json +0 -27
- package/dist/templates/vite-wagmi-template/tsconfig.json +0 -11
- package/dist/templates/vite-wagmi-template/tsconfig.node.json +0 -14
- package/dist/templates/vite-wagmi-template/vite.config.ts +0 -10
- package/templates/next-cosmos-template/.eslintrc.json +0 -3
- package/templates/next-cosmos-template/README.md +0 -60
- package/templates/next-cosmos-template/next-env.d.ts +0 -5
- package/templates/next-cosmos-template/next.config.mjs +0 -14
- package/templates/next-cosmos-template/package.json +0 -31
- package/templates/next-cosmos-template/public/next.svg +0 -1
- package/templates/next-cosmos-template/public/sei-logotype.svg +0 -15
- package/templates/next-cosmos-template/public/vercel.svg +0 -1
- package/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
- package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
- package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
- package/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
- package/templates/next-cosmos-template/src/app/components/index.ts +0 -3
- package/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
- package/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
- package/templates/next-cosmos-template/src/app/favicon.ico +0 -0
- package/templates/next-cosmos-template/src/app/index.css +0 -171
- package/templates/next-cosmos-template/src/app/layout.tsx +0 -21
- package/templates/next-cosmos-template/src/app/page.tsx +0 -17
- package/templates/next-cosmos-template/tsconfig.json +0 -26
- package/templates/next-cosmos-template/yarn.lock +0 -9814
- package/templates/next-wagmi-template/.eslintrc.json +0 -3
- package/templates/next-wagmi-template/next-env.d.ts +0 -5
- package/templates/next-wagmi-template/package.json +0 -30
- package/templates/next-wagmi-template/public/sei-logotype.svg +0 -15
- package/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
- package/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
- package/templates/next-wagmi-template/src/app/components/index.ts +0 -2
- package/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
- package/templates/next-wagmi-template/src/app/favicon.ico +0 -0
- package/templates/next-wagmi-template/src/app/index.css +0 -171
- package/templates/next-wagmi-template/src/app/layout.tsx +0 -21
- package/templates/next-wagmi-template/src/app/page.tsx +0 -21
- package/templates/next-wagmi-template/tsconfig.json +0 -26
- package/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
- package/templates/vite-cosmos-template/README.md +0 -72
- package/templates/vite-cosmos-template/favicon.ico +0 -0
- package/templates/vite-cosmos-template/index.html +0 -16
- package/templates/vite-cosmos-template/package.json +0 -35
- package/templates/vite-cosmos-template/public/sei-logotype.svg +0 -15
- package/templates/vite-cosmos-template/src/App.tsx +0 -16
- package/templates/vite-cosmos-template/src/assets/react.svg +0 -1
- package/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
- package/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
- package/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
- package/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
- package/templates/vite-cosmos-template/src/components/index.ts +0 -4
- package/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
- package/templates/vite-cosmos-template/src/constants/index.ts +0 -1
- package/templates/vite-cosmos-template/src/index.css +0 -171
- package/templates/vite-cosmos-template/src/main.tsx +0 -12
- package/templates/vite-cosmos-template/src/vite-env.d.ts +0 -1
- package/templates/vite-cosmos-template/tsconfig.app.json +0 -27
- package/templates/vite-cosmos-template/tsconfig.json +0 -11
- package/templates/vite-cosmos-template/tsconfig.node.json +0 -14
- package/templates/vite-cosmos-template/vite.config.ts +0 -7
- package/templates/vite-cosmos-template/yarn.lock +0 -9323
- package/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
- package/templates/vite-wagmi-template/favicon.ico +0 -0
- package/templates/vite-wagmi-template/package.json +0 -33
- package/templates/vite-wagmi-template/public/sei-logotype.svg +0 -15
- package/templates/vite-wagmi-template/src/App.tsx +0 -22
- package/templates/vite-wagmi-template/src/assets/react.svg +0 -1
- package/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
- package/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
- package/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
- package/templates/vite-wagmi-template/src/constants/index.ts +0 -1
- package/templates/vite-wagmi-template/src/index.css +0 -170
- package/templates/vite-wagmi-template/src/main.tsx +0 -12
- package/templates/vite-wagmi-template/src/vite-env.d.ts +0 -1
- package/templates/vite-wagmi-template/tsconfig.app.json +0 -27
- package/templates/vite-wagmi-template/tsconfig.json +0 -11
- package/templates/vite-wagmi-template/tsconfig.node.json +0 -14
- package/templates/vite-wagmi-template/vite.config.ts +0 -10
- /package/dist/templates/{next-wagmi-template → next-template}/README.md +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/next-env.d.ts +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/next.config.mjs +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/public/sei-logotype.svg +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/src/app/favicon.ico +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/README.md +0 -0
- /package/dist/templates/{next-wagmi-template/src/app → vite-template}/favicon.ico +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/index.html +0 -0
- /package/dist/templates/{next-wagmi-template → vite-template}/public/sei-logotype.svg +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/assets/react.svg +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/vite-env.d.ts +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
- /package/templates/{next-wagmi-template → next-template}/README.md +0 -0
- /package/{dist/templates/next-wagmi-template → templates/next-template}/next-env.d.ts +0 -0
- /package/templates/{next-wagmi-template → next-template}/next.config.mjs +0 -0
- /package/{dist/templates/vite-cosmos-template → templates/next-template}/public/sei-logotype.svg +0 -0
- /package/{dist/templates/vite-cosmos-template → templates/next-template/src/app}/favicon.ico +0 -0
- /package/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/README.md +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/favicon.ico +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/index.html +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/public/sei-logotype.svg +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/assets/react.svg +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/vite-env.d.ts +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/*
|
|
2
|
+
1. Use a more-intuitive box-sizing model.
|
|
3
|
+
*/
|
|
4
|
+
*,
|
|
5
|
+
*::before,
|
|
6
|
+
*::after {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
}
|
|
9
|
+
/*
|
|
10
|
+
2. Remove default margin
|
|
11
|
+
*/
|
|
12
|
+
* {
|
|
13
|
+
margin: 0;
|
|
14
|
+
}
|
|
15
|
+
/*
|
|
16
|
+
Typographic tweaks!
|
|
17
|
+
3. Add accessible line-height
|
|
18
|
+
4. Improve text rendering
|
|
19
|
+
*/
|
|
20
|
+
body {
|
|
21
|
+
line-height: 1.5;
|
|
22
|
+
-webkit-font-smoothing: antialiased;
|
|
23
|
+
}
|
|
24
|
+
/*
|
|
25
|
+
5. Improve media defaults
|
|
26
|
+
*/
|
|
27
|
+
img,
|
|
28
|
+
picture,
|
|
29
|
+
video,
|
|
30
|
+
canvas,
|
|
31
|
+
svg {
|
|
32
|
+
display: block;
|
|
33
|
+
max-width: 100%;
|
|
34
|
+
}
|
|
35
|
+
/*
|
|
36
|
+
6. Remove built-in form typography styles
|
|
37
|
+
*/
|
|
38
|
+
input,
|
|
39
|
+
button,
|
|
40
|
+
textarea,
|
|
41
|
+
select {
|
|
42
|
+
font: inherit;
|
|
43
|
+
}
|
|
44
|
+
/*
|
|
45
|
+
7. Avoid text overflows
|
|
46
|
+
*/
|
|
47
|
+
p,
|
|
48
|
+
h1,
|
|
49
|
+
h2,
|
|
50
|
+
h3,
|
|
51
|
+
h4,
|
|
52
|
+
h5,
|
|
53
|
+
h6 {
|
|
54
|
+
overflow-wrap: break-word;
|
|
55
|
+
line-height: 1;
|
|
56
|
+
}
|
|
57
|
+
/*
|
|
58
|
+
8. Create a root stacking context
|
|
59
|
+
*/
|
|
60
|
+
#root,
|
|
61
|
+
#__next {
|
|
62
|
+
isolation: isolate;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
:root {
|
|
66
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
67
|
+
line-height: 1.5;
|
|
68
|
+
font-weight: 400;
|
|
69
|
+
|
|
70
|
+
color-scheme: light dark;
|
|
71
|
+
color: #000;
|
|
72
|
+
background: var(--background);
|
|
73
|
+
|
|
74
|
+
font-synthesis: none;
|
|
75
|
+
text-rendering: optimizeLegibility;
|
|
76
|
+
-webkit-font-smoothing: antialiased;
|
|
77
|
+
-moz-osx-font-smoothing: grayscale;
|
|
78
|
+
|
|
79
|
+
--primary-color: #9f1239;
|
|
80
|
+
--primary-color-hover: #7f0a2e;
|
|
81
|
+
--background: linear-gradient(180deg, #f5f5f4 0%, #fff 100%);
|
|
82
|
+
--border: #d6d3d1;
|
|
83
|
+
--card: #fff;
|
|
84
|
+
--card-foreground: #242424;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
a {
|
|
88
|
+
font-weight: 500;
|
|
89
|
+
color: var(--primary-color);
|
|
90
|
+
text-decoration: inherit;
|
|
91
|
+
}
|
|
92
|
+
a:hover {
|
|
93
|
+
color: var(--primary-color-hover);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
body {
|
|
97
|
+
margin: 0;
|
|
98
|
+
padding: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
h1 {
|
|
102
|
+
font-size: 3.2em;
|
|
103
|
+
line-height: 1;
|
|
104
|
+
}
|
|
105
|
+
code {
|
|
106
|
+
font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", monospace;
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
border-radius: 4px;
|
|
109
|
+
padding: 0.1rem 0.4rem;
|
|
110
|
+
background-color: #d7cccc;
|
|
111
|
+
color: var(--card-foreground);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
button {
|
|
115
|
+
border-radius: 4rem;
|
|
116
|
+
border: 1px solid transparent;
|
|
117
|
+
padding: 0.6em 1.2em;
|
|
118
|
+
font-size: 1em;
|
|
119
|
+
font-weight: 500;
|
|
120
|
+
font-family: inherit;
|
|
121
|
+
background-color: #cec9c1;
|
|
122
|
+
cursor: pointer;
|
|
123
|
+
transition: all 0.25s ease;
|
|
124
|
+
color: black;
|
|
125
|
+
}
|
|
126
|
+
button:hover {
|
|
127
|
+
background-color: #b5afa7;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
button:disabled {
|
|
131
|
+
filter: grayscale(1) opacity(0.5);
|
|
132
|
+
color: rgb(56, 55, 55);
|
|
133
|
+
pointer-events: none;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
button.primary {
|
|
137
|
+
background-color: var(--primary-color);
|
|
138
|
+
color: #fff;
|
|
139
|
+
}
|
|
140
|
+
button.outline {
|
|
141
|
+
background-color: transparent;
|
|
142
|
+
border: 1px solid var(--border);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
button.primary:hover {
|
|
146
|
+
background-color: var(--primary-color-hover);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
button.secondary {
|
|
150
|
+
background-color: #000;
|
|
151
|
+
color: #fff;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
button.secondary:hover {
|
|
155
|
+
background-color: #2b2b2b;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
button:active {
|
|
159
|
+
transform: translateY(1px);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
button.small {
|
|
163
|
+
padding: 0.4em 0.8em;
|
|
164
|
+
font-size: 0.8em;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
button:focus-visible {
|
|
168
|
+
outline: 4px auto -webkit-focus-ring-color;
|
|
169
|
+
outline-offset: 4px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
.header {
|
|
173
|
+
width: 100%;
|
|
174
|
+
height: 4rem;
|
|
175
|
+
padding: 0 1%;
|
|
176
|
+
display: flex;
|
|
177
|
+
align-items: center;
|
|
178
|
+
justify-content: right;
|
|
179
|
+
background-color: transparent;
|
|
180
|
+
border-bottom: 1px solid var(--border);
|
|
181
|
+
position: sticky;
|
|
182
|
+
top: 0;
|
|
183
|
+
background: #f5f5f4;
|
|
184
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Metadata } from 'next';
|
|
2
|
+
import { Inter } from 'next/font/google';
|
|
3
|
+
|
|
4
|
+
const inter = Inter({ subsets: ['latin'] });
|
|
5
|
+
|
|
6
|
+
export const metadata: Metadata = {
|
|
7
|
+
title: 'Sei Next App (Wagmi)',
|
|
8
|
+
description: 'Generated by create sei app'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default function RootLayout({
|
|
12
|
+
children
|
|
13
|
+
}: Readonly<{
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
}>) {
|
|
16
|
+
return (
|
|
17
|
+
<html lang="en">
|
|
18
|
+
<body className={inter.className}>{children}</body>
|
|
19
|
+
</html>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ConnectButton } from '@rainbow-me/rainbowkit';
|
|
2
|
+
import Web3Provider from './components/Web3Provider';
|
|
3
|
+
import Homepage from './components/Homepage/Homepage';
|
|
4
|
+
|
|
5
|
+
import './index.css';
|
|
6
|
+
|
|
7
|
+
export default function Home() {
|
|
8
|
+
return (
|
|
9
|
+
<Web3Provider>
|
|
10
|
+
<div className="header">
|
|
11
|
+
<ConnectButton
|
|
12
|
+
showBalance={{
|
|
13
|
+
smallScreen: false,
|
|
14
|
+
largeScreen: true
|
|
15
|
+
}}
|
|
16
|
+
/>
|
|
17
|
+
</div>
|
|
18
|
+
<Homepage />
|
|
19
|
+
</Web3Provider>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
4
|
+
"allowJs": true,
|
|
5
|
+
"skipLibCheck": true,
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"module": "esnext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"incremental": true,
|
|
15
|
+
"plugins": [
|
|
16
|
+
{
|
|
17
|
+
"name": "next"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"paths": {
|
|
21
|
+
"@/*": ["./src/*"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
25
|
+
"exclude": ["node_modules"]
|
|
26
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: { browser: true, es2020: true },
|
|
4
|
+
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended'],
|
|
5
|
+
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
6
|
+
parser: '@typescript-eslint/parser',
|
|
7
|
+
plugins: ['react-refresh'],
|
|
8
|
+
rules: {
|
|
9
|
+
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }]
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "template-vite-sei-app",
|
|
3
|
+
"private": true,
|
|
4
|
+
"version": "0.0.0",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "tsc -b && vite build",
|
|
9
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
10
|
+
"preview": "vite preview"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@rainbow-me/rainbowkit": "^2.1.2",
|
|
14
|
+
"@sei-js/evm": "^1.2.0",
|
|
15
|
+
"@tanstack/react-query": "^5.45.1",
|
|
16
|
+
"react": "^18.3.1",
|
|
17
|
+
"react-dom": "^18.3.1",
|
|
18
|
+
"viem": "^2.15.1",
|
|
19
|
+
"wagmi": "^2.10.2"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/react": "^18.3.3",
|
|
23
|
+
"@types/react-dom": "^18.3.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^7.13.1",
|
|
25
|
+
"@typescript-eslint/parser": "^7.13.1",
|
|
26
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
27
|
+
"eslint": "^8.57.0",
|
|
28
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
29
|
+
"eslint-plugin-react-refresh": "^0.4.7",
|
|
30
|
+
"typescript": "^5.2.2",
|
|
31
|
+
"vite": "^5.3.1"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import './index.css';
|
|
2
|
+
import { ConnectButton } from '@rainbow-me/rainbowkit';
|
|
3
|
+
import Homepage from './components/Homepage/Homepage';
|
|
4
|
+
|
|
5
|
+
function App() {
|
|
6
|
+
return (
|
|
7
|
+
<>
|
|
8
|
+
<div className="header">
|
|
9
|
+
<ConnectButton
|
|
10
|
+
showBalance={{
|
|
11
|
+
smallScreen: false,
|
|
12
|
+
largeScreen: true
|
|
13
|
+
}}
|
|
14
|
+
/>
|
|
15
|
+
</div>
|
|
16
|
+
<Homepage />
|
|
17
|
+
</>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export default App;
|
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { BANK_PRECOMPILE_ABI, BANK_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI, WASM_PRECOMPILE_ADDRESS } from '@sei-js/evm';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { ReadContractParameters, formatEther, fromHex, parseEther, toHex } from 'viem';
|
|
4
|
+
import { useAccount, usePublicClient, useWriteContract } from 'wagmi';
|
|
5
|
+
|
|
6
|
+
import './Homepage.css';
|
|
7
|
+
|
|
8
|
+
function Examples() {
|
|
9
|
+
const [balance, setBalance] = useState('');
|
|
10
|
+
const [supply, setSupply] = useState('');
|
|
11
|
+
const [count, setCount] = useState(0);
|
|
12
|
+
|
|
13
|
+
const publicClient = usePublicClient();
|
|
14
|
+
const { address } = useAccount();
|
|
15
|
+
const { writeContractAsync } = useWriteContract();
|
|
16
|
+
|
|
17
|
+
const formatLargeSeiNumber = (num: string, decimals: number): string => {
|
|
18
|
+
if (num.length > 10) {
|
|
19
|
+
return (
|
|
20
|
+
(Number(num) / 1000000 / 1000000000).toLocaleString(navigator.language, { minimumFractionDigits: decimals, maximumFractionDigits: decimals }) + ' B'
|
|
21
|
+
);
|
|
22
|
+
} else {
|
|
23
|
+
return (Number(num) / 1000000).toLocaleString(navigator.language);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const copyToClipboard = (text: string) => {
|
|
28
|
+
try {
|
|
29
|
+
navigator.clipboard.writeText(text);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
console.error('Failed to copy text: ', err);
|
|
32
|
+
} finally {
|
|
33
|
+
alert('Copied to clipboard!');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const renderAddressExample = () => {
|
|
38
|
+
return (
|
|
39
|
+
<div className="card">
|
|
40
|
+
<div className="card-header">
|
|
41
|
+
<p className="card__title">Wallet address</p>
|
|
42
|
+
<small className="card__description">
|
|
43
|
+
<a href="https://viem.sh/docs/clients/public.html" target="_blank">
|
|
44
|
+
Viem Public Client
|
|
45
|
+
</a>{' '}
|
|
46
|
+
query example
|
|
47
|
+
</small>
|
|
48
|
+
</div>
|
|
49
|
+
<div className="card-body">
|
|
50
|
+
<div className="content-background space-between">
|
|
51
|
+
{address ? (
|
|
52
|
+
<div>
|
|
53
|
+
<p className="card-footer">{address}</p>
|
|
54
|
+
</div>
|
|
55
|
+
) : (
|
|
56
|
+
<a> --- </a>
|
|
57
|
+
)}
|
|
58
|
+
|
|
59
|
+
<button className="small outline" onClick={() => copyToClipboard(address as string)}>
|
|
60
|
+
Copy
|
|
61
|
+
</button>
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
<div className="card-footer"></div>
|
|
65
|
+
</div>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const getBalanceWagmi = async () => {
|
|
70
|
+
if (!address || !publicClient) {
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
const weiBalance = await publicClient.getBalance({ address });
|
|
74
|
+
const seiBalance = formatEther(weiBalance);
|
|
75
|
+
setBalance(seiBalance);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const renderBalanceExample = () => {
|
|
79
|
+
return (
|
|
80
|
+
<div className="card">
|
|
81
|
+
<div className="card-header">
|
|
82
|
+
<p className="card__title">Wallet balance</p>
|
|
83
|
+
<small className="card__description">
|
|
84
|
+
<a href="https://viem.sh/docs/clients/public.html" target="_blank">
|
|
85
|
+
Viem Public Client
|
|
86
|
+
</a>{' '}
|
|
87
|
+
query example
|
|
88
|
+
</small>
|
|
89
|
+
</div>
|
|
90
|
+
<div className="card-body">
|
|
91
|
+
<div className="content-background space-between">
|
|
92
|
+
<small>SEI</small>
|
|
93
|
+
<p>{balance ? balance : '---'} SEI</p>
|
|
94
|
+
</div>
|
|
95
|
+
</div>
|
|
96
|
+
<div className="card-footer">
|
|
97
|
+
<button onClick={getBalanceWagmi}>Fetch balance</button>
|
|
98
|
+
</div>
|
|
99
|
+
</div>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
// Example of using precompiles to query native Sei modules.
|
|
104
|
+
const getBankSupply = async () => {
|
|
105
|
+
if (!publicClient) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const params: ReadContractParameters = {
|
|
110
|
+
address: BANK_PRECOMPILE_ADDRESS,
|
|
111
|
+
abi: BANK_PRECOMPILE_ABI,
|
|
112
|
+
functionName: 'supply',
|
|
113
|
+
args: ['usei']
|
|
114
|
+
};
|
|
115
|
+
try {
|
|
116
|
+
const response = (await publicClient.readContract(params)) as BigInt;
|
|
117
|
+
const supply = formatLargeSeiNumber(response.toString(), 1);
|
|
118
|
+
setSupply(supply);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.log(e);
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
const renderBankSupplyExample = () => {
|
|
125
|
+
return (
|
|
126
|
+
<div className="card">
|
|
127
|
+
<div className="card-header">
|
|
128
|
+
<p className="card__title">Total Sei supply</p>
|
|
129
|
+
<small className="card__description">
|
|
130
|
+
<a href="https://www.docs.sei.io/dev-interoperability/precompiles/bank" target="_blank">
|
|
131
|
+
{' '}
|
|
132
|
+
Bank precompile
|
|
133
|
+
</a>{' '}
|
|
134
|
+
example for querying native Sei modules
|
|
135
|
+
</small>
|
|
136
|
+
</div>
|
|
137
|
+
<div className="card-body">
|
|
138
|
+
<div className="content-background space-between">
|
|
139
|
+
<small>SEI</small>
|
|
140
|
+
<p>{supply}</p>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
<div className="card-footer">
|
|
144
|
+
<button onClick={getBankSupply}>Fetch supply</button>
|
|
145
|
+
</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
// Fetch count of a CosmWasm Contract using WASM Precompile
|
|
151
|
+
const fetchCount = async () => {
|
|
152
|
+
if (!publicClient) {
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const COUNTER_CONTRACT_ADDRESS = 'sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m';
|
|
157
|
+
|
|
158
|
+
const queryMsg = toHex(JSON.stringify({ get_count: {} }));
|
|
159
|
+
|
|
160
|
+
const params: ReadContractParameters = {
|
|
161
|
+
address: WASM_PRECOMPILE_ADDRESS,
|
|
162
|
+
abi: WASM_PRECOMPILE_ABI,
|
|
163
|
+
functionName: 'query',
|
|
164
|
+
args: [COUNTER_CONTRACT_ADDRESS, queryMsg]
|
|
165
|
+
};
|
|
166
|
+
try {
|
|
167
|
+
const response = (await publicClient?.readContract(params)) as `0x${string}`;
|
|
168
|
+
const { count } = JSON.parse(fromHex(response, 'string'));
|
|
169
|
+
setCount(count);
|
|
170
|
+
} catch (e) {
|
|
171
|
+
console.log(e);
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Fetch count of a CosmWasm Contract using WASM Precompile
|
|
176
|
+
const incrementCounter = async () => {
|
|
177
|
+
if (!address || !publicClient) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const COUNTER_CONTRACT_ADDRESS = 'sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m';
|
|
182
|
+
|
|
183
|
+
const execMsg = toHex(JSON.stringify({ increment: {} }));
|
|
184
|
+
const coins = toHex('[]');
|
|
185
|
+
const params = {
|
|
186
|
+
account: address,
|
|
187
|
+
address: WASM_PRECOMPILE_ADDRESS,
|
|
188
|
+
abi: WASM_PRECOMPILE_ABI,
|
|
189
|
+
functionName: 'execute',
|
|
190
|
+
args: [COUNTER_CONTRACT_ADDRESS, execMsg, coins],
|
|
191
|
+
value: parseEther('0')
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
try {
|
|
195
|
+
const estimatedGas = await publicClient.estimateContractGas(params);
|
|
196
|
+
|
|
197
|
+
// Call smart contract execute msg
|
|
198
|
+
await writeContractAsync({ ...params, gas: estimatedGas });
|
|
199
|
+
|
|
200
|
+
// Wait for 1 block to confirm transaction
|
|
201
|
+
setTimeout(() => {}, 400);
|
|
202
|
+
await fetchCount();
|
|
203
|
+
} catch (error) {
|
|
204
|
+
console.log(error);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
const renderCounterContractExample = () => {
|
|
209
|
+
return (
|
|
210
|
+
<div className="card">
|
|
211
|
+
<div className="card-header">
|
|
212
|
+
<p className="card__title">Smart contract interaction</p>
|
|
213
|
+
<small>
|
|
214
|
+
<a href="https://www.docs.sei.io/dev-interoperability/precompiles/cosmwasm" target="_blank">
|
|
215
|
+
WASM Precompile
|
|
216
|
+
</a>{' '}
|
|
217
|
+
example of CosmWasm smart contract interaction
|
|
218
|
+
</small>
|
|
219
|
+
</div>
|
|
220
|
+
<div className="card-body">
|
|
221
|
+
<div className="content-background space-between">
|
|
222
|
+
<small>Count</small>
|
|
223
|
+
<p>{count}</p>
|
|
224
|
+
<button className="small outline" onClick={incrementCounter}>
|
|
225
|
+
Increase
|
|
226
|
+
</button>
|
|
227
|
+
</div>
|
|
228
|
+
</div>
|
|
229
|
+
<div className="card-footer">
|
|
230
|
+
<button onClick={fetchCount}>Fetch count</button>
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
return (
|
|
237
|
+
<div className="container">
|
|
238
|
+
<div className="grid">
|
|
239
|
+
{/* First card */}
|
|
240
|
+
{renderAddressExample()}
|
|
241
|
+
|
|
242
|
+
{/* Second card */}
|
|
243
|
+
{renderBalanceExample()}
|
|
244
|
+
|
|
245
|
+
{/* Third card */}
|
|
246
|
+
{renderBankSupplyExample()}
|
|
247
|
+
|
|
248
|
+
{/* Fourth card */}
|
|
249
|
+
{renderCounterContractExample()}
|
|
250
|
+
</div>
|
|
251
|
+
</div>
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
export default Examples;
|