Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supports auto route homa #61

Merged
merged 7 commits into from
Mar 27, 2024
Merged

supports auto route homa #61

merged 7 commits into from
Mar 27, 2024

Conversation

shunjizhan
Copy link
Collaborator

@shunjizhan shunjizhan commented Mar 25, 2024

Context

Currently UI needs to wait for token arrival at router address, then call relayer route. But there are many scenarios that breaks the process, and the fund is stuck at the router address.

To solve this issue, we can upgrade the relayer to be able to "wait and route", so the whole process is more robust. Now UI only needs to send one request to the relayer right after user signed xcm tx, and don't need to worry about user closing UI in the middle anymore.

This will also enhance UX by displaying a progress bar: xcm (waiting) => routing => confirming => complete

Change

  • separated different route apis from api/route.ts to specific files to be more clean
  • added 3 new endpoints:
    • /routeHomaAuto: wait for token arrive then auto perform the route, returns a route Id so frontend can use this to track and display progress.
    • /routeStatus: get current route status
    • /allRouteStatus: see all route status, mostly for debugging purpose

Note that we don't need to permanently store route status, as it's only for frontend to track progress and display progress bar. For a complete route history, we can add new endpoint with subquery in the future

Test

  • added tests for auto route homa flow, tested locally and worked
  • CI has been broken for a while, will fix it before releasing stable version

`);
{
"data": {
"routerAddr": "0x8A4f03B2D615172f0714AaC2E8C399a6f0d9e448",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is because the fee addr has been updated

@shunjizhan shunjizhan requested a review from xlc March 26, 2024 08:55
@shunjizhan shunjizhan marked this pull request as ready for review March 26, 2024 08:55
@shunjizhan shunjizhan changed the title added /routeHomaAuto endpoint supports auto route homa Mar 26, 2024
src/api/homa.ts Outdated Show resolved Hide resolved
@shunjizhan shunjizhan requested a review from xlc March 27, 2024 06:41
@shunjizhan shunjizhan merged commit a54f73d into master Mar 27, 2024
1 check failed
@shunjizhan shunjizhan deleted the add-cache branch March 27, 2024 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants