> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rheon.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Build the transaction

> POST /deposit/transaction - turn a quote into the unsigned transaction for the wallet to sign.

Turns a quote from [`/deposit/quote`](/api-reference/deposit-quote) into the
**unsigned** transaction the user's wallet signs and submits. If the source token
needs an ERC-20 allowance, an `approval` transaction is returned too - sign it
first.

<Note>
  Rheon never signs. Your client submits the transactions with the user's wallet, on
  the source chain.
</Note>

## Request

<ParamField body="quote" type="object" required>
  The full quote object returned by `/deposit/quote`, unchanged.

  <Expandable title="quote">
    <ParamField body="provider" type="string" required>
      The `provider` from the quote response.
    </ParamField>

    <ParamField body="outAmount" type="string" required>
      The `outAmount` from the quote response.
    </ParamField>

    <ParamField body="validUntil" type="number">
      Optional. The `validUntil` from the quote response, if present.
    </ParamField>

    <ParamField body="payload" type="object" required>
      The opaque `payload` from the quote response, unchanged.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="tx" type="object">
  The unsigned deposit transaction to sign and submit on the source chain.

  <Expandable title="tx">
    <ResponseField name="to" type="string">Target contract address.</ResponseField>
    <ResponseField name="data" type="string">Hex-encoded calldata.</ResponseField>
    <ResponseField name="value" type="string">Native value to send, decimal string in wei.</ResponseField>
    <ResponseField name="chainId" type="number">Source chain id the transaction executes on.</ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="approval" type="object">
  Optional. Present only when the source token needs an ERC-20 allowance. Sign and
  submit it **before** `tx`. Same shape as `tx`.
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "$RHEON_API/deposit/transaction" \
    -H "Content-Type: application/json" \
    -d '{
      "quote": {
        "provider": "rheon-router",
        "outAmount": "4986000",
        "validUntil": 1720800000,
        "payload": { "route": "..." }
      }
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "approval": {
      "to": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",
      "data": "0x095ea7b3...",
      "value": "0",
      "chainId": 10
    },
    "tx": {
      "to": "0x1231DEB6f5749EF6cE6943a275A1D3E7486F4EaE",
      "data": "0x4630a0d8...",
      "value": "0",
      "chainId": 10
    }
  }
  ```
</ResponseExample>

## Signing order

1. If `approval` is present, sign and submit it first, and wait for it to confirm.
2. Sign and submit `tx`.
3. Take the `tx` receipt to [`/deposit/status`](/api-reference/deposit-status) to
   track delivery.

## Errors

| HTTP | `code`            | When                                         |
| ---- | ----------------- | -------------------------------------------- |
| 400  | `invalid_request` | `quote` is missing or malformed.             |
| 429  | `rate_limited`    | Over the rate limit (5 requests / 10s / IP). |
| 500  | `internal`        | Unexpected server error.                     |
