diff options
author | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-13 16:25:39 +0800 |
---|---|---|
committer | Chi Kei Chan <chikeichan@gmail.com> | 2017-09-13 16:25:39 +0800 |
commit | 8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5 (patch) | |
tree | 09d0ab5b98acc83034ff98f6b97e28b8753c7f42 /ui/app/actions.js | |
parent | 8b5f2a95df45c24061c13c51ca874e933e743381 (diff) | |
download | tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.tar tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.tar.gz tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.tar.bz2 tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.tar.lz tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.tar.xz tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.tar.zst tangerine-wallet-browser-8f31b05ac5b7d8383c720b8b0c9f7f3cecc937f5.zip |
Add token exchange rates
Diffstat (limited to 'ui/app/actions.js')
-rw-r--r-- | ui/app/actions.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ui/app/actions.js b/ui/app/actions.js index c04808125..1ef538845 100644 --- a/ui/app/actions.js +++ b/ui/app/actions.js @@ -163,6 +163,8 @@ var actions = { coinBaseSubview: coinBaseSubview, SHAPESHIFT_SUBVIEW: 'SHAPESHIFT_SUBVIEW', shapeShiftSubview: shapeShiftSubview, + UPDATE_TOKEN_EXCHANGE_RATE: 'UPDATE_TOKEN_EXCHANGE_RATE', + updateTokenExchangeRate, PAIR_UPDATE: 'PAIR_UPDATE', pairUpdate: pairUpdate, coinShiftRquest: coinShiftRquest, @@ -1078,6 +1080,28 @@ function shapeShiftRequest (query, options, cb) { } } +function updateTokenExchangeRate (token = '') { + const pair = `${token.toLowerCase()}_eth` + + return dispatch => { + if (!token) { + return + } + + shapeShiftRequest('marketinfo', { pair }, marketinfo => { + if (!marketinfo.error) { + dispatch({ + type: actions.UPDATE_TOKEN_EXCHANGE_RATE, + payload: { + pair, + marketinfo, + }, + }) + } + }) + } +} + // Call Background Then Update // // A function generator for a common pattern wherein: |