0Bit Documentation

Lock a pool quote

For approved 0Pools partners, request a short-lived quote and keep execution inside the approved quote window.

Pool quotes are short-lived, single-use pricing decisions for approved headless liquidity partners. Lock a quote only after entitlement and availability checks pass.

A quote is either firm (the default: persisted, single-use, executable, and returned with a quote id and a short expiry roughly 15 seconds out) or indicative (price-only, with no quote id and not executable). Only a firm quote can be executed. Quotes are also fail-soft: when a pool is dry or cannot be priced right now, the request still succeeds (HTTP 200) but returns available: false with an unavailable reason and no quote id. Never execute when available is false.

Do not document pricing internals

This guide explains the partner workflow. It should not expose spread formulas, fee tiers, liquidity sources, reserve logic, treasury behavior, or route-selection internals.

Quote boundary

Implementation shape

  1. Start from an entitled and currently available pool.
  2. Request the quote from your server with secret-key credentials.
  3. Store the quote id, pool id, side, requested amount context, expiry, and quote status.
  4. Display the quote summary and countdown from returned data.
  5. Execute or reject before expiry; otherwise ask for a new quote.
async function lockPoolQuote(input: {
  poolId: string;
  side: 'buy' | 'sell';
  amount: string;
  currency: string;
}) {
  const quote = await poolsClient.createQuote({
    poolId: input.poolId,
    side: input.side,
    amount: input.amount,
    currency: input.currency,
  });

  await poolQuotes.store({
    quoteId: quote.id,
    poolId: input.poolId,
    expiresAt: quote.expiresAt,
    status: quote.available ? 'active' : 'unavailable',
  });

  return quote.available ? { view: 'confirm_quote', quoteId: quote.id } : { view: 'unavailable' };
}

Quote states

StateMeaningPartner action
AvailableA firm quote with a quote id; it can be shown for confirmation.Display returned terms and expiry.
Unavailableavailable: false: 0Pools cannot quote this route now (no quote id).Show generic unavailable copy or fallback; never execute.
ExpiredThe quote window (about 15 seconds) elapsed.Request a fresh quote before execution.
ConsumedThe quote has already been used.Do not reuse it.
RejectedThe quote was explicitly declined.Do not reuse it; request a fresh quote.

Guardrails

  • Do not hardcode quote duration; use the returned expiry.
  • Do not promise execution after expiry.
  • Do not expose internal pricing, balance, provider, venue, or route mechanics.
  • Do not execute a quote that belongs to another partner, pool, or request context.
  • Do not let the browser create or mutate quote requests directly.

On this page