aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Serrano <kevin.serrano@consensys.net>2017-08-30 07:36:05 +0800
committerKevin Serrano <kevin.serrano@consensys.net>2017-08-30 07:36:05 +0800
commit056276af02c5717684e36eeeaf6a8787ea4a39e6 (patch)
treee7acecefaa74e87925a7d186cb9325ddc80237c1
parent34b327caf07cd395229806cedecdeb770c034562 (diff)
downloadtangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.tar
tangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.tar.gz
tangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.tar.bz2
tangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.tar.lz
tangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.tar.xz
tangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.tar.zst
tangerine-wallet-browser-056276af02c5717684e36eeeaf6a8787ea4a39e6.zip
integrate infura currency
-rw-r--r--app/scripts/controllers/currency.js6
-rw-r--r--app/scripts/metamask-controller.js2
-rw-r--r--ui/app/config.js6
-rw-r--r--ui/app/infura-conversion.json59
4 files changed, 66 insertions, 7 deletions
diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js
index 1f20dc005..e32f51ec2 100644
--- a/app/scripts/controllers/currency.js
+++ b/app/scripts/controllers/currency.js
@@ -8,7 +8,7 @@ class CurrencyController {
constructor (opts = {}) {
const initState = extend({
- currentCurrency: 'USD',
+ currentCurrency: 'ethusd',
conversionRate: 0,
conversionDate: 'N/A',
}, opts.initState)
@@ -45,10 +45,10 @@ class CurrencyController {
updateConversionRate () {
const currentCurrency = this.getCurrentCurrency()
- return fetch(`https://api.cryptonator.com/api/ticker/eth-${currentCurrency}`)
+ return fetch(`https://api.infura.io/v1/ticker/${currentCurrency}`)
.then(response => response.json())
.then((parsedResponse) => {
- this.setConversionRate(Number(parsedResponse.ticker.price))
+ this.setConversionRate(Number(parsedResponse.bid))
this.setConversionDate(Number(parsedResponse.timestamp))
}).catch((err) => {
if (err) {
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index a007d6fc5..bc483f585 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -647,4 +647,4 @@ module.exports = class MetamaskController extends EventEmitter {
return Promise.resolve(rpcTarget)
})
}
-} \ No newline at end of file
+}
diff --git a/ui/app/config.js b/ui/app/config.js
index 62785c49b..c6d9c3e5d 100644
--- a/ui/app/config.js
+++ b/ui/app/config.js
@@ -3,7 +3,7 @@ const Component = require('react').Component
const h = require('react-hyperscript')
const connect = require('react-redux').connect
const actions = require('./actions')
-const currencies = require('./conversion.json').rows
+const infuraCurrencies = require('./infura-conversion.json').symbols
const validUrl = require('valid-url')
const copyToClipboard = require('copy-to-clipboard')
@@ -166,8 +166,8 @@ function currentConversionInformation (metamaskState, state) {
state.dispatch(actions.setCurrentCurrency(newCurrency))
},
defaultValue: currentCurrency,
- }, currencies.map((currency) => {
- return h('option', {key: currency.code, value: currency.code}, `${currency.code} - ${currency.name}`)
+ }, infuraCurrencies.map((currency) => {
+ return h('option', {key: currency, value: currency}, currency)
})
),
])
diff --git a/ui/app/infura-conversion.json b/ui/app/infura-conversion.json
new file mode 100644
index 000000000..de5ff4a90
--- /dev/null
+++ b/ui/app/infura-conversion.json
@@ -0,0 +1,59 @@
+{
+ "symbols": [
+ "eth1st",
+ "ethadt",
+ "ethadx",
+ "ethant",
+ "ethbat",
+ "ethbnt",
+ "ethbtc",
+ "ethcad",
+ "ethcfi",
+ "ethcrb",
+ "ethcvc",
+ "ethdash",
+ "ethdgd",
+ "ethetc",
+ "etheur",
+ "ethfun",
+ "ethgbp",
+ "ethgno",
+ "ethgnt",
+ "ethgup",
+ "ethhmq",
+ "ethjpy",
+ "ethlgd",
+ "ethlsk",
+ "ethltc",
+ "ethlun",
+ "ethmco",
+ "ethmtl",
+ "ethmyst",
+ "ethnmr",
+ "ethomg",
+ "ethpay",
+ "ethptoy",
+ "ethqrl",
+ "ethqtum",
+ "ethrep",
+ "ethrlc",
+ "ethrub",
+ "ethsc",
+ "ethsngls",
+ "ethsnt",
+ "ethsteem",
+ "ethstorj",
+ "ethtime",
+ "ethtkn",
+ "ethtrst",
+ "ethuah",
+ "ethusd",
+ "ethwings",
+ "ethxbt",
+ "ethxem",
+ "ethxlm",
+ "ethxmr",
+ "ethxrp",
+ "ethzec"
+ ]
+}