-
Notifications
You must be signed in to change notification settings - Fork 50
fix(create-sei): align CLI and generated docs (PLT-844) #333
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@sei-js/create-sei": patch | ||
| --- | ||
|
|
||
| Add the documented `-n` app name option and correct the generated template documentation and Bank precompile link. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,27 @@ | ||
| import { afterEach, beforeEach, describe, expect, it, jest, test } from 'bun:test'; | ||
| import { afterEach, beforeEach, describe, expect, test } from 'bun:test'; | ||
| import { promises as fs } from 'node:fs'; | ||
| import path from 'node:path'; | ||
|
|
||
| const packageRoot = path.resolve(import.meta.dir, '..'); | ||
|
|
||
| describe('CLI', () => { | ||
| test('documents the short name option', async () => { | ||
| const subprocess = Bun.spawn({ | ||
| cmd: [process.execPath, path.join(packageRoot, 'src/main.ts'), 'app', '--help'], | ||
| cwd: packageRoot, | ||
| stdout: 'pipe', | ||
| stderr: 'pipe' | ||
| }); | ||
|
|
||
| const [stdout, stderr, exitCode] = await Promise.all([new Response(subprocess.stdout).text(), new Response(subprocess.stderr).text(), subprocess.exited]); | ||
|
|
||
| expect(exitCode).toBe(0); | ||
| expect(stderr).toBe(''); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] |
||
| expect(stdout).toContain('-n, --name <name>'); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [suggestion] This asserts commander's rendered help string rather than the behaviour PLT-844 was actually about. It couples the test to commander's help formatting (a v13 upgrade that changes spacing or ordering breaks it while A behavioural assertion would be a tighter guard — e.g. spawn Also worth an explicit timeout on this test: it spawns a fresh Bun process that transpiles |
||
| }); | ||
| }); | ||
|
|
||
| describe('Extension System', () => { | ||
| const packageRoot = path.resolve(import.meta.dir, '..'); | ||
| const testDir = path.join(packageRoot, 'test-output'); | ||
| const extensionsDir = path.join(packageRoot, 'extensions'); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,54 +1,41 @@ | ||
| This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
| # Sei dApp starter | ||
|
|
||
| ## Getting Started | ||
| This app was generated by `@sei-js/create-sei`. It uses Next.js, Wagmi, Viem, RainbowKit, Mantine, and Tailwind CSS. | ||
|
|
||
| Install dependencies by running | ||
| ```bash | ||
| bun install | ||
| ``` | ||
| ## Run locally | ||
|
|
||
| Then, run the development server: | ||
| Install the dependencies and start the development server: | ||
|
|
||
| ```bash | ||
| bun install | ||
| bun run dev | ||
| ``` | ||
|
|
||
| Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
|
||
| You can start editing the page by modifying `src/app/page.tsx`. The page auto-updates as you edit the file. | ||
|
|
||
| This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. | ||
|
|
||
| ## Repository Basics | ||
| This repository includes basic features that allow you to connect to a wallet and use the wallet to interact with the chain. | ||
| Open [http://localhost:3000](http://localhost:3000). | ||
|
|
||
| Additionally, basic examples and links to documentation are provided on the example homepage in `src/app/components/Homepage`. | ||
| ## Project structure | ||
|
|
||
| This repository uses helper methods from [@sei-js/evm/viem](https://github.com/sei-protocol/sei-js/tree/main/packages/evm/src/viem) | ||
| - `src/app/layout.tsx` wraps every route with the wallet and UI providers. | ||
| - `src/app/page.tsx` shows the landing page until a wallet connects, then shows the interactive examples. | ||
| - `src/components/providers/providers.tsx` configures Wagmi, RainbowKit, WalletConnect, and the selected Sei network. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] "configures Wagmi, RainbowKit, WalletConnect" overstates it a little — |
||
| - `src/components/landing/index.tsx` contains the disconnected landing page. | ||
| - `src/components/default/index.tsx` contains the connected wallet, balance, and transaction examples. | ||
| - `src/app/development/page.tsx` and `src/app/resources/page.tsx` contain development notes and links. | ||
|
|
||
| ### Web3 Provider | ||
| This component is a Sei specific wrapper around a Wagmi Provider that should wrap the application. Wrapping the application in this provider will enable it to access hooks in Wagmi. These hooks are enable connection to a wallet and interaction with the chain. | ||
| ## Network configuration | ||
|
|
||
| In addition, this app uses [RainbowKit](https://www.rainbowkit.com/docs/wallet-button) which provides wallet connect functionality out of the box. | ||
| The app connects to Sei mainnet when `NEXT_PUBLIC_CHAIN` is unset. To use Sei testnet, add this to `.env.local`: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [suggestion] Accurate about the code path ( |
||
|
|
||
| To change the list of supported wallets, as well as connection configurations you can modify the `src/app/components/Web3Provider.tsx` component. | ||
|
|
||
| ### Changing the Chain | ||
| This application connects to Sei mainnet by default. | ||
|
|
||
| Set `NEXT_PUBLIC_CHAIN=testnet` in `.env.local` to use Sei testnet. The chain selection logic is in `src/components/providers/providers.tsx`. | ||
|
|
||
| ## Learn More | ||
|
|
||
| To learn more about Next.js, take a look at the following resources: | ||
|
|
||
| - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
| - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
|
||
| You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
| ```dotenv | ||
| NEXT_PUBLIC_CHAIN=testnet | ||
| ``` | ||
|
|
||
| ## Deploy on Vercel | ||
| You can also set `NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID` in `.env.local`. Without it, the template uses a placeholder project ID. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [nit] The placeholder is the literal string |
||
|
|
||
| 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. | ||
| ## Learn more | ||
|
|
||
| Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. | ||
| - [Sei documentation](https://docs.sei.io/) | ||
| - [Next.js documentation](https://nextjs.org/docs) | ||
| - [Wagmi documentation](https://wagmi.sh/react/getting-started) | ||
| - [Viem documentation](https://viem.sh/) | ||
| - [RainbowKit documentation](https://www.rainbowkit.com/docs/introduction) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[suggestion] Replacing the dead
www.docs.sei.io/dev-interoperability/precompiles/banklink is clearly right, but please confirm this specific path against the live docs — I have no outbound network access here, so I checked it against the repo instead.Every other Sei precompile docs link in this repo uses a flat
docs.sei.io/evm/precompiles/<slug>shape with no intermediate section segment:packages/precompiles/src/precompiles/p256.ts:19→docs.sei.io/evm/precompiles/p256-precompilepackages/precompiles/README.md:40→docs.sei.io/evm/precompiles/example-usagepackages/mcp-server/src/tests/docs/server.test.ts:39→docs.sei.io/evm/precompiles/example-usageThis is the only link that introduces a
cosmwasm-precompiles/segment, and Bank is a Cosmos-module precompile rather than a CosmWasm one, which makes that segment the part I'd double-check. If the page really does live under that path, no change needed — a dead link in a scaffolded template is worse than a slightly odd path.