feat: add pre-submission Soroban transaction simulation and wallet validation (#609)#637
Open
Auwal007 wants to merge 2 commits into
Open
feat: add pre-submission Soroban transaction simulation and wallet validation (#609)#637Auwal007 wants to merge 2 commits into
Auwal007 wants to merge 2 commits into
Conversation
This commit introduces a new transaction simulation layer for Soroban transactions that operates prior to on-chain submission. - Created `backend/simulation` to process `simulateTransaction` calls to Soroban RPC. - Extracted shared DTOs to `shared/types/simulation` to avoid circular dependency and frontend crashes. - Created `TransactionSimulationService` on the mobile frontend to dispatch simulation requests and handle the `state drift` edge-case. - Added `SimulationResultSheet` component to display gas fees, expected results, and potential errors before transaction signing. - Added unit tests for backend simulation service and fixed the gas benchmark script to output accurate values. - Integrated `SimulationResultSheet` to `CryptoPaymentScreen`. - Added a `contracts/simulation` module with read-only test functions.
Add wallet transaction simulation before on-chain submission
|
@Auwal007 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #609
Summary
This PR implements end-to-end Soroban transaction simulation before wallet signature requests, addressing issue #609.
The new simulation workflow validates transactions prior to on-chain submission, allowing users to detect failures early, review expected execution outcomes, and receive accurate gas estimates before signing with Freighter or XRPL wallets.
By simulating transactions ahead of submission, the application reduces failed on-chain transactions, prevents unnecessary fee consumption, and significantly improves the transaction UX.
Changes Included
Backend
Added a new transaction simulation domain under
backend/simulation/.Implemented Soroban RPC simulation client integration.
Added support for pre-submission transaction simulation.
Exposed simulation functionality through backend services.
Added standardized simulation DTOs and error handling.
Implemented metrics collection for:
Mobile
TransactionSimulationServicefor interacting with the simulation backend.SimulationResultSheetto display simulation details before wallet signature requests.Transaction Validation
Added prediction for common transaction failures, including:
Contracts
Reliability Improvements
shared/types/simulationto avoid frontend/backend dependency issues and Metro bundler failures.User Flow
Benefits
Closes #609.