npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

african-currency-to-crypto-conversion

v0.1.0

Published

Convert african currencies to their equivalent amount in crypto

Downloads

12

Readme

currency-converter

African Currency to Cryptocurrency Conversion Package Documentation

Introduction

The African Currency to Cryptocurrency Conversion Package is a library that allows you to convert various African currencies to popular cryptocurrencies. It provides an easy-to-use interface for fetching exchange rates and performing conversions between African currencies and cryptocurrencies.

Features

Perform conversions: Convert African currency amounts to their equivalent values in cryptocurrencies.

Get Dollar Equivalent Prices Data: This feature retrieves the prices of various African currencies and their equivalent values in dollars. It returns an object containing the prices and a status indicator.

Get Dollar Equivalent Price for a Currency: This feature retrieves the equivalent price in dollars for a specific African currency. It accepts a currency code as a parameter and returns an object containing the price and a status indicator.

Supported African currencies: The package supports the following African currencies:

NGN (Nigerian Naira)

GHS (Ghanaian Cedi)

ZAR (South African Rand)

KES (Kenyan Shilling)

TZS (Tanzanian Shilling)

ETB (Ethiopian Birr)

ZWL (Zimbabwean Dollar)

CFA (West African CFA Franc)

BWP (Botswana Pula)

RWF (Rwandan Franc)

EGP (Egyptian Pound)

Supported cryptocurrencies: The package supports the following cryptocurrencies:

BTC (Bitcoin)

ETH (Ethereum)

BNB (Binance Coin)

XRP (Ripple)

LTC (Litecoin)

DOT (Polkadot)

LINK (Chainlink)

Installation

To install the African Currency to Cryptocurrency Conversion Package, follow these steps:

Ensure you have Node.js installed on your system.

1. Open a terminal or command prompt.

2. Navigate to your project directory.

3. Run the following command:


npm install african-currency-to-crypto-conversion

Usage

To use the African Currency to Cryptocurrency Conversion Package in your project, follow these steps:

Import the package into your code:

const { convertCurrency } = require("african-currency-to-crypto-conversion");

//using the import module

import { convertCurrency } from "african-currency-crypto-conversion";

// Perform a currency conversion:
const convert = async () => {
  try {
    const res = await convertCurrency({
      currency: "NGN",
      coin: "BTC",
      amount: 10000,
    });
    console.log(res);
  } catch (error) {
    console.log(error);
  }
};

//sample data

//   {
//     data:
//  { amount: 0.0008119749 },
//   status: true
//   }

convert();

To get Dollar Equivalent Price for a Currency

const {
  getDollarEquivalent,
} = require("african-currency-to-crypto-conversion");

//using the import module

import { getDollarEquivalent } from "african-currency-crypto-conversion";

// get Dollar Equivalent Price for a Currency:
const getPrice = async () => {
  try {
    const price = await getDollarEquivalent("NGN");
    console.log(price);
  } catch (error) {
    console.log(error);
  }
};

//sample response

// {
//   "data": {
//     "price": 464.5105287036787
//   },
//   "status": true
// }

getPrice();

Parameters

currency (String): The currency code for which you want to retrieve the equivalent price.

To get Dollar Equivalent Prices Data

const {
  getDollarEquivalentsData,
} = require("african-currency-to-crypto-conversion");

//using the import module

import { getDollarEquivalentsData } from "african-currency-crypto-conversion";

// To get Dollar Equivalent Prices Data

const getPrices = async () => {
  try {
    const prices = await getDollarEquivalentsData();
    console.log(prices);
  } catch (error) {
    console.log(error);
  }
};

//sample response

// {
//   "data": {
//     "prices": {
//       "NGN": 464.5105287036787,
//       "GHS": 11.148273847842228,
//       "ZAR": 19.73319520513807,
//       "KES": 138.49673234277282,
//       "TZS": 2364.77689191065,
//       "ETB": 54.592450710313685,
//       "ZWL": 321.99957424965,
//       "BWP": 13.771257472757101,
//       "RWF": 1126.4573853711433,
//       "EGP": 30.9034972084006
//     }
//   },
//   "status": true
// }

getPrices();

convert();

The convertCurrency function takes an object as an argument with the following properties:

currency: The source African currency code (e.g., "NGN").

coin: The target cryptocurrency code (e.g., "BTC").

amount: The amount to convert from the African currency to the cryptocurrency.

The function returns a Promise that resolves to the converted amount in the target cryptocurrency.

Conclusion

The African Currency to Cryptocurrency Conversion Package simplifies the process of converting African currencies to popular cryptocurrencies. With its intuitive API, you can easily perform currency conversions in your applications by providing the source currency, target cryptocurrency, and the amount to convert.