lazyswap-tui

command module
v0.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

lazyswap

A Vim-style terminal wallet that swaps crypto directly on-chain, from your machine. No exchange account, no deposits, no custodian. You hold the keys; the trade goes straight to a DEX.

Go rewrite of the original Bun/TS TUI. Runs on EVM chains (Ethereum, BSC) for on-chain DEX swaps (Uniswap V2 / PancakeSwap), plus cross-chain BTC swaps via THORchain.

Build & install

Needs Go 1.26+ (and a C toolchain — the SQLite driver is cgo-free, but go-ethereum pulls in cgo on some platforms).

# Install the binary to $GOBIN (or ~/go/bin) — no clone needed
go install github.com/FernandoPazCavalcante/lazyswap-tui@latest

# Or build from a clone
git clone https://github.com/FernandoPazCavalcante/lazyswap-tui.git
cd lazyswap-tui
go build -o lazyswap-tui .   # produces ./lazyswap-tui

Then run it:

./lazyswap-tui      # from a build
lazyswap-tui        # if installed and $GOBIN is on PATH
go run .            # straight from source, no binary

Data lives in ~/.lazyswap/ (wallets.db, lazyswap.log). Override with LAZYSWAP_DATA_DIR. First launch creates a wallet; your private key is encrypted with AES-256-GCM under a PBKDF2-derived key (100k iterations) and never leaves the box in plaintext.

Why local beats a centralized exchange

Running lazyswap on your own machine is strictly safer than trading on a CEX:

  • You keep custody. Keys are encrypted on disk under your password. On a CEX the exchange holds your coins — "not your keys, not your coins." Exchanges get hacked, freeze withdrawals, and go insolvent (Mt. Gox, FTX). Here the funds are in your wallet the whole time.
  • No deposit, no withdrawal queue. The swap executes against the DEX router from your address in one signed transaction. Nothing to deposit first, nothing to wait to withdraw.
  • No account, no KYC, no gatekeeper. No sign-up, no identity upload, no region lock, no account suspension. Just a wallet and an RPC.
  • The key never leaves your machine. RPC reads, quotes, and signing all happen locally. Your password and private key are never transmitted to a server.
  • On-chain transparency. Every trade is a public transaction you can verify on a block explorer — not an internal ledger entry you have to trust.

Trade-off: you pay network gas and you are responsible for your own backup. Lose the password and the encrypted key with no seed backup, and it's gone — same rule as any self-custody wallet.

Architecture

                          ┌──────────────┐
                          │   main.go    │  open DAO, build TUI, run
                          └──────┬───────┘
                                 │
                     ┌───────────▼────────────┐
                     │  TUI  (Bubble Tea)      │  internal/tui
                     │  screens · panels ·     │  login, mainscreen,
                     │  overlays · theme · keys│  swap/import overlays
                     └───────────┬────────────┘
                                 │ calls
              ┌──────────────────┼──────────────────────┐
              │                  │                       │
       ┌──────▼──────┐    ┌──────▼───────┐        ┌──────▼───────┐
       │   wallet    │    │     swap     │        │   balance    │
       │ CRUD + DAO  │    │ orchestration│        │  fetch/format│
       └──────┬──────┘    └──────┬───────┘        └──────┬───────┘
              │                  │                       │
      ┌───────▼───────┐   ┌──────▼──────┬─────────┐      │
      │    crypto     │   │     dex     │ thorchain│      │
      │ AES-256-GCM   │   │ Uniswap V2 /│ cross-   │      │
      │ + PBKDF2      │   │ PancakeSwap │ chain BTC│      │
      └───────┬───────┘   └──────┬──────┴────┬─────┘      │
              │                  │           │            │
       ┌──────▼──────┐    ┌──────▼───────────▼────────────▼──────┐
       │  SQLite DAO │    │     chain config  ·  explorer API    │
       │ wallets.db  │    │  RPC URLs, routers, token addresses  │
       └─────────────┘    └──────────────────────────────────────┘
                                       │
                                ┌──────▼──────┐
                                │  EVM RPC /  │  on-chain
                                │ DEX router  │  (your signed tx)
                                └─────────────┘

Layers: TUI → Services → DAO / Blockchain. internal/chain/config.go is the single source of truth for RPC URLs, router and token addresses — nothing chain-specific is hardcoded elsewhere. internal/paths owns filesystem locations; internal/applog writes to lazyswap.log (never stdout).

License

MIT

Documentation

Overview

LazySwap TUI — Go rewrite entry point.

Directories

Path Synopsis
internal
applog
Package applog is a tiny file-based logger.
Package applog is a tiny file-based logger.
balance
Package balance fetches native and ERC-20 token balances and prices them in USD via the chain's Uniswap-V2-compatible router.
Package balance fetches native and ERC-20 token balances and prices them in USD via the chain's Uniswap-V2-compatible router.
chain
Package chain holds EVM chain configuration and contract ABIs.
Package chain holds EVM chain configuration and contract ABIs.
crypto
Package crypto implements AES-256-GCM encryption with PBKDF2-derived keys.
Package crypto implements AES-256-GCM encryption with PBKDF2-derived keys.
dex
Package dex provides DEX price providers used by the swap quoting flow.
Package dex provides DEX price providers used by the swap quoting flow.
explorer
Package explorer queries Etherscan / BscScan-style APIs to discover the ERC-20 tokens a wallet has ever interacted with.
Package explorer queries Etherscan / BscScan-style APIs to discover the ERC-20 tokens a wallet has ever interacted with.
paths
Package paths is the single source of truth for filesystem locations.
Package paths is the single source of truth for filesystem locations.
swap
Package swap orchestrates DEX quoting, approvals, and execution.
Package swap orchestrates DEX quoting, approvals, and execution.
thorchain
Package thorchain implements cross-chain EVM → BTC swaps via THORchain.
Package thorchain implements cross-chain EVM → BTC swaps via THORchain.
tui
Package tui owns the root Bubble Tea model.
Package tui owns the root Bubble Tea model.
tui/keys
Package keys defines the global key bindings used by the TUI.
Package keys defines the global key bindings used by the TUI.
tui/overlays/importoverlay
Package importoverlay provides the modal mnemonic-import overlay.
Package importoverlay provides the modal mnemonic-import overlay.
tui/overlays/swapoverlay
Package swapoverlay implements the modal swap flow.
Package swapoverlay implements the modal swap flow.
tui/panels/rightpanel
Package rightpanel provides the tab bar shared by the right-hand "Info" panel.
Package rightpanel provides the tab bar shared by the right-hand "Info" panel.
tui/panels/settings
Package settings implements the right-panel Settings tab (tab 4).
Package settings implements the right-panel Settings tab (tab 4).
tui/panels/swapbtc
Package swapbtc implements the right-panel "Swap BTC" tab (tab 5): a cross-chain EVM → BTC swap form routed through THORchain.
Package swapbtc implements the right-panel "Swap BTC" tab (tab 5): a cross-chain EVM → BTC swap form routed through THORchain.
tui/panels/tokens
Package tokens implements the token-balance list shown on the right side.
Package tokens implements the token-balance list shown on the right side.
tui/panels/wallet
Package wallet implements the left-side wallet list panel.
Package wallet implements the left-side wallet list panel.
tui/screens/login
Package login implements the password-entry screen as a Bubble Tea model.
Package login implements the password-entry screen as a Bubble Tea model.
tui/screens/mainscreen
Package mainscreen owns the post-login layout: wallet panel (left) + tokens panel (right), plus overlay routing for create / delete / import.
Package mainscreen owns the post-login layout: wallet panel (left) + tokens panel (right), plus overlay routing for create / delete / import.
tui/theme
Package theme exposes the lipgloss color palette used across the TUI.
Package theme exposes the lipgloss color palette used across the TUI.
wallet
SQLite-backed persistence for wallets + app config.
SQLite-backed persistence for wallets + app config.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL