New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

dexpricefetcher

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

dexpricefetcher

### Install

unpublished
latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

dexpricefetcher

Install

npm i dexpricefetcher

Usage

import { getTokenBalance, getTotalSupply, getDecimals, getSymbol, getName, getChainId, getTokenData, getTokenPrice } from 'dexpricefetcher';

const providerUrl = 'https://mainnet.infura.io/v3/YOUR-INFURA-PROJECT-ID';
const tokenAddress = '0x6B175474E89094C44Da98b954EedeAC495271d0F'; // DAI token contract address
const walletAddress = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e'; // Example wallet address

(async () => {
	const balance = await getTokenBalance(providerUrl, tokenAddress, walletAddress);
	console.log('Token Balance:', balance.toString());

	const totalSupply = await getTotalSupply(providerUrl, tokenAddress);
	console.log('Total Supply:', totalSupply.toString());

	const decimals = await getDecimals(providerUrl, tokenAddress);
	console.log('Decimals:', decimals.toString());

	const symbol = await getSymbol(providerUrl, tokenAddress);
	console.log('Symbol:', symbol);

	const name = await getName(providerUrl, tokenAddress);
	console.log('Name:', name);

	const chainId = await getChainId(providerUrl);
	console.log('Chain ID:', chainId);

	const tokenData = await getTokenData(tokenAddress);
	console.log('Token  Data:', tokenPriceData);

	const tokenPriceData = await getTokenPrice(tokenAddress);
	console.log('Token Price Data:', tokenPriceData);
})();

Keywords

dex

FAQs

Package last updated on 22 Apr 2023

Related posts