LCX Liberty. American DeFi. Your keys. Your assets. Your control.
RWA swap
POST /v1/rwa/swap returns the quote and a transaction whose minimum output is set from your tolerance.
Request
/v1/rwa/swapEverything /v1/rwa/quote takes, plus a taker. It quotes under the same rules and builds the transaction in the same call, its minimum output set to rwa.minOut.
| Field | Type | Description |
|---|---|---|
| chainId* | number | The chain both tokens are on. |
| tokenIn* | string | The token being sold. At least one of tokenIn and tokenOut must be in the RWA registry for chainId, or the request is refused with not_an_rwa. The other side may be any token we route, usually the chain's dollar. |
| tokenOut* | string | The token being bought. It must differ from tokenIn. |
| amountIn* | string | The amount to sell in base units, as on /v1/quote. Required unless amount is sent; never both. |
| amount | string | The same amount in human units, scaled by the token's own decimals. |
| maxRefDeviationBps | number | Your tolerance: how far below the reference price you accept, in basis points. Default 100, above 0 and at most 500. A quote further below is refused with below_tolerance. |
| slippageBps | number | The bound against the quote itself. Default 50. The swap's minimum output is the tighter of this and your tolerance. |
| allowOffReference | boolean | Default false. Buying a token whose market pays more than 3% above its reference (the market valuing it under what it stands for) is refused with off_reference unless this is true. |
| allowUnreferenced | boolean | Default false. A token with no live reference is refused with no_reference_price. With this true the quote is served under the engine's own guards and your slippage only, and rwa.refDeviationBps is null. |
| integrator | string | Your integration, exactly as on /v1/quote. |
| taker* | string | The address that sends the transaction and receives the output. |
| deadlineSecs | number | Seconds until the on-chain deadline, as on /v1/build. |
chainId*numberThe chain both tokens are on.
tokenIn*stringThe token being sold. At least one of tokenIn and tokenOut must be in the RWA registry for chainId, or the request is refused with not_an_rwa. The other side may be any token we route, usually the chain's dollar.
tokenOut*stringThe token being bought. It must differ from tokenIn.
amountIn*stringThe amount to sell in base units, as on /v1/quote. Required unless amount is sent; never both.
amountstringThe same amount in human units, scaled by the token's own decimals.
maxRefDeviationBpsnumberYour tolerance: how far below the reference price you accept, in basis points. Default 100, above 0 and at most 500. A quote further below is refused with below_tolerance.
slippageBpsnumberThe bound against the quote itself. Default 50. The swap's minimum output is the tighter of this and your tolerance.
allowOffReferencebooleanDefault false. Buying a token whose market pays more than 3% above its reference (the market valuing it under what it stands for) is refused with off_reference unless this is true.
allowUnreferencedbooleanDefault false. A token with no live reference is refused with no_reference_price. With this true the quote is served under the engine's own guards and your slippage only, and rwa.refDeviationBps is null.
integratorstringYour integration, exactly as on /v1/quote.
taker*stringThe address that sends the transaction and receives the output.
deadlineSecsnumberSeconds until the on-chain deadline, as on /v1/build.
* required
| Field | Type | Description |
|---|---|---|
| Idempotency-Key | string | Optional, 1 to 128 visible ASCII characters. The same key with the same body within 24 hours returns the first answer; with another body it is refused with idempotency_key_reused. Separate from the Stablecoin API's keys. |
Idempotency-KeystringOptional, 1 to 128 visible ASCII characters. The same key with the same body within 24 hours returns the first answer; with another body it is refused with idempotency_key_reused. Separate from the Stablecoin API's keys.
Response
data.quote and data.rwa as on /v1/rwa/quote, plus data.transaction (to, data, value, gas, chainId). If the market moves past rwa.minOut before the transaction lands, the swap reverts on chain rather than paying less.
/v1/allowance before sending. A swap from a token with no allowance reverts, and the revert costs gas.