1. CRX
  2. API reference
  3. Maker
  4. Send a firm quote

Send a firm quote

POST/rfqs/{rfq_id}/quotes

Sends a firm quote for an RFQ within 5 seconds of rfq.opened. Makers only. The quote must expire at least 60 seconds after it is sent. To replace a quote, send it again with the same leg_id within the 5-second quote window, with a new client_quote_id or none. Follow it on GET /trades: rfq.quoted, then rfq.accepted, rfq.expired, quote.expired or quote.dropped.

Authentication

  • x-crx-address x-crx-ts x-crx-sig
  • x-crx-address x-crx-signer x-crx-ts x-crx-sig
  • x-crx-session

Parameters

NameInTypeDescription
rfq_id requiredpathstring

RFQ ID, 32-byte hex.

Request body

FieldTypeDescription
rate requiredstring

Rate you quote, as a decimal string above 0 with up to 6 decimal places.

leg_id requiredstring

Leg ID you generate: 24 random bytes, then the RFQ's quote_expiry_max as an 8-byte big-endian integer. The quote expires at that time.

salt requiredstring

Random 32-byte value from a secure generator, as 0x hex. Not returned in responses.

sig requiredstring

EIP-712 signature of the quote by your account key: 65 bytes as 0x hex, low s, v 27 or 28. See QuoteTypedData.

client_quote_idstringlength 1 to 128

Your quote ID: 1 to 128 printable ASCII characters, unique per account. Defaults to quote_id.

Responses

200

The quote and its current status.

Your quote and its status.

FieldTypeDescription
quote_id requiredstring

ID CRX assigns to the quote.

rate requiredstring

Quoted rate, as a decimal string.

expires_at requiredintegerminimum 0

Quote expiry, in Unix time (milliseconds).

client_quote_id requiredstring

Your ID, or quote_id if none was sent.

status requiredstring quoted expired accepted dropped

Quote status. quoted for a new quote; dropped if cancelled or replaced.

leg_id requiredstring

Your leg_id.

leg_hash requiredstring

The Quote digest you signed; compare it with your own.

400

bad_request: a field is missing or malformed, leg_id does not end in the RFQ's quote_expiry_max, the quote expires less than 60 seconds from now, or a test quote is far from the current market rate. invalid_signature: sig is malformed or does not recover to the account. quote_format_outdated: sig signs an earlier Quote format; sign the struct in QuoteTypedData.

code bad_request invalid_signature quote_format_outdated

401

unauthorized: a signed header or the token is refused, or the account is not a maker.

code unauthorized

403

not_whitelisted: the account is not approved for this call.

code not_whitelisted

404

unknown_rfq: no such RFQ, or a test RFQ of another maker.

code unknown_rfq

408

timeout: no answer within 30 seconds.

code timeout

409

quote_window_closed: the quote window has closed. leg_id_taken: another account, another RFQ or a cancelled quote holds this leg_id; use a new one. leg_live: you hold another live leg on this RFQ, details.leg_id; replace or cancel it first. nonce_collision: your client_quote_id names another quote on this RFQ. quote_fills_full: the account is at its open-trade limit on this chain. conflict: the RFQ is your own or your firm's, takes no quotes now, or your client_quote_id is in use with other terms. market_paused: the pair is paused or delisted. platform_paused: CRX is paused.

code quote_window_closed leg_id_taken leg_live nonce_collision quote_fills_full conflict market_paused platform_paused

410

rfq_expired: the RFQ ended.

code rfq_expired

413

payload_too_large: the body is over 2 MiB.

code payload_too_large

415

unsupported_media_type: send content-type: application/json.

code unsupported_media_type

422

unprocessable_entity: a field has the wrong type. insufficient_collateral: your free collateral does not cover the margin this trade adds at your rate; details carries side, required and available in USD.

code unprocessable_entity insufficient_collateral

429

rate_limited: retry after Retry-After seconds.

code rate_limited

HeaderTypeDescription
Retry-Afterinteger

Seconds until the next call is accepted.

ratelimit-limitinteger

Maximum calls in a burst.

ratelimit-remaininginteger

Calls remaining before the limit.

ratelimit-resetinteger

Seconds until the full limit is restored.

ratelimit-refillinteger

Calls restored per minute.

502

upstream: a chain read failed. Retry shortly.

code upstream

503

collateral_unverified: no current collateral figure. withdraw_pending: a pending withdrawal blocks the collateral check; details carries step, reason, expected_by and expected_by_at. mark_unavailable: the pause or market state, or a test RFQ's market rate, is unavailable. Retry shortly.

code collateral_unverified withdraw_pending mark_unavailable

Schemas

QuoteTypedData

The Quote a maker signs for POST /rfqs/{rfq_id}/quotes, as an eth_signTypedData_v4 object (see TypedData). The struct, one line, no space after a comma:

Quote(address seat,bytes32 legId,bytes32 pair,int8 side,uint256 notional,uint64 rate,int16 premiumBps,uint40 expiry,uint64 nonce,bytes32 salt,bytes32 takerRef)

Typehash 0x00fc8b1401eebfc809c01d3a7351526ef07cfd5902793c3d279de280c0aec2cb. Domain: name CRX, version rulebook-1.0, and the chain_id and core from GET /health, whose chains[].domain is the separator. Build each field from the RFQ and your quote:

FieldFromForm
seatyour accountx-crx-address
legIdyour leg_id24 random bytes, then quote_expiry_max as 8 bytes big endian
pairthe RFQ pairkeccak256 of the slash form: USDBRL → keccak256("USD/BRL")
sidethe RFQ sideyour side, as the RFQ shows it to you: 1 long base, -1 short
notionalthe RFQ notional× 10^6, exact
rateyour rate× 10^6, exact; refuse more than 6 decimal places
premiumBpsthe RFQ premium_bpssigned
expirythe RFQ expiryUnix time in seconds, floor(expiry / 1000)
nonceyour leg_idbytes 16–23, big endian. The body does not send it
saltyour saltas sent
takerRefthe RFQ taker_refas served

Test vector on chain ID 1, with an example core that is not deployed. This schema's example is its typed data; the request example of POST /rfqs/{rfq_id}/quotes is its body.

seat          0x70997970C51812dc3A010C7d01b50e0d17dc79C8
legId         0x555555555555555555555555555555555555555555555555000000006ab13dd8
pair          0x644668ae48a22c7afafcf35ff66ebf9c8af2c396ae03de0795d66bde06cdf851 (keccak256("USD/BRL"))
side          -1
notional      5000000000000
rate          5410000
premiumBps    0
expiry        1798732800
nonce         6148914691236517205
salt          0x6161616161616161616161616161616161616161616161616161616161616161
takerRef      0x4f412fb92304015b744b7a32155b5879b48aa8cbb0076b8234640f8891c53b0b
              (taker account 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266,
              taker leg id 0x111111111111111111111111111111111111111111111111000000006ab13dd8)
chainId       1
core          0x1111111111111111111111111111111111111111

domain        0xc10b07f28873cb547d1ab61e8cacb2c0084fc537ac932f55d21f403a0194785c
structHash    0xfc12020df46e5a207618f5dd4b960ca5dfb75bc5f279d0b168355b5402cbd089
digest        0x66ed64dcb1c180844db51855479f4be2557a3686c64da3c2474f261b4d59d3fc
sig           0xa060dd5965ab39968e1e6f5772969e8617ab2de88eb069e6bee0b67dc07b19600d52812d18a34fa708bbee1755ba6e4d74953120d4e0af7e6b14911510cba9131c
              (signed by the seat: the public anvil test key 1)
{
  "domain": {
    "chainId": 1,
    "name": "CRX",
    "verifyingContract": "0x1111111111111111111111111111111111111111",
    "version": "rulebook-1.0"
  },
  "message": {
    "expiry": "1798732800",
    "legId": "0x555555555555555555555555555555555555555555555555000000006ab13dd8",
    "nonce": "6148914691236517205",
    "notional": "5000000000000",
    "pair": "0x644668ae48a22c7afafcf35ff66ebf9c8af2c396ae03de0795d66bde06cdf851",
    "premiumBps": "0",
    "rate": "5410000",
    "salt": "0x6161616161616161616161616161616161616161616161616161616161616161",
    "seat": "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
    "side": "-1",
    "takerRef": "0x4f412fb92304015b744b7a32155b5879b48aa8cbb0076b8234640f8891c53b0b"
  },
  "primaryType": "Quote",
  "types": {
    "EIP712Domain": [
      {
        "name": "name",
        "type": "string"
      },
      {
        "name": "version",
        "type": "string"
      },
      {
        "name": "chainId",
        "type": "uint256"
      },
      {
        "name": "verifyingContract",
        "type": "address"
      }
    ],
    "Quote": [
      {
        "name": "seat",
        "type": "address"
      },
      {
        "name": "legId",
        "type": "bytes32"
      },
      {
        "name": "pair",
        "type": "bytes32"
      },
      {
        "name": "side",
        "type": "int8"
      },
      {
        "name": "notional",
        "type": "uint256"
      },
      {
        "name": "rate",
        "type": "uint64"
      },
      {
        "name": "premiumBps",
        "type": "int16"
      },
      {
        "name": "expiry",
        "type": "uint40"
      },
      {
        "name": "nonce",
        "type": "uint64"
      },
      {
        "name": "salt",
        "type": "bytes32"
      },
      {
        "name": "takerRef",
        "type": "bytes32"
      }
    ]
  }
}

TypedData

An eth_signTypedData_v4 object; types holds EIP712Domain and the struct. In message, integers are decimal strings, and bytes32 values and addresses are lowercase 0x hex. chainId is a number. Compare parsed values, not bytes. Domain: name CRX, version rulebook-1.0, and the chain_id and core from GET /health.

FieldTypeDescription
types requiredobject
primaryType requiredstring

Trade, or Quote for a maker.

domain requiredobject
message requiredobject

The struct's fields. For Trade, see TradeTypedData; for Quote, QuoteTypedData.

TradeTypedData

The Trade struct, one line, no space after a comma:

Trade(string summary,string pair,string side,uint256 notionalE6,uint64 rateE6,int16 premiumBps,uint40 maturity,bytes32 pairC,bytes32 ownLegId,uint64 ownNonce,bytes32 ownSalt)

Typehash 0x2a4f432dd51178481baaacab72453a149e29560e5d366c2ebb93bb767fab4630. Build each field from your own RFQ and the quote:

FieldFromForm
summarythe fields belowone line, rules below
pairthe RFQ pairslash form, USDBRL → USD/BRL
sidethe RFQ side1 → buy, -1 → sell: your side, in the first currency
notionalE6the RFQ notional× 10^6, exact; refuse more than 6 decimal places
rateE6the quote rate× 10^6, exact
premiumBpsthe RFQ premium_bpssigned. Positive: you pay
maturitythe RFQ expiryUnix time in seconds, floor(expiry / 1000)
pairC, ownSaltthe templateas served
ownLegIdthe templatebytes 24–31 equal the RFQ's quote_expiry_max
ownNoncethe templateat most now + 24 hours, Unix time in milliseconds

summary: <side> <size> <BASE> vs <QUOTE> at <rate> <QUOTE> per <BASE>, matures <date>, upfront <up>. <size> and <rate> are the integer part, then . and the fraction with trailing zeros cut (no . when whole). <size> groups thousands with one space; <rate> is not grouped. <date> is YYYY-MM-DDTHH:MM:SSZ, UTC. <up> is none, taker pays <P> % or maker pays <P> %. <P> is the premium in basis points / 100, with two decimal places. ASCII only, one space between words, no trailing space.