Skip to content

wait_for_swap ​

Wait until a swap transaction is mined and decode its outcome from the router's Swapped (and, when present, FrontendFeeCharged) events.

rust
pub async fn wait_for_swap(&self, hash: H256) -> Result<SwapResult>

Usage ​

rust
let hash = router.swap(&params).await?;
let result: SwapResult = router.wait_for_swap(hash).await?;

Returns ​

Result<SwapResult>

The decoded swap outcome.

Fails if the transaction reverted or emitted no Swapped event.

Parameters ​

hash ​

  • Type: H256

Hash returned by any swap method.