@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,3 +0,0 @@
1
- {
2
- "extends": "next/core-web-vitals"
3
- }
@@ -1,30 +0,0 @@
1
- {
2
- "name": "template-next-wagmi-sei-app",
3
- "version": "0.1.0",
4
- "private": true,
5
- "scripts": {
6
- "dev": "next dev",
7
- "build": "next build",
8
- "start": "next start",
9
- "lint": "next lint"
10
- },
11
- "dependencies": {
12
- "@rainbow-me/rainbowkit": "^2.1.2",
13
- "@sei-js/evm": "^1.2.0",
14
- "@tanstack/react-query": "^5.45.1",
15
- "encoding": "^0.1.13",
16
- "next": "14.2.4",
17
- "pino-pretty": "^11.2.1",
18
- "react": "^18",
19
- "react-dom": "^18",
20
- "viem": "^2.15.1",
21
- "wagmi": "^2.10.2"
22
- },
23
- "devDependencies": {
24
- "@types/node": "^20",
25
- "@types/react": "^18",
26
- "@types/react-dom": "^18",
27
- "eslint-config-next": "14.2.4",
28
- "typescript": "^5"
29
- }
30
- }
@@ -1,271 +0,0 @@
1
- 'use client';
2
-
3
- import { BANK_PRECOMPILE_ABI, BANK_PRECOMPILE_ADDRESS, WASM_PRECOMPILE_ABI, WASM_PRECOMPILE_ADDRESS } from "@sei-js/evm";
4
- import { useState } from "react";
5
- import { ReadContractParameters, formatEther, fromHex, parseEther, toHex } from "viem";
6
- import { useAccount, usePublicClient, useWriteContract } from "wagmi";
7
-
8
- import "./Homepage.css";
9
-
10
- function Examples() {
11
- const [balance, setBalance] = useState('')
12
- const [supply, setSupply] = useState('');
13
- const [count, setCount] = useState(0)
14
-
15
- const publicClient = usePublicClient();
16
- const { address } = useAccount();
17
- const { writeContractAsync } = useWriteContract();
18
-
19
- const formatLargeSeiNumber = (num: string, decimals: number): string => {
20
- if (num.length > 10) {
21
- return (Number(num) / 1000000 / 1000000000).toLocaleString(navigator.language, { minimumFractionDigits: decimals, maximumFractionDigits: decimals}) + ' B';
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
44
- href="https://viem.sh/docs/clients/public.html"
45
- target="_blank">Viem Public Client</a> query example
46
- </small>
47
- </div>
48
- <div className="card-body">
49
- <div className="content-background space-between">
50
- {
51
- address ?
52
- <div>
53
- <p className="card-footer">
54
- {address}
55
- </p>
56
- </div> :
57
- <p> --- </p>
58
- }
59
-
60
- <button
61
- className="small outline"
62
- onClick={() =>
63
- copyToClipboard(
64
- address as string
65
- )
66
- }
67
- >
68
- Copy
69
- </button>
70
- </div>
71
- </div>
72
- <div className="card-footer">
73
- </div>
74
- </div>
75
- )
76
- }
77
-
78
- const getBalanceWagmi = async () => {
79
- if (!address || !publicClient) {
80
- return undefined
81
- }
82
- const weiBalance = await publicClient.getBalance({address});
83
- const seiBalance = formatEther(weiBalance)
84
- setBalance(seiBalance);
85
- }
86
-
87
- const renderBalanceExample = () => {
88
- return (
89
- <div className="card">
90
- <div className="card-header">
91
- <p className="card__title">Wallet balance</p>
92
- <small className="card__description">
93
- <a
94
- href="https://viem.sh/docs/clients/public.html"
95
- target="_blank">Viem Public Client</a> query example
96
- </small>
97
- </div>
98
- <div className="card-body">
99
- <div className="content-background space-between">
100
- <small>SEI</small>
101
- <p>{balance ? balance : '---' } SEI</p>
102
- </div>
103
- </div>
104
- <div className="card-footer">
105
- <button onClick={getBalanceWagmi}>Fetch balance</button>
106
- </div>
107
- </div>
108
- )
109
- }
110
-
111
- // Example of using precompiles to query native Sei modules.
112
- const getBankSupply = async () => {
113
- if (!publicClient) {
114
- return;
115
- }
116
-
117
- const params: ReadContractParameters = {
118
- address: BANK_PRECOMPILE_ADDRESS,
119
- abi: BANK_PRECOMPILE_ABI,
120
- functionName: 'supply',
121
- args: ['usei']
122
- }
123
- try {
124
- const response = await publicClient.readContract(params) as BigInt;
125
- const supply = formatLargeSeiNumber(response.toString(), 1)
126
- setSupply(supply);
127
- } catch (e) {
128
- console.log(e);
129
- }
130
- }
131
-
132
- const renderBankSupplyExample = () => {
133
- return (
134
- <div className="card">
135
- <div className="card-header">
136
- <p className="card__title">Total Sei supply</p>
137
- <small className="card__description">
138
- <a
139
- href="https://www.docs.sei.io/dev-interoperability/precompiles/bank"
140
- target="_blank"> Bank precompile
141
- </a> example for querying native Sei
142
- modules
143
- </small>
144
- </div>
145
- <div className="card-body">
146
- <div className="content-background space-between">
147
- <small>SEI</small>
148
- <p>{supply}</p>
149
- </div>
150
- </div>
151
- <div className="card-footer">
152
- <button onClick={getBankSupply}>Fetch supply</button>
153
- </div>
154
- </div>
155
- )
156
- }
157
-
158
- // Fetch count of a CosmWasm Contract using WASM Precompile
159
- const fetchCount = async () => {
160
- if (!publicClient) {
161
- return;
162
- }
163
-
164
- const COUNTER_CONTRACT_ADDRESS =
165
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
166
-
167
- const queryMsg = toHex(JSON.stringify({ get_count: {} }));
168
-
169
- const params: ReadContractParameters = {
170
- address: WASM_PRECOMPILE_ADDRESS,
171
- abi: WASM_PRECOMPILE_ABI,
172
- functionName: 'query',
173
- args: [COUNTER_CONTRACT_ADDRESS, queryMsg]
174
- }
175
- try {
176
- const response = await publicClient?.readContract(params) as `0x${string}`;
177
- const { count } = JSON.parse(fromHex(response, 'string'));
178
- setCount(count);
179
- } catch (e) {
180
- console.log(e);
181
- }
182
- }
183
-
184
- // Fetch count of a CosmWasm Contract using WASM Precompile
185
- const incrementCounter = async () => {
186
- if (!address || !publicClient) {
187
- return;
188
- }
189
-
190
- const COUNTER_CONTRACT_ADDRESS =
191
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
192
-
193
- const execMsg = toHex(JSON.stringify({ increment: {} }));
194
- const coins = toHex('[]')
195
- const params = {
196
- account: address,
197
- address: WASM_PRECOMPILE_ADDRESS,
198
- abi: WASM_PRECOMPILE_ABI,
199
- functionName: 'execute',
200
- args: [COUNTER_CONTRACT_ADDRESS, execMsg, coins],
201
- value: parseEther('0')
202
- }
203
-
204
- try {
205
- const estimatedGas = await publicClient.estimateContractGas(params);
206
-
207
- // Call smart contract execute msg
208
- await writeContractAsync({ ...params, gas: estimatedGas});
209
-
210
- // Wait for 1 block to confirm transaction
211
- setTimeout(() => {}, 400);
212
- await fetchCount();
213
-
214
- } catch (error) {
215
- console.log(error)
216
- }
217
- };
218
-
219
- const renderCounterContractExample = () => {
220
- return (
221
- <div className="card">
222
- <div className="card-header">
223
- <p className="card__title">Smart contract interaction</p>
224
- <small>
225
- <a
226
- href="https://www.docs.sei.io/dev-interoperability/precompiles/cosmwasm"
227
- target="_blank">
228
- WASM Precompile
229
- </a> example of CosmWasm smart
230
- contract interaction
231
- </small>
232
- </div>
233
- <div className="card-body">
234
- <div className="content-background space-between">
235
- <small>Count</small>
236
- <p>{count}</p>
237
- <button
238
- className="small outline"
239
- onClick={incrementCounter}
240
- >
241
- Increase
242
- </button>
243
- </div>
244
- </div>
245
- <div className="card-footer">
246
- <button onClick={fetchCount}>Fetch count</button>
247
- </div>
248
- </div>
249
- )
250
- }
251
-
252
- return (
253
- <div className="container">
254
- <div className="grid">
255
- {/* First card */}
256
- {renderAddressExample()}
257
-
258
- {/* Second card */}
259
- {renderBalanceExample()}
260
-
261
- {/* Third card */}
262
- {renderBankSupplyExample()}
263
-
264
- {/* Fourth card */}
265
- {renderCounterContractExample()}
266
- </div>
267
- </div>
268
- )
269
- }
270
-
271
- 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,2 +0,0 @@
1
- export * from './Homepage/Homepage'
2
- export * from './Web3Provider'
@@ -1 +0,0 @@
1
- export * from './chain';
@@ -1,171 +0,0 @@
1
- /*
2
- 1. Use a more-intuitive box-sizing model.
3
- */
4
- *, *::before, *::after {
5
- box-sizing: border-box;
6
- }
7
- /*
8
- 2. Remove default margin
9
- */
10
- * {
11
- margin: 0;
12
- }
13
- /*
14
- Typographic tweaks!
15
- 3. Add accessible line-height
16
- 4. Improve text rendering
17
- */
18
- body {
19
- line-height: 1.5;
20
- -webkit-font-smoothing: antialiased;
21
- }
22
- /*
23
- 5. Improve media defaults
24
- */
25
- img, picture, video, canvas, svg {
26
- display: block;
27
- max-width: 100%;
28
- }
29
- /*
30
- 6. Remove built-in form typography styles
31
- */
32
- input, button, textarea, select {
33
- font: inherit;
34
- }
35
- /*
36
- 7. Avoid text overflows
37
- */
38
- p, h1, h2, h3, h4, h5, h6 {
39
- overflow-wrap: break-word;
40
- line-height: 1;
41
- }
42
- /*
43
- 8. Create a root stacking context
44
- */
45
- #root, #__next {
46
- isolation: isolate;
47
- }
48
-
49
-
50
- :root {
51
- font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
52
- line-height: 1.5;
53
- font-weight: 400;
54
-
55
- color-scheme: light dark;
56
- color:#000;
57
- background: var(--background);
58
-
59
- font-synthesis: none;
60
- text-rendering: optimizeLegibility;
61
- -webkit-font-smoothing: antialiased;
62
- -moz-osx-font-smoothing: grayscale;
63
-
64
- --primary-color: #9F1239;
65
- --primary-color-hover: #7F0A2E;
66
- --background: linear-gradient(180deg, #F5F5F4 0%, #FFF 100%);
67
- --border: #D6D3D1;
68
- --card: #FFF;
69
- --card-foreground: #242424;
70
- }
71
-
72
- a {
73
- font-weight: 500;
74
- color: var(--primary-color);
75
- text-decoration: inherit;
76
- }
77
- a:hover {
78
- color: var(--primary-color-hover)
79
- }
80
-
81
- body {
82
- margin: 0;
83
- padding: 0;
84
- }
85
-
86
- h1 {
87
- font-size: 3.2em;
88
- line-height: 1;
89
- }
90
- code {
91
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
92
- monospace;
93
- display: inline-flex;
94
- border-radius: 4px;
95
- padding: 0.1rem 0.4rem;
96
- background-color: #d7cccc;
97
- color: var(--card-foreground);
98
- }
99
-
100
- button {
101
- border-radius: 4rem;
102
- border: 1px solid transparent;
103
- padding: 0.6em 1.2em;
104
- font-size: 1em;
105
- font-weight: 500;
106
- font-family: inherit;
107
- background-color: #cec9c1;
108
- cursor: pointer;
109
- transition: all 0.25s ease;
110
- color: black;
111
- }
112
- button:hover {
113
- background-color: #b5afa7;
114
- }
115
-
116
- button:disabled {
117
- filter:grayscale(1) opacity(0.5);
118
- color: rgb(56, 55, 55);
119
- pointer-events: none;
120
- }
121
-
122
- button.primary {
123
- background-color: var(--primary-color);
124
- color: #fff;
125
- }
126
- button.outline {
127
- background-color: transparent;
128
- border: 1px solid var(--border);
129
- }
130
-
131
- button.primary:hover {
132
- background-color: var(--primary-color-hover);
133
- }
134
-
135
- button.secondary {
136
- background-color: #000;
137
- color: #fff;
138
- }
139
-
140
- button.secondary:hover {
141
- background-color: #2b2b2b;
142
- }
143
-
144
- button:active {
145
- transform: translateY(1px);
146
- }
147
-
148
- button.small {
149
- padding: 0.4em 0.8em;
150
- font-size: 0.8em;
151
- }
152
-
153
-
154
- button:focus-visible {
155
- outline: 4px auto -webkit-focus-ring-color;
156
- outline-offset: 4px;
157
- }
158
-
159
- .header {
160
- width: 100%;
161
- height: 4rem;
162
- padding: 0 1%;
163
- display: flex;
164
- align-items: center;
165
- justify-content: right;
166
- background-color: transparent;
167
- border-bottom: 1px solid var(--border);
168
- position: sticky;
169
- top: 0;
170
- background: #F5F5F4;
171
- }
@@ -1,21 +0,0 @@
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
- }
@@ -1,21 +0,0 @@
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
- }
@@ -1,26 +0,0 @@
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
- }