/gas-saver-simulator

Simulate gas costs for token swaps on Ethereum using the Enso Network API

Primary LanguageTypeScriptOtherNOASSERTION

Gas Saver Simulator

Gas Saver Simulator is a full stack web app (React and Node.js) that allows users to simulate gas costs for token swaps on the Ethereum blockchain. It utilizes the Enso Network API to fetch real-time swap data.

Features

  • Simulate gas costs and token swaps on the Ethereum blockchain.
  • Get insights on gas cost (in ETH), price impact, and amount out.
  • Simple and intuitive React user interface built with v0.
  • Powered by the Enso Network API.

Walkthrough

Here’s a quick walkthrough of the app in action:

Gas Saver Simulator Walkthrough

Getting Started

Prerequisites

Ensure you have the following installed:

  • Node.js
  • npm or yarn

Installation

  1. Clone this repository:
    git clone https://github.com/hummusonrails/gas-saver-simulator.git
    cd gas-saver-simulator
    npm install
  2. Rename the .env.sample file to .env and fill in the required environment variables:
  • ENSO_API_KEY: Your Enso Network API key. Info on getting your API key can be found in the docs.
  • VITE_API_BASE_URL: The base URL of your backend server, i.e. https://localhost:3000.
  1. Start the development server:

    npm run dev
  2. Run the backend server:

    node src/app.js
  3. Open the application in your browser at http://localhost:5173 (or the URL where you deployed it to).

Project Structure

src/
├── components/
│   ├── ui/              # Reusable UI components (button, card, input, etc.)
│   └── GasSaverSimulator.tsx  # Main application component
├── pages/               # Styles and page-level files
├── routes/              # Backend API routes
├── services/            # Enso API service logic

API Reference

This project integrates with the Enso Network API to simulate token swaps and fetch real-time gas data. The API Swagger reference provides detailed information on the available endpoints.

License

This project is licensed under the MIT License.