Skip to content

feat(frontend): optimistic UI state reconciler for fractional token swaps - #505

Open
benzy018 wants to merge 1 commit into
Sahara-Pay:mainfrom
benzy018:feat/optimistic-swap-reconciler-470
Open

feat(frontend): optimistic UI state reconciler for fractional token swaps#505
benzy018 wants to merge 1 commit into
Sahara-Pay:mainfrom
benzy018:feat/optimistic-swap-reconciler-470

Conversation

@benzy018

Copy link
Copy Markdown

Implements React Query optimistic mutation layer for fractional token swaps with auto-rollback on RPC failure. Snapshots cache onMutate, applies AMM math locally, restores onError. Includes TokenSwapWidget demo. Closes #470

…waps with auto-rollback on RPC failure

Implement sophisticated optimistic mutation layer in React Query that snapshots cache state via onMutate, applies exact AMM constant-product math to predict new balances locally, and restores snapshots via onError if Soroban RPC returns tx_failed. Includes TokenSwapWidget demo component, comprehensive tests, and swap transaction builder.

Closes Sahara-Pay#470
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.

Design an optimistic UI state reconciler for fractional token swaps with automatic rollback on RPC failure

1 participant