Skip to content
12 changes: 12 additions & 0 deletions .claude/rules/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ BEFORE making the change.

## Active Decisions

### [2026-07-02] Lend AMM integration guide as lend/dex/ ("Lend AMM" nav group)
**Status:** implemented
**Scope:** new-section | navigation
**Files affected:** `lend/dex/index.mdx`, `lend/dex/typescript.mdx`, `lend/dex/api.mdx`, `lend/dex/cpi.mdx`, `lend/dex/errors.mdx`, `docs.json`, `lend/program-addresses.mdx`
**Linear issue:** DEV-690

**Context:** Fluid (who built Jupiter Lend) published a swap integration guide for their Solana DEX so that routers/aggregators other than Jupiter can route through Jupiter Lend as a DEX. Source is the DEX docs on the `dex-deployments` branch of the private `Instadapp/fluid-contracts-solana` repo.
**Decision:** Port as a public "Lend AMM" group in the Lend nav, ordered Earn → Borrow → Lend AMM (directly after Borrow, per YY). Page titles: "AMM Overview" (`index`, includes condensed architecture), "AMM SDK" (`typescript`), "AMM APIs" (`api`, coming-soon stub with `sidebarTitle: "AMM APIs (coming soon)"`), "AMM CPI Integration" (`cpi`), "AMM Errors" (`errors`). Product branded **Lend AMM** in prose (was briefly "Jupiter Lend DEX"; renamed per YY). "DEX" is reserved for the on-chain program (the DEX program, `jupZ4m2…`) and code identifiers (`Dex`, `dex_id`, `DexOperation`, `Dex*` error names). File paths stay at `lend/dex/` (match the program name; preview links already shared). No links to the private source repo; pages are self-contained.
**Rationale:** YY initially asked for preview-link-only, then decided pages go in nav un-hidden, then set the AMM naming convention. 5 source pages collapsed: the standalone architecture page was background the overview half-duplicated, so it was folded into the index. TypeScript and CPI stay separate (distinct audiences, each near the ~200-line split threshold); errors is a shared lookup reference linked from both.
**Alternatives considered:** (1) Hidden pages (original ask), superseded by YY's call to publish in nav. (2) Merging errors into CPI, rejected because the TypeScript path needs the same table. (3) Porting the full upstream doc set (pricing, swaps internals, liquidity actions), out of scope, swaps only. (4) Renaming paths to `lend/amm/`, rejected to keep preview links stable.
**Migration notes:** New paths only, no redirects needed.

### [2026-06-17] Portal nav ordered by developer journey, not feature-vs-reference
**Status:** implemented
**Scope:** navigation
Expand Down
20 changes: 20 additions & 0 deletions .claude/rules/product-learning.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,26 @@ source code > SDK/FE > docs). Keep it current as a side effect of documenting th

---

# Jupiter Lend AMM

## Sources

- **Upstream docs:** `Instadapp/fluid-contracts-solana` (PRIVATE repo), `dex-deployments` branch — its DEX docs (integration guide + architecture) are the source for `lend/dex/*` (DEV-690). Because the repo is private, the docs pages must stay self-contained: never link to source files there, and don't cite its file paths here (this repo is public).
- **SDKs:** `@jup-ag/lend-read` (quoting: `Dex.estimateSwapIn`/`estimateSwapOut`) and `@jup-ag/lend/dex` subpath (execution: `getSwapInIx`/`getSwapOutIx`).

## Facts

- [2026-07-02] The product is Fluid's concentrated-liquidity AMM running on the Jupiter Lend Liquidity Layer. Upstream calls it "Fluid DEX"; our docs brand it **Lend AMM** (YY decision, DEV-690; briefly "Jupiter Lend DEX" before YY set the AMM naming). In prose the on-chain program is called the "AMM program"; "dex"/"Dex" appears only in literal code identifiers (accounts, seeds, error names, SDK subpath, file paths). Program IDL: https://solscan.io/account/jupZ4m2GqUCJ5iueMfzQf8khFfH31d4XAQt3RzCT9Vd#programIdl Audience framing: routers/aggregators routing Jupiter Lend as a DEX directly (Jupiter's own routing engine already integrates it). REST endpoints are planned: nav has an "AMM APIs (coming soon)" stub at `lend/dex/api.mdx`; replace the stub when they launch.
- [2026-07-02] Program addresses: DEX `jupZ4m2GqUCJ5iueMfzQf8khFfH31d4XAQt3RzCT9Vd`, Liquidity Layer `jupeiUmn818Jg1ekPURTpr4mFo29p46vygyykFJ3wZC`, Oracle `jupnw4B6Eqs7ft6rxpzYLJZYSnrpRgPcr589n5Kv4oc`.
- [2026-07-02] Swap-path essentials: `swap_in` (exact-in) / `swap_out` (exact-out) return the counter-amount as Anchor `u64` return data; `token0`/`token1` ordered by pubkey sort; all four supply/borrow position accounts are mandatory for swaps (`None` → 6077) even though deposit/withdraw gate them; external-center-price pools need `[center_price_address, ...sources]` as leading remaining accounts; `ADDRESS_DEAD` (all-zero) recipient is a deliberate simulate-only quoting sentinel (errors 6081/6082).
- [2026-07-02] SDK availability at time of writing: `@jup-ag/lend-read@0.0.13` (latest) already ships the `Dex` quoting class, but the `./dex` execution subpath only exists in `@jup-ag/lend@0.2.0-beta.2` (`beta` dist-tag), NOT in latest 0.1.10. Upstream doc claims the IDL ships at `@jup-ag/lend/dist/idl/dex.json` — false in both published versions (no idl files in the tarballs), and the public `jup-ag/jupiter-lend` repo `target/idl/` has no `dex.json` either. The IDL IS published on-chain (verified: `anchor idl fetch jupZ4m2…` finds the account; needs Anchor 0.30+ to parse). Docs point CPI integrators at `anchor idl fetch` and note the beta tag on the TypeScript page. Re-check at DEX launch: when 0.2.x hits `latest`, drop the beta-tag Note.

## Content Gaps

- [2026-07-02] Upstream `docs/dex/` pages NOT ported (out of DEV-690 scope): pricing.md, swaps.md (internals), liquidity.md, arbitrage.md, parameters.md, deployments.md, and the top-level integration.md (full instruction surface incl. liquidity actions and `preview_dex_shares`). Port candidates if LP/liquidity-action docs are ever requested.

---

# Swap API V2 — Squads Multisig

## Architecture
Expand Down
2 changes: 2 additions & 0 deletions .claude/rules/style-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,5 @@ Format: `- [YYYY-MM-DD] Decision: rationale`
- [2026-04-16] British English spelling for docs prose (e.g. "randomise", "optimise", "colour"). Do not Americanise existing British spellings.
- [2026-06-17] Write in plain engineer English. Before showing any page, scan the prose for (1) em dashes, (2) the AI-slop phrases in the Words to Avoid table ("ship", "blast radius", "before it ever counts against your plan", "at a glance", rhetorical triplets). Prefer the concrete action and the literal effect over flourish. "An API key used in a client the user controls is not private" beats "When you ship a key, that key is no longer a secret".
- [2026-06-21] Fee settlement / rev-share docs use abstract placeholders for the integrator/Jupiter split (`y%` integrator, `x%` Jupiter, `y = 100 − x`; `F bps` for the total), never concrete bps or split ratios (no "85/15", no "100 bps" example). Splits are negotiated per-integrator and Jupiter aims to maximise its share, so a concrete example would anchor integrators to a number that may be lower than what is actually charged. Keep the split illustration general (e.g. `y/100 × F`).
- [2026-07-02] Diagrams use Mermaid (```mermaid code blocks, rendered natively by Mintlify), not ASCII art. First used on `lend/dex/index.mdx` (YY request). Port ASCII diagrams from upstream sources to Mermaid.
- [2026-07-02] Lend AMM naming: the product is the **Lend AMM** ("Jupiter Lend AMM" only where the Jupiter context isn't already established). Nav group "Lend AMM"; page titles "AMM Overview", "AMM SDK", "AMM APIs", "AMM CPI Integration", "AMM Errors". In prose, the on-chain program is the "AMM program" and program-address tables say "Lend AMM" / "Jupiter Lend (AMM)". Never say "DEX program" or explain AMM-vs-DEX naming (YY: too confusing). "dex"/"Dex" survives ONLY in literal code identifiers: `Dex` account, `DexMetadata`, `dex_id`, `DexOperation`, `Dex*` error names, `["dex", ...]` seeds, the `@jup-ag/lend/dex` subpath, and file paths (`lend/dex/`). IDL link: https://solscan.io/account/jupZ4m2GqUCJ5iueMfzQf8khFfH31d4XAQt3RzCT9Vd#programIdl
14 changes: 14 additions & 0 deletions changelog/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,20 @@ llmsDescription: "Changelog for Jupiter developer APIs, SDKs, and docs. Tracks b

---

<Update label="July 2026" description="">

## Jupiter Lend: AMM Integration Guide

The Lend AMM, a concentrated-liquidity AMM on the Liquidity Layer, now has a swap integration guide for routers, aggregators, and on-chain programs.

- Quote and execute swaps from TypeScript with `@jup-ag/lend-read` and `@jup-ag/lend/dex`
- Call `swap_in` / `swap_out` via CPI from your own program, with a raw instruction recipe for non-Anchor integrators
- [AMM overview](/lend/dex)

</Update>

---

<Update label="June 2026" description="">

## Swap API: JupiterZ Integrator Fees
Expand Down
10 changes: 10 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,16 @@
"lend/borrow/cpi"
]
},
{
"group": "Lend AMM",
"pages": [
"lend/dex/index",
"lend/dex/typescript",
"lend/dex/api",
"lend/dex/cpi",
"lend/dex/errors"
]
},
{
"group": "Flashloan",
"pages": ["lend/flashloan/index", "lend/flashloan/execute"]
Expand Down
19 changes: 19 additions & 0 deletions lend/dex/api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: "AMM APIs"
sidebarTitle: "AMM APIs (Coming soon)"
description: "REST endpoints for quoting and building Lend AMM swaps. Coming soon."
llmsDescription: "Placeholder for the upcoming Jupiter Lend AMM REST API. REST endpoints for quoting and building swaps against the Lend AMM over HTTP are not yet available. Until they launch, integrate with the TypeScript SDKs (@jup-ag/lend-read for quoting, @jup-ag/lend/dex for building swap instructions) or via Rust CPI from an on-chain program."
---

REST endpoints for quoting and building Lend AMM swaps over HTTP are coming soon.

Until they launch, two integration paths are available:

<CardGroup cols={2}>
<Card icon="code" href="/lend/dex/typescript" title="AMM SDK">
Quote with `@jup-ag/lend-read`, build and send the swap with `@jup-ag/lend/dex`.
</Card>
<Card icon="link" href="/lend/dex/cpi" title="AMM CPI Integration">
Call `swap_in` / `swap_out` from your own program via CPI.
</Card>
</CardGroup>
Loading