# Transaction Quote

Estimate the network fee of a send, in the native coin and in EUR, before creating it.

## Overview

Pass the wallet, chain, recipient, token and amount you intend to use with [Create Transaction](https://docs.aureahub.com/docs/tx-create.md). Nothing is stored or submitted. Rate limit: 60 requests per minute.

## Endpoint

### `POST /v1/transactions/quote`

Authentication: bearer token required.

Returns an estimated network fee for a prospective send.

**Request body**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `walletId` | string (uuid) | yes | Wallet that would send. Must belong to the authenticated user. |
| `chain` | string | yes | Chain identifier. |
| `toAddress` | string | yes | Recipient address. |
| `tokenAddress` | string | no | Token contract address. Default `""` (native coin). |
| `amount` | string | no | Amount in the smallest unit (digits). Default `"0"`. Used to estimate gas for token transfers. |
| `isTestnet` | boolean | no | Default `false`. Set it to match the wallet's network. |

**Responses**

`200` OK

```json
{
  "feeEur": 0.000027,
  "feeNativeAmount": "31500000000000",
  "feeNativeSymbol": "xDAI",
  "isFree": false,
  "estimatedArrival": "Instant"
}
```

`404` Not Found

```json
{ "error": "NotFoundError", "message": "Wallet not found" }
```

| Field | Meaning |
| --- | --- |
| feeEur | Estimated fee in EUR (number). |
| feeNativeAmount | Estimated fee in the native coin's smallest unit (wei on EVM chains), as a string. |
| feeNativeSymbol | Native coin symbol from the chain registry. |
| isFree | `true` when the quote is zero — see below for what that can mean. |
| estimatedArrival | Always `"Instant"` in the current API. |

## How the Fee Is Estimated

| Wallet / chain | Result |
| --- | --- |
| Custodial wallet (`aes_single`, `sss_2of2_akv`) | `feeEur: 0`, `feeNativeAmount: "0"`, `isFree: true`. |
| Non-custodial wallet on `solana` or `algorand` | The same zero quote. |
| Non-custodial wallet on an EVM chain | `feeNativeAmount` = gas limit × gas price. Gas limit: 21000 for a native coin; for a token, the network estimate plus 30% (150000 if the estimate fails). Gas price: the network's `maxFeePerGas` (or `gasPrice`) × 1.5. `feeEur` converts that amount as an 18-decimal value using the native token's EUR price from your tenant's token registry, or is `0` when no price is available. `isFree: false`. |
| Non-custodial EVM wallet, but the RPC endpoint or fee data is unavailable | The zero quote with `isFree: true`. |

> ℹ️ `isFree: true` is also returned when the fee could not be estimated, so for a non-custodial wallet it does not guarantee a free send. The quote prices a regular transfer and does not model gasless token sends. For non-custodial EVM wallets the chain must be in the chain registry, otherwise the call returns `400` (`Chain "…" (isTestnet=…) is not registered in the chain registry`).

## Implementation

```javascript
async function quoteSend(token, { walletId, chain, toAddress, tokenAddress = '', amount = '0', isTestnet = false }) {
  const res = await fetch('https://api.aureahub.com/v1/transactions/quote', {
    method: 'POST',
    headers: { Authorization: 'Bearer ' + token, 'Content-Type': 'application/json' },
    body: JSON.stringify({ walletId, chain, toAddress, tokenAddress, amount, isTestnet }),
  });
  const body = await res.json();
  if (!res.ok) throw new Error(res.status + ' ' + body.message);
  return body; // { feeEur, feeNativeAmount, feeNativeSymbol, isFree, estimatedArrival }
}

const q = await quoteSend(token, {
  walletId, chain: 'gnosis', toAddress, amount: '10000000000000000',
});

// Custodial wallets always quote zero; for non-custodial wallets a zero quote
// can also mean the fee could not be estimated.
const feeLabel = q.isFree ? 'No network fee quoted' : '≈ €' + q.feeEur.toFixed(4);
```

---

Web version: https://docs.aureahub.com/#tx-quote
