UNPKG

react-native-bitcoin-tools

Version:

A set of helpers for interacting with Bitcoin and Blockchain data.

18 lines (17 loc) 522 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getCurrentPrice = getCurrentPrice; const endpoint = 'https://mempool.space/api/v1/prices'; async function getCurrentPrice(currency = 'USD') { try { const priceData = await fetch(endpoint); const price = await priceData.json(); return Promise.resolve(price[currency]); } catch (error) { console.log('[BitcoinTools ERROR] ', error); return Promise.reject(error); } } //# sourceMappingURL=getCurrentPrice.js.map