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

# Gas Quotes

> Retrieve relayer fees, gas drops, and signatures from the Gas API.

import { Callout } from 'mintlify';

## Overview

Use the Gas API to calculate relayer fees and obtain the cryptographic signatures required by the `CashmereCCTP` contracts. Quotes are deterministic for the current block state and expire 100 seconds after issuance.

***

## `GET /getEcdsaSig_native`

Generates an ECDSA signature for EVM contracts (`transfer`, `transferWithPermit`, `transferV2`, `transferV2WithPermit`).

```
GET https://gas.cashmere.exchange/getEcdsaSig_native
```

### Query Parameters

| Name                | Type    | Required | Description                                                                 |
| ------------------- | ------- | -------- | --------------------------------------------------------------------------- |
| `localDomain`       | number  | ✅        | Origin Circle domain (Ethereum = `0`, Arbitrum = `3`, etc.).                |
| `destinationDomain` | number  | ✅        | Target Circle domain.                                                       |
| `isV2`              | boolean | ✅        | `true` for CCTP v2 flows (`transferV2*`), `false` for legacy v1.            |
| `isNative`          | boolean | ✅        | `true` if relayer fee + gas drop will be paid in the origin's native token. |

### Example

```bash theme={null}
curl "https://gas.cashmere.exchange/getEcdsaSig_native\
?localDomain=0\
&destinationDomain=3\
&isV2=true\
&isNative=false"
```

```json theme={null}
{
  "fee": "1500000",
  "deadline": "1729281534",
  "signature": "0x8b6aa1…1f9d",
  "isNative": false,
  "cctpVersion": 2
}
```

### Response Fields

| Field         | Description                                                                                    |
| ------------- | ---------------------------------------------------------------------------------------------- |
| `fee`         | Relayer fee (USDC, 6 decimals when `isNative=false`, native units otherwise).                  |
| `deadline`    | UNIX timestamp that the contracts enforce (`now + 100s`).                                      |
| `signature`   | ECDSA signature over `(localDomain, destinationDomain, fee, deadline, isNative, cctpVersion)`. |
| `isNative`    | Echo of the query flag.                                                                        |
| `cctpVersion` | `1` or `2`, matching the target function.                                                      |

<Callout type="info">
  Gas drops are not returned explicitly. When `isNative=false`, include your desired `gasDropAmount` in `TransferParams` and pass the same value to the contract.
</Callout>

***

## `GET /getEd25519Sig_native`

Generates an Ed25519 signature for Solana, Aptos, or Sui transfers.

```
GET https://gas.cashmere.exchange/getEd25519Sig_native
```

### Query Parameters

| Name                | Type    | Required | Description                                   |
| ------------------- | ------- | -------- | --------------------------------------------- |
| `localDomain`       | number  | ✅        | Origin domain.                                |
| `destinationDomain` | number  | ✅        | Target domain.                                |
| `isNative`          | boolean | ✅        | `true` for native fee flows.                  |
| `version`           | number  | ❌        | Set to `2` when calling Solana `transfer_v2`. |

### Example

```bash theme={null}
curl "https://gas.cashmere.exchange/getEd25519Sig_native\
?localDomain=5\
&destinationDomain=0\
&isNative=false\
&version=2"
```

```json theme={null}
{
  "signature": "0x6c80e3…d4",
  "message": "0x0200000000000000000000000000000000000000000000000000000000000000e0fb080000000000",
  "publicKey": "0x93ab6f…af",
  "destinationDomain": "0",
  "fee": "590000",
  "deadline": "1729281534",
  "isNative": false,
  "version": 2
}
```

### Message Layout

BCS-encoded fields (in order):

1. Optional `version` (`u8`).
2. Optional `localDomain` (`u32`) when `isNative` is provided.
3. `destinationDomain` (`u32`).
4. `fee` (`u64`).
5. `deadline` (`u64`).
6. Optional `isNative` (`bool`).

Reproduce this byte order on-chain before verifying the signature.

***

## Token Pricing

```
GET https://gas.cashmere.exchange/tokenPrices
```

Returns a JSON map of `{ domainId: priceInUsd }` pulled from Redis.

***

## WebSocket Updates

```
GET wss://gas.cashmere.exchange/subscribe
```

* `{ "type": "fees", "data": { <sourceChain>: { fee: { <dest>: { native, usd } }, gas: { native, usd } } } }`
* `{ "type": "tokenPrices", "data": { <domainId>: "<price>" } }`

Use the socket to keep frontends in sync without repeatedly polling the REST endpoints.

***

## Failure Modes

| HTTP Status | Description                                                                     |
| ----------- | ------------------------------------------------------------------------------- |
| `400`       | Missing or invalid query parameters.                                            |
| `500`       | Redis cache is incomplete (`MISSING_PRICE_DATA`) or an internal error occurred. |

Retries are usually safe after a brief delay if the issue is cache-related.
