@@ -62,14 +62,14 @@ function () {
62
62
startDate = moment . unix ( 1535068800 ) ; // Unix timestamp for August 24 2018 (contract creation)
63
63
64
64
url = "https://api.nomics.com/v1/exchange-rates/history?key=" . concat ( apiKey , "¤cy=ETH&start=" ) . concat ( startDate . toISOString ( ) ) ;
65
- _context2 . next = 4 ;
65
+ _context2 . prev = 2 ;
66
+ _context2 . next = 5 ;
66
67
return fetch ( url ) . then (
67
68
/*#__PURE__*/
68
69
function ( ) {
69
70
var _ref = ( 0 , _asyncToGenerator2 . default ) (
70
71
/*#__PURE__*/
71
72
_regenerator . default . mark ( function _callee ( resp ) {
72
- var response ;
73
73
return _regenerator . default . wrap ( function _callee$ ( _context ) {
74
74
while ( 1 ) {
75
75
switch ( _context . prev = _context . next ) {
@@ -78,10 +78,9 @@ function () {
78
78
return resp . json ( ) ;
79
79
80
80
case 2 :
81
- response = _context . sent ;
82
- return _context . abrupt ( "return" , response ) ;
81
+ return _context . abrupt ( "return" , _context . sent ) ;
83
82
84
- case 4 :
83
+ case 3 :
85
84
case "end" :
86
85
return _context . stop ( ) ;
87
86
}
@@ -94,17 +93,27 @@ function () {
94
93
} ;
95
94
} ( ) ) ;
96
95
97
- case 4 :
96
+ case 5 :
98
97
ethToUsdAtTimestampValues = _context2 . sent ;
98
+ _context2 . next = 12 ;
99
+ break ;
100
+
101
+ case 8 :
102
+ _context2 . prev = 8 ;
103
+ _context2 . t0 = _context2 [ "catch" ] ( 2 ) ;
104
+ console . log ( 'Unable to fetch the amount of transferred USD.' ) ;
105
+ return _context2 . abrupt ( "return" ) ;
106
+
107
+ case 12 :
99
108
this . ethToUsdAtTimestampValues = ethToUsdAtTimestampValues ;
100
109
this . _canFetchUSD = true ;
101
110
102
- case 7 :
111
+ case 14 :
103
112
case "end" :
104
113
return _context2 . stop ( ) ;
105
114
}
106
115
}
107
- } , _callee2 , this ) ;
116
+ } , _callee2 , this , [ [ 2 , 8 ] ] ) ;
108
117
} ) ) ;
109
118
110
119
return function enableUSDFetching ( _x ) {
0 commit comments