realtime-crypto-price
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Licence npm version Downloads

realtime-crypto-price

Fetchs the price of crypto in USDT from Binance API.

Installation

npm i realtime-crypto-price

Live Demo

https://codesandbox.io/s/realtime-crypto-price-eij1g8

Example

import "./styles.css";
import { ChainSymbols, getCryptoPrice } from "realtime-crypto-price";
import { useEffect, useState } from "react";

export default function App() {
  const [nearPrice, setNearPrice] = useState("0");
  const getNearPrice = async () => {
    const res = await getCryptoPrice(ChainSymbols.NEAR);
    setNearPrice(res?.price || "0");
  };

  useEffect(() => {
    getNearPrice();
  }, []);

  return (
    <div className="App">
      <h1>realtime-crypto-price</h1>
      <p>Current NEAR Price: {nearPrice} $</p>
    </div>
  );
}

API

Property Type Description
wallet string Wallet name.
rpc NearRPC TESTNET or MAINNET.

Package Sidebar

Install

npm i realtime-crypto-price

Weekly Downloads

5

Version

0.0.2

License

MIT

Unpacked Size

30.5 kB

Total Files

12

Last publish

Collaborators

  • sainthiago