@@ -1963,10 +1963,7 @@ impl<S: MutinyStorage> NodeManager<S> {
19631963 }
19641964
19651965 async fn fetch_bitcoin_price ( fiat : & str ) -> Result < f32 , MutinyError > {
1966- let api_url = format ! (
1967- "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies={}" ,
1968- fiat
1969- ) ;
1966+ let api_url = format ! ( "https://price.mutinywallet.com/price/{fiat}" ) ;
19701967
19711968 let client = Client :: builder ( )
19721969 . build ( )
@@ -1979,18 +1976,14 @@ impl<S: MutinyStorage> NodeManager<S> {
19791976
19801977 let resp: reqwest:: Response = utils:: fetch_with_timeout ( & client, request) . await ?;
19811978
1982- let response: CoingeckoResponse = resp
1979+ let response: BitcoinPriceResponse = resp
19831980 . error_for_status ( )
19841981 . map_err ( |_| MutinyError :: BitcoinPriceError ) ?
19851982 . json ( )
19861983 . await
19871984 . map_err ( |_| MutinyError :: BitcoinPriceError ) ?;
19881985
1989- if let Some ( price) = response. bitcoin . get ( fiat) {
1990- Ok ( * price)
1991- } else {
1992- Err ( MutinyError :: BitcoinPriceError )
1993- }
1986+ Ok ( response. price )
19941987 }
19951988
19961989 /// Retrieves the logs from storage.
@@ -2072,9 +2065,9 @@ impl<S: MutinyStorage> NodeManager<S> {
20722065 }
20732066}
20742067
2075- #[ derive( Deserialize , Clone , Debug ) ]
2076- struct CoingeckoResponse {
2077- pub bitcoin : HashMap < String , f32 > ,
2068+ #[ derive( Deserialize , Clone , Copy , Debug ) ]
2069+ struct BitcoinPriceResponse {
2070+ pub price : f32 ,
20782071}
20792072
20802073// This will create a new node with a node manager and return the PublicKey of the node created.
0 commit comments