wallet icon indicating copy to clipboard operation
wallet copied to clipboard

feat(swaps): Support cross-chain swaps, swap screen redesign

Open jophish opened this issue 9 months ago • 2 comments

Description

For RET-1065. Adds support for cross-chain swaps, and completes the redesign of the main swap screen.

One consequence of this redesign is that the confirm swap button can no longer be pressed unless a swap is actually possible given the current parameters. This means that several conditional bottom sheets that only appeared upon pressing confirm have been removed from the screen, which is kinda nice. Since there are now a ton of possible inline notifications and their order of precedence was already pretty messy, I've refactored how notifications are handled a bit.

Test plan

Manual and unit tested. See videos below:

Cross-chain swap from Celo -> Arbitrum on Mainnet

https://github.com/valora-inc/wallet/assets/569401/51e10c4b-7fa2-4693-8561-7662c0adb048

Cross-chain fee warning

https://github.com/valora-inc/wallet/assets/569401/73e2cd39-b5df-4b26-be9c-343f9dd840bc

Not enough of any fee currency available, no way to swap

https://github.com/valora-inc/wallet/assets/569401/94facfc9-fa03-4c05-a732-1f5435bf9f36

Swapping (a) fee currency and can proceed with swap only after reducing swap amount

https://github.com/valora-inc/wallet/assets/569401/d63c4de1-35ff-43a6-b3cf-ad20478dc06e

Unsupported tokens from providers

https://github.com/valora-inc/wallet/assets/569401/45a12e18-598d-4c02-9c08-18b39c2b9098

Related issues

Backwards compatibility

Network scalability

If a new NetworkId and/or Network are added in the future, the changes in this PR will:

  • [X] Continue to work without code changes, OR trigger a compilation error (guaranteeing we find it when a new network is added)

jophish avatar May 23 '24 19:05 jophish