Skip to content

Conversation

@thisconnect
Copy link
Collaborator

@thisconnect thisconnect commented Dec 4, 2025

First rought shot at how the swap api between backend<->frontend could look like.

};

export const getSwapState = (): Promise<TSwapQuotes> => {
return apiGet('swap/state');
Copy link
Collaborator

Choose a reason for hiding this comment

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

(I know this is just a draft, but I thought I'd take a look)

I'm not sure I understand the purpose of this endpoint. What's the intended flow here?

Frontend calls quote, gets a quote id, user selects the quote they want, frontend calls swap (called execute here). At what point in "state" called?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's just a draft but a good moment to discuss. Feel free to open a PR or comment here what I should change.

Does the quote stay the same forever? Or do we need a way that the backend can push updates to the quote if anything changes?

If a quote stays forever the same we can just return the data (TSwapQuotes or TSwapQuotes[]) via the POST request. But if the backend needs to be able to inform the frontend and push updates to the quotes, then we need some subscription.

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.

2 participants