Mobile SDK Stuck Transactions
Symbiosis Mobile SDK Stuck Transactions: getting and reverting

What are stuck transactions?

Any cross-chain operation (a cross-chain swap, a cross-chain zap, interchain communicating, bridging) 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 cross-chain operation) 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 operation means that they give away tokens on the origin blockchain and get nothing on the destination blockchain.
A cross-chain operation 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 operation (somehow to push it). Instead, a stuck cross-chain operation can be reverted.
If you are looking for more details on what happens during reverting of stuck transactions, please refer to this document Emergencies
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:
val sdk = SymbiosisSdk(...) // initializing sdk
val stuck: List<StuckTransaction> = sdk.getStuckTransactions(walletAddress)
To get all stuck transactions for a particular address on a particular blockchain, please use this code:
val sdk = SymbiosisSdk(...) // initializing sdk
val stuck: Flow<StuckTransaction> = sdk.bscTestnet.getStuckTransactions(
address = walletAddress,
otherClients = listOf(sdk.ethRinkeby, sdk.hecoTestnet),
advisorUrl = "..." // url to get bridging fee from
)
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:
val stuckRequest: StuckRequest = ... // a single stuck transaction
val revert = stuckRequest.revert(credentials)
//credentials is signature data for walletAddress used to find the stuck transaction
Having sent a transaction, please use the following method to wait for its completion: revert.waitForCompletion().
Copy link
On this page
What are stuck transactions?
Getting Stuck Transactions
Reverting Stuck Transactions