Catalog npm
Back to packageRELEASE DETAILS

0.42.2

npm

@0xflair/react-coingecko

React hooks to get prices of cryptocurrency coins and tokens from CoinGecko.

Published18 May 2022
Direct dependencies8
Transitive dependenciesNot calculated

README

Current package documentation

Flair SDK: react-coingecko

React hooks to get prices of cryptocurrency coins and tokens from CoinGecko.

Getting Started

Installation

  1. Install the package:

    npm install @0xflair/react-coingecko
    
  2. Install peer dependencies:

    npm install axios
    
    # if visual components needed:
    npm install tailwindcss @headlessui/react @heroicons/react @tailwindcss/aspect-ratio
    
  3. Configure tailwind.config.js (Tailwind v3) to scan SDK for classes (if visual components needed):

    module.exports = {
      purge: [
        "./public/**/*.html",
        "./src/**/*.{js,jsx,ts,tsx,vue}",
    
        // This line tells Tailwind to look into SDK files
        "./node_modules/@0xflair/**/*.{js,jsx,ts,tsx,vue}",
      ],
      content: ["./src/**/*.{js,jsx,ts,tsx}"],
      plugins: [
        // These plugins are used in this package
        require("@tailwindcss/forms"),
        require("@tailwindcss/aspect-ratio"),
      ],
    };
    
  4. Configure the React provider:

    const cryptoPricesConfig = {
      coinGecko: {
        apiKey: "xxxx",
        symbols: ["ethereum", "matic-network"],
      },
    };
    
    const App = () => {
      return (
        <div className="app">
          <CoinGeckoProvider config={cryptoPricesConfig}>
            <HookExample />
          </CoinGeckoProvider>
        </div>
      );
    };
    

Usage

Simple Price

import { CryptoPrice, CryptoUnits } from "@0xflair/react-coingecko";

function App() {
  return (
    <>
      <CryptoPrice value='0.06' unit={CryptoUnits.ETHER} />
    </>
  );

Price Hook

import { useCryptoPrice } from "@0xflair/react-coingecko";

function App() {
  const [{data, error, loading}, fetchPrice] = useCryptoPrice({
    symbol: 'ethereum'
  });

  return (
    <ul>
        <li>Price of Ether: {data.usd} USD</li>
        <li>Loading: {loading ? 'Yes...' : 'Idle'}</li>
        <li>Error: {error}</li>
    </ul>
  );

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 14

Native requirements
8 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
@0xflair/common
Environment
{
  "local_name": "@0xflair/common",
  "alias": false,
  "peer_metadata": null
}
^0.42.2runtime
@0xflair/react-common
Environment
{
  "local_name": "@0xflair/react-common",
  "alias": false,
  "peer_metadata": null
}
^0.42.2runtime
@0xflair/react-wallet
Environment
{
  "local_name": "@0xflair/react-wallet",
  "alias": false,
  "peer_metadata": null
}
^0.42.2runtime
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.26.1runtime
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
^5.6.5runtime
wagmi
Environment
{
  "local_name": "wagmi",
  "alias": false,
  "peer_metadata": null
}
^0.3.5runtime
@0xflair/common
Environment
{
  "local_name": "@0xflair/common",
  "alias": false,
  "peer_metadata": null
}
0.*peer
@0xflair/react-common
Environment
{
  "local_name": "@0xflair/react-common",
  "alias": false,
  "peer_metadata": null
}
0.*peer
@0xflair/react-wallet
Environment
{
  "local_name": "@0xflair/react-wallet",
  "alias": false,
  "peer_metadata": null
}
0.*peer
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.26.1peer
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
^5.6.5peer
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^17.0.2peer
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^17.0.2peer
wagmi
Environment
{
  "local_name": "wagmi",
  "alias": false,
  "peer_metadata": null
}
^0.3.5peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-ViCTAZHJDIXVfv3XBxR1KM19NuRiJ2n3laClerdSTGQh/RqaiwmDSGPwS/S8W8jXi6pc0kVo5vCLx58EbpdZ9A==",
  "shasum": "6ca0d760678ce9b7efd873a61e1aedaa816c8ad3",
  "tarball": "https://registry.npmjs.org/@0xflair/react-coingecko/-/react-coingecko-0.42.2.tgz",
  "fileCount": 8,
  "unpackedSize": 144132,
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEQCIES687IUUhzEyPiCxovdcD3QSr0xQ8/sgw/YY5nlwvMnAiBQHG0N5sXWUHgGpZzjq36GIPQXPWB8WOS5vPqE63y8Vw=="
    }
  ],
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJihPaGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpcLw/8CGdhTRAXWm5J1CjLRdp47se98gY6xaqa297j2t3XW0pVfld9\r\nH5AoZmp6ER6DV/go4XMNJw6YWw/Afsb3Wetv+5aLixtY9OtP2iZRe7kJY3RU\r\nbTwIZ9YoSnOQ4egrHLIHVxeFU/0/cvfZthZNSqb/ipVvzW8ynpYlhAjE+KRX\r\nlrOq0om1z2WETxU2Hnxzf6RXtEEObi2ZGmAKZTn5zN90P5PM3PdqCcbZ1bXY\r\njuNwj4dkt11QV4CYqoCyd65TOCBxZSLYgFBG0H4Nmj8p0l9cllYDL+1YAvkK\r\nefC99r6caaYgDqar5eI3J7k48YBk/133gXXG9cQTT3yWfW2oUSMRhh5+ii3A\r\nhf28nIWd1c3hthIaKOd8iMQ6ySBZLhMkFHI0qiJyJnE7ghUtf0yOfwZmx4+0\r\nghManiXG+Zy+g41oeC9I1lxchlADdVDyyI8Kb7nZHFkISyd1Vr89/15zKb4F\r\nSawkh6PR5dNY/m2cXZZtPXk24dm7MfIXAQfzJhjexPXC9UDsElFHEo6gXDSO\r\nHLWeK0RnJLwOel4AnBoFFY1WKWbHY2/17wdvajNUm/GdtAjRG1onSzpwfBjQ\r\n8yN/eJfFbO4vLUttJKI30SS+mRyBa5wcmnqS/kIssjQ04wAzI2UdTDlJ2EEY\r\n1wRGBtWt5CmWXo6SIheqkYKqYwnlrnDDr8U=\r\n=Q2Ub\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
0xflair/typescript-sdk

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 23:18 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:f4e3318622321358542e3165ff7f2dba03748a3f2dfedfccd67af730df77e835

Other collected versions

0.123.227 Nov0.123.112 Nov0.123.08 Nov0.122.228 Oct0.122.128 Oct0.122.028 OctView all collected versions →