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

chore(tangle-dapp): Add token to wallet post bridge transaction #2786

Merged
merged 4 commits into from
Feb 3, 2025

Conversation

devpavan04
Copy link
Member

Summary of changes

  • After executing a bridge transaction, the user is prompted to add the bridged token to their wallet.

Proposed area of change

  • apps/tangle-dapp
  • apps/tangle-cloud
  • libs/tangle-shared-ui
  • libs/webb-ui-components

Associated issue(s)

Screen Recording

CleanShot.2025-01-31.at.07.32.51.mp4

Copy link

netlify bot commented Jan 31, 2025

Deploy Preview for tangle-cloud ready!

Name Link
🔨 Latest commit 812707f
🔍 Latest deploy log https://app.netlify.com/sites/tangle-cloud/deploys/67a12c9ffae1f10008d75628
😎 Deploy Preview https://deploy-preview-2786--tangle-cloud.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Jan 31, 2025

Deploy Preview for tangle-dapp ready!

Name Link
🔨 Latest commit 812707f
🔍 Latest deploy log https://app.netlify.com/sites/tangle-dapp/deploys/67a12c9fc21a9800081229c9
😎 Deploy Preview https://deploy-preview-2786--tangle-dapp.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@yurixander yurixander left a comment

Choose a reason for hiding this comment

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

@devpavan04 Does this PR handle the case where the token already exists in the wallet? Will it be prompted to re-add it?

@devpavan04
Copy link
Member Author

@devpavan04 Does this PR handle the case where the token already exists in the wallet? Will it be prompted to re-add it?

Currently, there is no direct method to check if a token is already added. The MetaMask API does not provide a function to retrieve a list of tokens added to a user's wallet.

It will be prompted to re-add it, but the second modal will have a warning - already exists, be careful to add unknown tokens, etc.

@monaiuu We can go with the add to wallet button approach here. What do you think? But still, we cannot hide/show the button since we do not know if the token has already been added.

@AtelyPham
Copy link
Member

@devpavan04 Does this PR handle the case where the token already exists in the wallet? Will it be prompted to re-add it?

Currently, there is no direct method to check if a token is already added. The MetaMask API does not provide a function to retrieve a list of tokens added to a user's wallet.

It will be prompted to re-add it, but the second modal will have a warning - already exists, be careful to add unknown tokens, etc.

@monaiuu We can go with the add to wallet button approach here. What do you think? But still, we cannot hide/show the button since we do not know if the token has already been added.

We can use local storage to track if a token has been added to the MetaMask wallet. If the user successfully adds the token or receives the "Token Already Exists" error, we can record that the token is added for their currently selected account. However, this approach may require additional implementation.

Alternatively, we could display the "Add to Wallet" button. If the token is already in the user's wallet, clicking the button would simply inform them that the token exists.

@devpavan04 devpavan04 marked this pull request as draft February 3, 2025 18:18
@devpavan04
Copy link
Member Author

devpavan04 commented Feb 3, 2025

Checklist:

  • Use local storage to store token <> wallet info.

@devpavan04 devpavan04 marked this pull request as ready for review February 3, 2025 20:52
@devpavan04 devpavan04 merged commit 852149f into develop Feb 3, 2025
16 checks passed
@devpavan04 devpavan04 deleted the PS/add-token-to-wallet branch February 3, 2025 21:01
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.

[TASK] Implement 'Add Token to Wallet' Post-Bridge Transaction
4 participants