🔦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
You can get requestId
of a transaction using its hash with the Pusher API:
Getting details about the cross-chain transition by its requestId
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:
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.
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.
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 needd to contact support to request a refund.
Last updated