Skip to content

Latest commit

 

History

History
97 lines (69 loc) · 3.37 KB

File metadata and controls

97 lines (69 loc) · 3.37 KB

Contributing to Lens

Lens is a unified Stellar price oracle aggregating SDEX and AMM prices, gated behind x402 micropayments. Contributions welcome — docs, tests, new endpoints, ingestion improvements.

Ways to contribute

Repository layout

lens/
├── src/
│   ├── index.ts            # Fastify entry point
│   ├── db.ts               # Postgres / Supabase (Prisma)
│   ├── routes/             # REST + GraphQL handlers
│   ├── ingest/             # SDEX + AMM ingesters
│   ├── pricing/            # Best-route calculation
│   └── x402/               # Payment middleware
├── prisma/
│   └── schema.prisma
└── sql/                    # Raw SQL helpers (OHLCV, etc.)

Development setup

Prerequisites

  • Node.js 20+
  • PostgreSQL (local or Supabase)
  • Redis (optional — for BullMQ workers)
  • A Stellar testnet account for x402 payments (if testing paid endpoints)

Clone and install

git clone https://github.com/Miracle656/Lens.git
cd Lens
npm install
cp .env.example .env   # fill in DATABASE_URL, REDIS_URL, WATCHED_PAIRS
npx prisma db push
npm run dev

API runs on http://localhost:3000.

Environment variables

  • DATABASE_URL — Postgres connection string (Supabase or local)
  • REDIS_URL — optional, enables aggregate refresh worker
  • WATCHED_PAIRS — comma-separated CODE:ISSUER/CODE:ISSUER (e.g. XLM:native/USDC:GBBD...)
  • NETWORKtestnet or mainnet

Commit conventions

  • feat:, fix:, docs:, test:, refactor:, chore:
  • Keep PRs focused

Before opening a PR

npx prisma generate
npx tsc --noEmit
npm run build
npm test --if-present

Testing

Tests are being set up — see area:tests. Candidates: route handlers, price math, x402 flow, ingester bisection, DB queries.

Releases

Lens uses changesets for versioning and changelog generation.

Adding a changeset

When you make a change that should appear in the changelog (a feature, fix, or any user-facing change), add a changeset in the same PR:

npx changeset

Pick the bump type (patch / minor / major) and write a short summary. This creates a markdown file under .changeset/ — commit it alongside your change.

How a release happens

  1. When PRs with changesets are merged into main, the release workflow (.github/workflows/release.yml) opens (or updates) a "Version Packages" PR.
  2. That PR consumes the pending changeset files, bumps the version in package.json, and updates CHANGELOG.md.
  3. Merging the Version Packages PR bumps the version and creates a matching git tag and GitHub release.

Lens is not published to a registry, so there is no publish step — releases are tag-only (changeset tag).

Questions

Open an issue or start a discussion.