> For the complete documentation index, see [llms.txt](https://docs.crosscurve.fi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.crosscurve.fi/developer-documentation/guide-for-developers/tracking-cross-chain-swap.md).

# Tracking cross-chain swap

After initiating the cross-chain swap (sending the transaction), it is necessary to ensure that it reaches the destination network and is executed successfully. Each cross-chain swap involves several transactions and the number of transactions may vary depending on the operation.

For swapping two stablecoins from Network A to Network B, the route can be depicted as:

> **Chain A -----> Hubchain -----> Chain B**

Each transaction is linked with another by a unique identifier, **`requestId`**, which represents the cross-chain transition identifier and can be used to track the source status and transaction destinations.

### Searching for requestId <a href="#searching-for-requestid" id="searching-for-requestid"></a>

You can get **`requestId`** of a transaction using its hash with the Pusher API:

Copy

```solidity
const searchParams = new URLSearchParams({
search: '0x...', // transaction hash
limit: 1,
}).toString();
const response = await fetch(`https://api.crosscurve.fi/?${searchParams}`, {
method: 'GET',
})
const result = await response.json()
const details = result.result[0]
const requestId = details.requestId
TypeScript
```

### Getting details about the cross-chain transition by its requestId <a href="#getting-details-about-the-cross-chain-transition-by-its-requestid" id="getting-details-about-the-cross-chain-transition-by-its-requestid"></a>

Copy

```solidity
const response = await fetch(`https://api.crosscurve.fi/search?search=%7BhashOrReqId%7D&limit=%7Blimit%7D`, {
method: 'GET',
})
const details = await response.json()
const destination = details.destination
TypeScript
```

In the results, we are interested in the values of `destination.status` and `destination.transactionHash`. If `destination.transactionHash` is empty, this means that the transaction has not yet been executed and the request should be repeated at intervals until the hash appears.

Then there are 3 scenarios:

1. Both details.inconsistency and destination.emergency are false This scenario is considered the most correct and will occur in most cases. It means the cross-chain operation has been completed and we have the hash of the destination transaction. Now, using this hash, similarly, you can track the status of the next cross-chain transition (if there is one) and continue doing so until all cross-chain transitions are completed.
2. details.inconsistency is true This means that the destination transaction was successfully completed, but the token swap did not occur due to slippage. An intermediate result has been returned to your address in this network. The cross-chain operation is considered complete at this point.
3. The value of destination.emergency is true In this case, the destination network operation could not be executed and your tokens are stuck in the contract. To retrieve them, you need to contact support to request a refund.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.crosscurve.fi/developer-documentation/guide-for-developers/tracking-cross-chain-swap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
