@sei-js/create-sei 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.yarn/install-state.gz +0 -0
- package/CHANGELOG.md +12 -0
- package/README.md +16 -25
- package/biome.json +8 -0
- package/dist/main.js +10 -60
- package/dist/templates/next-template/.eslintrc.json +3 -0
- package/dist/templates/next-template/package.json +30 -0
- package/dist/templates/next-template/src/app/components/Homepage/Examples.tsx +257 -0
- package/dist/templates/next-template/src/app/components/Homepage/Homepage.css +154 -0
- package/dist/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +10 -36
- package/{templates/next-wagmi-template → dist/templates/next-template}/src/app/components/Web3Provider.tsx +29 -28
- package/dist/templates/next-template/src/app/components/index.ts +2 -0
- package/dist/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +2 -2
- package/dist/templates/next-template/src/app/constants/index.ts +1 -0
- package/dist/templates/next-template/src/app/index.css +184 -0
- package/dist/templates/next-template/src/app/layout.tsx +21 -0
- package/dist/templates/next-template/src/app/page.tsx +21 -0
- package/dist/templates/next-template/tsconfig.json +26 -0
- package/dist/templates/vite-template/.eslintrc.cjs +11 -0
- package/dist/templates/vite-template/package.json +33 -0
- package/dist/templates/vite-template/src/App.tsx +21 -0
- package/dist/templates/vite-template/src/components/Homepage/Examples.tsx +255 -0
- package/dist/templates/vite-template/src/components/Homepage/Homepage.css +154 -0
- package/dist/templates/vite-template/src/components/Homepage/Homepage.tsx +81 -0
- package/{templates/vite-wagmi-template → dist/templates/vite-template}/src/components/Web3Provider.tsx +29 -28
- package/dist/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +1 -1
- package/dist/templates/vite-template/src/constants/index.ts +1 -0
- package/dist/templates/vite-template/src/index.css +183 -0
- package/dist/templates/vite-template/src/main.tsx +12 -0
- package/dist/templates/vite-template/tsconfig.app.json +25 -0
- package/dist/templates/vite-template/tsconfig.json +11 -0
- package/dist/templates/vite-template/tsconfig.node.json +14 -0
- package/dist/templates/vite-template/vite.config.ts +10 -0
- package/package.json +1 -1
- package/src/main.ts +26 -87
- package/templates/next-template/.eslintrc.json +3 -0
- package/templates/next-template/package.json +30 -0
- package/templates/next-template/src/app/components/Homepage/Examples.tsx +257 -0
- package/templates/next-template/src/app/components/Homepage/Homepage.css +154 -0
- package/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +10 -36
- package/{dist/templates/next-wagmi-template → templates/next-template}/src/app/components/Web3Provider.tsx +29 -28
- package/templates/next-template/src/app/components/index.ts +2 -0
- package/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +2 -2
- package/templates/next-template/src/app/constants/index.ts +1 -0
- package/templates/next-template/src/app/index.css +184 -0
- package/templates/next-template/src/app/layout.tsx +21 -0
- package/templates/next-template/src/app/page.tsx +21 -0
- package/templates/next-template/tsconfig.json +26 -0
- package/templates/vite-template/.eslintrc.cjs +11 -0
- package/templates/vite-template/package.json +33 -0
- package/templates/vite-template/src/App.tsx +21 -0
- package/templates/vite-template/src/components/Homepage/Examples.tsx +255 -0
- package/templates/vite-template/src/components/Homepage/Homepage.css +154 -0
- package/templates/vite-template/src/components/Homepage/Homepage.tsx +81 -0
- package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/components/Web3Provider.tsx +29 -28
- package/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +1 -1
- package/templates/vite-template/src/constants/index.ts +1 -0
- package/templates/vite-template/src/index.css +183 -0
- package/templates/vite-template/src/main.tsx +12 -0
- package/templates/vite-template/tsconfig.app.json +25 -0
- package/templates/vite-template/tsconfig.json +11 -0
- package/templates/vite-template/tsconfig.node.json +14 -0
- package/templates/vite-template/vite.config.ts +10 -0
- package/tsconfig.json +18 -28
- package/dist/templates/next-cosmos-template/.eslintrc.json +0 -3
- package/dist/templates/next-cosmos-template/README.md +0 -60
- package/dist/templates/next-cosmos-template/next.config.mjs +0 -14
- package/dist/templates/next-cosmos-template/package.json +0 -31
- package/dist/templates/next-cosmos-template/public/next.svg +0 -1
- package/dist/templates/next-cosmos-template/public/vercel.svg +0 -1
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
- package/dist/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/dist/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
- package/dist/templates/next-cosmos-template/src/app/components/index.ts +0 -3
- package/dist/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
- package/dist/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
- package/dist/templates/next-cosmos-template/src/app/index.css +0 -171
- package/dist/templates/next-cosmos-template/src/app/layout.tsx +0 -21
- package/dist/templates/next-cosmos-template/src/app/page.tsx +0 -17
- package/dist/templates/next-cosmos-template/tsconfig.json +0 -26
- package/dist/templates/next-cosmos-template/yarn.lock +0 -9814
- package/dist/templates/next-wagmi-template/.eslintrc.json +0 -3
- package/dist/templates/next-wagmi-template/package.json +0 -30
- package/dist/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
- package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
- package/dist/templates/next-wagmi-template/src/app/components/index.ts +0 -2
- package/dist/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
- package/dist/templates/next-wagmi-template/src/app/index.css +0 -171
- package/dist/templates/next-wagmi-template/src/app/layout.tsx +0 -21
- package/dist/templates/next-wagmi-template/src/app/page.tsx +0 -21
- package/dist/templates/next-wagmi-template/tsconfig.json +0 -26
- package/dist/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
- package/dist/templates/vite-cosmos-template/README.md +0 -72
- package/dist/templates/vite-cosmos-template/index.html +0 -16
- package/dist/templates/vite-cosmos-template/package.json +0 -35
- package/dist/templates/vite-cosmos-template/src/App.tsx +0 -16
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
- package/dist/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/dist/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
- package/dist/templates/vite-cosmos-template/src/components/index.ts +0 -4
- package/dist/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
- package/dist/templates/vite-cosmos-template/src/constants/index.ts +0 -1
- package/dist/templates/vite-cosmos-template/src/index.css +0 -171
- package/dist/templates/vite-cosmos-template/src/main.tsx +0 -12
- package/dist/templates/vite-cosmos-template/tsconfig.app.json +0 -27
- package/dist/templates/vite-cosmos-template/tsconfig.json +0 -11
- package/dist/templates/vite-cosmos-template/tsconfig.node.json +0 -14
- package/dist/templates/vite-cosmos-template/vite.config.ts +0 -7
- package/dist/templates/vite-cosmos-template/yarn.lock +0 -9323
- package/dist/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
- package/dist/templates/vite-wagmi-template/package.json +0 -33
- package/dist/templates/vite-wagmi-template/src/App.tsx +0 -22
- package/dist/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
- package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
- package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
- package/dist/templates/vite-wagmi-template/src/constants/index.ts +0 -1
- package/dist/templates/vite-wagmi-template/src/index.css +0 -170
- package/dist/templates/vite-wagmi-template/src/main.tsx +0 -12
- package/dist/templates/vite-wagmi-template/tsconfig.app.json +0 -27
- package/dist/templates/vite-wagmi-template/tsconfig.json +0 -11
- package/dist/templates/vite-wagmi-template/tsconfig.node.json +0 -14
- package/dist/templates/vite-wagmi-template/vite.config.ts +0 -10
- package/templates/next-cosmos-template/.eslintrc.json +0 -3
- package/templates/next-cosmos-template/README.md +0 -60
- package/templates/next-cosmos-template/next-env.d.ts +0 -5
- package/templates/next-cosmos-template/next.config.mjs +0 -14
- package/templates/next-cosmos-template/package.json +0 -31
- package/templates/next-cosmos-template/public/next.svg +0 -1
- package/templates/next-cosmos-template/public/sei-logotype.svg +0 -15
- package/templates/next-cosmos-template/public/vercel.svg +0 -1
- package/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
- package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
- package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
- package/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
- package/templates/next-cosmos-template/src/app/components/index.ts +0 -3
- package/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
- package/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
- package/templates/next-cosmos-template/src/app/favicon.ico +0 -0
- package/templates/next-cosmos-template/src/app/index.css +0 -171
- package/templates/next-cosmos-template/src/app/layout.tsx +0 -21
- package/templates/next-cosmos-template/src/app/page.tsx +0 -17
- package/templates/next-cosmos-template/tsconfig.json +0 -26
- package/templates/next-cosmos-template/yarn.lock +0 -9814
- package/templates/next-wagmi-template/.eslintrc.json +0 -3
- package/templates/next-wagmi-template/next-env.d.ts +0 -5
- package/templates/next-wagmi-template/package.json +0 -30
- package/templates/next-wagmi-template/public/sei-logotype.svg +0 -15
- package/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
- package/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
- package/templates/next-wagmi-template/src/app/components/index.ts +0 -2
- package/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
- package/templates/next-wagmi-template/src/app/favicon.ico +0 -0
- package/templates/next-wagmi-template/src/app/index.css +0 -171
- package/templates/next-wagmi-template/src/app/layout.tsx +0 -21
- package/templates/next-wagmi-template/src/app/page.tsx +0 -21
- package/templates/next-wagmi-template/tsconfig.json +0 -26
- package/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
- package/templates/vite-cosmos-template/README.md +0 -72
- package/templates/vite-cosmos-template/favicon.ico +0 -0
- package/templates/vite-cosmos-template/index.html +0 -16
- package/templates/vite-cosmos-template/package.json +0 -35
- package/templates/vite-cosmos-template/public/sei-logotype.svg +0 -15
- package/templates/vite-cosmos-template/src/App.tsx +0 -16
- package/templates/vite-cosmos-template/src/assets/react.svg +0 -1
- package/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
- package/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
- package/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
- package/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
- package/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
- package/templates/vite-cosmos-template/src/components/index.ts +0 -4
- package/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
- package/templates/vite-cosmos-template/src/constants/index.ts +0 -1
- package/templates/vite-cosmos-template/src/index.css +0 -171
- package/templates/vite-cosmos-template/src/main.tsx +0 -12
- package/templates/vite-cosmos-template/src/vite-env.d.ts +0 -1
- package/templates/vite-cosmos-template/tsconfig.app.json +0 -27
- package/templates/vite-cosmos-template/tsconfig.json +0 -11
- package/templates/vite-cosmos-template/tsconfig.node.json +0 -14
- package/templates/vite-cosmos-template/vite.config.ts +0 -7
- package/templates/vite-cosmos-template/yarn.lock +0 -9323
- package/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
- package/templates/vite-wagmi-template/favicon.ico +0 -0
- package/templates/vite-wagmi-template/package.json +0 -33
- package/templates/vite-wagmi-template/public/sei-logotype.svg +0 -15
- package/templates/vite-wagmi-template/src/App.tsx +0 -22
- package/templates/vite-wagmi-template/src/assets/react.svg +0 -1
- package/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
- package/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
- package/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
- package/templates/vite-wagmi-template/src/constants/index.ts +0 -1
- package/templates/vite-wagmi-template/src/index.css +0 -170
- package/templates/vite-wagmi-template/src/main.tsx +0 -12
- package/templates/vite-wagmi-template/src/vite-env.d.ts +0 -1
- package/templates/vite-wagmi-template/tsconfig.app.json +0 -27
- package/templates/vite-wagmi-template/tsconfig.json +0 -11
- package/templates/vite-wagmi-template/tsconfig.node.json +0 -14
- package/templates/vite-wagmi-template/vite.config.ts +0 -10
- /package/dist/templates/{next-wagmi-template → next-template}/README.md +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/next-env.d.ts +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/next.config.mjs +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/public/sei-logotype.svg +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/src/app/favicon.ico +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/README.md +0 -0
- /package/dist/templates/{next-wagmi-template/src/app → vite-template}/favicon.ico +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/index.html +0 -0
- /package/dist/templates/{next-wagmi-template → vite-template}/public/sei-logotype.svg +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/assets/react.svg +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/vite-env.d.ts +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
- /package/templates/{next-wagmi-template → next-template}/README.md +0 -0
- /package/{dist/templates/next-wagmi-template → templates/next-template}/next-env.d.ts +0 -0
- /package/templates/{next-wagmi-template → next-template}/next.config.mjs +0 -0
- /package/{dist/templates/vite-cosmos-template → templates/next-template}/public/sei-logotype.svg +0 -0
- /package/{dist/templates/vite-cosmos-template → templates/next-template/src/app}/favicon.ico +0 -0
- /package/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/README.md +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/favicon.ico +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/index.html +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/public/sei-logotype.svg +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/assets/react.svg +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/vite-env.d.ts +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
|
@@ -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';
|