web
web copied to clipboard
Add estimated trade completion time on Thorchain swaps
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
This doesn't bode well for that library.
@asamere any idea where https://app.thorswap.finance/ gets the "Est. time" from?
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.
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).
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
}
Lets try to get this done, when working on the best rate work for V3.
@DiggyDiggy2 should this be closed if we plan on doing it in the future?