From 056276af02c5717684e36eeeaf6a8787ea4a39e6 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 29 Aug 2017 16:36:05 -0700 Subject: [PATCH 01/13] integrate infura currency --- app/scripts/controllers/currency.js | 6 +-- app/scripts/metamask-controller.js | 2 +- ui/app/config.js | 6 +-- ui/app/infura-conversion.json | 59 +++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 ui/app/infura-conversion.json 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" + ] +} From 456ceefcf7967423ea66e81d2108ffcb0e144082 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Thu, 14 Sep 2017 09:14:57 -0700 Subject: [PATCH 02/13] Modify conversion to new api. --- ui/app/config.js | 4 +- ui/app/infura-conversion.json | 651 +++++++++++++++++++++++++++++++--- 2 files changed, 597 insertions(+), 58 deletions(-) diff --git a/ui/app/config.js b/ui/app/config.js index 8eaaa1384..cc74b29db 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 infuraCurrencies = require('./infura-conversion.json').symbols +const infuraCurrencies = require('./infura-conversion.json').objects const validUrl = require('valid-url') const exportAsFile = require('./util').exportAsFile @@ -168,7 +168,7 @@ function currentConversionInformation (metamaskState, state) { }, defaultValue: currentCurrency, }, infuraCurrencies.map((currency) => { - return h('option', {key: currency, value: currency}, currency) + return h('option', {key: currency.symbol, value: currency.symbol}, `${currency.quote.code.toUpperCase()} - ${currency.quote.name}`) }) ), ]) diff --git a/ui/app/infura-conversion.json b/ui/app/infura-conversion.json index de5ff4a90..3103e72a0 100644 --- a/ui/app/infura-conversion.json +++ b/ui/app/infura-conversion.json @@ -1,59 +1,598 @@ { - "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" + "objects": [ + { + "symbol": "eth1st", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "1st", + "name": "FirstBlood" + } + }, + { + "symbol": "ethadt", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "adt", + "name": "adToken" + } + }, + { + "symbol": "ethadx", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "adx", + "name": "AdEx" + } + }, + { + "symbol": "ethant", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "ant", + "name": "Aragon" + } + }, + { + "symbol": "ethbat", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "bat", + "name": "Basic Attention Token" + } + }, + { + "symbol": "ethbnt", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "bnt", + "name": "Bancor" + } + }, + { + "symbol": "ethbtc", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "btc", + "name": "Bitcoin" + } + }, + { + "symbol": "ethcad", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "cad", + "name": "Canadian dollar" + } + }, + { + "symbol": "ethcfi", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "cfi", + "name": "Cofound.it" + } + }, + { + "symbol": "ethcrb", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "crb", + "name": "CreditBit" + } + }, + { + "symbol": "ethcvc", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "cvc", + "name": "Civic" + } + }, + { + "symbol": "ethdash", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "dash", + "name": "Dash" + } + }, + { + "symbol": "ethdgd", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "dgd", + "name": "DigixDAO" + } + }, + { + "symbol": "ethetc", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "etc", + "name": "Ethereum Classic" + } + }, + { + "symbol": "etheur", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "eur", + "name": "Euro" + } + }, + { + "symbol": "ethfun", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "fun", + "name": "FunFair" + } + }, + { + "symbol": "ethgbp", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "gbp", + "name": "Pound sterling" + } + }, + { + "symbol": "ethgno", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "gno", + "name": "Gnosis" + } + }, + { + "symbol": "ethgnt", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "gnt", + "name": "Golem" + } + }, + { + "symbol": "ethgup", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "gup", + "name": "Matchpool" + } + }, + { + "symbol": "ethhmq", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "hmq", + "name": "Humaniq" + } + }, + { + "symbol": "ethjpy", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "jpy", + "name": "Japanese yen" + } + }, + { + "symbol": "ethlgd", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "lgd", + "name": "Legends Room" + } + }, + { + "symbol": "ethlsk", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "lsk", + "name": "Lisk" + } + }, + { + "symbol": "ethltc", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "ltc", + "name": "Litecoin" + } + }, + { + "symbol": "ethlun", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "lun", + "name": "Lunyr" + } + }, + { + "symbol": "ethmco", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "mco", + "name": "Monaco" + } + }, + { + "symbol": "ethmtl", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "mtl", + "name": "Metal" + } + }, + { + "symbol": "ethmyst", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "myst", + "name": "Mysterium" + } + }, + { + "symbol": "ethnmr", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "nmr", + "name": "Numeraire" + } + }, + { + "symbol": "ethomg", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "omg", + "name": "OmiseGO" + } + }, + { + "symbol": "ethpay", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "pay", + "name": "TenX" + } + }, + { + "symbol": "ethptoy", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "ptoy", + "name": "Patientory" + } + }, + { + "symbol": "ethqrl", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "qrl", + "name": "Quantum-Resistant Ledger" + } + }, + { + "symbol": "ethqtum", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "qtum", + "name": "Qtum" + } + }, + { + "symbol": "ethrep", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "rep", + "name": "Augur" + } + }, + { + "symbol": "ethrlc", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "rlc", + "name": "iEx.ec" + } + }, + { + "symbol": "ethrub", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "rub", + "name": "Russian ruble" + } + }, + { + "symbol": "ethsc", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "sc", + "name": "Siacoin" + } + }, + { + "symbol": "ethsngls", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "sngls", + "name": "SingularDTV" + } + }, + { + "symbol": "ethsnt", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "snt", + "name": "Status" + } + }, + { + "symbol": "ethsteem", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "steem", + "name": "Steem" + } + }, + { + "symbol": "ethstorj", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "storj", + "name": "Storj" + } + }, + { + "symbol": "ethtime", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "time", + "name": "ChronoBank" + } + }, + { + "symbol": "ethtkn", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "tkn", + "name": "TokenCard" + } + }, + { + "symbol": "ethtrst", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "trst", + "name": "WeTrust" + } + }, + { + "symbol": "ethuah", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "uah", + "name": "Ukrainian hryvnia" + } + }, + { + "symbol": "ethusd", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "usd", + "name": "United States dollar" + } + }, + { + "symbol": "ethwings", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "wings", + "name": "Wings" + } + }, + { + "symbol": "ethxem", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "xem", + "name": "NEM" + } + }, + { + "symbol": "ethxlm", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "xlm", + "name": "Stellar lumen" + } + }, + { + "symbol": "ethxmr", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "xmr", + "name": "Monero" + } + }, + { + "symbol": "ethxrp", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "xrp", + "name": "Ripple" + } + }, + { + "symbol": "ethzec", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "zec", + "name": "Zcash" + } + } ] } From f6f7798828cd7f6325800b96d10a823a3338cdb0 Mon Sep 17 00:00:00 2001 From: Roman Rodov Date: Mon, 4 Sep 2017 11:09:50 +1000 Subject: [PATCH 03/13] Resolve merge conflicts for currency sort merge. --- ui/app/config.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/app/config.js b/ui/app/config.js index cc74b29db..06a1c2899 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -167,7 +167,9 @@ function currentConversionInformation (metamaskState, state) { state.dispatch(actions.setCurrentCurrency(newCurrency)) }, defaultValue: currentCurrency, - }, infuraCurrencies.map((currency) => { + }, infuraCurrencies.sort((a, b) => { + return a.quote.name.toLocaleLowerCase().localeCompare(b.quote.name.toLocaleLowerCase()) + }).map((currency) => { return h('option', {key: currency.symbol, value: currency.symbol}, `${currency.quote.code.toUpperCase()} - ${currency.quote.name}`) }) ), From 9af52ee1c58db23728d9240f3d5ec472a6adf68f Mon Sep 17 00:00:00 2001 From: Roman Rodov Date: Fri, 8 Sep 2017 10:56:43 +1000 Subject: [PATCH 04/13] Another merge conflict resolved. --- ui/app/config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/app/config.js b/ui/app/config.js index 06a1c2899..4b0218692 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -3,7 +3,9 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') -const infuraCurrencies = require('./infura-conversion.json').objects +const infuraCurrencies = require('./infura-conversion.json').sort((a, b) => { + return a.name.toLocaleLowerCase().localeCompare(b.name.toLocaleLowerCase()) + }) const validUrl = require('valid-url') const exportAsFile = require('./util').exportAsFile @@ -167,9 +169,7 @@ function currentConversionInformation (metamaskState, state) { state.dispatch(actions.setCurrentCurrency(newCurrency)) }, defaultValue: currentCurrency, - }, infuraCurrencies.sort((a, b) => { - return a.quote.name.toLocaleLowerCase().localeCompare(b.quote.name.toLocaleLowerCase()) - }).map((currency) => { + }, infuraCurrencies.map((currency) => { return h('option', {key: currency.symbol, value: currency.symbol}, `${currency.quote.code.toUpperCase()} - ${currency.quote.name}`) }) ), From 90e0c10dc25a2d35aef0fccb1df5f50e2fc1161f Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 11 Sep 2017 14:34:27 -0700 Subject: [PATCH 05/13] Add additional attribution to changelog. --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5928d5cb4..e0b8c3995 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,9 @@ - Add info on token contract addresses. - Add validation preventing users from inputting their own addresses as token tracking addresses. - Added button to reject all transactions (thanks to davidp94! https://github.com/davidp94) +- Add AUD to currency list (thanks to strelok1 https://github.com/strelok1). +- Sort currencies by currency name (also thanks to strelok1). + ## 3.9.13 2017-9-8 From 899a12cb2a66e7c44ef432154d2f4acf4df526a0 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 18 Sep 2017 12:04:46 -0700 Subject: [PATCH 06/13] Fix the changelog again. --- CHANGELOG.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0b8c3995..04661bfa2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,8 @@ - Fixed a long standing memory leak associated with filters installed by dapps - Fix link to support center. - Fixed tooltip icon locations to avoid overflow. -- Warn users when a dapp proposes a high gas limit (90% of blockGasLimit or higher) +- Warn users when a dapp proposes a high gas limit (90% of blockGasLimit or higher +- Sort currencies by currency name (thanks to strelok1: https://github.com/strelok1). ## 3.10.0 2017-9-11 @@ -17,8 +18,6 @@ - Add info on token contract addresses. - Add validation preventing users from inputting their own addresses as token tracking addresses. - Added button to reject all transactions (thanks to davidp94! https://github.com/davidp94) -- Add AUD to currency list (thanks to strelok1 https://github.com/strelok1). -- Sort currencies by currency name (also thanks to strelok1). ## 3.9.13 2017-9-8 From 51cebcc1733e6ac2b1d7fa8841eb937c979cd074 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 18 Sep 2017 12:20:41 -0700 Subject: [PATCH 07/13] Fix the property query for new currencies. --- ui/app/config.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/app/config.js b/ui/app/config.js index 4b0218692..fbd38c7f4 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -3,8 +3,8 @@ const Component = require('react').Component const h = require('react-hyperscript') const connect = require('react-redux').connect const actions = require('./actions') -const infuraCurrencies = require('./infura-conversion.json').sort((a, b) => { - return a.name.toLocaleLowerCase().localeCompare(b.name.toLocaleLowerCase()) +const infuraCurrencies = require('./infura-conversion.json').objects.sort((a, b) => { + return a.quote.name.toLocaleLowerCase().localeCompare(b.quote.name.toLocaleLowerCase()) }) const validUrl = require('valid-url') const exportAsFile = require('./util').exportAsFile From bd8428e9ed3e1fb386620def0739720aa8985299 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 18 Sep 2017 16:09:01 -0700 Subject: [PATCH 08/13] Comply with current currency API and add additional styling. --- app/scripts/controllers/currency.js | 4 ++-- ui/app/components/fiat-value.js | 2 +- ui/app/config.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/scripts/controllers/currency.js b/app/scripts/controllers/currency.js index e32f51ec2..9e696ce55 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: 'ethusd', + currentCurrency: 'usd', conversionRate: 0, conversionDate: 'N/A', }, opts.initState) @@ -45,7 +45,7 @@ class CurrencyController { updateConversionRate () { const currentCurrency = this.getCurrentCurrency() - return fetch(`https://api.infura.io/v1/ticker/${currentCurrency}`) + return fetch(`https://api.infura.io/v1/ticker/eth${currentCurrency}`) .then(response => response.json()) .then((parsedResponse) => { this.setConversionRate(Number(parsedResponse.bid)) diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index 8a64a1cfc..d76b80ab2 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -28,7 +28,7 @@ FiatValue.prototype.render = function () { fiatTooltipNumber = 'Unknown' } - return fiatDisplay(fiatDisplayNumber, currentCurrency) + return fiatDisplay(fiatDisplayNumber, currentCurrency.toUpperCase()) } function fiatDisplay (fiatDisplayNumber, fiatSuffix) { diff --git a/ui/app/config.js b/ui/app/config.js index fbd38c7f4..0fe232c07 100644 --- a/ui/app/config.js +++ b/ui/app/config.js @@ -170,7 +170,7 @@ function currentConversionInformation (metamaskState, state) { }, defaultValue: currentCurrency, }, infuraCurrencies.map((currency) => { - return h('option', {key: currency.symbol, value: currency.symbol}, `${currency.quote.code.toUpperCase()} - ${currency.quote.name}`) + return h('option', {key: currency.quote.code, value: currency.quote.code}, `${currency.quote.code.toUpperCase()} - ${currency.quote.name}`) }) ), ]) From 31e9dcf47063e1be7337d7d06b4c721e0f619951 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 26 Sep 2017 10:02:49 -0700 Subject: [PATCH 09/13] Modify tests for new API. --- test/unit/currency-controller-test.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/unit/currency-controller-test.js b/test/unit/currency-controller-test.js index 5eeaf9bcc..63ab60f9e 100644 --- a/test/unit/currency-controller-test.js +++ b/test/unit/currency-controller-test.js @@ -15,11 +15,11 @@ describe('currency-controller', function () { describe('currency conversions', function () { describe('#setCurrentCurrency', function () { it('should return USD as default', function () { - assert.equal(currencyController.getCurrentCurrency(), 'USD') + assert.equal(currencyController.getCurrentCurrency(), 'usd') }) it('should be able to set to other currency', function () { - assert.equal(currencyController.getCurrentCurrency(), 'USD') + assert.equal(currencyController.getCurrentCurrency(), 'usd') currencyController.setCurrentCurrency('JPY') var result = currencyController.getCurrentCurrency() assert.equal(result, 'JPY') @@ -36,12 +36,12 @@ describe('currency-controller', function () { describe('#updateConversionRate', function () { it('should retrieve an update for ETH to USD and set it in memory', function (done) { this.timeout(15000) - nock('https://api.cryptonator.com') - .get('/api/ticker/eth-USD') - .reply(200, '{"ticker":{"base":"ETH","target":"USD","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}') + nock('https://api.infura.io') + .get('/v1/ticker/ethusd') + .reply(200, '{"base": "ETH", "quote": "USD", "bid": 288.45, "ask": 288.46, "volume": 112888.17569277, "exchange": "bitfinex", "total_volume": 272175.00106721005, "num_exchanges": 8, "timestamp": 1506444677}') assert.equal(currencyController.getConversionRate(), 0) - currencyController.setCurrentCurrency('USD') + currencyController.setCurrentCurrency('usd') currencyController.updateConversionRate() .then(function () { var result = currencyController.getConversionRate() @@ -57,14 +57,14 @@ describe('currency-controller', function () { this.timeout(15000) assert.equal(currencyController.getConversionRate(), 0) - nock('https://api.cryptonator.com') - .get('/api/ticker/eth-JPY') - .reply(200, '{"ticker":{"base":"ETH","target":"JPY","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}') + nock('https://api.infura.io') + .get('/v1/ticker/ethjpy') + .reply(200, '{"base": "ETH", "quote": "JPY", "bid": 32300.0, "ask": 32400.0, "volume": 247.4616071, "exchange": "kraken", "total_volume": 247.4616071, "num_exchanges": 1, "timestamp": 1506444676}') var promise = new Promise( function (resolve, reject) { - currencyController.setCurrentCurrency('JPY') + currencyController.setCurrentCurrency('jpy') currencyController.updateConversionRate().then(function () { resolve() }) From 88ddedfb5a293cce4f2716729f412f633dff4053 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 26 Sep 2017 10:09:50 -0700 Subject: [PATCH 10/13] Account for undefined currencies. --- ui/app/components/fiat-value.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/app/components/fiat-value.js b/ui/app/components/fiat-value.js index d76b80ab2..d69f41d11 100644 --- a/ui/app/components/fiat-value.js +++ b/ui/app/components/fiat-value.js @@ -13,6 +13,7 @@ function FiatValue () { FiatValue.prototype.render = function () { const props = this.props const { conversionRate, currentCurrency } = props + const renderedCurrency = currentCurrency || '' const value = formatBalance(props.value, 6) @@ -28,7 +29,7 @@ FiatValue.prototype.render = function () { fiatTooltipNumber = 'Unknown' } - return fiatDisplay(fiatDisplayNumber, currentCurrency.toUpperCase()) + return fiatDisplay(fiatDisplayNumber, renderedCurrency.toUpperCase()) } function fiatDisplay (fiatDisplayNumber, fiatSuffix) { From 7b199e215d9767cf059420df750670140d5bc958 Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 26 Sep 2017 10:11:18 -0700 Subject: [PATCH 11/13] Polish names on currency list. --- ui/app/infura-conversion.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ui/app/infura-conversion.json b/ui/app/infura-conversion.json index 3103e72a0..f4c6f9e34 100644 --- a/ui/app/infura-conversion.json +++ b/ui/app/infura-conversion.json @@ -85,7 +85,7 @@ }, "quote": { "code": "cad", - "name": "Canadian dollar" + "name": "Canadian Dollar" } }, { @@ -184,7 +184,7 @@ }, "quote": { "code": "gbp", - "name": "Pound sterling" + "name": "Pound Sterling" } }, { @@ -239,7 +239,7 @@ }, "quote": { "code": "jpy", - "name": "Japanese yen" + "name": "Japanese Yen" } }, { @@ -415,7 +415,7 @@ }, "quote": { "code": "rub", - "name": "Russian ruble" + "name": "Russian Ruble" } }, { @@ -514,7 +514,7 @@ }, "quote": { "code": "uah", - "name": "Ukrainian hryvnia" + "name": "Ukrainian Hryvnia" } }, { @@ -525,7 +525,7 @@ }, "quote": { "code": "usd", - "name": "United States dollar" + "name": "United States Dollar" } }, { @@ -558,7 +558,7 @@ }, "quote": { "code": "xlm", - "name": "Stellar lumen" + "name": "Stellar Lumen" } }, { From accee142821884925f6fb8d7c84b5a0390feaf1c Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Tue, 26 Sep 2017 10:35:13 -0700 Subject: [PATCH 12/13] Remove old conversion list. --- ui/app/conversion.json | 207 ----------------------------------------- 1 file changed, 207 deletions(-) delete mode 100644 ui/app/conversion.json diff --git a/ui/app/conversion.json b/ui/app/conversion.json deleted file mode 100644 index 155ffc4fc..000000000 --- a/ui/app/conversion.json +++ /dev/null @@ -1,207 +0,0 @@ -{ - "rows": [ - { - "code": "REP", - "name": "Augur", - "statuses": [ - "primary" - ] - }, - { - "code": "BCN", - "name": "Bytecoin", - "statuses": [ - "primary" - ] - }, - { - "code": "BTC", - "name": "Bitcoin", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "BTS", - "name": "BitShares", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "BLK", - "name": "Blackcoin", - "statuses": [ - "primary" - ] - }, - { - "code": "GBP", - "name": "British Pound Sterling", - "statuses": [ - "secondary" - ] - }, - { - "code": "CAD", - "name": "Canadian Dollar", - "statuses": [ - "secondary" - ] - }, - { - "code": "CNY", - "name": "Chinese Yuan", - "statuses": [ - "secondary" - ] - }, - { - "code": "DSH", - "name": "Dashcoin", - "statuses": [ - "primary" - ] - }, - { - "code": "DOGE", - "name": "Dogecoin", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "ETC", - "name": "Ethereum Classic", - "statuses": [ - "primary" - ] - }, - { - "code": "EUR", - "name": "Euro", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "GNO", - "name": "GNO", - "statuses": [ - "primary" - ] - }, - { - "code": "GNT", - "name": "GNT", - "statuses": [ - "primary" - ] - }, - { - "code": "JPY", - "name": "Japanese Yen", - "statuses": [ - "secondary" - ] - }, - { - "code": "LTC", - "name": "Litecoin", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "MAID", - "name": "MaidSafeCoin", - "statuses": [ - "primary" - ] - }, - { - "code": "XEM", - "name": "NEM", - "statuses": [ - "primary" - ] - }, - { - "code": "XLM", - "name": "Stellar", - "statuses": [ - "primary" - ] - }, - { - "code": "XMR", - "name": "Monero", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "XRP", - "name": "Ripple", - "statuses": [ - "primary" - ] - }, - { - "code": "RUR", - "name": "Ruble", - "statuses": [ - "secondary" - ] - }, - { - "code": "STEEM", - "name": "Steem", - "statuses": [ - "primary" - ] - }, - { - "code": "STRAT", - "name": "STRAT", - "statuses": [ - "primary" - ] - }, - { - "code": "UAH", - "name": "Ukrainian Hryvnia", - "statuses": [ - "secondary" - ] - }, - { - "code": "USD", - "name": "US Dollar", - "statuses": [ - "primary", - "secondary" - ] - }, - { - "code": "WAVES", - "name": "WAVES", - "statuses": [ - "primary" - ] - }, - { - "code": "ZEC", - "name": "Zcash", - "statuses": [ - "primary" - ] - } - ] -} From 734490c58c25587a247e48eea086880bcb6a14fe Mon Sep 17 00:00:00 2001 From: tmashuang Date: Wed, 27 Sep 2017 11:16:38 -0700 Subject: [PATCH 13/13] Add AUD, HKD, SGD, IDR, PHP to currency conversion list --- CHANGELOG.md | 2 ++ ui/app/infura-conversion.json | 55 +++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ece1cf75..0d9dbd1d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Current Master +- Added AUD, HKD, SGD, IDR, PHP to currency conversion list + ## 3.10.3 2017-9-21 - Fix bug where metamask-dapp connections are lost on rpc error diff --git a/ui/app/infura-conversion.json b/ui/app/infura-conversion.json index f4c6f9e34..9a96fe069 100644 --- a/ui/app/infura-conversion.json +++ b/ui/app/infura-conversion.json @@ -1,5 +1,60 @@ { "objects": [ + { + "symbol": "ethaud", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "aud", + "name": "Australian Dollar" + } + }, + { + "symbol": "ethhkd", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "hkd", + "name": "Hong Kong Dollar" + } + }, + { + "symbol": "ethsgd", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "sgd", + "name": "Singapore Dollar" + } + }, + { + "symbol": "ethidr", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "idr", + "name": "Indonesian Rupiah" + } + }, + { + "symbol": "ethphp", + "base": { + "code": "eth", + "name": "Ethereum" + }, + "quote": { + "code": "php", + "name": "Philippine Peso" + } + }, { "symbol": "eth1st", "base": {