File tree Expand file tree Collapse file tree 3 files changed +14
-28
lines changed Expand file tree Collapse file tree 3 files changed +14
-28
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " remote" ,
3
- "version" : " 2.5.3 " ,
3
+ "version" : " 2.5.4 " ,
4
4
"scripts" : {
5
5
"dev" : " vite dev" ,
6
6
"dev-https" : " vite dev --mode https" ,
Original file line number Diff line number Diff line change @@ -13,9 +13,6 @@ export type Tile =
13
13
| 'channels'
14
14
| 'offers'
15
15
| 'forwards'
16
- // | 'accounting'
17
- // | 'charts'
18
- // | 'trades'
19
16
| 'settings'
20
17
| 'plugins'
21
18
@@ -49,26 +46,7 @@ export enum BitcoinDenomination {
49
46
// https://www.statista.com/statistics/1189498/share-of-global-payments-by-currency/
50
47
export enum FiatDenomination {
51
48
'none' = 'none' ,
52
- 'usd' = 'usd' ,
53
- 'eur' = 'eur' ,
54
- 'gbp' = 'gbp' ,
55
- 'cny' = 'cny' ,
56
- 'jpy' = 'jpy' ,
57
- 'cad' = 'cad' ,
58
- 'aud' = 'aud' ,
59
- 'hkd' = 'hkd' ,
60
- 'sgd' = 'sgd' ,
61
- 'sek' = 'sek' ,
62
- 'chf' = 'chf' ,
63
- 'thb' = 'thb' ,
64
- 'pln' = 'pln' ,
65
- 'nok' = 'nok' ,
66
- 'myr' = 'myr' ,
67
- 'dkk' = 'dkk' ,
68
- 'zar' = 'zar' ,
69
- 'nzd' = 'nzd' ,
70
- 'mxn' = 'mxn' ,
71
- 'rub' = 'rub'
49
+ 'usd' = 'usd'
72
50
}
73
51
74
52
export type Denomination = BitcoinDenomination | FiatDenomination
Original file line number Diff line number Diff line change @@ -53,10 +53,18 @@ export async function getBitcoinExchangeRate(
53
53
}
54
54
55
55
try {
56
- const result = await fetch ( `${ API_URL } /exchange-rates?currency=${ currency } ` ) . then ( res =>
57
- res . json ( )
58
- )
59
- return result
56
+ const result = await fetch ( 'https://api.coincap.io/v2/rates/bitcoin' ) . then ( res => res . json ( ) )
57
+
58
+ const rateUsd = parseFloat ( result ?. data ?. rateUsd || '0' )
59
+
60
+ if ( isNaN ( rateUsd ) || rateUsd <= 0 ) {
61
+ throw new Error ( `Invalid ${ currency } rate received from API` )
62
+ }
63
+
64
+ return {
65
+ none : 0 ,
66
+ usd : rateUsd
67
+ }
60
68
} catch ( error ) {
61
69
log . warn ( `Could not get exchange rate for currency: ${ currency } ` )
62
70
return null
You can’t perform that action at this time.
0 commit comments