Skip to content

quote

Best quote across all whitelisted venues and the Uniswap V3 fallback.

The router's quote functions are nonpayable on-chain, so the SDK calls them through eth_call simulation — by default carrying the latest pAMM state overrides plus their block number/timestamp, so venues quote fresh off-chain liquidity.

ts
quote(tokenIn: Address, tokenOut: Address, amountIn: bigint, opts?: QuoteOptions): Promise<Quote>

Usage

ts
import { parseEther } from "propamm/common/helpers";
import { ETH_SENTINEL, USDC } from "propamm/common/tokens";
import { router } from "./config";

const { amountOut, venue } = await router.quote(
  ETH_SENTINEL,
  USDC,
  parseEther("1"),
);
ts
import { ContractClient } from "propamm/client";
import { PropAmmRouter } from "propamm/router";
import { mainnet } from "propamm/common/chains";

export const client = ContractClient.fromRpc({
  rpcUrl: "https://...",
  chain: mainnet,
});
export const router = new PropAmmRouter(client); // defaults to the mainnet router proxy

Returns

Quote

The best output amount and the venue that produced it; pin venue in a follow-up swap via its venues option.

Parameters

tokenIn

  • Type: Address

Token being sold, or ETH_SENTINEL for native ETH.

tokenOut

  • Type: Address

Token being bought, or ETH_SENTINEL for native ETH.

amountIn

  • Type: bigint

Exact input amount, in atomic units.

opts (optional)

Per-call quote options.

ts
const stale = await router.quote(ETH_SENTINEL, USDC, parseEther("1"), {
  overrides: null,
});

venues restricts the quote: a single entry quotes that venue directly, several pick the best among them (must be non-empty when present). When no listed venue can be priced, the call does not revert: it falls back to the Uniswap V3 quote and reports the fallback router as venue.

ts
import { PAMMS } from "propamm/common/pamms";

const pinned = await router.quote(ETH_SENTINEL, USDC, parseEther("1"), {
  venues: [PAMMS.fermi],
});
const subset = await router.quote(ETH_SENTINEL, USDC, parseEther("1"), {
  venues: [PAMMS.fermi, PAMMS.bebop],
});