convert

Quote a conversion and return the transactions that execute it

Changed on

Takes an intent (chain, input token, output token, base-unit amount) and returns whatever executes it. Routing policy — the slippage floor, the deadline window, which contract is called — therefore changes with a backend deploy rather than a client release, which is what makes the mobile app viable. The client signs through its own wallet; this service never holds a key and never broadcasts.

Two response shapes, discriminated by strategy, and a client must branch on that field before reading any other:

  • mint — an input stablecoin on the hub. Returns the approve + mint calls to sign. mint mints to msg.sender and approve names only the spender, so no recipient address is present in these bytes for this service to substitute, which is what lets the client re-derive every call and refuse to sign on a mismatch.
  • swapAndMint / swapAndStake — anything else. Returns a solved routing plan, not calldata: this service runs the probe and the numerical solve Li.Fi’s contract-call quoting forces on an exact-input flow, and the client builds its own destination call and makes one Li.Fi request with it. The client never signs bytes this service produced, so this service cannot redirect funds; its influence is confined to the plan’s numbers, each of which the client bounds on both sides.

A 201 means the request was not statically refused, not that the conversion will succeed.

post/convert/quote

Request

Request body

chainIdnumber required

Chain the transaction is signed on. The hub for a direct mint, or a supported source chain for a Li.Fi conversion.

fromTokenstring required

Input token address. An accepted input stablecoin on the hub mints directly; anything else routes through Li.Fi. Use the zero address for a native token.

toTokenstring required

Output token address. Must be dreUSD or dreUSDs on the hub.

amountstring required

Input amount in the token’s smallest units, as a decimal integer string. Base units rather than a human decimal so no float ever touches a money value.

fromAddressstring

The wallet the client believes it is acting as. Required for Li.Fi conversions, where it is checked against the authenticated session and rejected on a mismatch — the receiver ends up inside calldata that moves money, so a stale session must fail loudly rather than solve for the wrong address. Never used as the receiver itself; that always comes from the session.

Example request

{
  "chainId": 8453,
  "fromToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  "toToken": "0xB4E008A61b5A7A7D0e1aebd639F704d24821Bb2F",
  "amount": "100000000",
  "fromAddress": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
}

Response

Calls to sign, or a routing plan to execute

OR

Example response

{
  "strategy": "mint"
}

Changes

    • breaking

      added to the response body oneOf list for the response status

    • breaking

      the response's body type changed from object to no type for status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • breaking

      removed the required property from the response with the status

    • info

      added the new optional request property

    • info

      added the non-success response with the status