Skip to content

Commit

Permalink
Fix metamask_watchAsset syntax error (MetaMask#147)
Browse files Browse the repository at this point in the history
The `wasAdded` variable was referenced by the wrong name (`added`) and
from the wrong scope. It now checks the result correctly.
  • Loading branch information
Gudahtt authored Jul 9, 2020
1 parent 84fc7a5 commit 5693bbd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/guide/registering-your-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ const tokenSymbol = 'TUT';
const tokenDecimals = 18;
const tokenImage = 'http://placekitten.com/200/300';

// wasAdded is a boolean. Like any RPC method, an error may be thrown.
try {
// wasAdded is a boolean. Like any RPC method, an error may be thrown.
const wasAdded = await ethereum.request({
method: 'metamask_watchAsset',
method: 'wallet_watchAsset',
params: {
type: 'ERC20', // Initially only supports ERC20, but eventually more!
options: {
Expand All @@ -37,15 +37,15 @@ try {
},
},
});

if (wasAdded) {
console.log('Thanks for your interest!');
} else {
console.log('Your loss!');
}
} catch (error) {
console.log(error);
}

if (added) {
console.log('Thanks for your interest!');
} else {
console.log('Your loss!');
}
```

## Default Token List
Expand Down

0 comments on commit 5693bbd

Please sign in to comment.