0.0.1 • Published 2 years ago

crypto-price-converter v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Crypto Price Converter Library

The Crypto Price Converter library allows developers to easily convert between cryptocurrency and traditional currency values. It leverages the CryptoConverter API for accurate and up-to-date conversion rates.

Installation

npm install crypto-price-converter

Usage

Initialize the library with your CryptoConverter API:

const { CryptoConverterAPI } = require("crypto-price-converter");

const converter = new CryptoConverterAPI();

Convert token quantity to currency

const { CryptoConverterAPI } = require("crypto-price-converter");

const converter = new CryptoConverterAPI()

converter.ConvertToCrypto({ symbol: "Bitcoin", amount: 1, currency: "USD" })

Output:

{ amount: 43149, currency: 'USD', symbol: 'Bitcoin' }

Convert your currency amount to crypto value

const { CryptoConverterAPI } = require("crypto-price-converter");

const converter = new CryptoConverterAPI()

converter.ConvertToCurrency({ symbol: "Bitcoin", amount: 1, currency: "USD" })

Output:

{ amount: 0.0000231755081230156, currency: 'USD', symbol: 'Bitcoin' }

CommonJs and ESModules Support

const { CryptoConverterAPI } = require("crypto-price-converter");
import { CryptoConverterAPI } from "crypto-price-converter"

Error handling

API requests can potentially return errors due to invalid inputs or other issues. These errors can be handled with a try...catch statement, and the error details can be found in either error.response or error.message:

0.0.1

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago