Skip to content

NEARBuilders/bitcoin-terminal

Repository files navigation

Bitcoin Terminal

A terminal-style interface for cross-chain swaps powered by NEAR Intents. Built with TanStack Start, this application provides a command-line inspired experience for seamless token swaps across blockchain networks.

Bitcoin Terminal TypeScript React 19 License

Description

Bitcoin Terminal is a modern, terminal-inspired interface for seamless cross-chain swaps. Built with the latest web technologies, it provides a familiar command-line experience for swapping tokens across different blockchain networks. The application integrates with Defuse Protocol for cross-chain swap infrastructure and uses NEAR Intents for transaction resolution.

Features

  • Terminal Interface: Interactive command-line style interface for swap operations
  • Cross-Chain Swaps: Swap tokens across different blockchain networks powered by NEAR Intents
  • Real-time Status: Track swap status with automatic polling
  • QR Code Display: Deposit address displayed as QR code for easy scanning
  • ASCII QR Codes: Fallback ASCII representation for terminal environments
  • Type-Safe: Built with TypeScript for maximum type safety
  • PWA Support: Installable as a Progressive Web App

Getting Started

Prerequisites

  • Node.js 18+
  • pnpm 8+

Installation

# Install dependencies
pnpm install

# Start development server
pnpm dev

The application will be available at http://localhost:3000

Building For Production

pnpm build

Preview Production Build

pnpm preview

Environment Variables

This application uses environment variables for configuration. Create a .env file in the root directory based on the example below:

Required Variables

  • DEFUSE_JWT_TOKEN - JWT authentication token for Defuse Protocol. Obtain this from the NEAR Intents Partner Portal by signing in and accessing your organization credentials.

Environment File Example

DEFUSE_JWT_TOKEN=your_jwt_token_here

To obtain your DEFUSE_JWT_TOKEN:

  1. Visit the NEAR Intents Partner Portal
  2. Sign in with your organization account
  3. Navigate to your API or credentials section
  4. Copy your JWT token and add it to the .env file

Usage

Available Commands

  • swap - Start a new swap wizard
  • status <addr> - Check status of a deposit address
  • clear - Clear terminal output
  • help - Show available commands
  • cancel - Cancel current swap operation

Swap Workflow

  1. Type swap to start a new swap wizard
  2. Follow the prompts to select:
    • Source token and blockchain
    • Amount to swap
    • Source address
    • Destination chain and token
    • Destination address
  3. Confirm the swap
  4. Send tokens to the displayed deposit address
  5. Type sent to start tracking the swap status

Tech Stack

Development

Linting & Formatting

This project uses Biome for linting and formatting:

# Check for issues
pnpm check

# Format code
pnpm format

# Lint code
pnpm lint

Testing

This project uses Vitest for testing:

pnpm test

Project Structure

src/
├── components/
│   ├── terminal/      # Terminal interface components (Terminal, TerminalBody, TerminalHeader, TerminalInput, QRCodeDisplay)
│   └── ui/            # Reusable UI components (Button, Input)
├── constants/         # Application constants
├── hooks/             # Custom React hooks (useStatusPolling, useTerminalWizard)
├── integrations/      # Third-party integrations (TanStack Query provider and devtools)
├── lib/               # Utility functions (errors, errorUtils, qrUtils, tokenUtils, utils)
├── orpc/              # RPC client and router (Defuse Protocol integration)
├── routes/            # TanStack Router routes and configuration
├── styles.css         # Global styles
├── types/             # TypeScript type definitions
├── router.tsx         # Router configuration
├── polyfill.ts        # Polyfills
└── logo.svg           # Application logo

public/                # Static assets (favicons, manifests)
├── favicon.ico
├── favicon.svg
├── apple-touch-icon.png
├── web-app-manifest-*.png
└── robots.txt

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support, please open an issue on the GitHub repository.

Acknowledgments

About

Bitcoin Terminal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published