aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts
diff options
context:
space:
mode:
authorEsteban MIno <efmino@uc.cl>2018-08-23 05:14:10 +0800
committerEsteban MIno <efmino@uc.cl>2018-08-23 05:14:10 +0800
commit56bed3f1bce3cde176784026b10bc3bbe8e819d0 (patch)
tree5c98dca8d42eac1c24438fd6c69c30cbcbcaa695 /app/scripts
parent153731e46285563f834cf29d154efec2cf9077e5 (diff)
downloadtangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.tar
tangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.tar.gz
tangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.tar.bz2
tangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.tar.lz
tangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.tar.xz
tangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.tar.zst
tangerine-wallet-browser-56bed3f1bce3cde176784026b10bc3bbe8e819d0.zip
expose web3.metamask.watchAsset
Diffstat (limited to 'app/scripts')
-rw-r--r--app/scripts/lib/auto-reload.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/scripts/lib/auto-reload.js b/app/scripts/lib/auto-reload.js
index cce31c3d2..f3c89ecdb 100644
--- a/app/scripts/lib/auto-reload.js
+++ b/app/scripts/lib/auto-reload.js
@@ -14,6 +14,23 @@ function setupDappAutoReload (web3, observable) {
console.warn('MetaMask: web3 will be deprecated in the near future in favor of the ethereumProvider \nhttps://github.com/MetaMask/faq/blob/master/detecting_metamask.md#web3-deprecation')
hasBeenWarned = true
}
+ // setup wallet
+ if (key === 'metamask') {
+ return {
+ watchAsset: (params) => {
+ return new Promise((resolve, reject) => {
+ web3.currentProvider.sendAsync({
+ jsonrpc: '2.0',
+ method: 'metamask_watchAsset',
+ params,
+ }, (err, res) => {
+ if (err) reject(err)
+ resolve(res)
+ })
+ })
+ },
+ }
+ }
// get the time of use
lastTimeUsed = Date.now()
// return value normally