@johnversus
i also given in this way but itβs not working for
is there any moralis version issue?
which version u are using
export async function getTokenMetadata(token_address, chainId) {
let options = {};
if (chainId == "0x61") {
//Get metadata for one token. Ex: USDT token on ETH
options = {
chain: "bsc testnet",
addresses: [token_address],
};
} else if (chainId == "0x38") {
//Get metadata for one token. Ex: USDT token on ETH
options = {
chain: "bsc",
addresses: token_address,
};
}
const tokenMetadata = await Moralis.Web3API.token.getTokenMetadata({
addresses: ['0xE4879C93aE512E12DA25308D89eca6383c08432B'],
chain: "0x61",
});
// const isLP = new ethers.Contract('0xB7926C0430Afb07AA7DEfDE6DA862aE0Bde767bc', Factory)
// const abc = await isLP.getPair('0x69859eB3160ad104E268725f4d310B8cD2f56E8F', '0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd' )
// // console.log(abc)
const getLp= await getIsLPTOken(chainId, token_address)
let isLP= false
if(getLp != ethers.constants.AddressZero){
isLP=true
}
// console.log(isLP)
const totalSupply = await getTotalSupply(token_address);
const formattedSupply = ethers.utils.formatUnits(
totalSupply.toString(),
tokenMetadata[0].decimals
);
const walletBalance = await getBalanceOf(
token_address,
Moralis.User.current().get("ethAddress")
);
const formattedBalance = ethers.utils.formatUnits(
walletBalance.toString(),
tokenMetadata[0].decimals
);
tokenMetadata[0].balance = formattedBalance;
tokenMetadata[0].totalSupply = formattedSupply;
tokenMetadata[0].isLP=isLP;
return tokenMetadata;
}