# Trade status

Source: https://soheil.fi/developers/docs/status/

Whether a trade went through, and what the contract recorded.

`GET /v1/status?chainId=&txHash=` (API key)

## Request

```bash
curl "https://api.soheil.fi/v1/status?chainId=8453&txHash=0x…" -H "x-api-key: sk_xxxxxxxx_…"
```

## States

| status | substatus | Meaning |
| --- | --- | --- |
| `PENDING` | `NOT_MINED` | Sent, not mined yet. Ask again in a few seconds. |
| `DONE` | `COMPLETED` | Mined; `trade` has what the contract recorded. |
| `FAILED` | `REVERTED` | Sent to our contract and reverted; the user kept their tokens. |
| `NOT_OURS` | `null` | Mined, but not a trade through our contract. |
| `NOT_FOUND` | `null` | The network does not know this transaction (yet). Check the hash and chainId. |

## Response

```json
{
  "status": "DONE", "substatus": "COMPLETED",
  "sending":   { "chainId": 8453, "txHash": "0x…", "blockNumber": 22018445, "timestamp": 1793710210 },
  "receiving": { "chainId": 8453, "txHash": "0x…", "blockNumber": 22018445, "timestamp": 1793710210 },
  "trade": { "id": "0x9f2c…", "sender": "0xyouruser…", "recipient": "0xyouruser…",
             "fromToken": "0x8335…2913", "fromAmount": "100000000",
             "toToken": "0x0000…0000", "toAmount": "41290000000000000",
             "routerFee": "100000", "integratorFee": "200000", "integratorAddress": "0xyourfeeaddress…" }
}
```

## Notes

-   `chainId` is the network the transaction was sent on. `sending` is that transaction; `receiving` is the one that paid the recipient: the same for a swap, a second one on `toChainId` for a bridge.
-   New values may appear in `status` and `substatus` (bridges will add some): treat an unknown `status` as `PENDING`.
-   A transaction holding more than one trade (a contract calling ours twice) shows the first.
-   Every trade is also read from the chain on its own, so your earnings count whether or not you ask.
