@sei-js/create-sei 0.0.3 → 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 +6 -0
- package/dist/main.js +1 -52
- package/dist/templates/{next-wagmi-template → next-template}/package.json +1 -1
- package/{templates/vite-wagmi-template → dist/templates/vite-template}/package.json +1 -1
- package/package.json +2 -3
- package/src/main.ts +1 -60
- package/templates/{next-wagmi-template → next-template}/package.json +1 -1
- package/{dist/templates/vite-wagmi-template → templates/vite-template}/package.json +1 -1
- package/tsconfig.json +1 -7
- 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 -168
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -154
- package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -83
- package/dist/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -18
- package/dist/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -35
- 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/layout.tsx +0 -21
- package/dist/templates/next-cosmos-template/src/app/page.tsx +0 -17
- package/dist/templates/next-cosmos-template/yarn.lock +0 -9814
- 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 -15
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -168
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -154
- package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -77
- package/dist/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -18
- package/dist/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -41
- 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/index.css +0 -184
- package/dist/templates/vite-cosmos-template/vite.config.ts +0 -7
- package/dist/templates/vite-cosmos-template/yarn.lock +0 -9323
- 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 -168
- package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -154
- package/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -83
- package/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -18
- package/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -35
- 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 -184
- 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/public/sei-logotype.svg +0 -15
- 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 -184
- package/templates/next-wagmi-template/tsconfig.json +0 -26
- package/templates/vite-cosmos-template/.eslintrc.cjs +0 -11
- 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 -15
- package/templates/vite-cosmos-template/src/assets/react.svg +0 -1
- package/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -168
- package/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -154
- package/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -77
- package/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -18
- package/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -41
- 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 -184
- 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 -25
- 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 -11
- package/templates/vite-wagmi-template/favicon.ico +0 -0
- package/templates/vite-wagmi-template/public/sei-logotype.svg +0 -15
- package/templates/vite-wagmi-template/src/assets/react.svg +0 -1
- package/templates/vite-wagmi-template/src/constants/index.ts +0 -1
- 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 -25
- package/templates/vite-wagmi-template/tsconfig.json +0 -11
- package/templates/vite-wagmi-template/tsconfig.node.json +0 -14
- /package/dist/templates/{next-cosmos-template → next-template}/.eslintrc.json +0 -0
- /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-wagmi-template → next-template}/src/app/components/Homepage/Examples.tsx +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.css +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/components/Web3Provider.tsx +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/components/index.ts +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/src/app/constants/index.ts +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/src/app/favicon.ico +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/src/app/index.css +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/layout.tsx +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/src/app/page.tsx +0 -0
- /package/dist/templates/{next-cosmos-template → next-template}/tsconfig.json +0 -0
- /package/dist/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/.eslintrc.cjs +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-wagmi-template → vite-template}/src/App.tsx +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/assets/react.svg +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/src/components/Homepage/Examples.tsx +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/src/components/Homepage/Homepage.css +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/src/components/Homepage/Homepage.tsx +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/src/components/Web3Provider.tsx +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +0 -0
- /package/dist/templates/{next-wagmi-template/src/app → vite-template/src}/constants/index.ts +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/src/index.css +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/main.tsx +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/src/vite-env.d.ts +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/tsconfig.app.json +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/tsconfig.json +0 -0
- /package/dist/templates/{vite-cosmos-template → vite-template}/tsconfig.node.json +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/vite.config.ts +0 -0
- /package/dist/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
- /package/{dist/templates/next-wagmi-template → templates/next-template}/.eslintrc.json +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/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Examples.tsx +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.css +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/components/Homepage/Homepage.tsx +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/components/Web3Provider.tsx +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/components/index.ts +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/constants/chain.ts +0 -0
- /package/{dist/templates/vite-cosmos-template/src → templates/next-template/src/app}/constants/index.ts +0 -0
- /package/{dist/templates/vite-cosmos-template → templates/next-template/src/app}/favicon.ico +0 -0
- /package/{dist/templates/next-wagmi-template → templates/next-template}/src/app/index.css +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/layout.tsx +0 -0
- /package/templates/{next-wagmi-template → next-template}/src/app/page.tsx +0 -0
- /package/{dist/templates/next-wagmi-template → templates/next-template}/tsconfig.json +0 -0
- /package/templates/{next-wagmi-template → next-template}/yarn.lock +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/.eslintrc.cjs +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/templates/{vite-wagmi-template → vite-template}/src/App.tsx +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/assets/react.svg +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/src/components/Homepage/Examples.tsx +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/src/components/Homepage/Homepage.css +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/src/components/Homepage/Homepage.tsx +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/src/components/Web3Provider.tsx +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/src/constants/chain.ts +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/constants/index.ts +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/src/index.css +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/main.tsx +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/src/vite-env.d.ts +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/tsconfig.app.json +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/tsconfig.json +0 -0
- /package/{dist/templates/vite-wagmi-template → templates/vite-template}/tsconfig.node.json +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/vite.config.ts +0 -0
- /package/templates/{vite-wagmi-template → vite-template}/yarn.lock +0 -0
package/.yarn/install-state.gz
CHANGED
|
Binary file
|
package/CHANGELOG.md
CHANGED
package/dist/main.js
CHANGED
|
@@ -23,15 +23,6 @@ var FrontendScaffolding;
|
|
|
23
23
|
FrontendScaffolding["Vite"] = "vite";
|
|
24
24
|
FrontendScaffolding["Next"] = "next";
|
|
25
25
|
})(FrontendScaffolding || (FrontendScaffolding = {}));
|
|
26
|
-
export var RPCIntegrationType;
|
|
27
|
-
(function (RPCIntegrationType) {
|
|
28
|
-
RPCIntegrationType["EVM"] = "evm";
|
|
29
|
-
RPCIntegrationType["CosmJS"] = "cosmos";
|
|
30
|
-
})(RPCIntegrationType || (RPCIntegrationType = {}));
|
|
31
|
-
export var EVMLibrary;
|
|
32
|
-
(function (EVMLibrary) {
|
|
33
|
-
EVMLibrary["Wagmi"] = "wagmi";
|
|
34
|
-
})(EVMLibrary || (EVMLibrary = {}));
|
|
35
26
|
const promptFramework = async () => {
|
|
36
27
|
const { appFramework } = await inquirer.prompt([
|
|
37
28
|
{
|
|
@@ -43,28 +34,6 @@ const promptFramework = async () => {
|
|
|
43
34
|
]);
|
|
44
35
|
return appFramework;
|
|
45
36
|
};
|
|
46
|
-
const promptRpcIntegrations = async () => {
|
|
47
|
-
const { rpcIntegrationType } = await inquirer.prompt([
|
|
48
|
-
{
|
|
49
|
-
type: 'list',
|
|
50
|
-
name: 'rpcIntegrationType',
|
|
51
|
-
message: 'Select the wallet connection type you want to include:',
|
|
52
|
-
choices: Object.values(RPCIntegrationType)
|
|
53
|
-
}
|
|
54
|
-
]);
|
|
55
|
-
return rpcIntegrationType;
|
|
56
|
-
};
|
|
57
|
-
const promptEVMLibrary = async () => {
|
|
58
|
-
const { evmLibrary } = await inquirer.prompt([
|
|
59
|
-
{
|
|
60
|
-
type: 'list',
|
|
61
|
-
name: 'evmLibrary',
|
|
62
|
-
message: 'Choose your preferred EVM library:',
|
|
63
|
-
choices: Object.values(EVMLibrary)
|
|
64
|
-
}
|
|
65
|
-
]);
|
|
66
|
-
return evmLibrary;
|
|
67
|
-
};
|
|
68
37
|
function isValidDirectoryName(dirName) {
|
|
69
38
|
const illegalRe = /[<>:"/\\|?*]/g;
|
|
70
39
|
const windowsReservedRe = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
|
|
@@ -94,20 +63,6 @@ const validateOptions = (options) => {
|
|
|
94
63
|
valid = false;
|
|
95
64
|
}
|
|
96
65
|
}
|
|
97
|
-
if (options.ecosystem) {
|
|
98
|
-
const validEcosystems = Object.values(RPCIntegrationType);
|
|
99
|
-
if (!validEcosystems.includes(options.ecosystem)) {
|
|
100
|
-
console.log(`Invalid Ecosystem '${options.ecosystem}' provided. Framework must be one of: [${validEcosystems.join(', ')}]`);
|
|
101
|
-
valid = false;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (options.library) {
|
|
105
|
-
const validEVMLibraries = Object.values(EVMLibrary);
|
|
106
|
-
if (!validEVMLibraries.includes(options.library)) {
|
|
107
|
-
console.log(`Invalid EVM Library '${options.library}' provided. Framework must be one of: [${validEVMLibraries.join(', ')}]`);
|
|
108
|
-
valid = false;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
66
|
return valid;
|
|
112
67
|
};
|
|
113
68
|
async function runWizard(options) {
|
|
@@ -133,11 +88,7 @@ async function runWizard(options) {
|
|
|
133
88
|
dAppName = promptResult.dAppName;
|
|
134
89
|
}
|
|
135
90
|
const appFramework = options.framework || (await promptFramework());
|
|
136
|
-
|
|
137
|
-
if (appConnectionType === RPCIntegrationType.EVM) {
|
|
138
|
-
appConnectionType = options.library || (await promptEVMLibrary());
|
|
139
|
-
}
|
|
140
|
-
const templateName = `${appFramework}-${appConnectionType}-template`;
|
|
91
|
+
const templateName = `${appFramework}-template`;
|
|
141
92
|
const templatePath = path.join(__dirname, 'templates', templateName);
|
|
142
93
|
const dst = path.join(process.cwd(), dAppName);
|
|
143
94
|
await fs.promises.cp(templatePath, dst, { recursive: true });
|
|
@@ -149,8 +100,6 @@ program
|
|
|
149
100
|
.description('Create a new SEI dApp')
|
|
150
101
|
.option('-n, --name <name>', 'Specify the name of your dApp. Name must be a valid package name.')
|
|
151
102
|
.option('-f, --framework <framework>', `Specify the app framework to use: [${Object.values(FrontendScaffolding).join(', ')}]`)
|
|
152
|
-
.option('-e, --ecosystem <ecosystem>', `Specify the ecosystem to use: [${Object.values(RPCIntegrationType).join(', ')}]`)
|
|
153
|
-
.option('-l, --library <library>', `Specify the EVM library to use: [${Object.values(EVMLibrary).join(', ')}]. Only used if ecosystem chosen is 'EVM'`)
|
|
154
103
|
.action(async (options) => {
|
|
155
104
|
try {
|
|
156
105
|
await runWizard(options);
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sei-js/create-sei",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"module": "dist/main.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./dist/main.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "tsc && cp -r ./templates ./dist/templates",
|
|
9
|
-
"dev": "node --loader ts-node/esm src/main.ts"
|
|
10
|
-
"docs": "typedoc --out docs"
|
|
9
|
+
"dev": "node --loader ts-node/esm src/main.ts"
|
|
11
10
|
},
|
|
12
11
|
"dependencies": {
|
|
13
12
|
"boxen": "^7.1.1",
|
package/src/main.ts
CHANGED
|
@@ -30,20 +30,9 @@ enum FrontendScaffolding {
|
|
|
30
30
|
Next = 'next'
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export enum RPCIntegrationType {
|
|
34
|
-
EVM = 'evm',
|
|
35
|
-
CosmJS = 'cosmos'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export enum EVMLibrary {
|
|
39
|
-
Wagmi = 'wagmi'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
33
|
interface WizardOptions {
|
|
43
34
|
name?: string;
|
|
44
35
|
framework?: FrontendScaffolding;
|
|
45
|
-
ecosystem?: RPCIntegrationType;
|
|
46
|
-
library?: EVMLibrary;
|
|
47
36
|
}
|
|
48
37
|
|
|
49
38
|
const promptFramework = async () => {
|
|
@@ -59,32 +48,6 @@ const promptFramework = async () => {
|
|
|
59
48
|
return appFramework;
|
|
60
49
|
};
|
|
61
50
|
|
|
62
|
-
const promptRpcIntegrations = async () => {
|
|
63
|
-
const { rpcIntegrationType } = await inquirer.prompt([
|
|
64
|
-
{
|
|
65
|
-
type: 'list',
|
|
66
|
-
name: 'rpcIntegrationType',
|
|
67
|
-
message: 'Select the wallet connection type you want to include:',
|
|
68
|
-
choices: Object.values(RPCIntegrationType)
|
|
69
|
-
}
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
return rpcIntegrationType;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
const promptEVMLibrary = async () => {
|
|
76
|
-
const { evmLibrary } = await inquirer.prompt([
|
|
77
|
-
{
|
|
78
|
-
type: 'list',
|
|
79
|
-
name: 'evmLibrary',
|
|
80
|
-
message: 'Choose your preferred EVM library:',
|
|
81
|
-
choices: Object.values(EVMLibrary)
|
|
82
|
-
}
|
|
83
|
-
]);
|
|
84
|
-
|
|
85
|
-
return evmLibrary;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
51
|
function isValidDirectoryName(dirName) {
|
|
89
52
|
const illegalRe = /[<>:"/\\|?*]/g;
|
|
90
53
|
const windowsReservedRe = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
|
|
@@ -121,22 +84,6 @@ const validateOptions = (options: WizardOptions): boolean => {
|
|
|
121
84
|
}
|
|
122
85
|
}
|
|
123
86
|
|
|
124
|
-
if (options.ecosystem) {
|
|
125
|
-
const validEcosystems = Object.values(RPCIntegrationType);
|
|
126
|
-
if (!validEcosystems.includes(options.ecosystem)) {
|
|
127
|
-
console.log(`Invalid Ecosystem '${options.ecosystem}' provided. Framework must be one of: [${validEcosystems.join(', ')}]`);
|
|
128
|
-
valid = false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
if (options.library) {
|
|
133
|
-
const validEVMLibraries = Object.values(EVMLibrary);
|
|
134
|
-
if (!validEVMLibraries.includes(options.library)) {
|
|
135
|
-
console.log(`Invalid EVM Library '${options.library}' provided. Framework must be one of: [${validEVMLibraries.join(', ')}]`);
|
|
136
|
-
valid = false;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
87
|
return valid;
|
|
141
88
|
};
|
|
142
89
|
|
|
@@ -166,12 +113,8 @@ async function runWizard(options: WizardOptions): Promise<void> {
|
|
|
166
113
|
}
|
|
167
114
|
|
|
168
115
|
const appFramework = options.framework || (await promptFramework());
|
|
169
|
-
let appConnectionType = options.ecosystem || (await promptRpcIntegrations());
|
|
170
|
-
if (appConnectionType === RPCIntegrationType.EVM) {
|
|
171
|
-
appConnectionType = options.library || (await promptEVMLibrary());
|
|
172
|
-
}
|
|
173
116
|
|
|
174
|
-
const templateName = `${appFramework}
|
|
117
|
+
const templateName = `${appFramework}-template`;
|
|
175
118
|
const templatePath = path.join(__dirname, 'templates', templateName);
|
|
176
119
|
const dst = path.join(process.cwd(), dAppName);
|
|
177
120
|
await fs.promises.cp(templatePath, dst, { recursive: true });
|
|
@@ -185,8 +128,6 @@ program
|
|
|
185
128
|
.description('Create a new SEI dApp')
|
|
186
129
|
.option('-n, --name <name>', 'Specify the name of your dApp. Name must be a valid package name.')
|
|
187
130
|
.option('-f, --framework <framework>', `Specify the app framework to use: [${Object.values(FrontendScaffolding).join(', ')}]`)
|
|
188
|
-
.option('-e, --ecosystem <ecosystem>', `Specify the ecosystem to use: [${Object.values(RPCIntegrationType).join(', ')}]`)
|
|
189
|
-
.option('-l, --library <library>', `Specify the EVM library to use: [${Object.values(EVMLibrary).join(', ')}]. Only used if ecosystem chosen is 'EVM'`)
|
|
190
131
|
.action(async (options: WizardOptions) => {
|
|
191
132
|
try {
|
|
192
133
|
await runWizard(options);
|
package/tsconfig.json
CHANGED
|
@@ -15,11 +15,5 @@
|
|
|
15
15
|
"noUnusedParameters": true,
|
|
16
16
|
"noFallthroughCasesInSwitch": true
|
|
17
17
|
},
|
|
18
|
-
"include": ["src"]
|
|
19
|
-
"typedocOptions": {
|
|
20
|
-
"readme": "./README.md",
|
|
21
|
-
"name": "create-sei",
|
|
22
|
-
"entryPoints": ["src/main.ts"],
|
|
23
|
-
"exclude": ["node_modules"]
|
|
24
|
-
}
|
|
18
|
+
"include": ["src"]
|
|
25
19
|
}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# Next-Cosmos Sei App Template
|
|
2
|
-
|
|
3
|
-
This repo provides a basic framework for an application that interacts with Sei via Cosmos endpoints.
|
|
4
|
-
|
|
5
|
-
## Getting Started
|
|
6
|
-
|
|
7
|
-
Install dependencies by running
|
|
8
|
-
```bash
|
|
9
|
-
npm install
|
|
10
|
-
#or
|
|
11
|
-
yarn
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Then, run the development server:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npm run dev
|
|
18
|
-
# or
|
|
19
|
-
yarn dev
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
|
|
23
|
-
|
|
24
|
-
You can start editing the page by modifying `src/app/page.tsx`. The page auto-updates as you edit the file.
|
|
25
|
-
|
|
26
|
-
## Repository Basics
|
|
27
|
-
This repository includes basic features that allow you to connect to a wallet and use the wallet to interact with the chain.
|
|
28
|
-
|
|
29
|
-
Additionally, basic examples and links to documentation are provided on the example homepage in `src/app/components/Homepage`.
|
|
30
|
-
|
|
31
|
-
### Web3 Provider
|
|
32
|
-
This component is a Sei specific wrapper around CosmosKit Provider that should wrap the application. Wrapping the application in this provider will enable it to access hooks in CosmosKit. These hooks are enable connection to a wallet and interaction with the chain.
|
|
33
|
-
|
|
34
|
-
To change the list of supported wallets, as well as connection configurations you can modify the `src/app/components/Web3Provider.tsx` component.
|
|
35
|
-
|
|
36
|
-
### Wallet Connect Button
|
|
37
|
-
This component provides an interface to connect your wallet to the application. It utilizies CosmosKit's hooks and modal.
|
|
38
|
-
|
|
39
|
-
To customize the wallet connect button or connection logic, you can modify the `src/app/components/WalletConnectButton.tsx` component.
|
|
40
|
-
|
|
41
|
-
### Changing the Chain
|
|
42
|
-
This application connects to the arctic-1 devnet by default
|
|
43
|
-
|
|
44
|
-
To change the chain the app connects to, edit the `selectedChain` variable in the `chain.ts` file in `src/app/constants`
|
|
45
|
-
|
|
46
|
-
## Learn More
|
|
47
|
-
|
|
48
|
-
### Next.js
|
|
49
|
-
To learn more about Next.js, take a look at the following resources:
|
|
50
|
-
|
|
51
|
-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
|
|
52
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
53
|
-
|
|
54
|
-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
|
|
55
|
-
|
|
56
|
-
## Deploy on Vercel
|
|
57
|
-
|
|
58
|
-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
|
|
59
|
-
|
|
60
|
-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "template-next-cosmos-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
|
-
"@cosmos-kit/react": "^2.17.0",
|
|
13
|
-
"@interchain-ui/react": "1.23.21",
|
|
14
|
-
"@interchain-ui/react-no-ssr": "^0.1.4",
|
|
15
|
-
"@sei-js/cosmjs": "^1.0.7",
|
|
16
|
-
"@tanstack/react-query": "^5.45.1",
|
|
17
|
-
"chain-registry": "^1.63.5",
|
|
18
|
-
"cosmos-kit": "^2.18.0",
|
|
19
|
-
"next": "14.2.4",
|
|
20
|
-
"pino-pretty": "^11.2.1",
|
|
21
|
-
"react": "^18",
|
|
22
|
-
"react-dom": "^18"
|
|
23
|
-
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@types/node": "^20",
|
|
26
|
-
"@types/react": "^18",
|
|
27
|
-
"@types/react-dom": "^18",
|
|
28
|
-
"eslint-config-next": "14.2.4",
|
|
29
|
-
"typescript": "^5"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-11-8-18-19-18zm-10 15c2-4 5-7 10-7s8 3 9 7h-19zm-39 3c0 6 4 10 10 10 4 0 7-2 9-5l8 5c-3 5-9 8-17 8-11 0-19-7-19-18s8-18 19-18c8 0 14 3 17 8l-8 5c-2-3-5-5-9-5-6 0-10 4-10 10zm83-29v46h-9V5h9zM37 0l37 64H0L37 0zm92 5-27 48L74 5h10l18 30 17-30h10zm59 12v10l-3-1c-6 0-10 4-10 10v15h-9V17h9v9c0-5 6-9 13-9z"/></svg>
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import { getCosmWasmClient, getQueryClient, getSigningCosmWasmClient, getStargateClient } from '@sei-js/cosmjs';
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { defaultUrls, selectedChain } from '../../constants';
|
|
4
|
-
import { useChain } from '@cosmos-kit/react';
|
|
5
|
-
|
|
6
|
-
import './Homepage.css';
|
|
7
|
-
type ExampleProps = {
|
|
8
|
-
chainId: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function Examples({ chainId }: ExampleProps) {
|
|
12
|
-
const [balance, setBalance] = useState(0);
|
|
13
|
-
const [pool, setPool] = useState({ bonded_tokens: 0, not_bonded_tokens: 0 });
|
|
14
|
-
const [count, setCount] = useState(0);
|
|
15
|
-
|
|
16
|
-
const { address, getOfflineSignerAmino } = useChain(selectedChain.chain_name);
|
|
17
|
-
|
|
18
|
-
// Example of using the query client to query Sei modules
|
|
19
|
-
const getStakingPool = async () => {
|
|
20
|
-
const queryClient = await getQueryClient(defaultUrls[chainId].rest);
|
|
21
|
-
const result = await queryClient.cosmos.staking.v1beta1.pool({});
|
|
22
|
-
setPool(result.pool);
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const renderStakingPoolExample = () => {
|
|
26
|
-
return (
|
|
27
|
-
<div className="card">
|
|
28
|
-
<div className="card-header">
|
|
29
|
-
<p className="card__title">Staking Pool</p>
|
|
30
|
-
<small className="card__description">
|
|
31
|
-
<a href="https://sei-protocol.github.io/sei-js/functions/cosmjs.getQueryClient.html" target="_blank">
|
|
32
|
-
Sei QueryClient
|
|
33
|
-
</a>{' '}
|
|
34
|
-
query example
|
|
35
|
-
</small>
|
|
36
|
-
</div>
|
|
37
|
-
<div className="card-body">
|
|
38
|
-
<div className="content-background space-between">
|
|
39
|
-
<small>Bonded Tokens</small>
|
|
40
|
-
<p>{pool ? pool.bonded_tokens : '---'} SEI</p>
|
|
41
|
-
</div>
|
|
42
|
-
<div className="content-background space-between">
|
|
43
|
-
<small>Unbonded Tokens</small>
|
|
44
|
-
<p>{pool ? pool.not_bonded_tokens : '---'} SEI</p>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
<div className="card-footer">
|
|
48
|
-
<button onClick={getStakingPool}>Fetch Staking Data</button>
|
|
49
|
-
</div>
|
|
50
|
-
</div>
|
|
51
|
-
);
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const getBalanceStargate = async () => {
|
|
55
|
-
if (!address) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
const queryClient = await getStargateClient(defaultUrls[chainId].rpc);
|
|
59
|
-
const useiBalance = await queryClient.getBalance(address, 'usei');
|
|
60
|
-
const seiBalance = Number(useiBalance.amount) / 1000000;
|
|
61
|
-
setBalance(seiBalance);
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const renderBalanceExample = () => {
|
|
65
|
-
return (
|
|
66
|
-
<div className="card">
|
|
67
|
-
<div className="card-header">
|
|
68
|
-
<p className="card__title">Wallet Balance</p>
|
|
69
|
-
<small className="card__description">
|
|
70
|
-
<a href="https://cosmos.github.io/cosmjs/latest/stargate/classes/StargateClient.html" target="_blank">
|
|
71
|
-
Stargate Client
|
|
72
|
-
</a>{' '}
|
|
73
|
-
query example
|
|
74
|
-
</small>
|
|
75
|
-
</div>
|
|
76
|
-
<div className="card-body">
|
|
77
|
-
<div className="content-background space-between">
|
|
78
|
-
<small>SEI</small>
|
|
79
|
-
<p>{balance ? balance : '---'} SEI</p>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
<div className="card-footer">
|
|
83
|
-
<button onClick={getBalanceStargate}>Fetch balance</button>
|
|
84
|
-
</div>
|
|
85
|
-
</div>
|
|
86
|
-
);
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
const fetchCount = async () => {
|
|
90
|
-
const cosmWasmClient = await getCosmWasmClient(defaultUrls[chainId].rpc);
|
|
91
|
-
console.log(cosmWasmClient);
|
|
92
|
-
const CONTRACT_ADDRESS = 'sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m';
|
|
93
|
-
const response = await cosmWasmClient.queryContractSmart(CONTRACT_ADDRESS, {
|
|
94
|
-
get_count: {}
|
|
95
|
-
});
|
|
96
|
-
const result = response?.count;
|
|
97
|
-
if (result) {
|
|
98
|
-
setCount(result);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const incrementCounter = async () => {
|
|
103
|
-
if (!address) {
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const offlineSigner = await getOfflineSignerAmino();
|
|
107
|
-
const signingCosmWasmClient = await getSigningCosmWasmClient(defaultUrls[chainId].rpc, offlineSigner);
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const senderAddress = address;
|
|
111
|
-
const CONTRACT_ADDRESS = 'sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m';
|
|
112
|
-
|
|
113
|
-
// Build message content
|
|
114
|
-
const msg = { increment: {} };
|
|
115
|
-
|
|
116
|
-
// Define gas price and limit
|
|
117
|
-
const fee = {
|
|
118
|
-
amount: [{ amount: '20000', denom: 'usei' }],
|
|
119
|
-
gas: '200000'
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
// Call smart contract execute msg
|
|
123
|
-
await signingCosmWasmClient?.execute(senderAddress, CONTRACT_ADDRESS, msg, fee);
|
|
124
|
-
|
|
125
|
-
await fetchCount();
|
|
126
|
-
} catch (error) {
|
|
127
|
-
console.log(error);
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
const renderCounterContractExample = () => {
|
|
132
|
-
return (
|
|
133
|
-
<div className="card">
|
|
134
|
-
<div className="card-header">
|
|
135
|
-
<p className="card__title">Smart contract interaction</p>
|
|
136
|
-
<small>
|
|
137
|
-
<a href="https://cosmos.github.io/cosmjs/latest/cosmwasm-stargate/classes/SigningCosmWasmClient.html" target="_blank">
|
|
138
|
-
CosmWasm Clients
|
|
139
|
-
</a>{' '}
|
|
140
|
-
example of smart contract interaction
|
|
141
|
-
</small>
|
|
142
|
-
</div>
|
|
143
|
-
<div className="card-body">
|
|
144
|
-
<div className="content-background space-between">
|
|
145
|
-
<small>Count</small>
|
|
146
|
-
<p>{count}</p>
|
|
147
|
-
<button className="small outline" onClick={incrementCounter}>
|
|
148
|
-
Increase
|
|
149
|
-
</button>
|
|
150
|
-
</div>
|
|
151
|
-
</div>
|
|
152
|
-
<div className="card-footer">
|
|
153
|
-
<button onClick={fetchCount}>Fetch count</button>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
return (
|
|
160
|
-
<div className="grid">
|
|
161
|
-
{renderBalanceExample()}
|
|
162
|
-
{renderStakingPoolExample()}
|
|
163
|
-
{renderCounterContractExample()}
|
|
164
|
-
</div>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export default Examples;
|