Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
node-tax-api
Advanced tools
This is a wrapper for the free (but rate-limited) TaxAPI.io API that allows users to get up-to-date U.S. sales tax and EU country VAT tax rates. Typings for TypeScript are included and exported.
If you have ES6 module support, you can do the following:
import TaxAPIClient, { TaxAPIClientOptions } from 'node-tax-api';
const taxClientOptions: TaxAPIClientOptions = {
cacheEnabled: true, // This is the default value, as TaxAPI.io best practices indicate results should be cached for one day.
};
// Set up client
const taxClient = new TaxAPIClient(taxClientOptions);
// Get sales tax by U.S. postal code
taxClient.getSalesTaxByZipCode('80521').then(response => console.log(response));
// Get VAT for all EU countries
taxClient.getVATRates().then(response => console.log(response));
// Get VAT for a single EU country
taxClient.getVATRatesByCountryCode('ES').then(response => console.log(response));
// Validate VAT number for a given company
taxClient.validateVATNumber('GB943684002').then(response => console.log(response));
Otherwise, you will want to do this:
const TaxApiClient = require('node-tax-api');
const taxClient = new TaxApiClient.default({ cacheEnabled: true });
// From here, the method usage will look the same.
By default, results from these API calls are cached in-memory for one day. This is at the request of TaxAPI.io, due to the API being free. It is currently rate-limited at one request per second. If you would like to handle caching on your own, or just throw caution to the wind and not cache the results, pass cacheEnabled: false
in the options you pass to the TaxAPIClient
constructor.
Shameless plug regarding caching: I authored another library, Type-Cacheable, which is the mechanism this library is using under the hood to cache the responses from TaxAPI.io. If you would like more fine-grained control over caching (using Redis rather than an in-memory cache, which would work better for a distributed system, for example), please consider using Type-Cacheable directly. To see how you can accomplish this, refer to the source code of this library.
Special thanks to Abs Farah for creating this free API for tax information. Note that I am not the creator or maintainer of the API, just this convenience wrapper to access it with. I will try to keep this repository up to date with the API as I can. If you would like to contribute new features, bug fixes, or improvements, please open a pull request or issue. Please direct questions, comments, or concerns regarding the API itself to the API maintainer.
FAQs
TypeScript-based library for accessing the free TaxAPI.io API
We found that node-tax-api 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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
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.