Skip to main content
Using the order server to fetch quotes is optional. You can submit any intent and pricing structure you want. While you can implement your own quoting logic, the order server allows you to query solvers’ inventory, providing stronger execution guarantees. The LI.FI order server caches quotes from solvers and their inventory. You can access this inventory at any time by calling the OIF-compatible quote endpoint.
interface GetQuoteRequest {
  /** User requesting the quote and recipient of refund inputs in case of failures */
  user: Address;
  intent: {
    intentType: "oif-swap";
    /** Available inputs for the quote */
    inputs: Input[];
    /** Requested outputs for the quote */
    outputs: Output[];
    swapType: "exact-input";
    /** Minimum validity timestamp in seconds */
    minValidUntil?: number;
  };
}

interface Input {
  user: Address;
  asset: Address;
  amount: Amount;
}

export interface Output {
  receiver: Address;
  asset: Address;
  amount?: Amount;
}
When fetching quotes from the order server, keep in mind:
  • The order server uses the interoperable address format, which encodes both the chain and address in a single bytes field.
  • Amounts are always provided in wei, the smallest denomination of a currency, with no decimals. For example, an ERC20 token with 6 decimals and an amount of 1.5 should be provided as "1500000".
  • Currently, the order server only supports fixed-input quotes, meaning the input amount is required.

Available Quotes

If a quote is available, the server returns a non-empty array of quotes. Depending on your intent, multiple fulfillment options may be provided. The recommended quote is always at index 0.
interface GetQuoteResponse {
  quotes: {
    order: null, // Not currently returned
    validUntil: number,
    quoteId: `quote_${string}`,
    preview: {
      inputs: Input[],
      outputs: Output[] 
    },
    metadata: { 
      exclusiveFor: string | null
    },
    partialFill: false
  }[]
}
The metadata.exclusiveFor field may be returned for each quote. It represents a weighted, randomly selected solver for your intent. If returned, it is highly recommended to attach this field to the order context as follows:
let currentTime: number;
const exclusiveExpiry = (currentTime + ONE_MINUTE).toString(16);
let exclusiveFor: string | null;
const paddedExclusiveFor: string = exclusiveFor.replace("0x", "").padStart(64, "0");
mandateOutput.context = `0xe0${paddedExclusiveFor}${exclusiveExpiry}`;

Getting a Quote

Using the order server to fetch quotes is optional, but it ensures access to solvers’ inventory and provides better execution guarantees.

Interoperable Address

The LI.FI order server uses interoperable addresses, which encode both a chain and an address inside a single bytes field. Here is an example encoding of the EVM address 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 on Base:
0x0001|0000|02|2105|14|833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
  ^^^^--------------------------------------------------------- Version: 1 (0001)
       ^^^^---------------------------------------------------- ChainType: EVM (0000)
            ^^------------------------------------------------- Length of Chain Reference: 2 (02)
               ^^^^-------------------------------------------- Chain Reference: Base=8453 (2105)
                    ^^----------------------------------------- Length of address: 20 (14)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Address: 0x833... (833...)
For more details on quoting, see the Swagger docs for /quote/request.