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.

python
async def quote(
    self,
    token_in: str,
    token_out: str,
    amount_in: int,
    opts: QuoteOptions | None = None,
) -> Quote

Usage

python
from propamm.common.helpers import parse_ether
from propamm.common.tokens import ETH_SENTINEL, USDC
from config import router

quote = await router.quote(ETH_SENTINEL, USDC, parse_ether("1"))
python
from propamm import ContractClient, PropAmmRouter

client = ContractClient("https://...")
router = PropAmmRouter(client, "0x...")  # 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

token_in

  • Type: str

Address of the token being sold, or ETH_SENTINEL for native ETH.

token_out

  • Type: str

Address of the token being bought, or ETH_SENTINEL for native ETH.

amount_in

  • Type: int

Exact input amount, in atomic units.

opts (optional)

Per-call quote options.

python
from propamm import QuoteOptions

stale = await router.quote(
    ETH_SENTINEL, USDC, parse_ether("1"), QuoteOptions(overrides=None)
)

overrides can also point at an explicit source — a streaming WebSocket source, or a fetch-on-demand JSON-RPC source:

python
from propamm import QuoteOptions
from propamm.overrides import OverridesRpcSource, OverridesWsSource

# a streaming WebSocket source…
overrides = OverridesWsSource(url="wss://rpc.titanbuilder.xyz/ws/pamm_quote_stream")

# …or a fetch-on-demand JSON-RPC source:
overrides = OverridesRpcSource(url="https://rpc.titanbuilder.xyz")

quote = await router.quote(
    ETH_SENTINEL, USDC, parse_ether("1"), QuoteOptions(overrides=overrides)
)

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 raise: it falls back to the Uniswap V3 quote and reports the fallback router as venue.

python
from propamm.common.pamms import BEBOP, FERMI

pinned = await router.quote(
    ETH_SENTINEL, USDC, parse_ether("1"), QuoteOptions(venues=[FERMI])
)
subset = await router.quote(
    ETH_SENTINEL, USDC, parse_ether("1"), QuoteOptions(venues=[FERMI, BEBOP])
)