Created
April 22, 2021 10:43
-
-
Save jessgusclark/1f8eb6960306afd91079cb9a26d551c9 to your computer and use it in GitHub Desktop.
Adding an ERC20 token to Metamask with wallet_watchAsset
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const params = addToken({ | |
type: 'ERC20', | |
options: { | |
address: '0x2acc95758f8b5f583470ba265eb685a8f45fc9d5', | |
symbol: 'RIF', | |
decimals: 18, | |
image: 'https://s2.coinmarketcap.com/static/img/coins/64x64/3701.png' | |
} | |
}) | |
window.ethereum.request({ method: 'wallet_watchAsset', params }) | |
.then(() => setLog([...log, 'Success, Token added!'])) | |
.catch((error: Error) => setLog([...log, `Error: ${error.message}`])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I think good article.