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

Add ability to switch chains in the swap component #11

Open
fadeev opened this issue Aug 1, 2024 · 2 comments
Open

Add ability to switch chains in the swap component #11

fadeev opened this issue Aug 1, 2024 · 2 comments

Comments

@fadeev
Copy link
Member

fadeev commented Aug 1, 2024

Right now when you select a token on a chain that is different from the one selected in MetaMask, the button is disabled.

Screenshot 2024-08-01 at 15 47 57

Make the button clickable, so that it opens MetaMask and prompts the user to switch the chain:

Screenshot 2024-08-01 at 15 49 23

Use wagmi:

import { useSwitchChain } from "wagmi";
const { switchChain } = useSwitchChain();

The bulk of the logic should be in the index.tsx of the swap component (and not in the template) to separate logic from presentation.

Make sure the button displays a spinner import { Loader2 } from "lucide-react" when changing the network.

@fadeev
Copy link
Member Author

fadeev commented Aug 1, 2024

Assigned to @mikelord007

@fadeev
Copy link
Member Author

fadeev commented Aug 15, 2024

@mikelord007 any updates on the issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant