Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
338c844
fix(solana): typed close-failure errors + pre-broadcast simulation gu…
fengtality Aug 13, 2026
8f423d4
feat(solana): distinguish NOT_FOUND from UNCONFIRMED in transaction poll
fengtality Aug 13, 2026
f9d4ed7
docs: rewrite retry-architecture as issues + final architecture
fengtality Aug 13, 2026
71537de
fix(poll): one txStatus contract for Solana and Ethereum; report EVM …
fengtality Aug 13, 2026
18d6e95
docs: single close-retry loop; unified poll contract
fengtality Aug 13, 2026
546c643
fix(poll): attribute failed-transaction errors to the failing program
fengtality Aug 13, 2026
2452a89
feat(clmm): binCount on unified pool-info; add bin support to Pancake…
fengtality Aug 13, 2026
4e7233b
fix(bsc): default nodeURL to bsc-dataseed.bnbchain.org
fengtality Aug 13, 2026
0a54fed
fix(ethereum): default mainnet nodeURL to Alchemy's public endpoint
fengtality Aug 13, 2026
6aeeb7e
docs: cover the poll and CLMM pool-info contracts
fengtality Aug 13, 2026
80c1445
fix(clmm): validate open amounts at the route, matching add
fengtality Aug 18, 2026
7eb4ffc
refactor(clmm): drop the never-populated reward fields from PositionInfo
fengtality Aug 18, 2026
f686579
feat(clmm): binCount bins for pancakeswap-sol; fix inverted out-of-ra…
fengtality Aug 18, 2026
227f22d
refactor(clmm): one fee-tier vocabulary for create-pool; canonical sc…
fengtality Aug 18, 2026
95e7ecd
refactor(amm): consistent unified params — no gas overrides, one conf…
fengtality Aug 19, 2026
7a36c6a
refactor(swap): uniform router contract — slippagePct + approximateIf…
fengtality Aug 19, 2026
a2b9779
refactor(amm): drop openTime from unified create-pool; optionals trai…
fengtality Aug 19, 2026
a67c572
fix(clmm): expose strategyType on unified add-liquidity, matching open
fengtality Aug 19, 2026
6b3383c
refactor(trading): standardize unified route surfaces
fengtality Aug 19, 2026
26c3bb3
fix(trading): uniform error passthrough on all unified routes
fengtality Aug 19, 2026
1559081
fix(trading): connector-config slippage defaults; percentageToRemove …
fengtality Aug 19, 2026
2eaee8b
docs: regenerate openapi.json from current routes
fengtality Aug 19, 2026
1fbbacf
test(jupiter): assert removed fields' absence independently
fengtality Aug 19, 2026
da3008b
refactor(trading): fold AMM pool-scoped swaps into the unified swap r…
fengtality Aug 19, 2026
828159e
fix(trading): fail loudly on landed-but-failed Solana txs; echo appli…
fengtality Aug 19, 2026
a6d82bb
feat(trading): let unified swaps pin a pool by address
fengtality Aug 19, 2026
1884ed7
test(trading): assert the live field names on unified CLMM and orca r…
fengtality Aug 19, 2026
40bb747
test(trading): send chainNetwork, not the pre-fold network field
fengtality Aug 19, 2026
198e0d8
docs: regenerate openapi.json from the current route table
fengtality Aug 19, 2026
b5f5e04
fix(raydium): collect fees without withdrawing liquidity
fengtality Aug 19, 2026
fdad604
fix(evm): route every EVM transaction through one confirmation gate
fengtality Aug 19, 2026
a3bb2d6
refactor(api): unify the route table around /trading/{router,clmm,amm…
fengtality Aug 19, 2026
5333a3f
refactor(api): give the AMM surface the same liquidity verbs as CLMM
fengtality Aug 19, 2026
60f25e1
feat(trading): rename clmm quote-position to quote-liquidity, add ope…
fengtality Aug 19, 2026
06a81c2
feat(amm): make open and close work on every AMM, and report position…
fengtality Aug 19, 2026
d62dcf6
fix(gateway): correct fee, rent and fee-percent accounting; return th…
fengtality Aug 19, 2026
45b8a11
feat(trading): name the pool and position every liquidity operation a…
fengtality Aug 19, 2026
d3f1315
refactor(clmm): report the pool from the connector instead of re-read…
fengtality Aug 19, 2026
982ed24
fix(gateway): audit fixes — missed return path, inconsistent decimal …
fengtality Aug 19, 2026
24795ff
chore(connectors): delete the schemas the per-connector routes left b…
fengtality Aug 19, 2026
d1ba898
test(orca): assert one outcome per case instead of accepting any of t…
fengtality Aug 19, 2026
78a2249
test(clmm): replace a hedged duplicate with the case it was standing …
fengtality Aug 19, 2026
2b69e52
feat(openapi): emit named schema components so a generated client has…
fengtality Aug 19, 2026
6a641d2
test: delete 157 tests that mocked the transport and asserted the fix…
fengtality Aug 19, 2026
d10e54d
test(clmm): assert routes are registered instead of accepting a crash
fengtality Aug 19, 2026
715323b
chore(scripts): drop the live RPC scripts that depended on a removed …
fengtality Aug 19, 2026
2935610
chore: stop prettier and the openapi generator from rewriting each other
fengtality Aug 19, 2026
e981472
feat(chains): make chain and network dropdowns in the docs
fengtality Aug 19, 2026
c19a032
test(wallet): make the two wallet suites run at all
fengtality Aug 19, 2026
3a89f18
feat(openapi): publish request bodies as components (GW-9)
fengtality Aug 20, 2026
c0bb102
feat(openapi): publish the reads as components too (GW-10)
fengtality Aug 20, 2026
3d9e7d8
fix(trading): act on the chain a liquidity route was given
fengtality Aug 20, 2026
f0d8097
feat(trading): learn tokens and pools from the chain as they are used
fengtality Aug 20, 2026
3182445
fix(ethereum): resolve a token by address from the chain, as Solana does
fengtality Aug 20, 2026
74a1ee5
feat(amm): fold close into remove at 100%, and drop the open and clos…
fengtality Aug 20, 2026
e3eb7b1
fix(amm): stop reporting position rent as deposited liquidity (GW-20)
fengtality Aug 20, 2026
d6e444f
fix(raydium): report a deposit as how much went in, not which way the…
fengtality Aug 20, 2026
db6da4d
fix(openapi): make the spec reproducible, and check that it is (GW-13…
fengtality Aug 20, 2026
414497c
fix(orca): deposit the quoted amount, not the slippage ceiling
fengtality Aug 20, 2026
a40e654
feat(openapi): name the operations, the errors and the responses (GW-…
fengtality Aug 20, 2026
e5b10e1
refactor(pools,tokens): address every route one way
fengtality Aug 20, 2026
368df48
fix(security): gate every route that signs, not the ones on a list
fengtality Aug 20, 2026
a29c5b5
fix(solana): report the money that moved, not the wallet's balance ch…
fengtality Aug 20, 2026
1261815
chore: delete the dead code, and the two live bugs hiding behind it
fengtality Aug 20, 2026
d4f0c81
fix(raydium): a close reports what the pool paid, not the rent beside it
fengtality Aug 20, 2026
47095b2
fix(routers): name the route that was attempted, and the impact in th…
fengtality Aug 20, 2026
e87bd50
feat(clmm): let a close say how much slippage it will accept
fengtality Aug 20, 2026
8711fde
fix(pancakeswap-sol): open reliably, and say what the fees were
fengtality Aug 20, 2026
77f53da
fix(trading): reject a request that was going to be misread
fengtality Aug 20, 2026
c2b214c
fix(schemas): send money as decimal strings so precision survives the…
fengtality Aug 20, 2026
1c285dd
test(orca): pin the wallet default instead of inheriting the machine's
fengtality Aug 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
9 changes: 8 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ module.exports = {
rules: {
'no-console': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
// `ignoreRestSiblings` allows the idiomatic way to drop a key —
// `const { poolType, ...rest } = obj` — which is not dead code; the named sibling is
// how the rest is defined. `varsIgnorePattern` keeps a deliberately-unread binding
// legible as deliberate.
'@typescript-eslint/no-unused-vars': [
'warn',
{ argsIgnorePattern: '^_', varsIgnorePattern: '^_', ignoreRestSiblings: true },
],
semi: [2, 'always'],
'prettier/prettier': 'error',
'@typescript-eslint/no-var-requires': 'off',
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,21 @@ jobs:
# Copy template configurations
cp -rf src/templates/* conf/

# The committed spec is what consumers generate their clients from, and the tests
# that check it read the committed copy — so a route change with no regeneration
# leaves them passing against a stale document. Only regenerating and comparing
# catches that. The generator writes the template port and placeholder wallets, so
# this produces the same bytes here as on any developer's machine.
- name: Check openapi.json is regenerated
shell: bash
run: |
pnpm generate:openapi
if ! git diff --quiet -- openapi.json; then
echo "::error::openapi.json does not match the routes. Run 'pnpm generate:openapi' and commit the result."
git --no-pager diff -- openapi.json
exit 1
fi

- name: Run unit test coverage
if: github.event_name == 'pull_request'
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ certs
*.yml
coverage
dist
vendor
vendor
openapi.json
16 changes: 1 addition & 15 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,28 +251,14 @@ Gateway implements RPC provider abstraction for optimized blockchain connectivit
- Regional optimization (slc, ewr, lon, fra, ams, sg, tyo)
- Connection warming for reduced latency

### Testing RPC Providers
Live integration tests in `scripts/`:
- `test-infura-live.js`: Test Infura integration with real API key
- `test-helius-live.js`: Test Helius integration with real API key
- `test-provider-switching.js`: Test provider switching functionality

Run tests:
```bash
# Requires configured API keys in conf/rpc/*.yml
node scripts/test-infura-live.js
node scripts/test-helius-live.js
```

### Adding New RPC Provider
1. Create config template: `src/templates/rpc/{provider}.yml`
2. Create JSON schema: `src/templates/namespace/{provider}-schema.json`
3. Register in `src/templates/root.yml`
4. Implement service class: `src/chains/{chain}/{provider}-service.ts`
5. Update chain connector to support provider selection
6. Add `rpcProvider` enum to network schema
7. Create live integration test script
8. Document configuration and usage
7. Document configuration and usage

## Hummingbot Gateway Endpoint Standardization
- This repo standardized DEX and chain endpoints that are used by Hummingbot strategies. See this branch for the matching code, especially the Gateway connector classes https://github.com/hummingbot/hummingbot/tree/development
Expand Down
186 changes: 70 additions & 116 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,29 +112,37 @@ Gateway uses [Swagger](https://swagger.io/) for API documentation. When running
- `POST /chains/{chain}/approve` - Approve token spending
- `POST /chains/{chain}/wrap` - Wrap/unwrap native tokens

#### Connector Routes (`/connectors/{dex}/{type}/*`)

**Router Operations** (e.g., `/connectors/jupiter/router/*`):
- `POST /quote` - Get swap quote from aggregator
- `POST /swap` - Execute swap through aggregator

**AMM Operations** (e.g., `/connectors/raydium/amm/*`):
- `POST /poolInfo` - Get pool details
- `POST /positionInfo` - Get liquidity position info
- `POST /quoteSwap` - Get swap quote
- `POST /executeSwap` - Execute swap
- `POST /quoteLiquidity` - Quote add/remove liquidity
- `POST /addLiquidity` - Add liquidity to pool
- `POST /removeLiquidity` - Remove liquidity from pool

**CLMM Operations** (e.g., `/connectors/uniswap/clmm/*`):
- `POST /poolInfo` - Get concentrated liquidity pool info
- `POST /openPosition` - Open new position
- `POST /closePosition` - Close existing position
- `POST /addLiquidity` - Add liquidity to position
- `POST /removeLiquidity` - Remove liquidity from position
- `POST /collectFees` - Collect earned fees
- `POST /positionsOwned` - List owned positions
#### Trading Routes (`/trading/{type}/*`)

The trading type is a path segment and the connector is a `connector` parameter, so
one set of routes covers every DEX.

**Router** (`/trading/router/*`) — aggregators that route across pools (Jupiter, 0x, dflow, okx, titan, Uniswap, PancakeSwap):
- `GET /trading/router/quote-swap` - Quote a swap (returns a `quoteId`)
- `POST /trading/router/execute-quote` - Execute a previously fetched quote by id
- `POST /trading/router/execute-swap` - Quote and execute in one call

**AMM** (`/trading/amm/*`) — constant-product pools (Uniswap V2, PancakeSwap V2, Raydium CPMM, Meteora DAMM v2):
- `GET /trading/amm/quote-swap` / `POST /trading/amm/execute-swap` - Swap against a single pool
- `GET /trading/amm/pool-info` - Pool reserves, price, fee
- `GET /trading/amm/position-info` - Wallet's liquidity in a pool
- `GET /trading/amm/positions-owned` - All of a wallet's positions
- `GET /trading/amm/quote-liquidity` - Two-sided deposit quote
- `POST /trading/amm/open` / `close` - Open or close a position (fungible-LP AMMs deposit/withdraw in full)
- `POST /trading/amm/add` / `remove` - Change a position's liquidity
- `POST /trading/amm/create-pool`

**CLMM** (`/trading/clmm/*`) — concentrated liquidity (Uniswap V3, PancakeSwap V3, Raydium, Meteora DLMM, Orca):
- `GET /trading/clmm/quote-swap` / `POST /trading/clmm/execute-swap` - Swap against a single pool
- `GET /trading/clmm/pool-info` - Pool info (optionally with bin/tick liquidity)
- `GET /trading/clmm/position-info` - Position details
- `GET /trading/clmm/positions-owned` - All of a wallet's positions
- `GET /trading/clmm/quote-liquidity` - Deposit split for a candidate range
- `GET /trading/clmm/fetch-pools` - Pool discovery from the DEX's own listing API
- `POST /trading/clmm/open` / `close` - Open or close a position
- `POST /trading/clmm/add` / `remove` - Change a position's liquidity
- `POST /trading/clmm/collect-fees` - Collect earned fees
- `POST /trading/clmm/create-pool`

#### Wallet Routes (`/wallet/*`)
- `GET /wallet` - List all wallets
Expand Down Expand Up @@ -405,43 +413,25 @@ docker compose up -d --build
- `DELETE /wallet/remove` - Remove wallet
- `POST /wallet/sign` - Sign message

### Chain Operations
### Chain Operations (`/chains/{chain}/*`)

#### Ethereum/EVM (`/chains/ethereum`)
- `GET /status` - Chain connection status
- `GET /tokens` - Get token information
- `GET /balances` - Get wallet balances
- `GET /allowances` - Check token allowances
- `POST /approve` - Approve token spending
- `GET /poll` - Poll transaction status
One parameterized set of routes serves every chain, so a new chain needs no new paths:
- `GET /chains/{chain}/status` - Chain connection status and block height
- `GET /chains/{chain}/estimate-gas` - Current transaction fee estimate
- `POST /chains/{chain}/balances` - Wallet token balances
- `POST /chains/{chain}/poll` - Poll a transaction by signature/hash
- `POST /chains/{chain}/wrap` / `unwrap` - Wrap or unwrap the native token

#### Solana (`/chains/solana`)
- `GET /status` - Chain connection status
- `GET /tokens` - Get token information
- `GET /balances` - Get wallet balances
- `GET /poll` - Poll transaction status
EVM-only operations keep chain-specific paths, since they have no meaning elsewhere:
- `POST /chains/ethereum/allowances` - Check token allowances
- `POST /chains/ethereum/approve` - Approve token spending

### DEX Trading Endpoints

#### Router Operations (DEX Aggregators)
- `GET /connectors/{dex}/router/quote-swap` - Get swap quote
- `POST /connectors/{dex}/router/execute-swap` - Execute swap without quote
- `POST /connectors/{dex}/router/execute-quote` - Execute pre-fetched quote
- `GET /connectors/0x/router/get-price` - Get price estimate (0x only)

#### AMM Operations (Uniswap V2, PancakeSwap V2, Raydium)
- `GET /connectors/{dex}/amm/pool-info` - Pool information
- `GET /connectors/{dex}/amm/position-info` - LP position details
- `POST /connectors/{dex}/amm/add-liquidity` - Add liquidity
- `POST /connectors/{dex}/amm/remove-liquidity` - Remove liquidity

#### CLMM Operations (Uniswap V3, PancakeSwap V3, Raydium, Meteora)
- `GET /connectors/{dex}/clmm/pool-info` - Pool information
- `GET /connectors/{dex}/clmm/positions-owned` - List positions
- `POST /connectors/{dex}/clmm/open-position` - Open position
- `POST /connectors/{dex}/clmm/add-liquidity` - Add to position
- `POST /connectors/{dex}/clmm/remove-liquidity` - Remove from position
- `POST /connectors/{dex}/clmm/collect-fees` - Collect fees
See [Trading Routes](#trading-routes-tradingtype) above. Every trading route takes
`chainNetwork` (e.g. `solana-mainnet-beta`) and `connector` (e.g. `jupiter`), and the
full request/response schemas are in the OpenAPI document at `/docs` (or `openapi.json`,
regenerated with `pnpm generate:openapi`).

## Contribution

Expand Down Expand Up @@ -626,64 +616,22 @@ The test directory is organized as follows:

```
/test
/chains/ # Chain endpoint tests
chain.test.js # Chain routes test
ethereum.test.js # Ethereum chain tests
solana.test.js # Solana chain tests
/connectors/ # Connector endpoint tests by protocol
/jupiter/ # Jupiter connector tests
/uniswap/ # Uniswap connector tests
/raydium/ # Raydium connector tests
/meteora/ # Meteora connector tests
/pancakeswap/ # PancakeSwap (EVM) connector tests
/pancakeswap-sol/ # PancakeSwap Solana connector tests
/mocks/ # Mock response data
/chains/ # Chain mock responses
chains.json # Chain routes mock response
/ethereum/ # Ethereum mock responses
/solana/ # Solana mock responses
/connectors/ # Connector mock responses
/services/ # Service tests
/data/ # Test data files
/wallet/ # Wallet tests
/config/ # Configuration tests
/jest-setup.js # Test environment configuration

/scripts # Live testing and utility scripts
test-helius-live.js # Helius RPC provider integration tests
test-infura-live.js # Infura RPC provider integration tests
test-provider-switching.js # RPC provider switching tests
/chains/ # Chain route tests (ethereum, solana)
/connectors/ # Connector tests, one directory per connector
/trading/ # The unified /trading/* route tests
/mocks/ # Shared mock modules (TypeScript)
/helpers/ /utils/ # Test helpers and fastifyWithTypeProvider
/services/ /wallet/ /config/ /pools/ /tokens/ /rpc/
jest-setup.js # Test environment configuration

/scripts # Utility scripts
generate-openapi.ts # Write openapi.json from the live route table
create-wallet.ts # Wallet creation helper
add-bsc-tokens.ts # Token list maintenance
add-pancakeswap-pools.ts # Pool list maintenance
migrate-pool-templates.ts # Pool template migration
```

#### RPC Provider Testing

Gateway includes comprehensive testing for RPC provider integrations:

**Live Integration Tests** (`scripts/test-*-live.js`):
- Test real API connectivity with configured keys
- Verify WebSocket connections and features
- Measure performance improvements vs standard RPC
- Validate network-specific endpoint mappings

**Running RPC Provider Tests**:
```bash
# Test Infura integration (requires API key in conf/rpc/infura.yml)
node scripts/test-infura-live.js

# Test Helius integration (requires API key in conf/rpc/helius.yml)
node scripts/test-helius-live.js

# Test provider switching functionality
node scripts/test-provider-switching.js
```

**Test Coverage Areas**:
- Provider initialization and configuration loading
- Automatic fallback to standard RPC on failures
- Network-specific endpoint resolution
- WebSocket connection establishment
- Performance benchmarking and health checks

For more details on the test setup and structure, see [Test README](./test/README.md).

## Development Guide
Expand Down Expand Up @@ -1010,12 +958,18 @@ testProviderIntegration();

3. **Implement trading methods** based on supported operations

4. **Create route files** following the pattern:
- Router routes in `router-routes/` (for DEX aggregators)
- AMM routes in `amm-routes/` (for V2-style pools)
- CLMM routes in `clmm-routes/` (for concentrated liquidity)
4. **Export plain operation functions** — not routes — following the pattern:
- Router operations in `router-routes/` (for DEX aggregators): `quoteSwap`, `executeSwap`, `executeQuote`
- AMM operations in `amm-routes/` (for V2-style pools)
- CLMM operations in `clmm-routes/` (for concentrated liquidity)

Each takes plain arguments and returns the shared response shape. Connectors no
longer register HTTP routes of their own; the unified `/trading/*` routes are the
only surface.

5. **Add configuration and register** in `src/connectors/connector.routes.ts`
5. **Add one entry per trading type** to `src/trading/connector-registry.ts`, which is
what wires the functions into the unified routes and into the `connector` enums the
schemas (and the OpenAPI document) advertise.

### Testing Requirements

Expand Down
26 changes: 14 additions & 12 deletions docs/connectors/meteora-damm-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,22 @@ DAMM v2 is Meteora's constant-product AMM, implemented by the on-chain **cp-amm*
(`cpamdpZCGKUy5JxQXB4dcpGPiikHawvSWAd6mEn1sGG`) and driven by the
[`@meteora-ag/cp-amm-sdk`](https://docs.meteora.ag/developer-guides/damm-v2/typescript-sdk/getting-started).

Gateway exposes it under the standard AMM interface at `/connectors/meteora/amm/*`, mirroring
the Raydium AMM connector:
Gateway exposes it through the unified AMM interface at `/trading/amm/*` with
`connector=meteora`, the same routes that serve every other AMM connector:

| Endpoint | Method | Notes |
|---|---|---|
| `/connectors/meteora/amm/pool-info` | GET | Pool reserves, price, base (cliff) fee % |
| `/connectors/meteora/amm/position-info` | GET | Wallet's aggregate liquidity in a pool + per-position `positions[]` breakdown |
| `/connectors/meteora/amm/positions-owned` | GET | All of the wallet's DAMM v2 positions across pools |
| `/connectors/meteora/amm/quote-swap` | GET | Exact-in (SELL) / exact-out (BUY) quote |
| `/connectors/meteora/amm/execute-swap` | POST | Swap |
| `/connectors/meteora/amm/quote-liquidity` | GET | Two-sided deposit quote |
| `/connectors/meteora/amm/add-liquidity` | POST | Add to a specific position (`positionAddress`) or open a new one |
| `/connectors/meteora/amm/remove-liquidity` | POST | Remove a % from a specific position (`positionAddress` **required**) |
| `/connectors/meteora/amm/create-pool` | POST | Create + seed a new pool |
| `/trading/amm/pool-info` | GET | Pool reserves, price, base (cliff) fee % |
| `/trading/amm/position-info` | GET | Wallet's aggregate liquidity in a pool + per-position `positions[]` breakdown |
| `/trading/amm/positions-owned` | GET | All of the wallet's DAMM v2 positions across pools |
| `/trading/amm/quote-swap` | GET | Exact-in (SELL) / exact-out (BUY) quote |
| `/trading/amm/execute-swap` | POST | Swap |
| `/trading/amm/quote-liquidity` | GET | Two-sided deposit quote |
| `/trading/amm/open` | POST | Open a new position (NFT) and seed it with liquidity |
| `/trading/amm/add` | POST | Add to a specific position (`positionAddress`) or open a new one |
| `/trading/amm/remove` | POST | Remove a % from a specific position (`positionAddress` **required**) |
| `/trading/amm/close` | POST | Withdraw everything and close the position NFT, refunding its rent (`positionAddress` **required**) |
| `/trading/amm/create-pool` | POST | Create + seed a new pool |

The implementation deliberately keeps to "the basics" so it fits the shared AMM schema. This
document records where DAMM v2 differs from a classic fungible-LP AMM (e.g. Raydium AMM/CPMM),
Expand Down Expand Up @@ -91,7 +93,7 @@ resolves the seed price in this priority order:
1. **`initialPrice`** (quote per base) if provided — `quoteTokenAmount = baseTokenAmount × initialPrice`.
2. **`quoteTokenAmount`** if provided — the `baseTokenAmount : quoteTokenAmount` ratio sets the price.
3. **Otherwise, the current market price is fetched** from the unified swap router
(`/trading/swap/quote`, i.e. the network's configured `swapProvider` — Jupiter on Solana, which
(`/trading/router/quote-swap`, i.e. the network's configured `swapProvider` — Jupiter on Solana, which
aggregates existing venues) via a SELL quote of a small probe (1% of `baseTokenAmount`), and the
pool is seeded there. The probe is kept small so the quote approximates the marginal market
price; quoting the full seed amount would bake its own price impact into the seed price and
Expand Down
Loading
Loading