@sei-js/create-sei 0.0.1 → 0.0.2

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 (91) hide show
  1. package/.yarn/install-state.gz +0 -0
  2. package/CHANGELOG.md +6 -0
  3. package/dist/main.js +161 -0
  4. package/dist/templates/next-cosmos-template/.eslintrc.json +3 -0
  5. package/dist/templates/next-cosmos-template/README.md +60 -0
  6. package/dist/templates/next-cosmos-template/next-env.d.ts +5 -0
  7. package/dist/templates/next-cosmos-template/next.config.mjs +14 -0
  8. package/dist/templates/next-cosmos-template/package.json +31 -0
  9. package/dist/templates/next-cosmos-template/public/next.svg +1 -0
  10. package/dist/templates/next-cosmos-template/public/sei-logotype.svg +15 -0
  11. package/dist/templates/next-cosmos-template/public/vercel.svg +1 -0
  12. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +177 -0
  13. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +156 -0
  14. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +110 -0
  15. package/dist/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +26 -0
  16. package/dist/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +39 -0
  17. package/dist/templates/next-cosmos-template/src/app/components/index.ts +3 -0
  18. package/dist/templates/next-cosmos-template/src/app/constants/chain.ts +16 -0
  19. package/dist/templates/next-cosmos-template/src/app/constants/index.ts +1 -0
  20. package/dist/templates/next-cosmos-template/src/app/favicon.ico +0 -0
  21. package/dist/templates/next-cosmos-template/src/app/index.css +171 -0
  22. package/dist/templates/next-cosmos-template/src/app/layout.tsx +21 -0
  23. package/dist/templates/next-cosmos-template/src/app/page.tsx +17 -0
  24. package/dist/templates/next-cosmos-template/tsconfig.json +26 -0
  25. package/dist/templates/next-cosmos-template/yarn.lock +9814 -0
  26. package/dist/templates/next-wagmi-template/.eslintrc.json +3 -0
  27. package/dist/templates/next-wagmi-template/README.md +58 -0
  28. package/dist/templates/next-wagmi-template/next-env.d.ts +5 -0
  29. package/dist/templates/next-wagmi-template/next.config.mjs +4 -0
  30. package/dist/templates/next-wagmi-template/package.json +30 -0
  31. package/dist/templates/next-wagmi-template/public/sei-logotype.svg +15 -0
  32. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +271 -0
  33. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +156 -0
  34. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.tsx +113 -0
  35. package/dist/templates/next-wagmi-template/src/app/components/Web3Provider.tsx +73 -0
  36. package/dist/templates/next-wagmi-template/src/app/components/index.ts +2 -0
  37. package/dist/templates/next-wagmi-template/src/app/constants/chain.ts +7 -0
  38. package/dist/templates/next-wagmi-template/src/app/constants/index.ts +1 -0
  39. package/dist/templates/next-wagmi-template/src/app/favicon.ico +0 -0
  40. package/dist/templates/next-wagmi-template/src/app/index.css +171 -0
  41. package/dist/templates/next-wagmi-template/src/app/layout.tsx +21 -0
  42. package/dist/templates/next-wagmi-template/src/app/page.tsx +21 -0
  43. package/dist/templates/next-wagmi-template/tsconfig.json +26 -0
  44. package/dist/templates/next-wagmi-template/yarn.lock +4809 -0
  45. package/dist/templates/vite-cosmos-template/.eslintrc.cjs +18 -0
  46. package/dist/templates/vite-cosmos-template/README.md +72 -0
  47. package/dist/templates/vite-cosmos-template/favicon.ico +0 -0
  48. package/dist/templates/vite-cosmos-template/index.html +16 -0
  49. package/dist/templates/vite-cosmos-template/package.json +35 -0
  50. package/dist/templates/vite-cosmos-template/public/sei-logotype.svg +15 -0
  51. package/dist/templates/vite-cosmos-template/src/App.tsx +16 -0
  52. package/dist/templates/vite-cosmos-template/src/assets/react.svg +1 -0
  53. package/dist/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +177 -0
  54. package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +156 -0
  55. package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +102 -0
  56. package/dist/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +26 -0
  57. package/dist/templates/vite-cosmos-template/src/components/Web3Provider.tsx +45 -0
  58. package/dist/templates/vite-cosmos-template/src/components/index.ts +4 -0
  59. package/dist/templates/vite-cosmos-template/src/constants/chain.ts +16 -0
  60. package/dist/templates/vite-cosmos-template/src/constants/index.ts +1 -0
  61. package/dist/templates/vite-cosmos-template/src/index.css +171 -0
  62. package/dist/templates/vite-cosmos-template/src/main.tsx +12 -0
  63. package/dist/templates/vite-cosmos-template/src/vite-env.d.ts +1 -0
  64. package/dist/templates/vite-cosmos-template/tsconfig.app.json +27 -0
  65. package/dist/templates/vite-cosmos-template/tsconfig.json +11 -0
  66. package/dist/templates/vite-cosmos-template/tsconfig.node.json +14 -0
  67. package/dist/templates/vite-cosmos-template/vite.config.ts +7 -0
  68. package/dist/templates/vite-cosmos-template/yarn.lock +9323 -0
  69. package/dist/templates/vite-wagmi-template/.eslintrc.cjs +18 -0
  70. package/dist/templates/vite-wagmi-template/README.md +72 -0
  71. package/dist/templates/vite-wagmi-template/favicon.ico +0 -0
  72. package/dist/templates/vite-wagmi-template/index.html +12 -0
  73. package/dist/templates/vite-wagmi-template/package.json +33 -0
  74. package/dist/templates/vite-wagmi-template/public/sei-logotype.svg +15 -0
  75. package/dist/templates/vite-wagmi-template/src/App.tsx +22 -0
  76. package/dist/templates/vite-wagmi-template/src/assets/react.svg +1 -0
  77. package/dist/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +269 -0
  78. package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +156 -0
  79. package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +106 -0
  80. package/dist/templates/vite-wagmi-template/src/components/Web3Provider.tsx +71 -0
  81. package/dist/templates/vite-wagmi-template/src/constants/chain.ts +6 -0
  82. package/dist/templates/vite-wagmi-template/src/constants/index.ts +1 -0
  83. package/dist/templates/vite-wagmi-template/src/index.css +170 -0
  84. package/dist/templates/vite-wagmi-template/src/main.tsx +12 -0
  85. package/dist/templates/vite-wagmi-template/src/vite-env.d.ts +1 -0
  86. package/dist/templates/vite-wagmi-template/tsconfig.app.json +27 -0
  87. package/dist/templates/vite-wagmi-template/tsconfig.json +11 -0
  88. package/dist/templates/vite-wagmi-template/tsconfig.node.json +14 -0
  89. package/dist/templates/vite-wagmi-template/vite.config.ts +10 -0
  90. package/dist/templates/vite-wagmi-template/yarn.lock +4603 -0
  91. package/package.json +1 -1
@@ -0,0 +1,110 @@
1
+ 'use client';
2
+
3
+ import './Homepage.css'
4
+ import Examples from './Examples';
5
+ import { selectedChain } from '../../constants';
6
+ import { WalletConnectButton } from '..';
7
+
8
+ type HelpItem = {
9
+ title: string;
10
+ description: string;
11
+ link: string;
12
+ };
13
+
14
+ const renderHelpItem = ({ title, description, link }: HelpItem) => (
15
+ <div className="card secondary">
16
+ <div className="card-header">
17
+ <p className="card__title">
18
+ <a href={link} target='_blank' rel='noopener noreferrer' className="external-link">
19
+ {title} {externalIcon}
20
+ </a>
21
+ </p>
22
+ <small className="card__description">
23
+ {description}
24
+ </small>
25
+ </div>
26
+ </div>
27
+ );
28
+
29
+ const helpItems: HelpItem[] = [
30
+ {
31
+ title: 'Sei Docs',
32
+ description: 'Find in-depth information about Sei.',
33
+ link: 'https://docs.sei.io/'
34
+ },
35
+ {
36
+ title: 'CosmosKit',
37
+ description: "Learn about CosmosKit and it's hooks for chain interaction.",
38
+ link: 'https://docs.cosmology.zone/cosmos-kit/get-started'
39
+ },
40
+ {
41
+ title: 'sei-js',
42
+ description: 'Interact with Sei using @sei-js/cosmjs.',
43
+ link: 'https://sei-protocol.github.io/sei-js/modules/cosmjs.html'
44
+ }
45
+ ];
46
+
47
+ const externalIcon = (
48
+ <svg
49
+ width="16"
50
+ height="16"
51
+ viewBox="0 0 16 16"
52
+ fill="none"
53
+ xmlns="http://www.w3.org/2000/svg"
54
+ >
55
+ <path
56
+ 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"
57
+ stroke="#9F1239"
58
+ strokeWidth="1.33333"
59
+ strokeLinecap="round"
60
+ strokeLinejoin="round"
61
+ />
62
+ <path
63
+ d="M10 2H14V6"
64
+ stroke="#9F1239"
65
+ strokeWidth="1.33333"
66
+ strokeLinecap="round"
67
+ strokeLinejoin="round"
68
+ />
69
+ <path
70
+ d="M6.66663 9.33333L14 2"
71
+ stroke="#9F1239"
72
+ strokeWidth="1.33333"
73
+ strokeLinecap="round"
74
+ strokeLinejoin="round"
75
+ />
76
+ </svg>
77
+ );
78
+
79
+ export function Homepage() {
80
+
81
+ return (
82
+ <div className="container">
83
+ <img src="sei-logotype.svg" className="logo" alt="SEI logotype" />
84
+ <div className="card intro">
85
+ <div className="card-header">
86
+ <p className="card__title">Wallet address</p>
87
+ <small className="card__description">
88
+ Connect wallet to see your address and balance
89
+ </small>
90
+ </div>
91
+ <WalletConnectButton/>
92
+ </div>
93
+ <Examples chainId={selectedChain.chain_id}/>
94
+ <div className="get-started">
95
+ Get started by editing <code>src/app/page.tsx</code>
96
+ </div>
97
+ <div className="grid docs">
98
+ {
99
+ helpItems.map((item, _) => (
100
+ <div key={item.title}>
101
+ {renderHelpItem(item)}
102
+ </div>
103
+ ))
104
+ }
105
+ </div>
106
+ </div>
107
+ );
108
+ }
109
+
110
+ export default Homepage;
@@ -0,0 +1,26 @@
1
+ import { useChain } from "@cosmos-kit/react";
2
+
3
+ import "@interchain-ui/react/styles";
4
+
5
+ import { truncateSeiAddress } from "@sei-js/cosmjs";
6
+ import { selectedChain } from "../../constants";
7
+
8
+ export function WalletConnectButton() {
9
+ const {
10
+ isWalletConnected,
11
+ address,
12
+ connect,
13
+ openView,
14
+ } = useChain(selectedChain.chain_name);
15
+
16
+ const truncatedSeiAddr = address ? truncateSeiAddress(address) : ""
17
+
18
+ return (
19
+ <button
20
+ className="primary"
21
+ onClick={isWalletConnected ? openView : connect}
22
+ >
23
+ {isWalletConnected ? truncateSeiAddress(truncatedSeiAddr) : "Connect"}
24
+ </button>
25
+ );
26
+ }
@@ -0,0 +1,39 @@
1
+ 'use client';
2
+
3
+ import { ReactNode } from 'react';
4
+
5
+ import { ChainProvider } from '@cosmos-kit/react';
6
+ import { COSMOS_KIT_ASSET_LIST } from '@sei-js/cosmjs';
7
+ import { wallets as finWallets } from '@cosmos-kit/fin'
8
+ import { wallets as keplrWallets } from '@cosmos-kit/keplr'
9
+ import {
10
+ CompassExtensionWallet,
11
+ compassExtensionInfo,
12
+ } from '@cosmos-kit/compass-extension'
13
+ import { selectedChain } from '../constants';
14
+
15
+ interface Web3ProviderProps {
16
+ children: ReactNode;
17
+ }
18
+
19
+ const compassWallet = new CompassExtensionWallet({
20
+ ...compassExtensionInfo,
21
+ mobileDisabled: false,
22
+ })
23
+
24
+ function Web3Provider({ children }: Web3ProviderProps) {
25
+
26
+ // Define your supported wallets here
27
+ const wallets = [compassWallet, ...finWallets, ...keplrWallets];
28
+
29
+ // Define the list of sei chain you would like to connect to here.
30
+ const chains = [selectedChain]
31
+
32
+ return (
33
+ <ChainProvider chains={chains} assetLists={[COSMOS_KIT_ASSET_LIST]} wallets={wallets}>
34
+ {children}
35
+ </ChainProvider>
36
+ );
37
+ }
38
+
39
+ export default Web3Provider;
@@ -0,0 +1,3 @@
1
+ export * from './Homepage/Homepage'
2
+ export * from './WalletConnectButton/WalletConnectButton'
3
+ export * from './Web3Provider'
@@ -0,0 +1,16 @@
1
+ import { ARCTIC_1_SEI_COSMOS_KIT_CHAIN, ATLANTIC_2_SEI_COSMOS_KIT_CHAIN, PACIFIC_1_SEI_COSMOS_KIT_CHAIN } from '@sei-js/cosmjs';
2
+
3
+ export type Urls = {
4
+ rpc: string,
5
+ rest: string,
6
+ }
7
+
8
+ export const defaultUrls: {[chainName: string]: Urls} = {
9
+ [PACIFIC_1_SEI_COSMOS_KIT_CHAIN.chain_id]: {rpc: "https://rpc.sei-apis.com", rest: 'https://rest-arctic-1.sei-apis.com'},
10
+ [ATLANTIC_2_SEI_COSMOS_KIT_CHAIN.chain_id]: {rpc: "https://rpc-testnet.sei-apis.com", rest: "https://rest-testnet.sei-apis.com"},
11
+ [ARCTIC_1_SEI_COSMOS_KIT_CHAIN.chain_id]: {rpc: "https://rpc-arctic-1.sei-apis.com", rest: "https://rest-arctic-1.sei-apis.com"}
12
+ }
13
+
14
+ // Set your selected chain here
15
+ // To point to mainnet, use PACIFIC_1_SEI_COSMOS_KIT_CHAIN
16
+ export const selectedChain = ARCTIC_1_SEI_COSMOS_KIT_CHAIN
@@ -0,0 +1 @@
1
+ export * from './chain';
@@ -0,0 +1,171 @@
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
+ }
@@ -0,0 +1,21 @@
1
+ import type { Metadata } from "next";
2
+ import { Inter } from "next/font/google";
3
+
4
+ const inter = Inter({ subsets: ["latin"] });
5
+
6
+ export const metadata: Metadata = {
7
+ title: "Sei Next App (Cosmos)",
8
+ description: "Generated by create sei app",
9
+ };
10
+
11
+ export default function RootLayout({
12
+ children,
13
+ }: Readonly<{
14
+ children: React.ReactNode;
15
+ }>) {
16
+ return (
17
+ <html lang="en">
18
+ <body className={inter.className}>{children}</body>
19
+ </html>
20
+ );
21
+ }
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+
3
+ import './index.css'
4
+ import Homepage from "./components/Homepage/Homepage";
5
+ import Web3Provider from "./components/Web3Provider";
6
+ import { WalletConnectButton } from "./components/WalletConnectButton/WalletConnectButton";
7
+
8
+ export default function Home() {
9
+ return (
10
+ <Web3Provider>
11
+ <div className="header">
12
+ <WalletConnectButton/>
13
+ </div>
14
+ <Homepage/>
15
+ </Web3Provider>
16
+ );
17
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": ["dom", "dom.iterable", "esnext"],
4
+ "allowJs": true,
5
+ "skipLibCheck": true,
6
+ "strict": true,
7
+ "noEmit": true,
8
+ "esModuleInterop": true,
9
+ "module": "esnext",
10
+ "moduleResolution": "bundler",
11
+ "resolveJsonModule": true,
12
+ "isolatedModules": true,
13
+ "jsx": "preserve",
14
+ "incremental": true,
15
+ "plugins": [
16
+ {
17
+ "name": "next"
18
+ }
19
+ ],
20
+ "paths": {
21
+ "@/*": ["./src/*"]
22
+ }
23
+ },
24
+ "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
25
+ "exclude": ["node_modules"]
26
+ }