Skip to content

Commit 5d70235

Browse files
authored
docs: document EXACT_OUTPUT support for bridging (#356)
1 parent de4d6c6 commit 5d70235

2 files changed

Lines changed: 23 additions & 4 deletions

File tree

‎references/api/api_core_concepts/trade-types.mdx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ We recommend using `EXPECTED_OUTPUT` for when an exact output amount is not nece
2020

2121
## Exact Output
2222

23-
The third supported type is `EXACT_OUTPUT`. In this order type, the user specifies exactly how much of the output currency they want to receive from the swap or bridge.
24-
The user is told how much of the origin token this will require to receive exactly the output amount. If the exact requested amount out cannot be filled, the request is failed and the user is refunded on origin.
23+
The third supported type is `EXACT_OUTPUT`. In this order type, the user specifies exactly how much of the output currency they want to receive from the swap, bridge, or cross-chain call.
24+
The user is told how much of the origin token this will require to receive exactly the output amount. If the exact requested amount out cannot be filled, the request is failed and the user is refunded on origin.
2525
This trade type automatically accounts for any associated fees including relay fees, app fees, and gas fees.
26-
We recommend using `EXACT_OUTPUT` for destination calls that require a precise output amount, like minting with an exact ERC20 amount. Destination calls also support `EXACT_INPUT` when you want to cap spend and accept a variable output.
26+
We recommend using `EXACT_OUTPUT` when a precise output amount is required — for example, bridging an exact amount to a destination address, guaranteeing a merchant receives a specific payment amount, or executing a destination call that requires a fixed input such as minting with an exact ERC20 amount. Destination calls also support `EXACT_INPUT` when you want to cap spend and accept a variable output.

‎references/api/api_guides/bridging-integration-guide.mdx‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ While not mandatory for integration, doing the following will improve the UX for
2323
## Get a Quote
2424
Every action in Relay starts with a Quote, this includes bridging. The quote provides all necessary information including fees, transaction data, and execution steps. Use the [quote endpoint](/references/api/get-quote-v2) to request a bridge quote.
2525

26+
Relay supports three [trade types](/references/api/api_core_concepts/trade-types) for bridging:
27+
28+
- **`EXACT_INPUT`** — specify the amount you want to send; the output amount may vary based on fees and slippage.
29+
- **`EXPECTED_OUTPUT`** — specify the approximate amount you want to receive; the input amount is calculated accordingly and the output may vary slightly due to slippage.
30+
- **`EXACT_OUTPUT`** — specify the exact amount you want to receive; the input amount is calculated accordingly. If the exact output cannot be filled, the request fails and the user is refunded on the origin chain.
31+
2632
<CodeGroup>
27-
```bash Request
33+
```bash EXACT_INPUT
2834
curl -X POST "https://api.relay.link/quote/v2" \
2935
-H "Content-Type: application/json" \
3036
-d '{
@@ -37,6 +43,19 @@ While not mandatory for integration, doing the following will improve the UX for
3743
"tradeType": "EXACT_INPUT"
3844
}'
3945
```
46+
```bash EXACT_OUTPUT
47+
curl -X POST "https://api.relay.link/quote/v2" \
48+
-H "Content-Type: application/json" \
49+
-d '{
50+
"user": "0x03508bb71268bba25ecacc8f620e01866650532c",
51+
"originChainId": 1,
52+
"destinationChainId": 8453,
53+
"originCurrency": "0x0000000000000000000000000000000000000000",
54+
"destinationCurrency": "0x0000000000000000000000000000000000000000",
55+
"amount": "100000000000000000",
56+
"tradeType": "EXACT_OUTPUT"
57+
}'
58+
```
4059
```json Response expandable
4160
{
4261
"steps": [

0 commit comments

Comments
 (0)