How minswap/sdk works
Project type and purpose
• This is an off-chain SDK library (NPM package) for the Minswap Cardano DEX ecosystem.
• It provides adapters for price and pool data, transaction builders for various AMM versions (V1, V2, StableSwap, LBE V2), a syncer service to populate a local data store from on-chain sources, plus utility workers like LBE V2 and expired-order monitors.
File structure
Top-level modules:
• src/adapters: implements BlockfrostAdapter, MinswapAdapter (backed by the syncer), MaestroAdapter.
• src/syncer: a standalone service that reads from on-chain (via connector) and writes to Postgres & Redis.
• src/lbe-v2-worker & src/expired-order-monitor: background workers for limit-order book events.
• src/dex, src/dex-v2, src/stableswap, src/lbe-v2: core logic for pricing, calculations, order building.
• src/utils & src/types: shared utilities and type definitions.
• examples/ & docs/: usage samples and detailed design specs.
• docker-compose.yaml, Dockerfile.syncer: infrastructure for running the syncer, database, Redis.
• prisma schema & init.sql: schema for Postgres.
README for additional insights
• The README emphasizes three adapter entry points (Blockfrost, Minswap/syncer, Maestro).
• Key use-cases: fetching current pools, historical data, building and submitting swap orders.
• Guidance on running the syncer via Docker Compose to power the MinswapAdapter.