-
Notifications
You must be signed in to change notification settings - Fork 17
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
Prevent users from selecting same asset in/out for a swap #861
Merged
jessepinho
merged 5 commits into
jessepinho/bsod-in-swaps-web-424
from
jessepinho/asset-in-out-web-533
Apr 2, 2024
Merged
Prevent users from selecting same asset in/out for a swap #861
jessepinho
merged 5 commits into
jessepinho/bsod-in-swaps-web-424
from
jessepinho/asset-in-out-web-533
Apr 2, 2024
Conversation
This file contains 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
jessepinho
changed the base branch from
main
to
jessepinho/bsod-in-swaps-web-424
March 30, 2024 22:17
…if the selected one is filtered out
jessepinho
force-pushed
the
jessepinho/asset-in-out-web-533
branch
from
March 30, 2024 22:37
2a1d651
to
57b2837
Compare
jessepinho
force-pushed
the
jessepinho/asset-in-out-web-533
branch
from
March 30, 2024 22:51
886aae1
to
8c997ee
Compare
jessepinho
changed the title
WIP: Should not be able to select same asset in/out
Prevent users from selecting same asset in/out for a swap
Mar 30, 2024
jessepinho
requested review from
grod220,
Valentine1898,
TalDerei and
turbocrime
and removed request for
grod220
March 30, 2024 23:01
TalDerei
reviewed
Apr 1, 2024
Valentine1898
approved these changes
Apr 1, 2024
…ction-planner (#869) * Move transaction validity assertions out of authorize and into transaction-planner * Move security assertion back to authorize
jessepinho
added a commit
that referenced
this pull request
Apr 2, 2024
* Sort assets * Add filtering logic to AssetOutSelector; automatically switch assets if the selected one is filtered out * Assert that trading pair is of different assets * Sort by balance descending, rather than alphabetically * Move transaction validity assertions out of authorize and into transaction-planner (#869) * Move transaction validity assertions out of authorize and into transaction-planner * Move security assertion back to authorize
jessepinho
added a commit
that referenced
this pull request
Apr 2, 2024
* Sort assets * Add filtering logic to AssetOutSelector; automatically switch assets if the selected one is filtered out * Assert that trading pair is of different assets * Sort by balance descending, rather than alphabetically * Move transaction validity assertions out of authorize and into transaction-planner (#869) * Move transaction validity assertions out of authorize and into transaction-planner * Move security assertion back to authorize
jessepinho
added a commit
that referenced
this pull request
Apr 2, 2024
* Add BSOD to TXP * Start showing outputs * Clean up code a little; change fn name * Add some new helpers for swaps * Add getters * Make components for both one-way and two-way swaps * Create more getters * Extract a ValueWithAddress component * Tighten up syntax * Install dep in UI package * More getters * Clean up the Swap view * Use <ActionDetails /> for fee and swap claim * Simplify TransactionIdComponent; prettify swap claim view * Add comment * Move unfilled lower * Fix test * Fix linter complaint * Include metadata in SwapView * Create more getters * Generate zero-value views on the fly; handle those in OneWaySwap * Remove log * Fix case of missing outputs * Handle outputs with no amounts * Tweak design when there are multiple claimed amounts * Fix logic * Prevent users from selecting same asset in/out for a swap (#861) * Sort assets * Add filtering logic to AssetOutSelector; automatically switch assets if the selected one is filtered out * Assert that trading pair is of different assets * Sort by balance descending, rather than alphabetically * Move transaction validity assertions out of authorize and into transaction-planner (#869) * Move transaction validity assertions out of authorize and into transaction-planner * Move security assertion back to authorize * Refactor per Gabe's suggestions
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.
Per #533, we want to prevent users from attempting a swap in which both the input and output asset types are the same.
This PR does that at two levels: in the extension's
authorize
RPC method, and in the UI. This ensures that the extension will prevent such swaps even if executed by a frontend other than minifront.First, I disabled my changes to the UI so that I could still attempt a swap with the same asset in and out. Here's the error the extension gives:
Of course, no one on minfront will see this error, since we're now preventing the user from selecting the same asset in/out:
Screen.Recording.2024-03-30.at.3.54.27.PM.mov
Also in this PR, I added sorting to the asset in/out selectors, since the asset in selector was picking its default asset based on which balance happened to load first, and the asset out selector was using the sorting in the registry.
Closes #533