🟦
Mobile SDK Stuck Transactions
Any cross-chain swap consists of two transactions:
  1. 1.
    One transaction (signed and sent by a user) is on the origin blockchain and
  2. 2.
    Another transaction (signed and sent by relayers) is on the destination blockchain.
A stuck transaction (or a stuck trade/stuck cross-chain swap) means that the transaction on the origin blockchain has been processed, but there is no transaction on the destination blockchain, or that transaction is failed.
For the user, a stuck trade means that they give away tokens on the origin blockchain and get nothing on the destination blockchain.
A cross-chain swap may get stuck due to multiple reasons. In any case, such a situation is an emergency, and users should be able to deal with it.
There is no way to accomplish a stuck cross-chain swap. A stuck cross-chain swap can be reverted.
An explanation of what happens during reverting of stuck transactions can be found here.
Dealing with stuck transactions consists of two steps:
  • Find a stuck transaction,
  • Revert the stuck transaction.

Getting Stuck Transactions

To get all stuck transactions for a particular address (walletAddress) on all defined in SymbiosisSDK blockchains, please use this code:
1
val sdk = SymbiosisSdk(...) // initializing sdk
2
val stuck: List<StuckTransaction> = sdk.getStuckTransactions(walletAddress)
Copied!
To get all stuck transactions for a particular address on a particular blockchain, please use this code:
1
val sdk = SymbiosisSdk(...) // initializing sdk
2
val stuck: Flow<StuckTransaction> = sdk.bscTestnet.getStuckTransactions(
3
address = walletAddress,
4
otherClients = listOf(sdk.ethRinkeby, sdk.hecoTestnet),
5
advisorUrl = "..." // url to get bridging fee from
6
)
Copied!
In this example, we get stuck transactions for cross-chain swaps: BSCT β†’ Rinkeby, BSCT β†’ Heco Testnet.

Reverting Stuck Transactions

There are two important things to pay attention to:
  1. 1.
    Reverting transaction should be sent to the blockchain where the user has not received tokens.
  2. 2.
    Once the reverting has been accomplished, the user receives stable cryptocurrency that may differ from the exchanging token of the origin cross-chain swap.
Let's consider a couple of examples:
  1. 1.
    A cross-chain swap UNI (Ethereum) -> CAKE (BSC) got stuck. The route for such a cross-chain swap may look like: UNI-> USDC | sUSDC-> BUSD-> CAKE To revert it, you should send a reverting transaction to BSC and the user gets USDC on Ethereum.
  2. 2.
    A cross-chain swap CAKE (BSC) -> UNI (Ethereum) got stuck. The route for such a cross-chain swap may look like: CAKE-> WBNB-> BUSD-> sUSDC | USDC-> WETH-> UNI To revert it, you should send a reverting transaction to Ethereum and the user gets sUSDC on BSC.
To revert a stuck trade please use this code:
1
val stuckRequest: StuckRequest = ... // a single stuck transaction
2
val revert = stuckRequest.revert(credentials)
3
//credentials is signature data for walletAddress used to find the stuck transaction
Copied!
Having sent a transaction, please use the following method to wait for its completion: revert.waitForCompletion().