@sei-js/create-sei 0.0.0 → 0.0.1

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 (93) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/README.md +7 -11
  3. package/package.json +18 -26
  4. package/.eslintignore +0 -2
  5. package/dist/main.js +0 -161
  6. package/dist/templates/next-cosmos-template/.eslintrc.json +0 -3
  7. package/dist/templates/next-cosmos-template/README.md +0 -60
  8. package/dist/templates/next-cosmos-template/next-env.d.ts +0 -5
  9. package/dist/templates/next-cosmos-template/next.config.mjs +0 -14
  10. package/dist/templates/next-cosmos-template/package.json +0 -31
  11. package/dist/templates/next-cosmos-template/public/next.svg +0 -1
  12. package/dist/templates/next-cosmos-template/public/sei-logotype.svg +0 -15
  13. package/dist/templates/next-cosmos-template/public/vercel.svg +0 -1
  14. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Examples.tsx +0 -177
  15. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.css +0 -156
  16. package/dist/templates/next-cosmos-template/src/app/components/Homepage/Homepage.tsx +0 -110
  17. package/dist/templates/next-cosmos-template/src/app/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
  18. package/dist/templates/next-cosmos-template/src/app/components/Web3Provider.tsx +0 -39
  19. package/dist/templates/next-cosmos-template/src/app/components/index.ts +0 -3
  20. package/dist/templates/next-cosmos-template/src/app/constants/chain.ts +0 -16
  21. package/dist/templates/next-cosmos-template/src/app/constants/index.ts +0 -1
  22. package/dist/templates/next-cosmos-template/src/app/favicon.ico +0 -0
  23. package/dist/templates/next-cosmos-template/src/app/index.css +0 -171
  24. package/dist/templates/next-cosmos-template/src/app/layout.tsx +0 -21
  25. package/dist/templates/next-cosmos-template/src/app/page.tsx +0 -17
  26. package/dist/templates/next-cosmos-template/tsconfig.json +0 -26
  27. package/dist/templates/next-cosmos-template/yarn.lock +0 -9814
  28. package/dist/templates/next-wagmi-template/.eslintrc.json +0 -3
  29. package/dist/templates/next-wagmi-template/README.md +0 -58
  30. package/dist/templates/next-wagmi-template/next-env.d.ts +0 -5
  31. package/dist/templates/next-wagmi-template/next.config.mjs +0 -4
  32. package/dist/templates/next-wagmi-template/package.json +0 -30
  33. package/dist/templates/next-wagmi-template/public/sei-logotype.svg +0 -15
  34. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Examples.tsx +0 -271
  35. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.css +0 -156
  36. package/dist/templates/next-wagmi-template/src/app/components/Homepage/Homepage.tsx +0 -113
  37. package/dist/templates/next-wagmi-template/src/app/components/Web3Provider.tsx +0 -73
  38. package/dist/templates/next-wagmi-template/src/app/components/index.ts +0 -2
  39. package/dist/templates/next-wagmi-template/src/app/constants/chain.ts +0 -7
  40. package/dist/templates/next-wagmi-template/src/app/constants/index.ts +0 -1
  41. package/dist/templates/next-wagmi-template/src/app/favicon.ico +0 -0
  42. package/dist/templates/next-wagmi-template/src/app/index.css +0 -171
  43. package/dist/templates/next-wagmi-template/src/app/layout.tsx +0 -21
  44. package/dist/templates/next-wagmi-template/src/app/page.tsx +0 -21
  45. package/dist/templates/next-wagmi-template/tsconfig.json +0 -26
  46. package/dist/templates/next-wagmi-template/yarn.lock +0 -4809
  47. package/dist/templates/vite-cosmos-template/.eslintrc.cjs +0 -18
  48. package/dist/templates/vite-cosmos-template/README.md +0 -72
  49. package/dist/templates/vite-cosmos-template/favicon.ico +0 -0
  50. package/dist/templates/vite-cosmos-template/index.html +0 -16
  51. package/dist/templates/vite-cosmos-template/package.json +0 -35
  52. package/dist/templates/vite-cosmos-template/public/sei-logotype.svg +0 -15
  53. package/dist/templates/vite-cosmos-template/src/App.tsx +0 -16
  54. package/dist/templates/vite-cosmos-template/src/assets/react.svg +0 -1
  55. package/dist/templates/vite-cosmos-template/src/components/Homepage/Examples.tsx +0 -177
  56. package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.css +0 -156
  57. package/dist/templates/vite-cosmos-template/src/components/Homepage/Homepage.tsx +0 -102
  58. package/dist/templates/vite-cosmos-template/src/components/WalletConnectButton/WalletConnectButton.tsx +0 -26
  59. package/dist/templates/vite-cosmos-template/src/components/Web3Provider.tsx +0 -45
  60. package/dist/templates/vite-cosmos-template/src/components/index.ts +0 -4
  61. package/dist/templates/vite-cosmos-template/src/constants/chain.ts +0 -16
  62. package/dist/templates/vite-cosmos-template/src/constants/index.ts +0 -1
  63. package/dist/templates/vite-cosmos-template/src/index.css +0 -171
  64. package/dist/templates/vite-cosmos-template/src/main.tsx +0 -12
  65. package/dist/templates/vite-cosmos-template/src/vite-env.d.ts +0 -1
  66. package/dist/templates/vite-cosmos-template/tsconfig.app.json +0 -27
  67. package/dist/templates/vite-cosmos-template/tsconfig.json +0 -11
  68. package/dist/templates/vite-cosmos-template/tsconfig.node.json +0 -14
  69. package/dist/templates/vite-cosmos-template/vite.config.ts +0 -7
  70. package/dist/templates/vite-cosmos-template/yarn.lock +0 -9323
  71. package/dist/templates/vite-wagmi-template/.eslintrc.cjs +0 -18
  72. package/dist/templates/vite-wagmi-template/README.md +0 -72
  73. package/dist/templates/vite-wagmi-template/favicon.ico +0 -0
  74. package/dist/templates/vite-wagmi-template/index.html +0 -12
  75. package/dist/templates/vite-wagmi-template/package.json +0 -33
  76. package/dist/templates/vite-wagmi-template/public/sei-logotype.svg +0 -15
  77. package/dist/templates/vite-wagmi-template/src/App.tsx +0 -22
  78. package/dist/templates/vite-wagmi-template/src/assets/react.svg +0 -1
  79. package/dist/templates/vite-wagmi-template/src/components/Homepage/Examples.tsx +0 -269
  80. package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.css +0 -156
  81. package/dist/templates/vite-wagmi-template/src/components/Homepage/Homepage.tsx +0 -106
  82. package/dist/templates/vite-wagmi-template/src/components/Web3Provider.tsx +0 -71
  83. package/dist/templates/vite-wagmi-template/src/constants/chain.ts +0 -6
  84. package/dist/templates/vite-wagmi-template/src/constants/index.ts +0 -1
  85. package/dist/templates/vite-wagmi-template/src/index.css +0 -170
  86. package/dist/templates/vite-wagmi-template/src/main.tsx +0 -12
  87. package/dist/templates/vite-wagmi-template/src/vite-env.d.ts +0 -1
  88. package/dist/templates/vite-wagmi-template/tsconfig.app.json +0 -27
  89. package/dist/templates/vite-wagmi-template/tsconfig.json +0 -11
  90. package/dist/templates/vite-wagmi-template/tsconfig.node.json +0 -14
  91. package/dist/templates/vite-wagmi-template/vite.config.ts +0 -10
  92. package/dist/templates/vite-wagmi-template/yarn.lock +0 -4603
  93. package/eslintrc.json +0 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sei-js/create-sei-app
2
2
 
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d6e74ed: Update package structure and building of all @sei-js packages
8
+
3
9
  ## 0.0.0
4
10
 
5
11
  ### Major Changes
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Create Sei App
2
2
 
3
- This repository contains various templates for kick starting a Sei application out of the box, as well as a CLI (Command Line Interface) tool that can be used to create projects using the given templates.
3
+ This repository contains various templates for kick-starting a Sei application out of the box, as well as a CLI (Command Line Interface) tool that can be used to create projects using the given templates.
4
4
 
5
5
  You can use either:
6
6
  - Next.js
@@ -8,15 +8,11 @@ You can use either:
8
8
 
9
9
  to scaffold your project.
10
10
 
11
- ## Getting Started
12
- 1. Install dependencies by running `yarn` or `npm`
11
+ ## Scaffold your project
12
+ Simply run `npx @sei-js/create-sei app` to run the setup wizard and choose the template you want to use.
13
13
 
14
- 2. Install this package globally by running `npm install -g @sei-js/create-sei`
15
-
16
- 3. Run `create-sei` and follow the prompts
17
-
18
- ## EVM Applications (Reccommended)
19
- Building on our EVM (Ethereum Virtual Machine) is the easiest way to get your dApp kick started on Sei! The mature EVM ecosystem provides many tools out of the box to help developers build faster, including deploying smart contracts and other helpful connection libraries.
14
+ ## EVM Applications (Recommended)
15
+ Building on our EVM (Ethereum Virtual Machine) is the easiest way to get your dApp kick-started on Sei! The mature EVM ecosystem provides many tools out of the box to help developers build faster, including deploying smart contracts and other helpful connection libraries.
20
16
 
21
17
  This tool will offer multiple variants of EVM tooling, including
22
18
  - [Wagmi](https://wagmi.sh/core/getting-started) ([Viem](https://viem.sh/)): Recommended
@@ -24,7 +20,7 @@ This tool will offer multiple variants of EVM tooling, including
24
20
 
25
21
  Both variants use [@sei-js/evm](https://sei-protocol.github.io/sei-js/modules/evm.html)
26
22
 
27
- If you are new to Web3 development, we reccommend using Wagmi since it provides helpful hooks out of the box.
23
+ If you are new to Web3 development, we recommend using Wagmi since it provides helpful hooks out of the box.
28
24
 
29
25
  ## Cosmos Applications
30
26
  Cosmos based Sei Applications interact with the CosmWasm VM on the chain. Use this if you are a seasoned CosmWasm developer, or if you intend to interact with CosmWasm Smart Contracts, as well as other chains in the Cosmos ecosystem.
@@ -37,4 +33,4 @@ Cosmos Applications use
37
33
  - [Cosmjs](https://github.com/cosmos/cosmjs)
38
34
 
39
35
  ## Contributing
40
- We love contributions from the amazing Sei community! If you have a dApp template to contribute, do make a Pull Request into the [sei-js](https://github.com/sei-protocol/sei-js) repository.
36
+ We love contributions from the amazing Sei community! If you have a dApp template to contribute, do make a Pull Request into the [sei-js](https://github.com/sei-protocol/sei-js) repository.
package/package.json CHANGED
@@ -1,28 +1,20 @@
1
1
  {
2
- "name": "@sei-js/create-sei",
3
- "version": "0.0.0",
4
- "module": "dist/main.js",
5
- "type": "module",
6
- "bin": {
7
- "create-sei": "./dist/main.js"
8
- },
9
- "scripts": {
10
- "build": "tsc && cp -r ./templates ./dist/templates",
11
- "dev": "node --loader ts-node/esm src/main.ts",
12
- "lint": "eslint --ext .ts"
13
- },
14
- "dependencies": {
15
- "boxen": "^7.1.1",
16
- "commander": "^12.1.0",
17
- "inquirer": "^9.2.15"
18
- },
19
- "devDependencies": {
20
- "@esbuild-plugins/node-globals-polyfill": "^0.2.3",
21
- "@tanstack/react-query": "^5.25.0",
22
- "@types/boxen": "^3.0.1",
23
- "@types/inquirer": "^9.0.7",
24
- "autoprefixer": "^10.4.18",
25
- "copyfiles": "^2.4.1",
26
- "degit": "^2.8.4"
27
- }
2
+ "name": "@sei-js/create-sei",
3
+ "version": "0.0.1",
4
+ "module": "dist/main.js",
5
+ "type": "module",
6
+ "bin": "./dist/main.js",
7
+ "scripts": {
8
+ "build": "tsc && cp -r ./templates ./dist/templates",
9
+ "dev": "node --loader ts-node/esm src/main.ts"
10
+ },
11
+ "dependencies": {
12
+ "boxen": "^7.1.1",
13
+ "commander": "^12.1.0",
14
+ "inquirer": "^9.2.15"
15
+ },
16
+ "devDependencies": {
17
+ "@types/boxen": "^3.0.1",
18
+ "@types/inquirer": "^9.0.7"
19
+ }
28
20
  }
package/.eslintignore DELETED
@@ -1,2 +0,0 @@
1
- node_modules
2
- dist
package/dist/main.js DELETED
@@ -1,161 +0,0 @@
1
- #!/usr/bin/env node
2
- import inquirer from 'inquirer';
3
- import boxen from 'boxen';
4
- import path from 'path';
5
- import fs from 'fs';
6
- import { fileURLToPath } from 'url';
7
- import { dirname } from 'path';
8
- import { Command } from 'commander';
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = dirname(__filename);
11
- const program = new Command();
12
- // Print welcome message
13
- const printWelcomeMessage = () => {
14
- console.log(boxen('Welcome to the SEI DApp Generator!', {
15
- padding: 1,
16
- margin: 1,
17
- borderStyle: 'double',
18
- borderColor: '#932C23'
19
- }));
20
- };
21
- var FrontendScaffolding;
22
- (function (FrontendScaffolding) {
23
- FrontendScaffolding["Vite"] = "vite";
24
- FrontendScaffolding["Next"] = "next";
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
- const promptFramework = async () => {
36
- const { appFramework } = await inquirer.prompt([
37
- {
38
- type: 'list',
39
- name: 'appFramework',
40
- message: 'Select an app framework to use?',
41
- choices: Object.values(FrontendScaffolding)
42
- }
43
- ]);
44
- return appFramework;
45
- };
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
- function isValidDirectoryName(dirName) {
69
- const illegalRe = /[<>:"/\\|?*\x00-\x1F]/g;
70
- const windowsReservedRe = /^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i;
71
- const trailingRe = /[. ]+$/;
72
- const validNpmPackageRe = /^(?:@[a-z0-9-*~][a-z0-9-*._~]*)?[a-z0-9-~][a-z0-9-._~]*$/;
73
- if (typeof dirName !== 'string' || dirName.length === 0) {
74
- return false;
75
- }
76
- if (illegalRe.test(dirName) || windowsReservedRe.test(dirName) || trailingRe.test(dirName) || !validNpmPackageRe.test(dirName)) {
77
- return false;
78
- }
79
- return true;
80
- }
81
- const validateOptions = (options) => {
82
- let valid = true;
83
- if (options.name) {
84
- if (!isValidDirectoryName(options.name)) {
85
- console.log('Invalid package name. Please use a valid npm package name.');
86
- valid = false;
87
- }
88
- }
89
- if (options.framework) {
90
- const validFrameworks = Object.values(FrontendScaffolding);
91
- if (!validFrameworks.includes(options.framework)) {
92
- console.log(`Invalid Framework '${options.framework}' provided. Framework must be one of: [${validFrameworks.join(', ')}]`);
93
- valid = false;
94
- }
95
- }
96
- if (options.ecosystem) {
97
- const validEcosystems = Object.values(RPCIntegrationType);
98
- if (!validEcosystems.includes(options.ecosystem)) {
99
- console.log(`Invalid Ecosystem '${options.ecosystem}' provided. Framework must be one of: [${validEcosystems.join(', ')}]`);
100
- valid = false;
101
- }
102
- }
103
- if (options.library) {
104
- const validEVMLibraries = Object.values(EVMLibrary);
105
- if (!validEVMLibraries.includes(options.library)) {
106
- console.log(`Invalid EVM Library '${options.library}' provided. Framework must be one of: [${validEVMLibraries.join(', ')}]`);
107
- valid = false;
108
- }
109
- }
110
- return valid;
111
- };
112
- async function runWizard(options) {
113
- if (!validateOptions(options)) {
114
- return;
115
- }
116
- printWelcomeMessage();
117
- let dAppName = '';
118
- if (options.name) {
119
- dAppName = options.name;
120
- }
121
- else {
122
- const promptResult = await inquirer.prompt([
123
- {
124
- type: 'input',
125
- name: 'dAppName',
126
- message: 'What is your dApp (project) name?',
127
- validate: (input) => {
128
- return isValidDirectoryName(input) || 'Invalid package name. Please use a valid npm package name.';
129
- }
130
- }
131
- ]);
132
- dAppName = promptResult.dAppName;
133
- }
134
- const appFramework = options.framework || await promptFramework();
135
- let appConnectionType = options.ecosystem || await promptRpcIntegrations();
136
- if (appConnectionType == RPCIntegrationType.EVM) {
137
- appConnectionType = options.library || await promptEVMLibrary();
138
- }
139
- const templateName = `${appFramework}-${appConnectionType}-template`;
140
- const templatePath = path.join(__dirname, 'templates', templateName);
141
- const dst = path.join(process.cwd(), dAppName);
142
- await fs.promises.cp(templatePath, dst, { recursive: true });
143
- console.log(`Project setup complete! Using template ${templateName}\n`);
144
- console.log(`To start your app, run: \n > cd ${dAppName} \n > yarn \n > yarn dev\n`);
145
- }
146
- program
147
- .command('app')
148
- .description('Create a new SEI dApp')
149
- .option('-n, --name <name>', `Specify the name of your dApp. Name must be a valid package name.`)
150
- .option('-f, --framework <framework>', `Specify the app framework to use: [${Object.values(FrontendScaffolding).join(', ')}]`)
151
- .option('-e, --ecosystem <ecosystem>', `Specify the ecosystem to use: [${Object.values(RPCIntegrationType).join(', ')}]`)
152
- .option('-l, --library <library>', `Specify the EVM library to use: [${Object.values(EVMLibrary).join(', ')}]. Only used if ecosystem chosen is 'EVM'`)
153
- .action(async (options) => {
154
- try {
155
- await runWizard(options);
156
- }
157
- catch (error) {
158
- console.error('An error occurred:', error);
159
- }
160
- });
161
- program.parse(process.argv);
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "next/core-web-vitals"
3
- }
@@ -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,5 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/image-types/global" />
3
-
4
- // NOTE: This file should not be edited
5
- // see https://nextjs.org/docs/basic-features/typescript for more information.
@@ -1,14 +0,0 @@
1
- /** @type {import('next').NextConfig} */
2
- const nextConfig = {
3
- images: {
4
- remotePatterns: [
5
- {
6
- protocol: 'https',
7
- hostname: 'cdn.sei.io',
8
- port: '',
9
- },
10
- ],
11
- },
12
- };
13
-
14
- export default nextConfig;
@@ -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,15 +0,0 @@
1
- <svg width="86" height="32" viewBox="0 0 86 32" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <g id="sei-logotype" clip-path="url(#clip0_1_53)">
3
- <path id="Vector" fill-rule="evenodd" clip-rule="evenodd" d="M15.8553 31.8727C20.5775 31.8727 24.8201 29.8188 27.7383 26.5556C26.3808 25.3758 24.3351 25.3041 22.8899 26.4702L22.6138 26.693C19.9677 28.8281 16.1121 28.5128 13.8481 25.9762C12.6133 24.5927 10.4986 24.4514 9.09076 25.6584L5.90753 28.3874C8.63393 30.5685 12.0923 31.8727 15.8553 31.8727ZM21.0223 24.1558C23.5427 22.1221 27.0852 22.195 29.5092 24.1592C30.9581 21.7586 31.7917 18.9448 31.7917 15.9363C31.7917 12.5934 30.7624 9.49098 29.0035 6.9285C27.8696 6.68701 26.6405 6.96905 25.7075 7.79581L25.442 8.03112C22.8973 10.2861 19.0312 10.1491 16.6526 7.71961C15.3553 6.39459 13.2362 6.35106 11.8856 7.62174L8.1813 11.1067L6.1435 8.94069L9.84784 5.45571C12.3779 3.07544 16.3473 3.15694 18.7775 5.63906C20.0473 6.936 22.1112 7.00916 23.4696 5.80535L23.7351 5.57004C24.5597 4.83932 25.5138 4.3467 26.5127 4.08762C23.6893 1.54648 19.9529 0 15.8553 0C7.76541 0 1.08344 6.02803 0.0559658 13.8374C2.51319 12.6583 5.54417 13.112 7.5477 15.1637C8.81252 16.4589 10.8491 16.5956 12.2757 15.4811L14.3469 13.863C16.9498 11.8295 20.6294 11.9279 23.1199 14.0978L27.1522 17.6109L25.1986 19.8531L21.1663 16.34C19.7502 15.1062 17.6579 15.0502 16.1777 16.2066L14.1066 17.8246C11.4855 19.8723 7.74378 19.6211 5.41997 17.2414C4.06868 15.8577 1.85863 15.8094 0.448196 17.1329L0 17.5534C0.335417 20.8819 1.69509 23.9081 3.75904 26.3121L7.15509 23.4006C9.79233 21.1396 13.7538 21.4042 16.0669 23.9959C17.2755 25.3501 19.3337 25.5184 20.7463 24.3786L21.0223 24.1558Z" fill="url(#paint0_linear_1_53)"/>
4
- <path id="Union" fill-rule="evenodd" clip-rule="evenodd" d="M85.5173 2.22307C85.5173 3.44217 84.5132 4.44614 83.2944 4.44614C82.0751 4.44614 81.071 3.44217 81.071 2.22307C81.071 0.968111 82.0751 0 83.2944 0C84.5132 0 85.5173 0.968111 85.5173 2.22307ZM85.0152 26.139H81.6448V8.60541H85.0152V26.139ZM43.2705 21.0474C43.2705 24.382 45.888 26.5692 50.0114 26.5692C54.1707 26.5692 57.039 24.4537 57.039 21.1191C57.039 18.5016 55.5692 17.1391 52.593 16.422L49.5095 15.669C47.7884 15.2388 46.9278 14.4499 46.9278 13.2667C46.9278 11.6532 48.1111 10.7209 50.2266 10.7209C52.2703 10.7209 53.4536 11.8324 53.5253 13.5894H56.7526C56.6809 10.2548 54.1707 8.10343 50.3341 8.10343C46.4617 8.10343 43.7367 10.1472 43.7367 13.3742C43.7367 15.9558 45.2067 17.4977 48.3262 18.2506L51.4098 18.9678C53.2385 19.4339 53.8122 20.151 53.8122 21.3343C53.8122 22.9478 52.4497 23.9159 50.0831 23.9159C47.8601 23.9159 46.4975 22.8402 46.4975 21.0474H43.2705ZM69.0593 26.5692C73.3981 26.5692 76.3382 24.4537 77.1989 20.6889H74.0436C73.4698 22.6968 71.749 23.7725 69.1311 23.7725C65.7965 23.7725 63.8605 21.7286 63.6094 18.0355L77.1631 17.9997V16.7447C77.1631 11.5456 73.9002 8.10343 68.9165 8.10343C63.8246 8.10343 60.3465 11.9042 60.3465 17.3901C60.3465 22.8402 63.8963 26.5692 69.0593 26.5692ZM68.9165 10.936C71.8925 10.936 73.7926 12.8723 73.7926 15.7766H63.6811C64.1115 12.693 65.9758 10.936 68.9165 10.936Z" fill="black"/>
5
- </g>
6
- <defs>
7
- <linearGradient id="paint0_linear_1_53" x1="15.8958" y1="2.37374e-07" x2="22.1762" y2="31.8667" gradientUnits="userSpaceOnUse">
8
- <stop stop-color="#780000"/>
9
- <stop offset="1" stop-color="#C1121F"/>
10
- </linearGradient>
11
- <clipPath id="clip0_1_53">
12
- <rect width="85.5172" height="32" fill="white"/>
13
- </clipPath>
14
- </defs>
15
- </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,177 +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
32
- href="https://sei-protocol.github.io/sei-js/functions/cosmjs.getQueryClient.html"
33
- target="_blank">Sei QueryClient</a> query example
34
- </small>
35
- </div>
36
- <div className="card-body">
37
- <div className="content-background space-between">
38
- <small>Bonded Tokens</small>
39
- <p>{pool ? pool.bonded_tokens : '---'} SEI</p>
40
- </div>
41
- <div className="content-background space-between">
42
- <small>Unbonded Tokens</small>
43
- <p>{pool ? pool.not_bonded_tokens : '---'} SEI</p>
44
- </div>
45
- </div>
46
- <div className="card-footer">
47
- <button onClick={getStakingPool}>Fetch Staking Data</button>
48
- </div>
49
- </div>
50
- )
51
- }
52
-
53
- const getBalanceStargate = async () => {
54
- if (!address) {
55
- return undefined
56
- }
57
- const queryClient = await getStargateClient(defaultUrls[chainId].rpc);
58
- const useiBalance = await queryClient.getBalance(address, 'usei');
59
- const seiBalance = Number(useiBalance.amount) / 1000000
60
- setBalance(seiBalance);
61
- }
62
-
63
- const renderBalanceExample = () => {
64
- return (
65
- <div className="card">
66
- <div className="card-header">
67
- <p className="card__title">Wallet Balance</p>
68
- <small className="card__description">
69
- <a
70
- href="https://cosmos.github.io/cosmjs/latest/stargate/classes/StargateClient.html"
71
- target="_blank">Stargate Client</a> query example
72
- </small>
73
- </div>
74
- <div className="card-body">
75
- <div className="content-background space-between">
76
- <small>SEI</small>
77
- <p>{balance ? balance : '---' } SEI</p>
78
- </div>
79
- </div>
80
- <div className="card-footer">
81
- <button onClick={getBalanceStargate}>Fetch balance</button>
82
- </div>
83
- </div>
84
- )
85
- }
86
-
87
- const fetchCount = async () => {
88
- const cosmWasmClient = await getCosmWasmClient(defaultUrls[chainId].rpc);
89
- console.log(cosmWasmClient);
90
- const CONTRACT_ADDRESS =
91
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
92
- const response = await cosmWasmClient.queryContractSmart(CONTRACT_ADDRESS, {
93
- get_count: {},
94
- });
95
- const result = response?.count;
96
- if (result) {
97
- setCount(result);
98
- }
99
- }
100
-
101
- const incrementCounter = async () => {
102
- if (!address) {
103
- return;
104
- }
105
- const offlineSigner = await getOfflineSignerAmino();
106
- const signingCosmWasmClient = await getSigningCosmWasmClient(
107
- defaultUrls[chainId].rpc,
108
- offlineSigner
109
- )
110
-
111
- try {
112
- const senderAddress = address;
113
- const CONTRACT_ADDRESS =
114
- "sei14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sh9m79m";
115
-
116
- // Build message content
117
- const msg = { increment: {} };
118
-
119
- // Define gas price and limit
120
- const fee = {
121
- amount: [{ amount: "20000", denom: "usei" }],
122
- gas: "200000",
123
- };
124
-
125
- // Call smart contract execute msg
126
- await signingCosmWasmClient?.execute(senderAddress, CONTRACT_ADDRESS, msg, fee);
127
-
128
- await fetchCount();
129
-
130
- } catch (error) {
131
- console.log(error)
132
- }
133
- };
134
-
135
- const renderCounterContractExample = () => {
136
- return (
137
- <div className="card">
138
- <div className="card-header">
139
- <p className="card__title">Smart contract interaction</p>
140
- <small>
141
- <a
142
- href="https://cosmos.github.io/cosmjs/latest/cosmwasm-stargate/classes/SigningCosmWasmClient.html"
143
- target="_blank">
144
- CosmWasm Clients
145
- </a> example of smart
146
- contract interaction
147
- </small>
148
- </div>
149
- <div className="card-body">
150
- <div className="content-background space-between">
151
- <small>Count</small>
152
- <p>{count}</p>
153
- <button
154
- className="small outline"
155
- onClick={incrementCounter}
156
- >
157
- Increase
158
- </button>
159
- </div>
160
- </div>
161
- <div className="card-footer">
162
- <button onClick={fetchCount}>Fetch count</button>
163
- </div>
164
- </div>
165
- )
166
- }
167
-
168
- return (
169
- <div className="grid">
170
- {renderBalanceExample()}
171
- {renderStakingPoolExample()}
172
- {renderCounterContractExample()}
173
- </div>
174
- )
175
- }
176
-
177
- export default Examples;