Getting Metadata for a given liquidity pair address through Moralis endpoints

Hello guys, I’m trying to fetch the metadata of a given liquidity pair. For instance, on bsc, given the pair address, I’d like to be able to identify which of the token pair (Token0 and Token1) is wBNB and also its corresponding balance. I know this is possible but just not sure which endpoint to use and how to go about it. Thanks in advance!

Hi,
Can you give an exact example for what liquidity pair address you want to get that info?
You may be able to use web3 calls for what the contract would expose.
Or you could try to look at the events associated with that liquidity pair.

Hey bud, thanks for helping out. Here’s an example LP pair address: 0x905888799D02EcFE66ab22712c969e6256e12C44

If you could show me how to call it either way or both on web3 that would be greatly appreciated.

You have this contract read functions: https://bscscan.com/token/0x905888799d02ecfe66ab22712c969e6256e12c44#readContract
and at the end you have token0 and token1 contract addresses:

token0: 0x06d72db97bcf607f065d8d65d9b8105fdfc1cab3 address
token1: 0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c address

and you can use web3 calls to get that info, you’ll also need the ABI for that contract

an example of how to make a call to a smart contract:

async function getTokenInfo(){
    window.web3 = await Moralis.Web3.enable();
    let address = '0x06d72db97bcf607f065d8d65d9b8105fdfc1cab3';
    let contractAbi = [{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"}];
    let contract = new web3.eth.Contract(contractAbi, address);
    let name = await contract.methods.name().call();
    console.log(name);
        }

=> Dogematic

Thanks bud, you’re da man!