Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Enable Formatic wallet #2388

Merged
merged 12 commits into from
Feb 14, 2022
Merged

Conversation

henrypalacios
Copy link
Contributor

@henrypalacios henrypalacios commented Feb 3, 2022

Summary

closes #433
Enable the ability to connect via Formatic

To Test

Background

This PR is part of the activation of previously supported wallets #2165

@henrypalacios henrypalacios added app:CowSwap CowSwap app Protofire Handled by Protofire development team labels Feb 3, 2022
@henrypalacios henrypalacios self-assigned this Feb 3, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2022

  • 🔭 GP Swap: CoW Protocol v2 Swap UI

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works fine for approval, swap and cancellation 👍
(although their message signing UX is not very useful, you have no idea what you are signing)

But the behaviour on page refresh is broken.

Steps:

  1. Connect with Formatic
  2. Refresh the page.
  • Upper menu is not loaded:
    Screen Shot 2022-02-03 at 10 39 22
  1. Refresh the page again.
  • Upper menu is loaded and you can connect wallet again
  1. Click on connect wallet and pick Formatic
  • It'll connect without needing to login again

@elena-zh
Copy link

elena-zh commented Feb 4, 2022

Hey @henrypalacios , I have done some tests: sell/buy orders work great!
I need to retest wrap/unwrap/approve/claim transactions, but will do it a bit later.
For now, I have faced the same issue @alfetopito mentioned above.
In addition, the app does not show an error message when cancel signing transaction. See the video: https://watch.screencastify.com/v/4oUhXdp7lBovwyTTYTsq
You can see a different behavior for cancelling transactions when connected to Fortmaic and MM.

@henrypalacios
Copy link
Contributor Author

@alfetopito the last change will fix the connection on refresh, maybe we could add a loading notification?

  1. I have created a re-connection of providers that are not injected as it seems that this will be necessary for others as well.

  2. Regarding the UX sign message, I have not found a way to implement what they describe in their documentation.

  3. According to what @elena-zh mentions, I have not been able to catch the fortmatic error in signFn, maybe because I still don't understand how signOrderGp enables the provider internally.

@alfetopito
Copy link
Contributor

@alfetopito the last change will fix the connection on refresh, maybe we could add a loading notification?

Sure, if that help UX let's give it a try

1. I have created a re-connection of providers that are not injected as it seems that this will be necessary for others as well.

👍

2. Regarding the UX sign message, I have not found a way to implement what they describe in [their documentation](https://docs.fortmatic.com/web3-integration/user-signing).

I don't think you need to do anything.
It was more of a comment of their UX not displaying anything useful, sorry if it wasn't clear.

3. According to what @elena-zh mentions, I have not been able to catch the fortmatic [error in signFn](https://github.com/gnosis/cowswap/blob/433-enable-formatic/src/custom/utils/signatures.ts#L162), maybe because I still don't understand how [signOrderGp](https://github.com/gnosis/cowswap/blob/433-enable-formatic/src/custom/utils/signatures.ts#L114) enables the provider internally.

Well, yeah, then you'll need to dig into the signing stuff.
When doing the signing, watch out the console for errors from the wallet.
It wouldn't be the first wallet to not return anything at all to not fault of our own.

@henrypalacios
Copy link
Contributor Author

@elena-zh As I mentioned to @alfetopito I have added a notification of connecting when it detects that a provider has connected after refreshing the page.
Screenshot from 2022-02-08 11-19-09

@elena-zh
Copy link

elena-zh commented Feb 8, 2022

@henrypalacios , I was able to test all the rest functionality.
And it works!

However, the issue with cancelling signing I mentioned above is still not fixed.

As for 'connecting..' state, it a great idea! The only thing I can mention that in a certain moment of a 'connecting' state connection modal appears, then is closed. Video: https://watch.screencastify.com/v/mlNWW4B6xVeaqNucalPU
Could you please fix this (not to show connection modal)?

Thanks

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, working nicely now 👍

The thing still left to address (besides updating the api keys, but that's a follow up PR) is to handle the wallet "rejection"

As mentioned over slack, the Safe handles it, so we can get "inspired" by whatever they did there :)

@henrypalacios
Copy link
Contributor Author

@elena-zh with the latest change (fortmatic manual update) the rejection wallet should work, what I'm not sure is if everything else is still working, could you test it please? If it works I will go that way.

@elena-zh
Copy link

elena-zh commented Feb 9, 2022

Hey @henrypalacios , not I see this error when I try to connect the wallet
image

I cleared all app data storage, but it did not help.
Could you please take a look at it?

@elena-zh
Copy link

Now I'm able to connect, but rejection still does not work..

@elena-zh
Copy link

@henrypalacios , I retested changes under the current PR, and everything looks good to be besides the cancelling orders' signing issue. I have created a separate issue for this #2413 .
So we can stop working under this PR and proceed with the cancelling issue fixing in another one.
Thanks.

Copy link
Contributor

@alfetopito alfetopito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, this is already in a working state.
The other 2 points listed below can be addressed in follow up PRs:

  1. Try to get the signal from the when user closes the signature modal
  2. Use different API keys for different environments

Comment on lines 29 to 38
// TODO implements this
// const pollForOverlayReady = new Promise<void>((resolve) => {
// const interval = setInterval(() => {
// if (provider.overlayReady) {
// clearInterval(interval)
// this.emit(OVERLAY_READY)
// resolve()
// }
// }, 200)
// })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was this for? Do you intend to enable it again or is it no needed for the new version?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's the point, I checked to see if it is necessary. I did not find that it was necessary after much testing. What I did find is that it is responsible for the strange behavior was commented where the modal reappears:
Selection_454

As it is not part of the custom I have not removed it, let me know if you think I should remove it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, good point, I missed it's the original source file!

Then you should mod it instead and do the same thing (comment it out without deleting it)

@elena-zh
Copy link

I have retested the latest changes: LGTM (besides an opened issue #2413 )

@henrypalacios henrypalacios merged commit 45499d0 into 2165-adding-wallet-supports Feb 14, 2022
@henrypalacios henrypalacios deleted the 433-enable-formatic branch February 14, 2022 16:09
alfetopito pushed a commit that referenced this pull request Mar 1, 2022
* testing

* Enable Coinbase Wallet (wallet-link) (#2353)

* enable walletlink and upgrade package

* Limiting the supported networks for CoinbaseWallet

* Adding setDefaultInjected provider

* Enable Formatic wallet (#2388)

* Activate formatic wallet

* Adding reconnect Uninjected Provider

* Adding connecting web3Status after refresh

* Upgrade fortmatic to v2.2.1

* Mute unnecessary Overlay useEffect

* Adding new API 🔑

* Adding custom src/custom/connectors/Fortmaitc.ts

* merger conflict resolution

* set api key according to environment (#2422)

* Change clickable, fortmatic supportedChains, enum DefaultInjected

* Change CW deeplink

* Testing walletLink on mobile
fairlighteth pushed a commit that referenced this pull request Mar 2, 2022
* testing

* Enable Coinbase Wallet (wallet-link) (#2353)

* enable walletlink and upgrade package

* Limiting the supported networks for CoinbaseWallet

* Adding setDefaultInjected provider

* Enable Formatic wallet (#2388)

* Activate formatic wallet

* Adding reconnect Uninjected Provider

* Adding connecting web3Status after refresh

* Upgrade fortmatic to v2.2.1

* Mute unnecessary Overlay useEffect

* Adding new API 🔑

* Adding custom src/custom/connectors/Fortmaitc.ts

* merger conflict resolution

* set api key according to environment (#2422)

* Change clickable, fortmatic supportedChains, enum DefaultInjected

* Change CW deeplink

* Testing walletLink on mobile

(cherry picked from commit e88eb5e)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
app:CowSwap CowSwap app Protofire Handled by Protofire development team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants