How to swap tokens

Learn how to request quotes from market makers and deliver orders

Once you have your endorsement server and auctions set up, you can start requesting quotes from market makers.

📘

What networks are supported?

DFlow liquidity is available on a number of chains – refer to Supported networks.

Swap tokens

To swap tokens using DFlow market maker liquidity, you must request a firm quote. A firm quote includes a blockchain transaction that contains the instructions needed to perform the token swap.

Step 1: Request an endorsement

First, request an /endorsement from your endorsement server. The endpoint returns an endorsement object granting you permission to request a firm quote.

Step 2: Request a firm quote

Once your request is endorsed, you can request a /firmQuote (EVM Solana). A firm quote ensures your users will trade at a guaranteed best price.

Step 3: Send order

EVM

If your user chooses to sign the swap transaction, you must send the signed transaction directly to the blockchain network. Then, make a request to /reportTransaction (EVM) with the transaction hash to receive USDC payments if transaction was successfully executed.

Solana

If your user chooses to sign the swap transaction, you can execute it by sending it to DFlow to be settled on-chain. You receive USDC payments when you deliver to DFlow. Refer to docs on /sendTransaction (Solana).

Indicative quote

An indicative quote contains pricing information from the market maker, but unlike a firm quote, it cannot be used to swap tokens at a set price. You should use indicative quotes to show pricing information when you don't have a wallet connected or don't intend to send an order.

Step 1: Request an endorsement

First, request an endorsement from your endorsement server. Note that if your application allows your users to see indicative prices before connecting their wallets, your endorsements for indicative quotes can be generic and omit the retailTrader.

Step 2: Request an indicative quote

Once your request is endorsed, you can request an /indicativeQuote (EVM, Solana).

Payment in lieu

Payment in lieu is activated when a market maker does not provide a firm quote. This feature incentivizes market makers to provide timely firm quotes. Payment in lieu is a feature available to self-managed integrators only.

If an auction has payment in lieu enabled and the market maker didn't provide a firm quote, you will receive a payment in lieu token which authorizes you to receive the payment that you would've received if the market maker had returned a quote and you had sent the transaction.

Step 1: Request approval

To receive a payment in lieu, your endorsement server must approve the payment using /paymentInLieuApproval.

Step 2: Accept payment in lieu

With the approval from your endorsement server, you can send a request to accept the payment in lieu using /paymentInLieu. Payment in USDC will be sent to your DFlow account.