starknet-react icon indicating copy to clipboard operation
starknet-react copied to clipboard

Add hook to change network

Open fracek opened this issue 2 years ago • 10 comments

Wallet now support adding a network and asking users to switch network. We should expose an hook to do that.

Requires #211

fracek avatar Feb 10 '23 14:02 fracek

After some research I can work on it.

0xads avatar Mar 27 '23 10:03 0xads

Perfect, looking forward to review the PR!

fracek avatar Mar 30 '23 09:03 fracek

Hi, I'm a little busy at work. If anyone wants to take it. Otherwise I'll dot it in a few weeks.

0xads avatar Apr 08 '23 09:04 0xads

Will work on it

fricoben avatar Apr 11 '23 05:04 fricoben

Will work on it

Hey @fricoben, are you still working on this one ?

YohanTz avatar Jul 25 '23 20:07 YohanTz

No you can go for it

fricoben avatar Jul 31 '23 16:07 fricoben

Hi @YohanTz is this issue still open ?

ktarun1419 avatar Feb 01 '24 19:02 ktarun1419

I want to work on it

ktarun1419 avatar Feb 01 '24 19:02 ktarun1419

Hi @YohanTz is this issue still open ?

Hey @ktarun1419, a working PR is here: https://github.com/apibara/starknet-react/pull/307, but can't be merged for now, as mentioned in the PR description :)

YohanTz avatar Feb 02 '24 12:02 YohanTz

Hi @YohanTz is this issue still open ?

Hey @ktarun1419, a working PR is here: #307, but can be merged for now, as mentioned in the PR description :)

Thank you :)

ktarun1419 avatar Feb 02 '24 13:02 ktarun1419

This issue has been automatically marked as stale because it has not had activity in the six months. It will be closed in 2 weeks if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant.

github-actions[bot] avatar Aug 01 '24 02:08 github-actions[bot]

This can now be added to starknet react v3.

fracek avatar Aug 07 '24 08:08 fracek

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hey! I'd like to collaborate on this project. I have five years of frontend development experience, I'm currently going through a Starknet bootcamp with Dojo Coding, which provides me with the foundational knowledge needed. I believe this combination of my experience and current training makes me well-suited to tackle this issue. I've already contributed to another project using Typescript and Starknet.js. Thanks for considering me.

How I plan on tackling this issue

I would start by testing old PR's and go from there.

sotoyjuan avatar Aug 08 '24 20:08 sotoyjuan

Hey, happy to review the PR for this. BTW if you wait a bit it can be part of OD Hack

fracek avatar Aug 10 '24 11:08 fracek

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

I’m proficient in JavaScript and TypeScript, and have extensive experience with React, which allows me to create and manage custom hooks effectively. I’m also well-versed in Web3 technologies and wallet integrations, including working with APIs like MetaMask and WalletConnect, which are crucial for handling network management and interactions with blockchain networks.

I have a solid understanding of blockchain networks, including how to add new networks and handle network switching. My problem-solving skills help me tackle integration challenges and ensure smooth functionality. I also have experience testing hooks across different environments to ensure they work reliably and consistently.

How I plan on tackling this issue

  1. Define a New Hook: Create a custom hook that provides functionality for adding a network and prompting users to switch networks, encapsulating the necessary logic and state management.

  2. Implement Network Addition: In the hook, include methods for adding a new network to the wallet, ensuring it handles network configuration and integration smoothly.

  3. Handle Network Switching: Add functionality to the hook for requesting users to switch to a different network, including user prompts or automatic network changes.

  4. Integrate with Existing Features: Ensure the new hook integrates with your existing wallet and network management features, addressing any dependencies or interactions as outlined in Issue #211.

  5. Test Thoroughly: Test the hook in various scenarios to confirm it successfully adds networks and handles network switching, ensuring compatibility across different wallets and user environments.

GoSTEAN avatar Aug 21 '24 15:08 GoSTEAN

Hi @fracek can I work on this issue

ShantelPeters avatar Aug 21 '24 22:08 ShantelPeters

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

Hi @fracek

I'm ready to work on creating a hook to support adding and switching networks in a wallet. My name is Benjamin, and I have extensive experience in developing custom hooks for blockchain interactions, including wallet management and network handling. My background includes integrating network management features to enhance user experience in decentralized applications.

Understanding the Issue

The current wallet functionality includes adding a network and asking users to switch networks. To improve usability and streamline network management, we need to expose a custom hook that facilitates these actions programmatically. This feature requires the implementation details from issue #211.

How I plan on tackling this issue

Develop Network Management Hook

  • Hook Creation: I will develop a custom hook that allows users to add a new network to their wallet and prompt them to switch to it if necessary.
  • Parameters:
    • networkName: The name of the network to be added.
    • networkChainId: The chain ID of the network to be added.
    • networkRpcUrl: The RPC URL for the network.
    • networkSymbol: The symbol for the network (e.g., ETH for Ethereum).
    • onSuccess: Callback for when the network is successfully added and switched.
    • onError: Callback for handling errors during the network addition or switching process.

Implementation Steps

  • Create Hook Function: Implement the hook function to handle adding and switching networks, including interaction with the wallet's API.
  • Integration: Ensure that the hook integrates seamlessly with existing wallet management systems.
  • Testing: Thoroughly test the hook to confirm that it correctly adds and switches networks and handles errors appropriately.
  • Documentation: Provide clear documentation on how to use the hook, including examples and parameter descriptions.

Tasks

Develop Hook

  • Implement Hook Functionality: Create the hook to manage network addition and switching, including handling user prompts and network configurations.
  • Integration: Ensure compatibility with the wallet’s existing network management features.

Testing

  • Functionality Testing: Verify that the hook correctly adds and switches networks as expected.
  • Error Handling: Test the hook’s error handling to ensure it gracefully manages issues that arise during network operations.
  • User Experience: Ensure that the hook provides a smooth and intuitive experience for users when adding or switching networks.

Benjtalkshow avatar Aug 22 '24 10:08 Benjtalkshow

Hey @ShantelPeters did you apply trough only dust? I think it's required.

fracek avatar Aug 22 '24 17:08 fracek

Thank you I’ll get straight to work

ShantelPeters avatar Aug 22 '24 18:08 ShantelPeters

Hi @fracek you said the issue is invalid and there’s nothing to do sir

ShantelPeters avatar Aug 26 '24 14:08 ShantelPeters

Hey, yes the hook is already in starknet react v3. Closing it for now.

fracek avatar Aug 26 '24 14:08 fracek