@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.
Files changed (228) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/CHANGELOG.md +12 -0
  3. package/README.md +16 -25
  4. package/biome.json +8 -0
  5. package/dist/main.js +10 -60
  6. package/dist/templates/next-template/.eslintrc.json +3 -0
  7. package/dist/templates/next-template/package.json +30 -0
  8. package/dist/templates/next-template/src/app/components/Homepage/Examples.tsx +257 -0
  9. package/dist/templates/next-template/src/app/components/Homepage/Homepage.css +154 -0
  10. package/dist/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +10 -36
  11. package/{templates/next-wagmi-template → dist/templates/next-template}/src/app/components/Web3Provider.tsx +29 -28
  12. package/dist/templates/next-template/src/app/components/index.ts +2 -0
  13. package/dist/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +2 -2
  14. package/dist/templates/next-template/src/app/constants/index.ts +1 -0
  15. package/dist/templates/next-template/src/app/index.css +184 -0
  16. package/dist/templates/next-template/src/app/layout.tsx +21 -0
  17. package/dist/templates/next-template/src/app/page.tsx +21 -0
  18. package/dist/templates/next-template/tsconfig.json +26 -0
  19. package/dist/templates/vite-template/.eslintrc.cjs +11 -0
  20. package/dist/templates/vite-template/package.json +33 -0
  21. package/dist/templates/vite-template/src/App.tsx +21 -0
  22. package/dist/templates/vite-template/src/components/Homepage/Examples.tsx +255 -0
  23. package/dist/templates/vite-template/src/components/Homepage/Homepage.css +154 -0
  24. package/dist/templates/vite-template/src/components/Homepage/Homepage.tsx +81 -0
  25. package/{templates/vite-wagmi-template → dist/templates/vite-template}/src/components/Web3Provider.tsx +29 -28
  26. package/dist/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +1 -1
  27. package/dist/templates/vite-template/src/constants/index.ts +1 -0
  28. package/dist/templates/vite-template/src/index.css +183 -0
  29. package/dist/templates/vite-template/src/main.tsx +12 -0
  30. package/dist/templates/vite-template/tsconfig.app.json +25 -0
  31. package/dist/templates/vite-template/tsconfig.json +11 -0
  32. package/dist/templates/vite-template/tsconfig.node.json +14 -0
  33. package/dist/templates/vite-template/vite.config.ts +10 -0
  34. package/package.json +1 -1
  35. package/src/main.ts +26 -87
  36. package/templates/next-template/.eslintrc.json +3 -0
  37. package/templates/next-template/package.json +30 -0
  38. package/templates/next-template/src/app/components/Homepage/Examples.tsx +257 -0
  39. package/templates/next-template/src/app/components/Homepage/Homepage.css +154 -0
  40. package/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +10 -36
  41. package/{dist/templates/next-wagmi-template → templates/next-template}/src/app/components/Web3Provider.tsx +29 -28
  42. package/templates/next-template/src/app/components/index.ts +2 -0
  43. package/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +2 -2
  44. package/templates/next-template/src/app/constants/index.ts +1 -0
  45. package/templates/next-template/src/app/index.css +184 -0
  46. package/templates/next-template/src/app/layout.tsx +21 -0
  47. package/templates/next-template/src/app/page.tsx +21 -0
  48. package/templates/next-template/tsconfig.json +26 -0
  49. package/templates/vite-template/.eslintrc.cjs +11 -0
  50. package/templates/vite-template/package.json +33 -0
  51. package/templates/vite-template/src/App.tsx +21 -0
  52. package/templates/vite-template/src/components/Homepage/Examples.tsx +255 -0
  53. package/templates/vite-template/src/components/Homepage/Homepage.css +154 -0
  54. package/templates/vite-template/src/components/Homepage/Homepage.tsx +81 -0
  55. package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/components/Web3Provider.tsx +29 -28
  56. package/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +1 -1
  57. package/templates/vite-template/src/constants/index.ts +1 -0
  58. package/templates/vite-template/src/index.css +183 -0
  59. package/templates/vite-template/src/main.tsx +12 -0
  60. package/templates/vite-template/tsconfig.app.json +25 -0
  61. package/templates/vite-template/tsconfig.json +11 -0
  62. package/templates/vite-template/tsconfig.node.json +14 -0
  63. package/templates/vite-template/vite.config.ts +10 -0
  64. package/tsconfig.json +18 -28
  65. package/dist/templates/next-cosmos-template/.eslintrc.json +0 -3
  66. package/dist/templates/next-cosmos-template/README.md +0 -60
  67. package/dist/templates/next-cosmos-template/next.config.mjs +0 -14
  68. package/dist/templates/next-cosmos-template/package.json +0 -31
  69. package/dist/templates/next-cosmos-template/public/next.svg +0 -1
  70. package/dist/templates/next-cosmos-template/public/vercel.svg +0 -1
  71. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
  72. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
  73. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
  74. package/dist/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
  75. package/dist/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
  76. package/dist/templates/next-cosmos-template/src/app/components/index.ts +0 -3
  77. package/dist/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
  78. package/dist/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
  79. package/dist/templates/next-cosmos-template/src/app/index.css +0 -171
  80. package/dist/templates/next-cosmos-template/src/app/layout.tsx +0 -21
  81. package/dist/templates/next-cosmos-template/src/app/page.tsx +0 -17
  82. package/dist/templates/next-cosmos-template/tsconfig.json +0 -26
  83. package/dist/templates/next-cosmos-template/yarn.lock +0 -9814
  84. package/dist/templates/next-wagmi-template/.eslintrc.json +0 -3
  85. package/dist/templates/next-wagmi-template/package.json +0 -30
  86. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
  87. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
  88. package/dist/templates/next-wagmi-template/src/app/components/index.ts +0 -2
  89. package/dist/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
  90. package/dist/templates/next-wagmi-template/src/app/index.css +0 -171
  91. package/dist/templates/next-wagmi-template/src/app/layout.tsx +0 -21
  92. package/dist/templates/next-wagmi-template/src/app/page.tsx +0 -21
  93. package/dist/templates/next-wagmi-template/tsconfig.json +0 -26
  94. package/dist/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
  95. package/dist/templates/vite-cosmos-template/README.md +0 -72
  96. package/dist/templates/vite-cosmos-template/index.html +0 -16
  97. package/dist/templates/vite-cosmos-template/package.json +0 -35
  98. package/dist/templates/vite-cosmos-template/src/App.tsx +0 -16
  99. package/dist/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
  100. package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
  101. package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
  102. package/dist/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
  103. package/dist/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
  104. package/dist/templates/vite-cosmos-template/src/components/index.ts +0 -4
  105. package/dist/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
  106. package/dist/templates/vite-cosmos-template/src/constants/index.ts +0 -1
  107. package/dist/templates/vite-cosmos-template/src/index.css +0 -171
  108. package/dist/templates/vite-cosmos-template/src/main.tsx +0 -12
  109. package/dist/templates/vite-cosmos-template/tsconfig.app.json +0 -27
  110. package/dist/templates/vite-cosmos-template/tsconfig.json +0 -11
  111. package/dist/templates/vite-cosmos-template/tsconfig.node.json +0 -14
  112. package/dist/templates/vite-cosmos-template/vite.config.ts +0 -7
  113. package/dist/templates/vite-cosmos-template/yarn.lock +0 -9323
  114. package/dist/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
  115. package/dist/templates/vite-wagmi-template/package.json +0 -33
  116. package/dist/templates/vite-wagmi-template/src/App.tsx +0 -22
  117. package/dist/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
  118. package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
  119. package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
  120. package/dist/templates/vite-wagmi-template/src/constants/index.ts +0 -1
  121. package/dist/templates/vite-wagmi-template/src/index.css +0 -170
  122. package/dist/templates/vite-wagmi-template/src/main.tsx +0 -12
  123. package/dist/templates/vite-wagmi-template/tsconfig.app.json +0 -27
  124. package/dist/templates/vite-wagmi-template/tsconfig.json +0 -11
  125. package/dist/templates/vite-wagmi-template/tsconfig.node.json +0 -14
  126. package/dist/templates/vite-wagmi-template/vite.config.ts +0 -10
  127. package/templates/next-cosmos-template/.eslintrc.json +0 -3
  128. package/templates/next-cosmos-template/README.md +0 -60
  129. package/templates/next-cosmos-template/next-env.d.ts +0 -5
  130. package/templates/next-cosmos-template/next.config.mjs +0 -14
  131. package/templates/next-cosmos-template/package.json +0 -31
  132. package/templates/next-cosmos-template/public/next.svg +0 -1
  133. package/templates/next-cosmos-template/public/sei-logotype.svg +0 -15
  134. package/templates/next-cosmos-template/public/vercel.svg +0 -1
  135. package/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
  136. package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
  137. package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
  138. package/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
  139. package/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
  140. package/templates/next-cosmos-template/src/app/components/index.ts +0 -3
  141. package/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
  142. package/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
  143. package/templates/next-cosmos-template/src/app/favicon.ico +0 -0
  144. package/templates/next-cosmos-template/src/app/index.css +0 -171
  145. package/templates/next-cosmos-template/src/app/layout.tsx +0 -21
  146. package/templates/next-cosmos-template/src/app/page.tsx +0 -17
  147. package/templates/next-cosmos-template/tsconfig.json +0 -26
  148. package/templates/next-cosmos-template/yarn.lock +0 -9814
  149. package/templates/next-wagmi-template/.eslintrc.json +0 -3
  150. package/templates/next-wagmi-template/next-env.d.ts +0 -5
  151. package/templates/next-wagmi-template/package.json +0 -30
  152. package/templates/next-wagmi-template/public/sei-logotype.svg +0 -15
  153. package/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
  154. package/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
  155. package/templates/next-wagmi-template/src/app/components/index.ts +0 -2
  156. package/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
  157. package/templates/next-wagmi-template/src/app/favicon.ico +0 -0
  158. package/templates/next-wagmi-template/src/app/index.css +0 -171
  159. package/templates/next-wagmi-template/src/app/layout.tsx +0 -21
  160. package/templates/next-wagmi-template/src/app/page.tsx +0 -21
  161. package/templates/next-wagmi-template/tsconfig.json +0 -26
  162. package/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
  163. package/templates/vite-cosmos-template/README.md +0 -72
  164. package/templates/vite-cosmos-template/favicon.ico +0 -0
  165. package/templates/vite-cosmos-template/index.html +0 -16
  166. package/templates/vite-cosmos-template/package.json +0 -35
  167. package/templates/vite-cosmos-template/public/sei-logotype.svg +0 -15
  168. package/templates/vite-cosmos-template/src/App.tsx +0 -16
  169. package/templates/vite-cosmos-template/src/assets/react.svg +0 -1
  170. package/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
  171. package/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
  172. package/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
  173. package/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
  174. package/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
  175. package/templates/vite-cosmos-template/src/components/index.ts +0 -4
  176. package/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
  177. package/templates/vite-cosmos-template/src/constants/index.ts +0 -1
  178. package/templates/vite-cosmos-template/src/index.css +0 -171
  179. package/templates/vite-cosmos-template/src/main.tsx +0 -12
  180. package/templates/vite-cosmos-template/src/vite-env.d.ts +0 -1
  181. package/templates/vite-cosmos-template/tsconfig.app.json +0 -27
  182. package/templates/vite-cosmos-template/tsconfig.json +0 -11
  183. package/templates/vite-cosmos-template/tsconfig.node.json +0 -14
  184. package/templates/vite-cosmos-template/vite.config.ts +0 -7
  185. package/templates/vite-cosmos-template/yarn.lock +0 -9323
  186. package/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
  187. package/templates/vite-wagmi-template/favicon.ico +0 -0
  188. package/templates/vite-wagmi-template/package.json +0 -33
  189. package/templates/vite-wagmi-template/public/sei-logotype.svg +0 -15
  190. package/templates/vite-wagmi-template/src/App.tsx +0 -22
  191. package/templates/vite-wagmi-template/src/assets/react.svg +0 -1
  192. package/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
  193. package/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
  194. package/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
  195. package/templates/vite-wagmi-template/src/constants/index.ts +0 -1
  196. package/templates/vite-wagmi-template/src/index.css +0 -170
  197. package/templates/vite-wagmi-template/src/main.tsx +0 -12
  198. package/templates/vite-wagmi-template/src/vite-env.d.ts +0 -1
  199. package/templates/vite-wagmi-template/tsconfig.app.json +0 -27
  200. package/templates/vite-wagmi-template/tsconfig.json +0 -11
  201. package/templates/vite-wagmi-template/tsconfig.node.json +0 -14
  202. package/templates/vite-wagmi-template/vite.config.ts +0 -10
  203. /package/dist/templates/{next-wagmi-template → next-template}/README.md +0 -0
  204. /package/dist/templates/{next-cosmos-template → next-template}/next-env.d.ts +0 -0
  205. /package/dist/templates/{next-wagmi-template → next-template}/next.config.mjs +0 -0
  206. /package/dist/templates/{next-cosmos-template → next-template}/public/sei-logotype.svg +0 -0
  207. /package/dist/templates/{next-cosmos-template → next-template}/src/app/favicon.ico +0 -0
  208. /package/dist/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
  209. /package/dist/templates/{vite-wagmi-template → vite-template}/README.md +0 -0
  210. /package/dist/templates/{next-wagmi-template/src/app → vite-template}/favicon.ico +0 -0
  211. /package/dist/templates/{vite-wagmi-template → vite-template}/index.html +0 -0
  212. /package/dist/templates/{next-wagmi-template → vite-template}/public/sei-logotype.svg +0 -0
  213. /package/dist/templates/{vite-cosmos-template → vite-template}/src/assets/react.svg +0 -0
  214. /package/dist/templates/{vite-cosmos-template → vite-template}/src/vite-env.d.ts +0 -0
  215. /package/dist/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
  216. /package/templates/{next-wagmi-template → next-template}/README.md +0 -0
  217. /package/{dist/templates/next-wagmi-template → templates/next-template}/next-env.d.ts +0 -0
  218. /package/templates/{next-wagmi-template → next-template}/next.config.mjs +0 -0
  219. /package/{dist/templates/vite-cosmos-template → templates/next-template}/public/sei-logotype.svg +0 -0
  220. /package/{dist/templates/vite-cosmos-template → templates/next-template/src/app}/favicon.ico +0 -0
  221. /package/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
  222. /package/templates/{vite-wagmi-template → vite-template}/README.md +0 -0
  223. /package/{dist/templates/vite-wagmi-template → templates/vite-template}/favicon.ico +0 -0
  224. /package/templates/{vite-wagmi-template → vite-template}/index.html +0 -0
  225. /package/{dist/templates/vite-wagmi-template → templates/vite-template}/public/sei-logotype.svg +0 -0
  226. /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/assets/react.svg +0 -0
  227. /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/vite-env.d.ts +0 -0
  228. /package/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
@@ -1,18 +0,0 @@
1
- module.exports = {
2
- root: true,
3
- env: { browser: true, es2020: true },
4
- extends: [
5
- 'eslint:recommended',
6
- 'plugin:@typescript-eslint/recommended',
7
- 'plugin:react-hooks/recommended',
8
- ],
9
- ignorePatterns: ['dist', '.eslintrc.cjs'],
10
- parser: '@typescript-eslint/parser',
11
- plugins: ['react-refresh'],
12
- rules: {
13
- 'react-refresh/only-export-components': [
14
- 'warn',
15
- { allowConstantExport: true },
16
- ],
17
- },
18
- }
@@ -1,72 +0,0 @@
1
- # Vite-Cosmos Sei App Template
2
-
3
- This repo provides a basic framework for an application that interacts with Sei via Cosmos endpoints.
4
-
5
- It is based on the React Typescript Vite template.
6
-
7
- Currently, two official plugins are available:
8
-
9
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
10
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
11
-
12
- ## Getting Started
13
-
14
- Install dependencies by running
15
- ```bash
16
- npm install
17
- #or
18
- yarn
19
- ```
20
-
21
- Then, run the development server:
22
-
23
- ```bash
24
- npm run dev
25
- # or
26
- yarn dev
27
- ```
28
-
29
- Open [http://localhost:5173](http://localhost:5173) with your browser to see the result.
30
-
31
- You can start editing the page by modifying `src/App.tsx`. The page auto-updates as you edit the file.
32
-
33
- ## Repository Basics
34
- This repository includes basic features that allow you to connect to a wallet and use the wallet to interact with the chain.
35
-
36
- Additionally, basic examples and links to documentation are provided on the example homepage in `src/components/Homepage`.
37
-
38
- ### Web3 Provider
39
- This component is a Sei specific wrapper around Wagmi's Provider that should wrap the application. Wrapping the application in this provider will enable it to access hooks in Wagmi. These hooks are enable connection to a wallet and interaction with the chain.
40
-
41
- To change the list of supported wallets, as well as connection configurations you can modify the `src/components/Web3Provider.tsx` component.
42
-
43
- ### Wallet Connect Button
44
- This component utilizies Rainbowkit's pre built wallet connect button, which uses hooks in Wagmi.
45
-
46
- ### Changing the Chain
47
- This application connects to the arctic-1 devnet by default
48
-
49
- To change the chain the app connects to, edit the `selectedChain` variable in the `chain.ts` file in `src/constants`
50
-
51
- ## Expanding the ESLint configuration
52
-
53
- If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
54
-
55
- - Configure the top-level `parserOptions` property like this:
56
-
57
- ```js
58
- export default {
59
- // other rules...
60
- parserOptions: {
61
- ecmaVersion: 'latest',
62
- sourceType: 'module',
63
- project: ['./tsconfig.json', './tsconfig.node.json'],
64
- tsconfigRootDir: __dirname,
65
- },
66
- }
67
- ```
68
-
69
- - Replace `plugin:@typescript-eslint/recommended` to `plugin:@typescript-eslint/recommended-type-checked` or `plugin:@typescript-eslint/strict-type-checked`
70
- - Optionally add `plugin:@typescript-eslint/stylistic-type-checked`
71
- - Install [eslint-plugin-react](https://github.com/jsx-eslint/eslint-plugin-react) and add `plugin:react/recommended` & `plugin:react/jsx-runtime` to the `extends` list
72
-
@@ -1,16 +0,0 @@
1
- <!doctype html>
2
- <html lang="en">
3
- <head>
4
- <script type="module">
5
- import { Buffer } from "buffer";
6
- window.Buffer = Buffer;
7
- </script>
8
- <meta charset="UTF-8" />
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
10
- <title>Sei Vite App (Cosmos)</title>
11
- </head>
12
- <body>
13
- <div id="root"></div>
14
- <script type="module" src="/src/main.tsx"></script>
15
- </body>
16
- </html>
@@ -1,35 +0,0 @@
1
- {
2
- "name": "template-vite-cosmos-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
- "@cosmos-kit/react": "^2.17.0",
14
- "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
15
- "@interchain-ui/react": "^1.23.22",
16
- "@sei-js/cosmjs": "^1.0.7",
17
- "buffer": "^6.0.3",
18
- "chain-registry": "^1.63.7",
19
- "cosmos-kit": "^2.18.0",
20
- "react": "^18.3.1",
21
- "react-dom": "^18.3.1"
22
- },
23
- "devDependencies": {
24
- "@types/react": "^18.3.3",
25
- "@types/react-dom": "^18.3.0",
26
- "@typescript-eslint/eslint-plugin": "^7.13.1",
27
- "@typescript-eslint/parser": "^7.13.1",
28
- "@vitejs/plugin-react": "^4.3.1",
29
- "eslint": "^8.57.0",
30
- "eslint-plugin-react-hooks": "^4.6.2",
31
- "eslint-plugin-react-refresh": "^0.4.7",
32
- "typescript": "^5.2.2",
33
- "vite": "^5.3.1"
34
- }
35
- }
@@ -1,16 +0,0 @@
1
- import './index.css'
2
- import { WalletConnectButton, Homepage } from './components'
3
-
4
- function App() {
5
-
6
- return (
7
- <>
8
- <div className="header">
9
- <WalletConnectButton/>
10
- </div>
11
- <Homepage/>
12
- </>
13
- )
14
- }
15
-
16
- export default App
@@ -1,177 +0,0 @@
1
- import { getCosmWasmClient, getQueryClient, getSigningCosmWasmClient, getStargateClient } from "@sei-js/cosmjs";
2
- import { useState } from "react";
3
- import { defaultUrls, selectedChain } from "../../constants";
4
- import { useChain } from "@cosmos-kit/react";
5
-
6
- import './Homepage.css'
7
- type ExampleProps = {
8
- chainId: string
9
- }
10
-
11
- function Examples({ chainId }: ExampleProps) {
12
- const [balance, setBalance] = useState(0)
13
- const [pool, setPool] = useState({ bonded_tokens: 0, not_bonded_tokens: 0 });
14
- const [count, setCount] = useState(0)
15
-
16
- const { address, getOfflineSignerAmino } = useChain(selectedChain.chain_name);
17
-
18
- // Example of using the query client to query Sei modules
19
- const getStakingPool = async () => {
20
- const queryClient = await getQueryClient(defaultUrls[chainId].rest);
21
- const result = await queryClient.cosmos.staking.v1beta1.pool({});
22
- setPool(result.pool)
23
- }
24
-
25
- const renderStakingPoolExample = () => {
26
- return (
27
- <div className="card">
28
- <div className="card-header">
29
- <p className="card__title">Staking Pool</p>
30
- <small className="card__description">
31
- <a
32
- href="https://sei-protocol.github.io/sei-js/functions/cosmjs.getQueryClient.html"
33
- target="_blank">Sei QueryClient</a> query example
34
- </small>
35
- </div>
36
- <div className="card-body">
37
- <div className="content-background space-between">
38
- <small>Bonded Tokens</small>
39
- <p>{pool ? pool.bonded_tokens : '---'} SEI</p>
40
- </div>
41
- <div className="content-background space-between">
42
- <small>Unbonded Tokens</small>
43
- <p>{pool ? pool.not_bonded_tokens : '---'} SEI</p>
44
- </div>
45
- </div>
46
- <div className="card-footer">
47
- <button onClick={getStakingPool}>Fetch Staking Data</button>
48
- </div>
49
- </div>
50
- )
51
- }
52
-
53
- const getBalanceStargate = async () => {
54
- if (!address) {
55
- return undefined
56
- }
57
- const queryClient = await getStargateClient(defaultUrls[chainId].rpc);
58
- const useiBalance = await queryClient.getBalance(address, 'usei');
59
- const seiBalance = Number(useiBalance.amount) / 1000000
60
- setBalance(seiBalance);
61
- }
62
-
63
- const renderBalanceExample = () => {
64
- return (
65
- <div className="card">
66
- <div className="card-header">
67
- <p className="card__title">Wallet Balance</p>
68
- <small className="card__description">
69
- <a
70
- href="https://cosmos.github.io/cosmjs/latest/stargate/classes/StargateClient.html"
71
- target="_blank">Stargate Client</a> query example
72
- </small>
73
- </div>
74
- <div className="card-body">
75
- <div className="content-background space-between">
76
- <small>SEI</small>
77
- <p>{balance ? balance : '---' } SEI</p>
78
- </div>
79
- </div>
80
- <div className="card-footer">
81
- <button onClick={getBalanceStargate}>Fetch balance</button>
82
- </div>
83
- </div>
84
- )
85
- }
86
-
87
- const fetchCount = async () => {
88
- const cosmWasmClient = await getCosmWasmClient(defaultUrls[chainId].rpc);
89
- console.log(cosmWasmClient);
90
- const CONTRACT_ADDRESS =
91
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
92
- const response = await cosmWasmClient.queryContractSmart(CONTRACT_ADDRESS, {
93
- get_count: {},
94
- });
95
- const result = response?.count;
96
- if (result) {
97
- setCount(result);
98
- }
99
- }
100
-
101
- const incrementCounter = async () => {
102
- if (!address) {
103
- return;
104
- }
105
- const offlineSigner = await getOfflineSignerAmino();
106
- const signingCosmWasmClient = await getSigningCosmWasmClient(
107
- defaultUrls[chainId].rpc,
108
- offlineSigner
109
- )
110
-
111
- try {
112
- const senderAddress = address;
113
- const CONTRACT_ADDRESS =
114
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
115
-
116
- // Build message content
117
- const msg = { increment: {} };
118
-
119
- // Define gas price and limit
120
- const fee = {
121
- amount: [{ amount: "20000", denom: "usei" }],
122
- gas: "200000",
123
- };
124
-
125
- // Call smart contract execute msg
126
- await signingCosmWasmClient?.execute(senderAddress, CONTRACT_ADDRESS, msg, fee);
127
-
128
- await fetchCount();
129
-
130
- } catch (error) {
131
- console.log(error)
132
- }
133
- };
134
-
135
- const renderCounterContractExample = () => {
136
- return (
137
- <div className="card">
138
- <div className="card-header">
139
- <p className="card__title">Smart contract interaction</p>
140
- <small>
141
- <a
142
- href="https://cosmos.github.io/cosmjs/latest/cosmwasm-stargate/classes/SigningCosmWasmClient.html"
143
- target="_blank">
144
- CosmWasm Clients
145
- </a> example of smart
146
- contract interaction
147
- </small>
148
- </div>
149
- <div className="card-body">
150
- <div className="content-background space-between">
151
- <small>Count</small>
152
- <p>{count}</p>
153
- <button
154
- className="small outline"
155
- onClick={incrementCounter}
156
- >
157
- Increase
158
- </button>
159
- </div>
160
- </div>
161
- <div className="card-footer">
162
- <button onClick={fetchCount}>Fetch count</button>
163
- </div>
164
- </div>
165
- )
166
- }
167
-
168
- return (
169
- <div className="grid">
170
- {renderBalanceExample()}
171
- {renderStakingPoolExample()}
172
- {renderCounterContractExample()}
173
- </div>
174
- )
175
- }
176
-
177
- export default Examples;
@@ -1,156 +0,0 @@
1
- #root {
2
- display: flex;
3
- flex-direction: column;
4
- min-height: 100vh;
5
- }
6
- .app {
7
- width: 100%;
8
- height: 100%;
9
- }
10
-
11
- .logo {
12
- width: 20%;
13
- align-self: center;
14
- }
15
-
16
- .container {
17
- margin: 0 auto;
18
- display: flex;
19
- flex-direction: column;
20
- gap: 3rem;
21
- width: 100%;
22
- padding: 1rem;
23
- height: -webkit-fill-available;
24
- flex-grow: 1;
25
- justify-content: center;
26
- }
27
-
28
- .grid {
29
- width: 100%;
30
- display: grid;
31
- grid-template-columns: repeat(1, 1fr);
32
- gap: 1rem;
33
- }
34
- .grid.docs {
35
- grid-template-columns: repeat(1, 1fr);
36
- }
37
-
38
- .card {
39
- width: 100%;
40
- padding: 1.5em;
41
- border-radius: 1rem;
42
- background: var(--card);
43
- color: var(--card-foreground);
44
- box-shadow: 0px 4px 6px 0px rgba(0, 0, 0, 0.09);
45
- }
46
-
47
- .card.secondary {
48
- background: transparent;
49
- border: 1px solid var(--border);
50
- box-shadow: none;
51
- }
52
- .card.intro {
53
- display: flex;
54
- flex-direction: column;
55
- gap: 1rem;
56
- justify-content: space-between;
57
- align-items: flex-start;
58
- }
59
- .card-header {
60
- display: flex;
61
- flex-direction: column;
62
- justify-content: space-between;
63
- gap: 0.25rem;
64
- }
65
- .card-body {
66
- display: flex;
67
- flex-direction: column;
68
- justify-content: space-between;
69
- margin: 1.5rem 0;
70
- }
71
-
72
- .card-footer {
73
- display: flex;
74
- flex-direction: row;
75
- gap: 0.5rem;
76
- }
77
-
78
- .card__title {
79
- font-size: 1.15rem;
80
- font-weight: 600;
81
- }
82
- .content-background {
83
- overflow: hidden;
84
- background: #fafaf9;
85
- border-radius: 4rem;
86
- padding: 0 1rem;
87
- height: 3.5rem;
88
- display: flex;
89
- align-items: center;
90
- }
91
-
92
- .wallet-address {
93
- text-wrap: anywhere;
94
- line-break: anywhere;
95
- }
96
-
97
- .space-between {
98
- justify-content: space-between;
99
- gap: 1rem;
100
- }
101
-
102
- .hide-on-mobile {
103
- display: none;
104
- }
105
-
106
- .hide-on-desktop {
107
- display: block;
108
- }
109
-
110
- .external-link {
111
- display: inline-flex;
112
- gap: 0.25rem;
113
- }
114
-
115
- .get-started {
116
- text-align: center;
117
- }
118
-
119
- .wallet-connect {
120
- display: flex;
121
- gap: 1rem;
122
- align-items: center;
123
- }
124
-
125
-
126
- @media (min-width: 768px) {
127
-
128
- .card.intro {
129
- grid-column: span 2;
130
- flex-direction: row;
131
- align-items: center;
132
- }
133
- .hide-on-mobile {
134
- display: block;
135
- }
136
- .hide-on-desktop {
137
- display: none;
138
- }
139
-
140
- .container {
141
- max-width: 96rem;
142
- padding: 2rem;
143
- }
144
- .grid {
145
- grid-template-columns: repeat(3, 1fr);
146
- }
147
- .grid.docs {
148
- grid-template-columns: repeat(3, 1fr);
149
- }
150
- }
151
-
152
- @media (min-width: 1024px) {
153
- .container {
154
- max-width: 80rem;
155
- }
156
- }
@@ -1,102 +0,0 @@
1
- import './Homepage.css'
2
- import Examples from './Examples';
3
- import { selectedChain } from '../../constants';
4
- import { WalletConnectButton } from '..';
5
-
6
- type HelpItem = {
7
- title: string;
8
- description: string;
9
- link: string;
10
- };
11
-
12
- const renderHelpItem = ({ title, description, link }: HelpItem) => (
13
- <div className="card secondary">
14
- <div className="card-header">
15
- <p className="card__title">
16
- <a href={link} target='_blank' rel='noopener noreferrer' className="external-link">
17
- {title} {externalIcon}
18
- </a>
19
- </p>
20
- <small className="card__description">
21
- {description}
22
- </small>
23
- </div>
24
- </div>
25
- );
26
-
27
- const helpItems: HelpItem[] = [
28
- {
29
- title: 'Sei Docs',
30
- description: 'Find in-depth information about Sei.',
31
- link: 'https://docs.sei.io/'
32
- },
33
- {
34
- title: 'CosmosKit',
35
- description: "Learn about CosmosKit and it's hooks for chain interaction.",
36
- link: 'https://docs.cosmology.zone/cosmos-kit/get-started'
37
- },
38
- {
39
- title: 'sei-js',
40
- description: 'Interact with Sei using @sei-js/cosmjs.',
41
- link: 'https://sei-protocol.github.io/sei-js/modules/cosmjs.html'
42
- }
43
- ];
44
-
45
- const externalIcon = (
46
- <svg
47
- width="16"
48
- height="16"
49
- viewBox="0 0 16 16"
50
- fill="none"
51
- xmlns="http://www.w3.org/2000/svg"
52
- >
53
- <path
54
- d="M12 8.66667V12.6667C12 13.0203 11.8595 13.3594 11.6095 13.6095C11.3594 13.8595 11.0203 14 10.6667 14H3.33333C2.97971 14 2.64057 13.8595 2.39052 13.6095C2.14048 13.3594 2 13.0203 2 12.6667V5.33333C2 4.97971 2.14048 4.64057 2.39052 4.39052C2.64057 4.14048 2.97971 4 3.33333 4H7.33333"
55
- stroke="#9F1239"
56
- strokeWidth="1.33333"
57
- strokeLinecap="round"
58
- strokeLinejoin="round"
59
- />
60
- <path
61
- d="M10 2H14V6"
62
- stroke="#9F1239"
63
- strokeWidth="1.33333"
64
- strokeLinecap="round"
65
- strokeLinejoin="round"
66
- />
67
- <path
68
- d="M6.66663 9.33333L14 2"
69
- stroke="#9F1239"
70
- strokeWidth="1.33333"
71
- strokeLinecap="round"
72
- strokeLinejoin="round"
73
- />
74
- </svg>
75
- );
76
-
77
- export function Homepage() {
78
-
79
- return (
80
- <div className="container">
81
- <img src="sei-logotype.svg" className="logo" alt="SEI logotype" />
82
- <div className="card intro">
83
- <div className="card-header">
84
- <p className="card__title">Wallet address</p>
85
- <small className="card__description">
86
- Connect wallet to see your address and balance
87
- </small>
88
- </div>
89
- <WalletConnectButton/>
90
- </div>
91
- <Examples chainId={selectedChain.chain_id}/>
92
- <div className="get-started">
93
- Get started by editing <code>src/App.tsx</code>
94
- </div>
95
- <div className="grid docs">
96
- {helpItems.map((item, _) => (renderHelpItem(item)))}
97
- </div>
98
- </div>
99
- );
100
- }
101
-
102
- export default Homepage;
@@ -1,26 +0,0 @@
1
- import { useChain } from "@cosmos-kit/react";
2
-
3
- import "@interchain-ui/react/styles";
4
-
5
- import { truncateSeiAddress } from "@sei-js/cosmjs";
6
- import { selectedChain } from "../../constants";
7
-
8
- export function WalletConnectButton() {
9
- const {
10
- isWalletConnected,
11
- address,
12
- connect,
13
- openView,
14
- } = useChain(selectedChain.chain_name);
15
-
16
- const truncatedSeiAddr = address ? truncateSeiAddress(address) : ""
17
-
18
- return (
19
- <button
20
- className="primary"
21
- onClick={isWalletConnected ? openView : connect}
22
- >
23
- {isWalletConnected ? truncateSeiAddress(truncatedSeiAddr) : "Connect"}
24
- </button>
25
- );
26
- }
@@ -1,45 +0,0 @@
1
- 'use client';
2
-
3
- import { ReactNode } from 'react';
4
- import { Buffer } from 'buffer';
5
-
6
- import { ChainProvider } from '@cosmos-kit/react';
7
- import { COSMOS_KIT_ASSET_LIST } from '@sei-js/cosmjs';
8
- import { wallets as finWallets } from '@cosmos-kit/fin'
9
- import { wallets as keplrWallets } from '@cosmos-kit/keplr'
10
- import {
11
- CompassExtensionWallet,
12
- compassExtensionInfo,
13
- } from '@cosmos-kit/compass-extension'
14
- import { selectedChain } from '../constants';
15
-
16
- interface Web3ProviderProps {
17
- children: ReactNode;
18
- }
19
-
20
- const compassWallet = new CompassExtensionWallet({
21
- ...compassExtensionInfo,
22
- mobileDisabled: false,
23
- })
24
-
25
- function Web3Provider({ children }: Web3ProviderProps) {
26
-
27
- // Buffer polyfill
28
- if (typeof window !== 'undefined') {
29
- window.Buffer = window.Buffer ?? Buffer;
30
- }
31
-
32
- // Define your supported wallets here
33
- const wallets = [compassWallet, ...finWallets, ...keplrWallets];
34
-
35
- // Define the list of sei chain you would like to connect to here.
36
- const chains = [selectedChain]
37
-
38
- return (
39
- <ChainProvider chains={chains} assetLists={[COSMOS_KIT_ASSET_LIST]} wallets={wallets}>
40
- {children}
41
- </ChainProvider>
42
- );
43
- }
44
-
45
- export default Web3Provider;
@@ -1,4 +0,0 @@
1
- export * from './Homepage/Homepage'
2
- export * from './WalletConnectButton/WalletConnectButton'
3
- export * from './Web3Provider'
4
- export * from './Homepage/Examples'
@@ -1,16 +0,0 @@
1
- import { ARCTIC_1_SEI_COSMOS_KIT_CHAIN, ATLANTIC_2_SEI_COSMOS_KIT_CHAIN, PACIFIC_1_SEI_COSMOS_KIT_CHAIN } from '@sei-js/cosmjs';
2
-
3
- export type Urls = {
4
- rpc: string,
5
- rest: string,
6
- }
7
-
8
- export const defaultUrls: {[chainName: string]: Urls} = {
9
- [PACIFIC_1_SEI_COSMOS_KIT_CHAIN.chain_id]: {rpc: "https://rpc.sei-apis.com", rest: 'https://rest-arctic-1.sei-apis.com'},
10
- [ATLANTIC_2_SEI_COSMOS_KIT_CHAIN.chain_id]: {rpc: "https://rpc-testnet.sei-apis.com", rest: "https://rest-testnet.sei-apis.com"},
11
- [ARCTIC_1_SEI_COSMOS_KIT_CHAIN.chain_id]: {rpc: "https://rpc-arctic-1.sei-apis.com", rest: "https://rest-arctic-1.sei-apis.com"}
12
- }
13
-
14
- // Set your selected chain here
15
- // To point to mainnet, use PACIFIC_1_SEI_COSMOS_KIT_CHAIN
16
- export const selectedChain = ARCTIC_1_SEI_COSMOS_KIT_CHAIN
@@ -1 +0,0 @@
1
- export * from './chain';