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
- Build standard executor input (
executorAddress,poolKey, amount limit fields,sqrtPriceLimitX96,zeroForOne,receiver,deadline). - Build a
SignedSwapQuoteBasepayload from your quote service. - Sign with
signSignedSwapQuote(...)using the expected quote signer. - Attach
signedSwapQuoteto anSignedCollateralSwapRoutercall descriptor. - Execute swap with
walletClient.writeContract(...). - Parse events/errors from receipt for monitoring and remediation.
Signed Quote Schema
| Field | Type | Unit | Validation focus |
|---|---|---|---|
poolId | bytes32 | hex | pool binding |
trader | address | EVM address | trader binding |
maxAbsAmount | uint256 | token base units | size bound (>= abs(amountSpecified)) |
quotedPriceE18 | uint256 | 1e18 fixed-point | oracle envelope policy |
expiry | uint64 | Unix timestamp seconds | freshness |
v, r, s | signature | ECDSA | signer authenticity |
EIP-712 Domain
The SDK signs and hashes quotes with:
name:CollateralManagerversion:1chainId: target chain idverifyingContract: collateral manager addressprimaryType: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
SignedQuoteExpiredSignedQuoteReplaySignedQuoteTraderMismatchSignedQuotePoolMismatchSignedQuoteSignerMismatch/SignedQuoteSignerMissingSignedQuoteAmountLimitExceededSignedQuotePolicyViolationSignedQuoteModeDisabled
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);
}