How routing works¶
What sits behind a Vector quote and how a signed gasless swap actually executes.
Quote sources¶
Vector prices routes from pluggable quote sources — adapters that read
liquidity directly (on-chain AMM quoting against live pool state) rather than
trusting posted prices. Every candidate route is priced by a real source at
quote time; what you see in amountOut is what the venue's current state
supports, and path names the legs and providers involved.
Planning and ranking¶
The planner composes candidate routes from the available sources — single-leg
swaps, and bridge-including compositions where a pair spans chains — then ranks
them by your routeMode: raw output (max_value), estimated completion time
(fastest), or a weighted balance (suggested). Ranking happens per request;
there is no static routing table to go stale.
quoteId: a deterministic snapshot¶
A quote is hashed into its quoteId — the route, amounts, fee, and expiry are
pinned when quoted. Build path by ID
rebuilds calldata for exactly that snapshot; if liquidity has shifted enough
that the snapshot can't be honored, building fails rather than silently
repricing. Quotes are short-lived by design (expiry), keeping the honored
window tight.
The executor: how gasless swaps stay safe¶
Gasless execution runs through Vector's on-chain executor contract (the
vectorContract on each supported chain).
One transaction, four steps:
The user's Permit2 signature authorizes the exact input amount to that executor. In mode 3 (Permit2Witness), the signed message also carries a witness — the hash of the calldata and the target — so the signature is valid for one specific execution and nothing else. The executor verifies the witness on-chain; a relayer holding your signature cannot run different calldata with it. Output goes directly to the receiver; the executor holds nothing between transactions.
Where Photon fits¶
Vector doesn't broadcast; it hands the executor transaction to
Photon, which relays it with all of its retry, nonce,
and fee-bump machinery — that's the photonTxId on every gasless submission.
The user's gaslessness is Photon's sponsorship; the swap's integrity is the
executor's verification. The two concerns never mix.