web icon indicating copy to clipboard operation
web copied to clipboard

Add estimated trade completion time on Thorchain swaps

Open DiggyDiggy2 opened this issue 2 years ago • 1 comments

Overview

On thorchain trades, since they take awhile, on the confirm screen once the trade is processing, we can display a "Estimated Completion Time 0:34"

Here's an example lib that includes helpers for calculating: https://www.npmjs.com/package/@xchainjs/xchain-thorchain-query

References and additional details

We can replace the message that Thorchain swaps can take a few minutes, with the actual estimated time to completion

Acceptance Criteria

When the user executes a Thorchain swap, they will see the estimated completion time on the trade confirm screen.

Need By Date

No response

Screenshots/Mockups

No response

Estimated effort

No response

DiggyDiggy2 avatar Oct 14 '22 19:10 DiggyDiggy2

This doesn't bode well for that library.

Image

0xApotheosis avatar Oct 24 '22 05:10 0xApotheosis

@asamere any idea where https://app.thorswap.finance/ gets the "Est. time" from?

Image

0xApotheosis avatar Nov 03 '22 22:11 0xApotheosis

looks like they're using the average block time for the "to asset" chain (BTC in this example). If our fees are accurate/not low balled we can use a similar strategy. possibly add to adapters so each chain impl implements getBlockTime() or similar.

asamere avatar Nov 03 '22 23:11 asamere

Solid, thank you ser.

Ok, the path forward here: add a generic abstraction to get the block time for a chain, which is consumed by the client.

Without thinking too much about the architecture yet this could live at the chain adapter level, or simply be a client-side helper function if it's feasible to make one that generalizes across chains (though I suspect it's not).

0xApotheosis avatar Nov 03 '22 23:11 0xApotheosis

I caught up with 9R on this, they actually calculate the time as a function of the trade size.

See the outbound_delay_seconds key in the response to https://thornode.ninerealms.com/thorchain/quote/swap?amount=1000000000&from_asset=BTC.BTC&to_asset=ETH.ETH&destination=0x3021c479f7f8c9f1d5c7d8523ba5e22c0bcb5430:

{
  "expected_amount_out": "13168808042",
  "fees": {
    "affiliate": "0",
    "asset": "ETH.ETH",
    "outbound": "240000"
  },
  "inbound_address": "bc1qf6nlucxdurqxdnrtzuzdd2fgarc0ewl506p4rw",
  "inbound_confirmation_blocks": 2,
  "inbound_confirmation_seconds": 1200,
  "memo": "=:ETH.ETH:0x3021c479f7f8c9f1d5c7d8523ba5e22c0bcb5430",
  "outbound_delay_blocks": 720,
  "outbound_delay_seconds": 10800,
  "slippage_bps": 390
}

0xApotheosis avatar Nov 20 '22 23:11 0xApotheosis

Lets try to get this done, when working on the best rate work for V3.

DiggyDiggy2 avatar Feb 24 '23 18:02 DiggyDiggy2

@DiggyDiggy2 should this be closed if we plan on doing it in the future?

0xApotheosis avatar Mar 10 '23 03:03 0xApotheosis