Skip to content

[Design] Atomic Swap user interface #375

Open
@tuliomir

Description

@tuliomir

Summary

The atomic swap feature is implemented in the headless in a simple design and, keeping the same in the desktop wallet, could create a poor visual usability to the users.

We propose here a new, simplified visual flow to improve this usability, integrating with a backend for an improved real-time collaboration experience, but with graceful degradation for the current robust solution of a direct string exchange and direct input/output manipulation.

Acceptance Criteria

  • The user should be able to request to send tokens just as easily as in the Send Tokens screen.
  • The interface should help the user identify what tokens are being sent and received on this wallet at all times, to prevent scam attempts
  • There should be an option for the user to edit the inputs directly, for advanced usage
  • The Hathor Labs Atomic Swap backend should be used by default

Guide-level explanation

To preserve the existing interface on the Send Tokens screen, the proposal editing screen will follow the pattern of showing inputs and ouputs grouped by tokens, with the main difference being that they will be exhibited read-only. Here is the current interface on the Send Tokens screen:
Current-Interface

Here is the new proposed layout:
04 - new inputs-outputs

Adding inputs and outputs will be done using Send and Receive buttons that will be added at the Proposal screen. These operations will use the current PartialTxProposal facade on the wallet-lib, that already has the send and receive operations to build the proposal.

Above the inputs and outputs section, that will have the title Proposal Details, a highlighted Summary section will display the wallet's balance for this proposal, with the total amount of tokens being sent and tokens being received displayed in an easy to read format.

Below is the proposed simplified user flow. Further explanation on the states will be described afterwards.
Swap Frontend-Flow-drawio

Edit Proposal states

The initial screen, accessible through the "Atomic Swap" button on the navigation bar, shows every proposal that is being currently listened to.

  • All proposal contents are loaded at wallet loading time, to update the wallet's locked balance by atomic swap utxos
  • Clicking on any of them navigates the user to its full details
  • An option is available for removing any proposal from this list

Once on the Proposal Details screen, the editing will be made through the Send and Receive buttons.

  • Clicking Send will open a modal allowing the user to inform how many tokens should be sent and, optionally, to which address.
  • Clicking Receive will open a modal allowing the user to inform how many tokens should be received and in which address ( belonging to this wallet )
    Only registered tokens will be allowed to be selected on the proposal by the user.

If any change is desired, the user may remove all inputs and outputs from this wallet through the button "Remove all interactions". That way, all the other participants' changes are preserved and the current user may adjust its parts from scratch.

Whenever there is one input from the user's wallet and the proposal is complete ( there is at least one input, the sum of inputs and outputs match ), a new button will be shown to "Sign my Inputs".
When the proposal is complete and all of its inputs are signed, a button is shown to "Send Proposal".

At any moment, if an external participant changes the proposal contents, the local changes are discarded and overwritten by the external contents.

By default, only the proposal balance and the action buttons will be displayed to keep the screen uncluttered. A link to "Show Details" will be rendered right below the action buttons, and clicking this link will display the inputs and outputs as shown in the current flow drawings.

Editing Functionalities

Some functionalities were ommited from the flow drawing above, but will be implemented, such as:

1) Alert when changing a proposal that already has signatures
Whenever a user tries to make any change to a proposal that already has at least one signature, a modal will open to confirm this decision, since it will affect every other participant that has already signed their part of the proposal.

2) Lock utxos on save only
By default, the "Send" and "Receive" operations on the TxProposal class mark the wallet's utos as used. This should be avoided until the proposal changes are saved, or the user might get confused have his utxos locked while experimenting with the proposal possibilities.

Alternatives

The concepts below were discarded since the proposal described above is simpler and efficient for the initial implementation.

Simple and Advanced modes

To achieve this, the screen would be segmented into "Simple" and "Advanced" display modes. In the "Simple" display, the user would only see the information of "Send" and "Receive" tokens.
Editable Swap

This information would be a representation built from the user's inputs OR the proposal's inputs and outputs. For example, the screen above could mean:

  • The user has manually entered the 2.40 HTR value from the form
  • The imported transaction has one input from a utxo that belongs to this wallet, with the value of 2.40 HTR
  • The imported transaction has multiple inputs from utxos that belongs to this wallet, with the total summed value of 2.40 HTR

By selecting the Advanced View, the user would then see the full inputs and outputs using the same visual identity as what the Send Tokens screen already has.

In addition to the interface with Send/Receive instead of Inputs/Outputs, the Simple Mode would also omit the proposal communication with the other participants, as by default the wallet would use Hathor Labs's Atomic Swap backend in the "Save and Upload" button. The Advanced mode will include the possibility of the graceful fallback to proposal string exchange.

Other interface possibilities will be discussed in the Alternatives section below.

Simple Mode Flow

Below is the full workflow of this Simple Mode interaction
Swap Frontend-Simple Mode drawio

Advanced Mode Flow

Below is the simplified workflow of the Advanced Mode interaction, built upon the Simple Mode above:
Swap Frontend-Advanced Mode drawio

Task Breakdown

Total: 9,8 dev days

Component Effort
Initial screen: proposals followed list 1.1
Import Existing Proposal screen 0.7
New proposal screen 0.8
Send/Receive modals 1
Edit Atomic Swap screen with modal buttons 3
Manage state changes: open, signing, signed... 1.0
"Remove everything from my wallet" button 0.5
Integrate with lib: sign and send proposal 1.5

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions