0.0.2 • Published 3 years ago
realtime-crypto-price v0.0.2
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. |