Merge pull request #1552 from MetaMask/currency-fix

Fix Currency API
feature/default_network_editable
Dan Finlay 8 years ago committed by GitHub
commit 4298d80127
  1. 1
      CHANGELOG.md
  2. 2
      app/manifest.json
  3. 2
      app/scripts/controllers/currency.js
  4. 4
      test/unit/currency-controller-test.js

@ -2,6 +2,7 @@
## Current Master ## Current Master
- Fix currency API URL from cryptonator.
- Update gasLimit params with every new block seen. - Update gasLimit params with every new block seen.
## 3.7.7 2017-6-8 ## 3.7.7 2017-6-8

@ -58,7 +58,7 @@
"storage", "storage",
"clipboardWrite", "clipboardWrite",
"http://localhost:8545/", "http://localhost:8545/",
"https://www.cryptonator.com/" "https://api.cryptonator.com/"
], ],
"web_accessible_resources": [ "web_accessible_resources": [
"scripts/inpage.js" "scripts/inpage.js"

@ -45,7 +45,7 @@ class CurrencyController {
updateConversionRate () { updateConversionRate () {
const currentCurrency = this.getCurrentCurrency() const currentCurrency = this.getCurrentCurrency()
return fetch(`https://www.cryptonator.com/api/ticker/eth-${currentCurrency}`) return fetch(`https://api.cryptonator.com/api/ticker/eth-${currentCurrency}`)
.then(response => response.json()) .then(response => response.json())
.then((parsedResponse) => { .then((parsedResponse) => {
this.setConversionRate(Number(parsedResponse.ticker.price)) this.setConversionRate(Number(parsedResponse.ticker.price))

@ -36,7 +36,7 @@ describe('currency-controller', function () {
describe('#updateConversionRate', function () { describe('#updateConversionRate', function () {
it('should retrieve an update for ETH to USD and set it in memory', function (done) { it('should retrieve an update for ETH to USD and set it in memory', function (done) {
this.timeout(15000) this.timeout(15000)
nock('https://www.cryptonator.com') nock('https://api.cryptonator.com')
.get('/api/ticker/eth-USD') .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":""}') .reply(200, '{"ticker":{"base":"ETH","target":"USD","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')
@ -57,7 +57,7 @@ describe('currency-controller', function () {
this.timeout(15000) this.timeout(15000)
assert.equal(currencyController.getConversionRate(), 0) assert.equal(currencyController.getConversionRate(), 0)
nock('https://www.cryptonator.com') nock('https://api.cryptonator.com')
.get('/api/ticker/eth-JPY') .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":""}') .reply(200, '{"ticker":{"base":"ETH","target":"JPY","price":"11.02456145","volume":"44948.91745289","change":"-0.01472534"},"timestamp":1472072136,"success":true,"error":""}')

Loading…
Cancel
Save