Skip to content

Instantly share code, notes, and snippets.

View A7U's full-sized avatar
🪐
Travelling across the universe

A7U A7U

🪐
Travelling across the universe
View GitHub Profile
@Linch1
Linch1 / tokenPriceApi.js
Last active May 21, 2024 04:43
Retrive the price of any bsc token from it's address without using external service like poocoin/dextools
let pancakeSwapAbi = [
{"inputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"address[]","name":"path","type":"address[]"}],"name":"getAmountsOut","outputs":[{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"stateMutability":"view","type":"function"},
];
let tokenAbi = [
{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},
];
const Web3 = require('web3');
/*
Required Node.js