Quotes & build-tx
03 / 08

Quote it, then build it

Two endpoints cover both market phases — the quote tells you what a swap does, build-tx returns the unsigned transaction that does it.

GET /tokens/:address/quote

Prices a hypothetical swap against the curve (or the Uniswap pool once graduated). No auth.

  • type
    Default
    buy
    Notes
    buy or sell — anything else returns an error object
  • amount
    Default
    1
    Notes
    Positive number. Buys are denominated in the quote asset; sells in the token
curl "https://api.vectr.bot/tokens/0x…/quote?type=buy&amount=0.5"

The quote is a view, not a reservation — the curve reprices with every trade that lands before yours. Always quote immediately before building.

POST /tokens/:address/build-tx

Returns the unsigned transaction — to, data, value — plus an approval step when the token needs one. Nothing is signed or broadcast here.

curl -X POST https://api.vectr.bot/tokens/0x…/build-tx \
  -H "Content-Type: application/json" \
  -d '{"type":"buy","amount":"0.5","slippage":1,"recipient":"0xYourWallet"}'
  • type
    Default
    required
    Notes
    buy or sell
  • amount
    Default
    required
    Notes
    Send as a string — a float can't carry an exact 18-decimal amount, and a Max sell a wei over the balance reverts
  • slippage
    Default
    1
    Notes
    Percent tolerance applied to the quote
  • recipient
    Default
    session wallet
    Notes
    The sending wallet. Required once the token trades on Uniswap — the router delivers output to an explicit address

Graduated tokens need a recipient

On the curve, tokens go to whoever sends the transaction. After graduation the Uniswap router needs recipient explicitly — anonymous calls must pass their wallet, or the build has nowhere to send the output.

Broadcasting

What happens to the unsigned transaction is up to the caller: sign it in your own wallet, hand it to the Vectr terminal for confirmation, or submit it through POST /wallet/sign-and-submit with a read-write API key. See authentication for the signing path and its restrictions.