Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@public-js/exchange-rates
Advanced tools
An extensive exchange rates API client supporting multiple services for best results
An extensive exchange rates API client supporting multiple services for best results
Add the package to your project by running:
npm i @public-js/exchange-rates
Instantiate a class:
import { ExchangeRates } from '@public-js/exchange-rates';
const service = await new ExchangeRates({
OpenexchangeratesOrg: env.OXR_API_KEY,
ExchangerateHost: true,
});
Fetch the latest rates:
const rates = await service.getRates('USD', ['EUR', 'CNY']);
console.log(rates); // {"CNY":6.8936,"EUR":0.901185}
Fetch the historical rates:
const rates = await service.getRates('USD', ['EUR', 'CNY'], '2023-01-15');
console.log(rates); // {"CNY":6.8936,"EUR":0.901185}
OpenexchangeratesOrg
– has a limited free planExchangeratesapiIo
– has a limited free planCurrencyapiCom
– has a limited free planExchangerateHost
– free to use, accepts donationsExchangerateApiCom
– has a limited free planNote The majority of services require an API key/token to work. This doesn't apply to ExchangerateHost, which needs any truthy value provided as a key to be active.
When the ExchangeRates
class is instantiated it requires a configuration object to be provided.
The said object has to list the desired services and their respective API keys/tokens.
Since some of the services don't handle unsupported currency codes well, they will be queried for a full rates list which then gets filtered out. This process is repeated for each service until all of them are queried or the required currencies are fetched.
The order of the services is listed in the "Supported services" section, it can't be altered at a time and is pre-defined based on data reliability, precision and currency coverage. It is possible however to enable only part of the supported services by providing only some of the API keys.
MIT, full license text. Read more about it on TLDRLegal.
FAQs
An extensive exchange rates API client supporting multiple services for best results
The npm package @public-js/exchange-rates receives a total of 4 weekly downloads. As such, @public-js/exchange-rates popularity was classified as not popular.
We found that @public-js/exchange-rates demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.