Steer Protocol
Developer Guide

Signed Swap Quote Integration

Canonical integration guide for signed quote settlement mode, validation semantics, and strict reject behavior.

Purpose

Use this page as the normative integration guide for signed swap quote mode.

Signed quote mode gates signed quote vault settlement:

  • no signed quote -> pure AMM pass-through, no vault settlement
  • valid signed quote -> signed quote settlement path
  • invalid supplied signed quote -> revert (no same-transaction fallback)

Integration Sequence

  1. Build standard executor input (executorAddress, poolKey, amount limit fields, sqrtPriceLimitX96, zeroForOne, receiver, deadline).
  2. Build a SignedSwapQuoteBase payload from your quote service.
  3. Sign with signSignedSwapQuote(...) using the expected quote signer.
  4. Attach signedSwapQuote to an SignedCollateralSwapRouter call descriptor.
  5. Execute swap with walletClient.writeContract(...).
  6. Parse events/errors from receipt for monitoring and remediation.

Signed Quote Schema

FieldTypeUnitValidation focus
poolIdbytes32hexpool binding
traderaddressEVM addresstrader binding
maxAbsAmountuint256token base unitssize bound (>= abs(amountSpecified))
quotedPriceE18uint2561e18 fixed-pointoracle envelope policy
expiryuint64Unix timestamp secondsfreshness
v, r, ssignatureECDSAsigner authenticity

EIP-712 Domain

The SDK signs and hashes quotes with:

  • name: CollateralManager
  • version: 1
  • chainId: target chain id
  • verifyingContract: collateral manager address
  • primaryType: SignedSwapQuote

Typed fields used for digest/signature:

  • poolId, trader, maxAbsAmount, quotedPrice, expiry

Replay protection is derived on-chain from the signed price envelope, recovered signer, chain id, and collateral manager address. The same envelope is single-use even if the submitted swap size changes.

Strict Reject Semantics

If a signed quote is supplied, quote validation must pass before settlement state mutation.

Common failure families:

  • malformed/unsupported payload
  • SignedQuoteExpired
  • SignedQuoteReplay
  • SignedQuoteTraderMismatch
  • SignedQuotePoolMismatch
  • SignedQuoteSignerMismatch / SignedQuoteSignerMissing
  • SignedQuoteAmountLimitExceeded
  • SignedQuotePolicyViolation
  • SignedQuoteModeDisabled

Any of these failures reverts the transaction and does not downgrade to unsigned pure-AMM execution in the same transaction.

Example (signed path)

import {
  signSignedSwapQuote,
  buildExactInputSignedQuoteCallDescriptor,
  parseError,
  type SignedSwapQuoteBase,
} from "@steerprotocol/collateral-rail-sdk";

const quote: SignedSwapQuoteBase = {
  poolId: "0x2222222222222222222222222222222222222222222222222222222222222222",
  trader: "0x3333333333333333333333333333333333333333",
  maxAbsAmount: 1_000000n,
  quotedPriceE18: 1_000000000000000000n,
  expiry: 1_700_000_000n,
};

const signedSwapQuote = await signSignedSwapQuote(
  walletClient,
  "0xCollateralManager",
  chainId,
  quote,
  "0xSigner",
);

const call = buildExactInputSignedQuoteCallDescriptor({
  executorAddress: "0xSignedCollateralSwapRouter",
  poolKey,
  amountIn: 1n,
  amountOutMin: 0n,
  sqrtPriceLimitX96: 0n,
  zeroForOne: true,
  receiver: quote.trader,
  deadline: 1_700_000_120n,
  signedSwapQuote,
});

try {
  await walletClient.writeContract(call as never);
} catch (error) {
  const parsed = parseError(error);
  console.error(parsed?.source, parsed?.name, parsed?.args);
}

See Also

On this page