Skip to content
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

Replace web3-react with wagmi and add seif, tailwind and compass wallet connectors #1239

Merged
merged 85 commits into from
Jun 19, 2024

Conversation

tiagofilipenunes
Copy link
Collaborator

@tiagofilipenunes tiagofilipenunes commented May 29, 2024

fix #1203
fix #545
fix #492
fix #1208
close #1220 (@solana/web3.js no longer needed)

Done

  • Replace web3-react by wagmi
  • Improve wallet connect error handling according to EIP-1993 and add back button on error to try connecting again
  • Hide gnosis safe if not in iframe, as it only connected with iframe
  • Move GTM and getConnector functionality to the wagmi library. Available GTM events for all wallets:
    • Auto-connection and auto-disconnection (through the wallet interface)
    • Manual connection and manual disconnection
    • Account change
  • Update tanstack-query from v4 to v5 (migration guide) and keep the same behaviour
    • Replace isLoading with isPending (docs)
    • Replace cachetime with gcTime (docs)
    • Change mutation and query input to object (docs)
    • Remove onError callbacks that were outputting errors to console.error. Instead output errors via QueryCache if there is an error and query.meta.errorMessage is defined. Same error output as before is shown (docs)
  • Add placeholder wallets
    • Add Seif Wallet
    • Add Tailwind Wallet
    • Add Compass Wallet
  • Add detection for injected EIP-6963 providers
    • If expected default providers are not detected show a placeholder for them in the list and display "Wallet not installed" error on connect.
    • If an expected default provider is detected, then remove their placeholder and instead show the injected provider
    • If an injected provider that is not part of the default list is detected, add them to the list as well to let the user choose them
  • Tenderly on Sei now supported with tenderly faucet config moved to network config
  • Coinbase Wallet improvements
    • Wallet now works locally
    • When it is not installed, user is prompted to use the extension-free smart wallet option
  • Metamask wallet: when it is not installed, the user is shown a modal with a link to download the desktop or mobile version
  • 'build-essential' package was not in the playground docker used in the e2e workflow so it is now installed before dependencies are. It's required as make and other C/C++ libraries were not available and were required.

Note

  • All wallets apart from Seif work locally. Seif only injects its provider on safe environments, so please always use the preview link to test it.

Copy link

cloudflare-workers-and-pages bot commented May 29, 2024

Deploying carbon-app-sei with  Cloudflare Pages  Cloudflare Pages

Latest commit: f38be59
Status: ✅  Deploy successful!
Preview URL: https://a01392fe.carbon-app-sei.pages.dev
Branch Preview URL: https://add-sei-wallets.carbon-app-sei.pages.dev

View logs

Copy link

cloudflare-workers-and-pages bot commented May 29, 2024

Deploying carbon-app with  Cloudflare Pages  Cloudflare Pages

Latest commit: f38be59
Status: ✅  Deploy successful!
Preview URL: https://8147f917.carbon-app-csq.pages.dev
Branch Preview URL: https://add-sei-wallets.carbon-app-csq.pages.dev

View logs

@tiagofilipenunes tiagofilipenunes marked this pull request as ready for review May 29, 2024 17:42
src/libs/web3/noconnector.ts Outdated Show resolved Hide resolved
src/libs/web3/web3.connectors.ts Outdated Show resolved Hide resolved
src/libs/web3/web3.connectors.ts Outdated Show resolved Hide resolved
src/libs/web3/web3.connectors.ts Outdated Show resolved Hide resolved
src/libs/web3/web3.utils.ts Outdated Show resolved Hide resolved
src/libs/web3/noconnector.ts Outdated Show resolved Hide resolved
src/libs/web3/noconnector.ts Outdated Show resolved Hide resolved
src/libs/web3/web3.connectors.ts Outdated Show resolved Hide resolved
@tiagofilipenunes tiagofilipenunes marked this pull request as draft May 31, 2024 16:47
@ashachaf
Copy link
Collaborator

ashachaf commented Jun 2, 2024

  • compass wallet connection issue
    flow:

  • make sure your compass wallet is locked

  • visit sei.carbondefi.xyz

  • click to connect compass wallet

  • you would see the unlock screen of compass wallet

  • following unlocking, you see the app pending screen
    actual:
    you would need to close the wallet connect popup on the app and try again for the flow to work
    expected:
    following the unlock, to force the connect popup to show up on the compass wallet

  • compass wallet connection flow
    flow:

  • click to connect compass wallet

  • see the connect popup on the wallet

  • reject connection
    actual: wallet connect popup on the app still waiting for response
    expected: app identify the user action and indicate in the app. (either by closing the wallet connect popup or displaying an error)

  • trying to connect metamask

image image
  • trying to connect tailwind
image image

- Add SafeEIP1193 that receives an injectedConnector and tries to get a provider for it
- Remove NoConnector class
- Create connector factory
- Improve wallet object retrieval based on wagmi implementation
- Sort connectors by name order in config
- Switch network with useCallback
- Remove onError callbacks in useQuery as they're deprecated in v5 and move the custom error message to meta.message and throw error in QueryClient.QueryCache.onError if meta.message is defined
- Replace isLoading with isPending. For queries, isLoading is now isPending and a new isLoading flag which is now isPending && isFetching. For mutation, isLoading is deprecated for isPending
- Change useQuery input as it now only accepts objects with keys of queryKey, queryFn, etc
Copy link
Collaborator

@GrandSchtroumpf GrandSchtroumpf left a comment

Choose a reason for hiding this comment

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

Great PR !

package.json Outdated Show resolved Hide resolved
src/components/common/WalletIcon.tsx Outdated Show resolved Hide resolved
src/config/sei/common.ts Show resolved Hide resolved
src/config/types.ts Outdated Show resolved Hide resolved
src/libs/modals/modals/WalletModal/ModalWalletError.tsx Outdated Show resolved Hide resolved
src/libs/wagmi/connectors.ts Outdated Show resolved Hide resolved
src/libs/wagmi/useWagmiImposter.ts Outdated Show resolved Hide resolved
src/libs/wagmi/useWagmiNetwork.tsx Outdated Show resolved Hide resolved
src/libs/wagmi/wagmi.constants.ts Outdated Show resolved Hide resolved
src/libs/wagmi/wagmi.constants.ts Outdated Show resolved Hide resolved
@ashachaf
Copy link
Collaborator

ashachaf commented Jun 13, 2024

  • connecting coinbase wallet cause tailwind to open
    Uploading Screen Recording 2024-06-13 at 18.42.45.mov…

src/components/common/WalletIcon.tsx Outdated Show resolved Hide resolved
src/libs/wagmi/useWagmiImposter.ts Outdated Show resolved Hide resolved
@ashachaf
Copy link
Collaborator

ashachaf commented Jun 19, 2024

  • (optional) compass wallet doesnt trigger the connect dapp popup
    flow:
  • click to connect compass wallet
  • see the "unlock" wallet popup and confirm it
    expected:
    see the connect dapp popup to conenct wallet
    actual:
    no wallet connect popup, and the app shows the loading animation waiting for user interaction on the wallet popup.

@tiagofilipenunes tiagofilipenunes merged commit 88b1e5a into main Jun 19, 2024
2 checks passed
@tiagofilipenunes tiagofilipenunes deleted the add-sei-wallets branch June 19, 2024 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants