https://github.com/evmts/tevm-cast
An example application of Tevm emulating the cast CLI in the browser
https://github.com/evmts/tevm-cast
Last synced: about 1 year ago
JSON representation
An example application of Tevm emulating the cast CLI in the browser
- Host: GitHub
- URL: https://github.com/evmts/tevm-cast
- Owner: evmts
- License: mit
- Created: 2024-09-14T22:37:47.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-20T23:00:16.000Z (over 1 year ago)
- Last Synced: 2025-04-10T21:51:51.669Z (about 1 year ago)
- Language: TypeScript
- Homepage: https://tevm-cast.vercel.app
- Size: 361 KB
- Stars: 20
- Watchers: 0
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Tevm Cast Clone
- [Tevm cast website](https://tevm-cast.vercel.app)
Tevm Cast Clone is a web-based Ethereum command-line interface (CLI) emulator similar to [foundry cast](https://book.getfoundry.sh/cast/).
It's goal is:
1. To provide a convenient lightweight peformant interface to do simple ethereum queries in a mobile browser
2. Show off Tevm features such as network forking and in-browser EVM

## Features
- Support for multiple Ethereum networks (Mainnet, Optimism, Base). Feel free to add new networks
- Real-time network information display (Chain ID, Base Fee, Gas Limit, Fork Block)
- Command history functionality
- Execution of various Ethereum commands, including:
- `cast block`
- `cast tx`
- `cast call`
- `cast send`
- `cast chain-id`
- `cast code`
- `cast keccak`
- And more...
- Command history and rpc urls saved in local storage
## How to Use
1. Select a network from the dropdown menu or enter a custom RPC URL.
2. Enter a command in the input area (e.g., `cast bn` for block number).
3. Click the "Run" button or press Enter to execute the command.
4. View the output in the result area below.
## Technical Stack
This website is built using just good old fashioned html and vanilla js
- Frontend: HTML, CSS, TypeScript
- Ethereum Interaction: Tevm library
- Build Tool: Vite
## Getting Started
To run this project locally:
1. Clone the repository
2. Install dependencies with `npm install`
3. Start the development server with `npm run dev`
4. Open the provided localhost URL in your browser
## Files
- `index.html`: The main HTML file that structures the web application's layout and includes necessary scripts and styles.
- `main.css`: The stylesheet that defines the application's appearance, including responsive design and animations.
- `src/main.ts`: The primary TypeScript file that initializes the application, setting up storage, nodes, HTML rendering, command runner, and event listeners.
- `src/Nodes.ts`: Manages the creation and handling of Tevm nodes for different networks.
- `src/Storage.ts`: Handles local storage operations, including Fork URL management and command history.
- `src/Html.ts`: Responsible for rendering and updating HTML elements in the UI.
- `src/EventListeners.ts`: Sets up and manages all event listeners for user interactions.
- `src/CommandRunner.ts`: Contains the logic for executing various Ethereum commands using the Tevm Node library.
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request. Especially looking for contributions to add more cast commands.
#### Adding a new network
1. Add it to local storage https://github.com/evmts/tevm-cast/blob/main/src/Storage.ts#L1
2. Add to html https://github.com/evmts/tevm-cast/blob/main/index.html#L37
3. Add a tevm node https://github.com/evmts/tevm-cast/blob/main/src/Nodes.ts#L35
#### Adding or updating a command
Check [src/CommandRunner.ts](./src/CommandRunner.ts]
## License
This project is open source and available under the [MIT License](LICENSE).