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

[feat] Add connect wallet functionality #123

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

jimenezz22
Copy link
Contributor

@jimenezz22 jimenezz22 commented Oct 3, 2024

Pull Request

Changes description

Describe what your changes will do and any TODOs there might be in the future related to the issue you are closing.

  • Use useState to manage wallet connection status (walletConnection), storing the wallet address and wallet object.
  • The handleConnect function triggers wallet connection via connect() and retrieves the wallet's address.
  • Upon successful connection, stores the address in the component state and persists it in localStorage for session persistence.
  • The handleDisconnect function disconnects the wallet via disconnect(), clears the connection state, and removes relevant data from localStorage.
  • The "Connect wallet" button dynamically changes to display the connected wallet’s shortened address (e.g., 0x1234...abcd) when a wallet is connected.
  • A disconnect button allows the user to disconnect their wallet with a simple UI interaction.

Current output

giphy

Before connecting:

Screenshot 2024-10-03 at 1 40 37 AM

During connecting:

Screenshot 2024-10-03 at 1 40 17 AM Screenshot 2024-10-03 at 1 41 31 AM Screenshot 2024-10-03 at 1 41 15 AM

After connecting:
Screenshot 2024-10-03 at 1 40 51 AM

Time spent breakdown

Give a breakdown on the time you used to solve the issue you are closing.

  • Approximately 4/5 hours divided into two days. I read the Starknetkit documentation required to connect the wallets, saw their examples and adapted it to what is required for this issue

Comments

Any other details you might want to share.

  • None

@adrianvrj adrianvrj self-requested a review October 3, 2024 15:08
Copy link
Member

@adrianvrj adrianvrj left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of changes

@adrianvrj
Copy link
Member

@jimenezz22 seems like something went wrong when building the frontend

@jimenezz22
Copy link
Contributor Author

jimenezz22 commented Oct 4, 2024

@jimenezz22 seems like something went wrong when building the frontend

@adrianvrj checking

@jimenezz22
Copy link
Contributor Author

@adrianvrj Everything looks good right now

Screenshot 2024-10-03 at 7 00 04 PM

@adrianvrj
Copy link
Member

@jimenezz22 everything looks good now, tysm, great work homie!

@adrianvrj adrianvrj merged commit 607b761 into web3wagers:dev Oct 4, 2024
5 checks passed
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

Successfully merging this pull request may close these issues.

[feat] Add connect wallet functionality
2 participants