AddTokenToWallet
Today we bring you a very easy but nonetheless valuable lesson that helps you quickly add a token to your wallet with a button on your website!
This could apply to Project Teams, Aggregator service providers, Analytics Providers and general Users at large who want to learn more and play with Web3 things.
What you need:
VS Code with “Live Server” extension installed
Contract address of the token(s) you want to add
A free Netlify or Vercel account (or any other cloud hosting service of your choice) if you want to publish it to your friends or on the www
All you have to do, is replace the Token Address, Symbol, Decimals and image location in the code above with your own respective details. The example above uses the Blocktools Uni V2 LP Token which TOOLS holders receive as free rewards for staking their TOOLS, here is what the “Add to Wallet” button looks like on the dashboard.
Tips:
1. Create a folder and give it a name
2. Save the .js as app.js in that folder (beginners can just copy paste the contents into a notepad and save)
3. Save the html as index.html in the same folder
4. Open the folder on VS Code, Click Go-live on the bottom right (this will show up if you have installed Live Server extension
5. That’s it! Your Add to Wallet button is ready for use!
Play with it: Give it a proper UI, use it in conjunction with the other Learn2Earn apps from earlier lessons, Add more tokens to the list. Scale!
Happy Building!