Skip to content

Commit

Permalink
Fix metamask_watchAsset example (MetaMask#146)
Browse files Browse the repository at this point in the history
The example passed an array as the `params` property, which does not
work. `params` must be passed as an object.
  • Loading branch information
Gudahtt authored Jul 9, 2020
1 parent 3c36007 commit e45fe28
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions docs/guide/registering-your-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,15 @@ const tokenImage = 'http://placekitten.com/200/300';
try {
const wasAdded = await ethereum.request({
method: 'metamask_watchAsset',
params: [
{
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
address: tokenAddress, // The address that the token is at.
symbol: tokenSymbol, // A ticker symbol or shorthand, up to 5 chars.
decimals: tokenDecimals, // The number of decimals in the token
image: tokenImage, // A string url of the token logo
},
params: {
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
address: tokenAddress, // The address that the token is at.
symbol: tokenSymbol, // A ticker symbol or shorthand, up to 5 chars.
decimals: tokenDecimals, // The number of decimals in the token
image: tokenImage, // A string url of the token logo
},
],
},
});
} catch (error) {
console.log(error);
Expand Down

0 comments on commit e45fe28

Please sign in to comment.