@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,33 +0,0 @@
1
- {
2
- "name": "template-vite-wagmi-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
- }
@@ -1,22 +0,0 @@
1
- import './index.css'
2
- import { ConnectButton } from '@rainbow-me/rainbowkit';
3
- import Homepage from './components/Homepage/Homepage';
4
-
5
- function App() {
6
-
7
- return (
8
- <>
9
- <div className="header">
10
- <ConnectButton
11
- showBalance={{
12
- smallScreen: false,
13
- largeScreen: true,
14
- }}
15
- />
16
- </div>
17
- <Homepage/>
18
- </>
19
- );
20
- }
21
-
22
- export default App;
@@ -1,269 +0,0 @@
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 (Number(num) / 1000000 / 1000000000).toLocaleString(navigator.language, { minimumFractionDigits: decimals, maximumFractionDigits: decimals}) + ' B';
20
- } else {
21
- return (Number(num) / 1000000).toLocaleString(navigator.language);
22
- }
23
- };
24
-
25
- const copyToClipboard = (text: string) => {
26
- try {
27
- navigator.clipboard.writeText(text);
28
- } catch (err) {
29
- console.error("Failed to copy text: ", err);
30
- } finally {
31
- alert("Copied to clipboard!");
32
- }
33
- }
34
-
35
- const renderAddressExample = () => {
36
- return (
37
- <div className="card">
38
- <div className="card-header">
39
- <p className="card__title">Wallet address</p>
40
- <small className="card__description">
41
- <a
42
- href="https://viem.sh/docs/clients/public.html"
43
- target="_blank">Viem Public Client</a> query example
44
- </small>
45
- </div>
46
- <div className="card-body">
47
- <div className="content-background space-between">
48
- {
49
- address ?
50
- <div>
51
- <p className="card-footer">
52
- {address}
53
- </p>
54
- </div> :
55
- <a> --- </a>
56
- }
57
-
58
- <button
59
- className="small outline"
60
- onClick={() =>
61
- copyToClipboard(
62
- address as string
63
- )
64
- }
65
- >
66
- Copy
67
- </button>
68
- </div>
69
- </div>
70
- <div className="card-footer">
71
- </div>
72
- </div>
73
- )
74
- }
75
-
76
- const getBalanceWagmi = async () => {
77
- if (!address || !publicClient) {
78
- return undefined
79
- }
80
- const weiBalance = await publicClient.getBalance({address});
81
- const seiBalance = formatEther(weiBalance)
82
- setBalance(seiBalance);
83
- }
84
-
85
- const renderBalanceExample = () => {
86
- return (
87
- <div className="card">
88
- <div className="card-header">
89
- <p className="card__title">Wallet balance</p>
90
- <small className="card__description">
91
- <a
92
- href="https://viem.sh/docs/clients/public.html"
93
- target="_blank">Viem Public Client</a> query example
94
- </small>
95
- </div>
96
- <div className="card-body">
97
- <div className="content-background space-between">
98
- <small>SEI</small>
99
- <p>{balance ? balance : '---' } SEI</p>
100
- </div>
101
- </div>
102
- <div className="card-footer">
103
- <button onClick={getBalanceWagmi}>Fetch balance</button>
104
- </div>
105
- </div>
106
- )
107
- }
108
-
109
- // Example of using precompiles to query native Sei modules.
110
- const getBankSupply = async () => {
111
- if (!publicClient) {
112
- return;
113
- }
114
-
115
- const params: ReadContractParameters = {
116
- address: BANK_PRECOMPILE_ADDRESS,
117
- abi: BANK_PRECOMPILE_ABI,
118
- functionName: 'supply',
119
- args: ['usei']
120
- }
121
- try {
122
- const response = await publicClient.readContract(params) as BigInt;
123
- const supply = formatLargeSeiNumber(response.toString(), 1)
124
- setSupply(supply);
125
- } catch (e) {
126
- console.log(e);
127
- }
128
- }
129
-
130
- const renderBankSupplyExample = () => {
131
- return (
132
- <div className="card">
133
- <div className="card-header">
134
- <p className="card__title">Total Sei supply</p>
135
- <small className="card__description">
136
- <a
137
- href="https://www.docs.sei.io/dev-interoperability/precompiles/bank"
138
- target="_blank"> Bank precompile
139
- </a> example for querying native Sei
140
- modules
141
- </small>
142
- </div>
143
- <div className="card-body">
144
- <div className="content-background space-between">
145
- <small>SEI</small>
146
- <p>{supply}</p>
147
- </div>
148
- </div>
149
- <div className="card-footer">
150
- <button onClick={getBankSupply}>Fetch supply</button>
151
- </div>
152
- </div>
153
- )
154
- }
155
-
156
- // Fetch count of a CosmWasm Contract using WASM Precompile
157
- const fetchCount = async () => {
158
- if (!publicClient) {
159
- return;
160
- }
161
-
162
- const COUNTER_CONTRACT_ADDRESS =
163
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
164
-
165
- const queryMsg = toHex(JSON.stringify({ get_count: {} }));
166
-
167
- const params: ReadContractParameters = {
168
- address: WASM_PRECOMPILE_ADDRESS,
169
- abi: WASM_PRECOMPILE_ABI,
170
- functionName: 'query',
171
- args: [COUNTER_CONTRACT_ADDRESS, queryMsg]
172
- }
173
- try {
174
- const response = await publicClient?.readContract(params) as `0x${string}`;
175
- const { count } = JSON.parse(fromHex(response, 'string'));
176
- setCount(count);
177
- } catch (e) {
178
- console.log(e);
179
- }
180
- }
181
-
182
- // Fetch count of a CosmWasm Contract using WASM Precompile
183
- const incrementCounter = async () => {
184
- if (!address || !publicClient) {
185
- return;
186
- }
187
-
188
- const COUNTER_CONTRACT_ADDRESS =
189
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
190
-
191
- const execMsg = toHex(JSON.stringify({ increment: {} }));
192
- const coins = toHex('[]')
193
- const params = {
194
- account: address,
195
- address: WASM_PRECOMPILE_ADDRESS,
196
- abi: WASM_PRECOMPILE_ABI,
197
- functionName: 'execute',
198
- args: [COUNTER_CONTRACT_ADDRESS, execMsg, coins],
199
- value: parseEther('0')
200
- }
201
-
202
- try {
203
- const estimatedGas = await publicClient.estimateContractGas(params);
204
-
205
- // Call smart contract execute msg
206
- await writeContractAsync({ ...params, gas: estimatedGas});
207
-
208
- // Wait for 1 block to confirm transaction
209
- setTimeout(() => {}, 400);
210
- await fetchCount();
211
-
212
- } catch (error) {
213
- console.log(error)
214
- }
215
- };
216
-
217
- const renderCounterContractExample = () => {
218
- return (
219
- <div className="card">
220
- <div className="card-header">
221
- <p className="card__title">Smart contract interaction</p>
222
- <small>
223
- <a
224
- href="https://www.docs.sei.io/dev-interoperability/precompiles/cosmwasm"
225
- target="_blank">
226
- WASM Precompile
227
- </a> example of CosmWasm smart
228
- contract interaction
229
- </small>
230
- </div>
231
- <div className="card-body">
232
- <div className="content-background space-between">
233
- <small>Count</small>
234
- <p>{count}</p>
235
- <button
236
- className="small outline"
237
- onClick={incrementCounter}
238
- >
239
- Increase
240
- </button>
241
- </div>
242
- </div>
243
- <div className="card-footer">
244
- <button onClick={fetchCount}>Fetch count</button>
245
- </div>
246
- </div>
247
- )
248
- }
249
-
250
- return (
251
- <div className="container">
252
- <div className="grid">
253
- {/* First card */}
254
- {renderAddressExample()}
255
-
256
- {/* Second card */}
257
- {renderBalanceExample()}
258
-
259
- {/* Third card */}
260
- {renderBankSupplyExample()}
261
-
262
- {/* Fourth card */}
263
- {renderCounterContractExample()}
264
- </div>
265
- </div>
266
- )
267
- }
268
-
269
- 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(2, 1fr);
146
- }
147
- .grid.docs {
148
- grid-template-columns: repeat(2, 1fr);
149
- }
150
- }
151
-
152
- @media (min-width: 1024px) {
153
- .container {
154
- max-width: 80rem;
155
- }
156
- }
@@ -1,106 +0,0 @@
1
- import { ConnectButton } from '@rainbow-me/rainbowkit';
2
- import Examples from './Examples';
3
- import "./Homepage.css"
4
-
5
- type HelpItem = {
6
- title: string;
7
- description: string;
8
- link: string;
9
- };
10
-
11
- const renderHelpItem = ({ title, description, link }: HelpItem) => (
12
- <div className="card secondary">
13
- <div className="card-header">
14
- <p className="card__title">
15
- <a href={link} target='_blank' rel='noopener noreferrer' className="external-link">
16
- {title} {externalIcon}
17
- </a>
18
- </p>
19
- <small className="card__description">
20
- {description}
21
- </small>
22
- </div>
23
- </div>
24
- );
25
-
26
- const helpItems: HelpItem[] = [
27
- {
28
- title: 'Sei Docs',
29
- description: 'Find in-depth information about Sei.',
30
- link: 'https://docs.sei.io/'
31
- },
32
- {
33
- title: 'Wagmi',
34
- description: "Learn about Wagmi and it's hooks for chain interaction.",
35
- link: 'https://wagmi.sh/'
36
- },
37
- {
38
- title: 'Viem',
39
- description: 'Interact with Sei using Viem modules + Wagmi.',
40
- link: 'https://viem.sh/'
41
- },
42
- {
43
- title: 'EVM JSON-RPC API',
44
- description: 'Learn about the EVM api available on Sei.',
45
- link: 'https://ethereum.org/en/developers/docs/apis/json-rpc/'
46
- }
47
- ];
48
-
49
- const externalIcon = (
50
- <svg
51
- width="16"
52
- height="16"
53
- viewBox="0 0 16 16"
54
- fill="none"
55
- xmlns="http://www.w3.org/2000/svg"
56
- >
57
- <path
58
- 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"
59
- stroke="#9F1239"
60
- strokeWidth="1.33333"
61
- strokeLinecap="round"
62
- strokeLinejoin="round"
63
- />
64
- <path
65
- d="M10 2H14V6"
66
- stroke="#9F1239"
67
- strokeWidth="1.33333"
68
- strokeLinecap="round"
69
- strokeLinejoin="round"
70
- />
71
- <path
72
- d="M6.66663 9.33333L14 2"
73
- stroke="#9F1239"
74
- strokeWidth="1.33333"
75
- strokeLinecap="round"
76
- strokeLinejoin="round"
77
- />
78
- </svg>
79
- );
80
-
81
- function Homepage() {
82
-
83
- return (
84
- <div className="container">
85
- <img src="sei-logotype.svg" className="logo" alt="SEI logotype" />
86
- <div className="card intro">
87
- <div className="card-header">
88
- <p className="card__title">Wallet address</p>
89
- <small className="card__description">
90
- Connect wallet to see your address and balance
91
- </small>
92
- </div>
93
- <ConnectButton/>
94
- </div>
95
- <Examples />
96
- <div className="get-started">
97
- Get started by editing <code>src/App.tsx</code>
98
- </div>
99
- <div className="grid docs">
100
- {helpItems.map((item, _) => (renderHelpItem(item)))}
101
- </div>
102
- </div>
103
- );
104
- }
105
-
106
- export default Homepage;
@@ -1 +0,0 @@
1
- export * from './chain';