Skip to content

Instantly share code, notes, and snippets.

View kryptome's full-sized avatar
🎯
Focusing

Piyush Mishra kryptome

🎯
Focusing
View GitHub Profile
@Linch1
Linch1 / tokenPriceApi.js
Last active May 13, 2024 10:42
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